aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp48
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Authentication/AuthCodes.h13
-rw-r--r--src/server/authserver/CMakeLists.txt40
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Main.cpp102
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Realms/RealmList.cpp18
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Realms/RealmList.h5
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Server/AuthSocket.cpp201
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Server/AuthSocket.h0
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Server/RealmAcceptor.h4
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Server/RealmSocket.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/authserver/Server/RealmSocket.h2
-rw-r--r--src/server/authserver/authserver.conf.dist216
-rw-r--r--[-rwxr-xr-x]src/server/authserver/authserver.rc0
-rw-r--r--[-rwxr-xr-x]src/server/collision/BoundingIntervalHierarchy.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/collision/BoundingIntervalHierarchy.h0
-rw-r--r--src/server/collision/CMakeLists.txt29
-rw-r--r--[-rwxr-xr-x]src/server/collision/Management/IVMapManager.h2
-rw-r--r--[-rwxr-xr-x]src/server/collision/Management/VMapFactory.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/collision/Management/VMapFactory.h0
-rw-r--r--src/server/collision/Management/VMapManager2.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/collision/Management/VMapManager2.h0
-rw-r--r--src/server/collision/Maps/MapTree.cpp14
-rw-r--r--[-rwxr-xr-x]src/server/collision/Maps/MapTree.h0
-rw-r--r--src/server/collision/Maps/TileAssembler.cpp13
-rw-r--r--[-rwxr-xr-x]src/server/collision/Maps/TileAssembler.h0
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp13
-rw-r--r--src/server/collision/Models/GameObjectModel.h2
-rw-r--r--[-rwxr-xr-x]src/server/collision/Models/ModelInstance.h2
-rw-r--r--[-rwxr-xr-x]src/server/collision/Models/WorldModel.h0
-rw-r--r--src/server/collision/RegularGrid.h2
-rw-r--r--[-rwxr-xr-x]src/server/collision/VMapTools.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/CombatAI.cpp10
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/CombatAI.h1
-rw-r--r--src/server/game/AI/CoreAI/GameObjectAI.h11
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/GuardAI.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/GuardAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PassiveAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PassiveAI.h1
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PetAI.cpp267
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/PetAI.h16
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/ReactorAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/ReactorAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/TotemAI.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/TotemAI.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/UnitAI.cpp31
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CoreAI/UnitAI.h37
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAI.cpp11
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAI.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIFactory.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIImpl.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIRegistry.cpp1
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAIRegistry.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAISelector.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/CreatureAISelector.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAI.cpp129
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAI.h7
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAIMgr.cpp287
-rw-r--r--[-rwxr-xr-x]src/server/game/AI/EventAI/CreatureEventAIMgr.h3
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp38
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.h8
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp39
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h1
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp25
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedGossip.h1
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp39
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h7
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp146
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.h7
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp118
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h85
-rw-r--r--[-rwxr-xr-x]src/server/game/Accounts/AccountMgr.cpp12
-rw-r--r--[-rwxr-xr-x]src/server/game/Accounts/AccountMgr.h6
-rw-r--r--[-rwxr-xr-x]src/server/game/Achievements/AchievementMgr.cpp252
-rw-r--r--[-rwxr-xr-x]src/server/game/Achievements/AchievementMgr.h47
-rw-r--r--[-rwxr-xr-x]src/server/game/Addons/AddonMgr.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/game/Addons/AddonMgr.h10
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp213
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.h30
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp1166
-rw-r--r--src/server/game/Battlefield/Battlefield.h425
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp140
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.h79
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp1067
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h1696
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/ArenaTeam.cpp77
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/ArenaTeam.h10
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp9
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Battleground.cpp440
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Battleground.h119
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundMgr.cpp598
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundMgr.h74
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundQueue.cpp261
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/BattlegroundQueue.h13
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAA.cpp75
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAA.h47
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp143
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAB.h41
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp381
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundAV.h61
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp29
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundBE.h20
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp29
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundDS.h28
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp133
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundEY.h43
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp127
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundIC.h71
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp35
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundNA.h20
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRB.cpp74
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRB.h49
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp36
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRL.h20
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp28
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundRV.h27
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp181
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundSA.h114
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp268
-rw-r--r--[-rwxr-xr-x]src/server/game/Battlegrounds/Zones/BattlegroundWS.h52
-rw-r--r--src/server/game/CMakeLists.txt34
-rwxr-xr-xsrc/server/game/Calendar/Calendar.cpp99
-rwxr-xr-xsrc/server/game/Calendar/Calendar.h189
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp896
-rw-r--r--src/server/game/Calendar/CalendarMgr.h317
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/Channel.cpp808
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/Channel.h163
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/ChannelMgr.cpp49
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Channels/ChannelMgr.h25
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Chat.cpp209
-rw-r--r--[-rwxr-xr-x]src/server/game/Chat/Chat.h150
-rw-r--r--src/server/game/Chat/ChatLink.cpp122
-rwxr-xr-xsrc/server/game/Chat/Commands/Level0.cpp129
-rwxr-xr-xsrc/server/game/Chat/Commands/Level1.cpp629
-rwxr-xr-xsrc/server/game/Chat/Commands/Level2.cpp679
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp1763
-rwxr-xr-xsrc/server/game/Chat/Commands/TicketCommands.cpp457
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/HostileRefManager.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/HostileRefManager.h1
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/ThreatManager.cpp33
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/ThreatManager.h65
-rw-r--r--[-rwxr-xr-x]src/server/game/Combat/UnitEvents.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/ConditionMgr.cpp441
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/ConditionMgr.h20
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/DisableMgr.cpp76
-rw-r--r--[-rwxr-xr-x]src/server/game/Conditions/DisableMgr.h6
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCEnums.h309
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCStores.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCStores.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCStructure.h19
-rw-r--r--[-rwxr-xr-x]src/server/game/DataStores/DBCfmt.h198
-rw-r--r--[-rwxr-xr-x]src/server/game/DungeonFinding/LFG.h44
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.cpp66
-rw-r--r--src/server/game/DungeonFinding/LFGGroupData.h20
-rw-r--r--[-rwxr-xr-x]src/server/game/DungeonFinding/LFGMgr.cpp2255
-rw-r--r--[-rwxr-xr-x]src/server/game/DungeonFinding/LFGMgr.h329
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.cpp57
-rw-r--r--src/server/game/DungeonFinding/LFGPlayerData.h26
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.cpp673
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.h143
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp173
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Corpse/Corpse.cpp52
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Corpse/Corpse.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/Creature.cpp242
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/Creature.h32
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/CreatureGroups.cpp14
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/CreatureGroups.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/GossipDef.cpp75
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/GossipDef.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/TemporarySummon.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Creature/TemporarySummon.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/DynamicObject/DynamicObject.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/DynamicObject/DynamicObject.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/GameObject/GameObject.cpp191
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/GameObject/GameObject.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Container/Bag.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Container/Bag.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Item.cpp20
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/Item.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/ItemEnchantmentMgr.cpp11
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/ItemEnchantmentMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Item/ItemPrototype.h6
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Object.cpp359
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Object.h27
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/ObjectDefines.h3
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/ObjectPosSelector.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/ObjectPosSelector.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateData.cpp10
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateData.h0
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp1568
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateFieldFlags.h44
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateFields.h20
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Object/Updates/UpdateMask.h26
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Pet/Pet.cpp78
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Pet/Pet.h98
-rw-r--r--src/server/game/Entities/Pet/PetDefines.h80
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/Player.cpp1812
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/Player.h266
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/SocialMgr.cpp21
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Player/SocialMgr.h25
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Totem/Totem.cpp25
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Totem/Totem.h6
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Transport/Transport.cpp67
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Transport/Transport.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Unit/StatSystem.cpp38
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Unit/Unit.cpp1493
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Unit/Unit.h230
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Vehicle/Vehicle.cpp47
-rw-r--r--[-rwxr-xr-x]src/server/game/Entities/Vehicle/Vehicle.h21
-rw-r--r--src/server/game/Entities/Vehicle/VehicleDefines.h12
-rw-r--r--[-rwxr-xr-x]src/server/game/Events/GameEventMgr.cpp227
-rw-r--r--[-rwxr-xr-x]src/server/game/Events/GameEventMgr.h12
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectAccessor.cpp36
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectAccessor.h19
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectMgr.cpp1807
-rw-r--r--[-rwxr-xr-x]src/server/game/Globals/ObjectMgr.h115
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Cells/Cell.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Grid.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridLoader.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridReference.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridStates.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/GridStates.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/NGrid.h8
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Notifiers/GridNotifiers.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Notifiers/GridNotifiers.h54
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/Notifiers/GridNotifiersImpl.h1
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/ObjectGridLoader.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Grids/ObjectGridLoader.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/Group.cpp180
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/Group.h19
-rw-r--r--src/server/game/Groups/GroupMgr.cpp34
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/GroupRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/GroupReference.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Groups/GroupReference.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Guilds/Guild.cpp1229
-rw-r--r--[-rwxr-xr-x]src/server/game/Guilds/Guild.h424
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp126
-rw-r--r--src/server/game/Guilds/GuildMgr.h7
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AddonHandler.cpp43
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AddonHandler.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ArenaTeamHandler.cpp25
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AuctionHouseHandler.cpp170
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/AuthHandler.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/BattleGroundHandler.cpp340
-rw-r--r--src/server/game/Handlers/BattlefieldHandler.cpp151
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/CalendarHandler.cpp896
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ChannelHandler.cpp304
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp909
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ChatHandler.cpp171
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/CombatHandler.cpp14
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/DuelHandler.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/GroupHandler.cpp133
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/GuildHandler.cpp385
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/ItemHandler.cpp129
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/LFGHandler.cpp513
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/LootHandler.cpp42
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/MailHandler.cpp147
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/MiscHandler.cpp470
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/MovementHandler.cpp95
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/NPCHandler.cpp79
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/NPCHandler.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/PetHandler.cpp127
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/PetitionsHandler.cpp147
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/QueryHandler.cpp46
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/QuestHandler.cpp74
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/SkillHandler.cpp27
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/SpellHandler.cpp57
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/TaxiHandler.cpp26
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/TicketHandler.cpp93
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/TradeHandler.cpp28
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp52
-rw-r--r--[-rwxr-xr-x]src/server/game/Handlers/VoiceChatHandler.cpp14
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceSaveMgr.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceSaveMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceScript.cpp29
-rw-r--r--[-rwxr-xr-x]src/server/game/Instances/InstanceScript.h19
-rw-r--r--[-rwxr-xr-x]src/server/game/Loot/LootMgr.cpp124
-rw-r--r--[-rwxr-xr-x]src/server/game/Loot/LootMgr.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Mails/Mail.cpp12
-rw-r--r--[-rwxr-xr-x]src/server/game/Mails/Mail.h26
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/Map.cpp168
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/Map.h9
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapInstanced.cpp7
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapInstanced.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapManager.cpp17
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/MapReference.h0
-rw-r--r--src/server/game/Maps/MapUpdater.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/game/Maps/ZoneScript.h15
-rw-r--r--[-rwxr-xr-x]src/server/game/Miscellaneous/Formulas.h3
-rw-r--r--[-rwxr-xr-x]src/server/game/Miscellaneous/Language.h39
-rw-r--r--[-rwxr-xr-x]src/server/game/Miscellaneous/SharedDefines.h434
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/FollowerRefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/FollowerReference.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/FollowerReference.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MotionMaster.cpp79
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MotionMaster.h10
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerator.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerator.h18
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGeneratorImpl.h0
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp23
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h8
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp47
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h10
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h8
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h6
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp26
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/PointMovementGenerator.h10
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp14
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h8
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp71
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h15
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp26
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h16
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp20
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.h32
-rw-r--r--src/server/game/Movement/Spline/MoveSplineFlag.h77
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp20
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h2
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInitArgs.h4
-rw-r--r--src/server/game/Movement/Spline/MovementTypedefs.h6
-rw-r--r--src/server/game/Movement/Spline/MovementUtil.cpp79
-rw-r--r--src/server/game/Movement/Spline/Spline.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/Waypoints/Path.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/Waypoints/WaypointManager.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/game/Movement/Waypoints/WaypointManager.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvP.cpp75
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvP.h10
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp14
-rw-r--r--[-rwxr-xr-x]src/server/game/OutdoorPvP/OutdoorPvPMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Pools/PoolMgr.cpp86
-rw-r--r--[-rwxr-xr-x]src/server/game/Pools/PoolMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Quests/QuestDef.cpp10
-rw-r--r--[-rwxr-xr-x]src/server/game/Quests/QuestDef.h31
-rw-r--r--[-rwxr-xr-x]src/server/game/Reputation/ReputationMgr.cpp36
-rw-r--r--[-rwxr-xr-x]src/server/game/Reputation/ReputationMgr.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/MapScripts.cpp115
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptLoader.cpp28
-rw-r--r--src/server/game/Scripting/ScriptLoader.h1
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptMgr.cpp122
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptMgr.h9
-rw-r--r--[-rwxr-xr-x]src/server/game/Scripting/ScriptSystem.cpp140
-rw-r--r--src/server/game/Scripting/ScriptSystem.h25
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/Protocol/Opcodes.cpp12
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/Protocol/Opcodes.h10
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSession.cpp127
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSession.h439
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocket.cpp130
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocket.h0
-rw-r--r--src/server/game/Server/WorldSocketAcceptor.h4
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocketMgr.cpp18
-rw-r--r--[-rwxr-xr-x]src/server/game/Server/WorldSocketMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillDiscovery.cpp20
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillDiscovery.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillExtraItems.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Skills/SkillExtraItems.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuraDefines.h639
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuraEffects.cpp219
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuras.cpp97
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Auras/SpellAuras.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Spell.cpp243
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/Spell.h13
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellEffects.cpp336
-rw-r--r--src/server/game/Spells/SpellInfo.cpp42
-rw-r--r--src/server/game/Spells/SpellInfo.h18
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellMgr.cpp507
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellMgr.h41
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellScript.cpp104
-rw-r--r--[-rwxr-xr-x]src/server/game/Spells/SpellScript.h33
-rw-r--r--[-rwxr-xr-x]src/server/game/Texts/CreatureTextMgr.cpp91
-rw-r--r--[-rwxr-xr-x]src/server/game/Texts/CreatureTextMgr.h13
-rw-r--r--[-rwxr-xr-x]src/server/game/Tickets/TicketMgr.cpp94
-rw-r--r--[-rwxr-xr-x]src/server/game/Tickets/TicketMgr.h27
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp11
-rw-r--r--src/server/game/Tools/PlayerDump.cpp21
-rw-r--r--[-rwxr-xr-x]src/server/game/Tools/PlayerDump.h7
-rw-r--r--src/server/game/Warden/Warden.cpp26
-rw-r--r--src/server/game/Warden/Warden.h2
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp28
-rw-r--r--src/server/game/Warden/WardenMac.cpp23
-rw-r--r--src/server/game/Warden/WardenWin.cpp16
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/Weather.cpp7
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/Weather.h2
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/WeatherMgr.cpp17
-rw-r--r--[-rwxr-xr-x]src/server/game/Weather/WeatherMgr.h0
-rw-r--r--[-rwxr-xr-x]src/server/game/World/World.cpp673
-rw-r--r--[-rwxr-xr-x]src/server/game/World/World.h96
-rw-r--r--src/server/scripts/CMakeLists.txt31
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt7
-rw-r--r--src/server/scripts/Commands/cs_account.cpp26
-rw-r--r--src/server/scripts/Commands/cs_achievement.cpp7
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp10
-rw-r--r--src/server/scripts/Commands/cs_bf.cpp180
-rw-r--r--src/server/scripts/Commands/cs_cast.cpp5
-rw-r--r--src/server/scripts/Commands/cs_character.cpp273
-rw-r--r--src/server/scripts/Commands/cs_cheat.cpp300
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp25
-rw-r--r--src/server/scripts/Commands/cs_disable.cpp375
-rw-r--r--src/server/scripts/Commands/cs_event.cpp6
-rw-r--r--src/server/scripts/Commands/cs_gm.cpp14
-rw-r--r--src/server/scripts/Commands/cs_go.cpp2
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp9
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp5
-rw-r--r--src/server/scripts/Commands/cs_honor.cpp6
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp1
-rw-r--r--src/server/scripts/Commands/cs_learn.cpp75
-rw-r--r--src/server/scripts/Commands/cs_lfg.cpp136
-rw-r--r--src/server/scripts/Commands/cs_list.cpp2
-rw-r--r--src/server/scripts/Commands/cs_lookup.cpp112
-rw-r--r--src/server/scripts/Commands/cs_message.cpp217
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp2956
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp84
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp95
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp45
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp345
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp18
-rw-r--r--src/server/scripts/Commands/cs_server.cpp43
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp12
-rw-r--r--src/server/scripts/Commands/cs_ticket.cpp512
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp26
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp190
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp38
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp2
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp59
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp25
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp21
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp149
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h3
-rw-r--r--src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp59
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp41
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp83
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp90
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp33
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp103
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp115
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp78
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp307
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp10
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp55
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.h3
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp166
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp50
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp92
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp23
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp125
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp13
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h45
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp30
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp43
-rw-r--r--src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp81
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp514
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp307
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp15
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp57
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp34
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp25
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp34
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp26
-rw-r--r--src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp31
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp23
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp92
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp133
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp37
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp145
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp137
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp31
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp39
-rw-r--r--src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp41
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp12
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp22
-rw-r--r--src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp19
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp36
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp41
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp30
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp66
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp34
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp17
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/alterac_mountains.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/arathi_highlands.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/blasted_lands.cpp7
-rw-r--r--src/server/scripts/EasternKingdoms/boss_kruul.cpp3
-rw-r--r--src/server/scripts/EasternKingdoms/burning_steppes.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/duskwood.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp6
-rw-r--r--src/server/scripts/EasternKingdoms/eversong_woods.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/ghostlands.cpp42
-rw-r--r--src/server/scripts/EasternKingdoms/hinterlands.cpp54
-rw-r--r--src/server/scripts/EasternKingdoms/ironforge.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp20
-rw-r--r--src/server/scripts/EasternKingdoms/loch_modan.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/redridge_mountains.cpp24
-rw-r--r--src/server/scripts/EasternKingdoms/silvermoon_city.cpp9
-rw-r--r--src/server/scripts/EasternKingdoms/silverpine_forest.cpp79
-rw-r--r--src/server/scripts/EasternKingdoms/stormwind_city.cpp65
-rw-r--r--src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp5
-rw-r--r--src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp29
-rw-r--r--src/server/scripts/EasternKingdoms/tirisfal_glades.cpp16
-rw-r--r--src/server/scripts/EasternKingdoms/undercity.cpp23
-rw-r--r--src/server/scripts/EasternKingdoms/western_plaguelands.cpp42
-rw-r--r--src/server/scripts/EasternKingdoms/westfall.cpp44
-rw-r--r--src/server/scripts/EasternKingdoms/wetlands.cpp14
-rw-r--r--src/server/scripts/Events/CMakeLists.txt16
-rw-r--r--src/server/scripts/Events/childrens_week.cpp1050
-rw-r--r--src/server/scripts/Examples/example_commandscript.cpp2
-rw-r--r--src/server/scripts/Examples/example_creature.cpp42
-rw-r--r--src/server/scripts/Examples/example_escort.cpp54
-rw-r--r--src/server/scripts/Examples/example_gossip_codebox.cpp25
-rw-r--r--src/server/scripts/Examples/example_misc.cpp9
-rw-r--r--src/server/scripts/Examples/example_spell.cpp50
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp9
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp20
-rw-r--r--src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp22
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp13
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp44
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h34
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp2
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp9
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp25
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp3
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp50
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp21
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp35
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp654
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp10
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp26
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp24
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp22
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp73
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp20
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp41
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp43
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp39
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp29
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp214
-rw-r--r--src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp1
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp23
-rw-r--r--src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp36
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp9
-rw-r--r--src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp6
-rw-r--r--src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp57
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp3
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp15
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp5
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp288
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp2
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp21
-rw-r--r--src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h23
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp12
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp28
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp28
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp37
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp3
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp7
-rw-r--r--src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp3
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp7
-rw-r--r--src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp98
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp21
-rw-r--r--src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp21
-rw-r--r--src/server/scripts/Kalimdor/ashenvale.cpp45
-rw-r--r--src/server/scripts/Kalimdor/azshara.cpp39
-rw-r--r--src/server/scripts/Kalimdor/azuremyst_isle.cpp130
-rw-r--r--src/server/scripts/Kalimdor/bloodmyst_isle.cpp5
-rw-r--r--src/server/scripts/Kalimdor/boss_azuregos.cpp11
-rw-r--r--src/server/scripts/Kalimdor/darkshore.cpp95
-rw-r--r--src/server/scripts/Kalimdor/desolace.cpp9
-rw-r--r--src/server/scripts/Kalimdor/durotar.cpp5
-rw-r--r--src/server/scripts/Kalimdor/dustwallow_marsh.cpp95
-rw-r--r--src/server/scripts/Kalimdor/felwood.cpp5
-rw-r--r--src/server/scripts/Kalimdor/feralas.cpp59
-rw-r--r--src/server/scripts/Kalimdor/moonglade.cpp36
-rw-r--r--src/server/scripts/Kalimdor/mulgore.cpp15
-rw-r--r--src/server/scripts/Kalimdor/orgrimmar.cpp1
-rw-r--r--src/server/scripts/Kalimdor/silithus.cpp205
-rw-r--r--src/server/scripts/Kalimdor/stonetalon_mountains.cpp13
-rw-r--r--src/server/scripts/Kalimdor/tanaris.cpp129
-rw-r--r--src/server/scripts/Kalimdor/teldrassil.cpp9
-rw-r--r--src/server/scripts/Kalimdor/the_barrens.cpp87
-rw-r--r--src/server/scripts/Kalimdor/thousand_needles.cpp35
-rw-r--r--src/server/scripts/Kalimdor/thunder_bluff.cpp1
-rw-r--r--src/server/scripts/Kalimdor/ungoro_crater.cpp89
-rw-r--r--src/server/scripts/Kalimdor/winterspring.cpp2
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp211
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp319
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp24
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp48
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp15
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp8
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp32
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp3
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp28
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp7
-rw-r--r--src/server/scripts/Northrend/CMakeLists.txt2
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp128
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp7
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp7
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp1763
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp38
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp142
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp5
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h52
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp36
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp9
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp4
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp9
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp17
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h8
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp1175
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp3426
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp791
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp1550
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp675
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp380
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp855
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h60
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp5
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp24
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp27
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp28
-rw-r--r--src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp14
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp25
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp85
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp63
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp8
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp22
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp21
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp267
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp9
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp60
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp116
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp78
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp8
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp5
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp6
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_eck.cpp3
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp33
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp31
-rw-r--r--src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp31
-rw-r--r--src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp9
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp5
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp1
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp206
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp7
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp8
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h1
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp1
-rw-r--r--[-rwxr-xr-x]src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp7
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp20
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp26
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp41
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp23
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp32
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp85
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp7
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp4
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_noth.cpp41
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp24
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp3
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp591
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp55
-rw-r--r--src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp8
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp17
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp7
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp25
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp26
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp28
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp379
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp3
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp29
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp11
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp28
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp130
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp62
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp5
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp92
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp308
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.h13
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp3
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp4
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp44
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp7
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp14
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp22
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp19
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp203
-rw-r--r--src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp7
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp13
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp450
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp53
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp87
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp204
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp48
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp47
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp38
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp116
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp145
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp62
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp121
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp50
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp12
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp45
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h34
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp1
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp151
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp76
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp74
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp10
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp195
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp16
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp41
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp7
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp34
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp7
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp10
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp18
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp3
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp3
-rw-r--r--src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp5
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp26
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp23
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp33
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp3
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp55
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp25
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp14
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.cpp16
-rw-r--r--src/server/scripts/Northrend/borean_tundra.cpp845
-rw-r--r--src/server/scripts/Northrend/crystalsong_forest.cpp6
-rw-r--r--src/server/scripts/Northrend/dalaran.cpp6
-rw-r--r--src/server/scripts/Northrend/dragonblight.cpp68
-rw-r--r--src/server/scripts/Northrend/grizzly_hills.cpp225
-rw-r--r--src/server/scripts/Northrend/howling_fjord.cpp5
-rw-r--r--src/server/scripts/Northrend/icecrown.cpp384
-rw-r--r--src/server/scripts/Northrend/isle_of_conquest.cpp5
-rw-r--r--src/server/scripts/Northrend/sholazar_basin.cpp192
-rw-r--r--src/server/scripts/Northrend/storm_peaks.cpp516
-rw-r--r--src/server/scripts/Northrend/wintergrasp.cpp624
-rw-r--r--src/server/scripts/Northrend/zuldrak.cpp56
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPEP.h0
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPHP.h0
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPNA.h0
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp3
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPSI.h0
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp12
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPTF.h0
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/scripts/OutdoorPvP/OutdoorPvPZM.h0
-rw-r--r--src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp60
-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.cpp26
-rw-r--r--src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp37
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp52
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp58
-rw-r--r--src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp3
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp24
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp56
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp63
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp34
-rw-r--r--src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp15
-rw-r--r--src/server/scripts/Outland/BlackTemple/black_temple.cpp5
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp66
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_illidan.cpp30
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp69
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp187
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp46
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_supremus.cpp73
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp104
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp33
-rw-r--r--src/server/scripts/Outland/BlackTemple/illidari_council.cpp176
-rw-r--r--src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp10
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp132
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp95
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp98
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp118
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp4
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp71
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp9
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp33
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp36
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp42
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp23
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp3
-rw-r--r--src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp3
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_gruul.cpp26
-rw-r--r--src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp91
-rw-r--r--src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp17
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h4
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp68
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp46
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp24
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp229
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_omor_the_unscarred.cpp30
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp35
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp30
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp5
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp55
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp8
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp54
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp103
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp18
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp4
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp30
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp151
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp22
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp19
-rw-r--r--src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp27
-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.cpp25
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp29
-rw-r--r--src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp3
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp34
-rw-r--r--src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp21
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp7
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp25
-rw-r--r--src/server/scripts/Outland/blades_edge_mountains.cpp33
-rw-r--r--src/server/scripts/Outland/boss_doomlord_kazzak.cpp2
-rw-r--r--src/server/scripts/Outland/boss_doomwalker.cpp3
-rw-r--r--src/server/scripts/Outland/hellfire_peninsula.cpp59
-rw-r--r--src/server/scripts/Outland/nagrand.cpp47
-rw-r--r--src/server/scripts/Outland/netherstorm.cpp116
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp316
-rw-r--r--src/server/scripts/Outland/shattrath_city.cpp133
-rw-r--r--src/server/scripts/Outland/terokkar_forest.cpp42
-rw-r--r--src/server/scripts/Outland/zangarmarsh.cpp97
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp17
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp547
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp646
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp177
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp64
-rw-r--r--src/server/scripts/Spells/spell_item.cpp15
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp4
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp144
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp46
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp56
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp248
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp34
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp11
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp107
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp7
-rw-r--r--[-rwxr-xr-x]src/server/scripts/World/achievement_scripts.cpp32
-rw-r--r--src/server/scripts/World/areatrigger_scripts.cpp85
-rw-r--r--src/server/scripts/World/boss_emerald_dragons.cpp310
-rw-r--r--[-rwxr-xr-x]src/server/scripts/World/chat_log.cpp86
-rw-r--r--src/server/scripts/World/go_scripts.cpp190
-rw-r--r--src/server/scripts/World/guards.cpp11
-rw-r--r--src/server/scripts/World/item_scripts.cpp4
-rw-r--r--src/server/scripts/World/mob_generic_creature.cpp4
-rw-r--r--src/server/scripts/World/npc_innkeeper.cpp7
-rw-r--r--src/server/scripts/World/npc_professions.cpp13
-rw-r--r--src/server/scripts/World/npc_taxi.cpp18
-rw-r--r--src/server/scripts/World/npcs_special.cpp154
-rw-r--r--src/server/shared/AutoPtr.h52
-rw-r--r--src/server/shared/CMakeLists.txt24
-rw-r--r--[-rwxr-xr-x]src/server/shared/Common.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Common.h8
-rw-r--r--[-rwxr-xr-x]src/server/shared/CompilerDefs.h10
-rw-r--r--[-rwxr-xr-x]src/server/shared/Configuration/Config.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/shared/Configuration/Config.h1
-rw-r--r--src/server/shared/Containers.h6
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/ARC4.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/ARC4.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/Authentication/AuthCrypt.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/Authentication/AuthCrypt.h1
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/BigNumber.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/BigNumber.h6
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/HMACSHA1.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/HMACSHA1.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/SHA1.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Cryptography/SHA1.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/DataStores/DBCFileLoader.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/shared/DataStores/DBCFileLoader.h4
-rw-r--r--[-rwxr-xr-x]src/server/shared/DataStores/DBCStore.h10
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/AdhocStatement.cpp1
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/AdhocStatement.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/DatabaseEnv.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/DatabaseWorker.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/DatabaseWorkerPool.h24
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Field.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Field.h24
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp64
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h42
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Implementation/LoginDatabase.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Implementation/LoginDatabase.h2
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Implementation/WorldDatabase.cpp5
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Implementation/WorldDatabase.h5
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/MySQLConnection.cpp114
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/MySQLConnection.h4
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/MySQLThreading.h4
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/PreparedStatement.cpp5
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/PreparedStatement.h6
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/QueryHolder.cpp20
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/QueryHolder.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/QueryResult.cpp4
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/QueryResult.h1
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/SQLOperation.h2
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Transaction.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Database/Transaction.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Debugging/Errors.h8
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp11
-rw-r--r--[-rwxr-xr-x]src/server/shared/Define.h12
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/FactoryHolder.h0
-rw-r--r--src/server/shared/Dynamic/HashNamespace.h119
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/LinkedList.h16
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/LinkedReference/RefManager.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/LinkedReference/Reference.h14
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/ObjectRegistry.h3
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/TypeContainer.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/TypeContainerFunctions.h4
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/TypeContainerVisitor.h2
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/TypeList.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Dynamic/UnorderedMap.h83
-rw-r--r--src/server/shared/Dynamic/UnorderedSet.h66
-rw-r--r--src/server/shared/Logging/Appender.cpp226
-rw-r--r--src/server/shared/Logging/Appender.h157
-rw-r--r--src/server/shared/Logging/AppenderConsole.cpp193
-rw-r--r--src/server/shared/Logging/AppenderConsole.h59
-rw-r--r--src/server/shared/Logging/AppenderDB.cpp55
-rw-r--r--src/server/shared/Logging/AppenderDB.h36
-rw-r--r--src/server/shared/Logging/AppenderFile.cpp74
-rw-r--r--src/server/shared/Logging/AppenderFile.h40
-rw-r--r--[-rwxr-xr-x]src/server/shared/Logging/Log.cpp1172
-rw-r--r--[-rwxr-xr-x]src/server/shared/Logging/Log.h209
-rw-r--r--src/server/shared/Logging/LogOperation.cpp31
-rw-r--r--src/server/shared/Logging/LogOperation.h41
-rw-r--r--src/server/shared/Logging/LogWorker.cpp50
-rw-r--r--src/server/shared/Logging/LogWorker.h47
-rw-r--r--src/server/shared/Logging/Logger.cpp84
-rw-r--r--src/server/shared/Logging/Logger.h46
-rw-r--r--[-rwxr-xr-x]src/server/shared/Packets/ByteBuffer.h112
-rw-r--r--[-rwxr-xr-x]src/server/shared/Packets/WorldPacket.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/SystemConfig.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Threading/Callback.h0
-rw-r--r--src/server/shared/Threading/DelayExecutor.cpp2
-rw-r--r--src/server/shared/Threading/DelayExecutor.h2
-rw-r--r--[-rwxr-xr-x]src/server/shared/Threading/LockedQueue.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Threading/Threading.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Threading/Threading.h2
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/ByteConverter.h4
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/EventProcessor.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/EventProcessor.h7
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/ServiceWin32.cpp8
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/ServiceWin32.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/SignalHandler.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/Timer.h0
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/Util.cpp82
-rw-r--r--[-rwxr-xr-x]src/server/shared/Utilities/Util.h394
-rw-r--r--src/server/worldserver/CMakeLists.txt34
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/CommandLine/CliRunnable.cpp2
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/CommandLine/CliRunnable.h0
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/Main.cpp22
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/Master.cpp88
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/Master.h0
-rw-r--r--src/server/worldserver/RemoteAccess/RARunnable.cpp6
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/RemoteAccess/RASocket.cpp30
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/RemoteAccess/RASocket.h0
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/TCSoap/TCSoap.cpp18
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/TCSoap/TCSoap.h2
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/WorldThread/WorldRunnable.cpp0
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/WorldThread/WorldRunnable.h0
-rw-r--r--src/server/worldserver/worldserver.conf.dist596
-rw-r--r--[-rwxr-xr-x]src/server/worldserver/worldserver.rc0
-rw-r--r--src/tools/map_extractor/CMakeLists.txt2
-rw-r--r--src/tools/map_extractor/System.cpp7
-rw-r--r--src/tools/map_extractor/dbcfile.cpp6
-rw-r--r--src/tools/map_extractor/dbcfile.h2
-rw-r--r--src/tools/vmap4_extractor/adtfile.cpp42
-rw-r--r--src/tools/vmap4_extractor/adtfile.h10
-rw-r--r--src/tools/vmap4_extractor/dbcfile.cpp5
-rw-r--r--src/tools/vmap4_extractor/model.cpp47
-rw-r--r--src/tools/vmap4_extractor/model.h37
-rw-r--r--src/tools/vmap4_extractor/mpq_libmpq04.h6
-rw-r--r--src/tools/vmap4_extractor/vmapexport.cpp32
-rw-r--r--src/tools/vmap4_extractor/wdtfile.cpp20
-rw-r--r--src/tools/vmap4_extractor/wdtfile.h12
-rw-r--r--src/tools/vmap4_extractor/wmo.cpp39
-rw-r--r--src/tools/vmap4_extractor/wmo.h53
1085 files changed, 55893 insertions, 39088 deletions
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp
index ace18e7b45c..bdb96ca0d25 100644
--- a/src/server/authserver/Authentication/AuthCodes.cpp
+++ b/src/server/authserver/Authentication/AuthCodes.cpp
@@ -16,15 +16,36 @@
*/
#include "AuthCodes.h"
+#include <cstddef>
namespace AuthHelper
{
- bool IsPreBCAcceptedClientBuild(int build)
+ static RealmBuildInfo const PostBcAcceptedClientBuilds[] =
+ {
+ {15595, 4, 3, 4, ' '},
+ {14545, 4, 2, 2, ' '},
+ {13623, 4, 0, 6, 'a'},
+ {12340, 3, 3, 5, 'a'},
+ {11723, 3, 3, 3, 'a'},
+ {11403, 3, 3, 2, ' '},
+ {11159, 3, 3, 0, 'a'},
+ {10505, 3, 2, 2, 'a'},
+ {9947, 3, 1, 3, ' '},
+ {8606, 2, 4, 3, ' '},
+ {0, 0, 0, 0, ' '} // terminator
+ };
+
+ static RealmBuildInfo const PreBcAcceptedClientBuilds[] =
{
- int accepted_versions[] = PRE_BC_ACCEPTED_CLIENT_BUILD;
+ {6005, 1, 12, 2, ' '},
+ {5875, 1, 12, 1, ' '},
+ {0, 0, 0, 0, ' '} // terminator
+ };
- for (int i = 0; accepted_versions[i]; ++i)
- if (build == accepted_versions[i])
+ bool IsPreBCAcceptedClientBuild(int build)
+ {
+ for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i)
+ if (PreBcAcceptedClientBuilds[i].Build == build)
return true;
return false;
@@ -32,10 +53,8 @@ namespace AuthHelper
bool IsPostBCAcceptedClientBuild(int build)
{
- int accepted_versions[] = POST_BC_ACCEPTED_CLIENT_BUILD;
-
- for (int i = 0; accepted_versions[i]; ++i)
- if (build == accepted_versions[i])
+ for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i)
+ if (PostBcAcceptedClientBuilds[i].Build == build)
return true;
return false;
@@ -45,4 +64,17 @@ namespace AuthHelper
{
return (IsPostBCAcceptedClientBuild(build) || IsPreBCAcceptedClientBuild(build));
}
+
+ RealmBuildInfo const* GetBuildInfo(int build)
+ {
+ for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i)
+ if (PostBcAcceptedClientBuilds[i].Build == build)
+ return &PostBcAcceptedClientBuilds[i];
+
+ for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i)
+ if (PreBcAcceptedClientBuilds[i].Build == build)
+ return &PreBcAcceptedClientBuilds[i];
+
+ return NULL;
+ }
};
diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h
index f940d459d40..148225377ff 100755..100644
--- a/src/server/authserver/Authentication/AuthCodes.h
+++ b/src/server/authserver/Authentication/AuthCodes.h
@@ -65,9 +65,6 @@ enum LoginResult
LOGIN_LOCKED_ENFORCED = 0x10,
};
-#define POST_BC_ACCEPTED_CLIENT_BUILD {12340, 11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0}
-#define PRE_BC_ACCEPTED_CLIENT_BUILD {5875, 6005, 0}
-
enum ExpansionFlags
{
POST_BC_EXP_FLAG = 0x2,
@@ -75,8 +72,18 @@ enum ExpansionFlags
NO_VALID_EXP_FLAG = 0x0
};
+struct RealmBuildInfo
+{
+ int Build;
+ int MajorVersion;
+ int MinorVersion;
+ int BugfixVersion;
+ int HotfixVersion;
+};
+
namespace AuthHelper
{
+ RealmBuildInfo const* GetBuildInfo(int build);
bool IsAcceptedClientBuild(int build);
bool IsPostBCAcceptedClientBuild(int build);
bool IsPreBCAcceptedClientBuild(int build);
diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt
index 0d94dc47407..581b48f571c 100644
--- a/src/server/authserver/CMakeLists.txt
+++ b/src/server/authserver/CMakeLists.txt
@@ -15,15 +15,9 @@ file(GLOB_RECURSE sources_realms Realms/*.cpp Realms/*.h)
file(GLOB_RECURSE sources_server Server/*.cpp Server/*.h)
file(GLOB sources_localdir *.cpp *.h)
-if( USE_COREPCH )
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
-if ( USE_COREPCH AND MSVC )
- set(authserver_SRCS
- PrecompiledHeaders/authPCH.cpp
- PrecompiledHeaders/authPCH.h
- )
+if (USE_COREPCH)
+ set(authserver_PCH_HDR PrecompiledHeaders/authPCH.h)
+ set(authserver_PCH_SRC PrecompiledHeaders/authPCH.cpp)
endif()
set(authserver_SRCS
@@ -62,34 +56,23 @@ include_directories(
${OPENSSL_INCLUDE_DIR}
)
-set(authserver_LINK_FLAGS "")
-
add_executable(authserver
${authserver_SRCS}
+ ${authserver_PCH_SRC}
)
add_dependencies(authserver revision.h)
if( NOT WIN32 )
- add_definitions(-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/authserver.conf"')
-endif()
-
-if( UNIX )
- set(authserver_LINK_FLAGS "-pthread ${authserver_LINK_FLAGS}")
-endif()
-
-if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
- set(authserver_LINK_FLAGS "-framework Carbon ${authserver_LINK_FLAGS}")
+ set_target_properties(authserver PROPERTIES
+ COMPILE_DEFINITIONS _TRINITY_REALM_CONFIG="${CONF_DIR}/authserver.conf"
+ )
endif()
-set_target_properties(authserver PROPERTIES LINK_FLAGS "${authserver_LINK_FLAGS}")
-
target_link_libraries(authserver
shared
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
- ${OPENSSL_EXTRA_LIBRARIES}
- ${OSX_LIBS}
)
if( WIN32 )
@@ -108,11 +91,6 @@ elseif( WIN32 )
endif()
# Generate precompiled header
-if( USE_COREPCH )
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_precompiled_header(authserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/authPCH.h)
- elseif(MSVC)
- add_native_precompiled_header(authserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/authPCH)
- endif()
+if (USE_COREPCH)
+ add_cxx_pch(authserver ${authserver_PCH_HDR} ${authserver_PCH_SRC})
endif()
-
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index 01a33d836d6..90d112a1433 100755..100644
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -15,7 +15,13 @@
* 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 main.cpp
+* @brief Authentication Server main program
+*
+* This file contains the main program for the
+* authentication server
+*/
#include <ace/Dev_Poll_Reactor.h>
#include <ace/TP_Reactor.h>
#include <ace/ACE.h>
@@ -44,7 +50,7 @@ bool stopEvent = false; // Setting it to tru
LoginDatabaseWorkerPool LoginDatabase; // Accessor to the auth server database
-// Handle authserver's termination signals
+/// Handle authserver's termination signals
class AuthServerSignalHandler : public Trinity::SignalHandler
{
public:
@@ -63,15 +69,14 @@ public:
/// Print out the usage string for this program on the console.
void usage(const char *prog)
{
- sLog->outString("Usage: \n %s [<options>]\n"
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r",
prog);
}
-// Launch the auth server
+/// Launch the auth server
extern int main(int argc, char **argv)
{
- sLog->SetLogDB(false);
// Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_REALM_CONFIG;
int c = 1;
@@ -81,7 +86,7 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError("Runtime-Error: -c option requires an input argument");
+ printf("Runtime-Error: -c option requires an input argument\n");
usage(argv[0]);
return 1;
}
@@ -93,17 +98,16 @@ extern int main(int argc, char **argv)
if (!ConfigMgr::Load(cfg_file))
{
- sLog->outError("Invalid or missing configuration file : %s", cfg_file);
- sLog->outError("Verify that the file exists and has \'[authserver]\' written in the top of the file!");
+ printf("Invalid or missing configuration file : %s\n", cfg_file);
+ printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n");
return 1;
}
- sLog->Initialize();
- sLog->outString("%s (authserver)", _FULLVERSION);
- sLog->outString("<Ctrl-C> to stop.\n");
- sLog->outString("Using configuration file %s.", cfg_file);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "<Ctrl-C> to stop.\n");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file);
- sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ sLog->outWarn(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
@@ -111,7 +115,7 @@ extern int main(int argc, char **argv)
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
- sLog->outBasic("Max allowed open files is %d", ACE::max_handles());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles());
// authserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
@@ -120,41 +124,43 @@ extern int main(int argc, char **argv)
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
- sLog->outError("Cannot create PID file %s.\n", pidfile.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
-
- sLog->outString("Daemon PID: %u\n", pid);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid);
}
// Initialize the database connection
if (!StartDB())
return 1;
- // Initialize the log database
- sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
- sLog->SetLogDB(false);
sLog->SetRealmID(0); // ensure we've set realm to 0 (authserver realmid)
// Get the list of realms for the server
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
- sLog->outError("No valid realms specified.");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
- uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
+ int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
+ if (rmport < 0 || rmport > 0xFFFF)
+ {
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
+ return 1;
+ }
+
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
- ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
+ ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
- sLog->outError("Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
@@ -182,13 +188,13 @@ extern int main(int argc, char **argv)
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
- sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
else if (SetProcessAffinityMask(hProcess, curAff))
- sLog->outString("Using processors (bitmask, hex): %x", curAff);
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff);
else
- sLog->outError("Can't set used processors (hex): %x", curAff);
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff);
}
- sLog->outString();
+
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
@@ -196,10 +202,10 @@ extern int main(int argc, char **argv)
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
- sLog->outString("The auth server process priority class has been set to HIGH");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "The auth server process priority class has been set to HIGH");
else
- sLog->outError("Can't set auth server process priority class.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set auth server process priority class.");
+
}
}
#endif
@@ -208,17 +214,6 @@ extern int main(int argc, char **argv)
uint32 numLoops = (ConfigMgr::GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
uint32 loopCounter = 0;
- // possibly enable db logging; avoid massive startup spam by doing it here.
- if (sLog->GetLogDBLater())
- {
- sLog->outString("Enabling database logging...");
- sLog->SetLogDBLater(false);
- // login db needs thread for logging
- sLog->SetLogDB(true);
- }
- else
- sLog->SetLogDB(false);
-
// Wait for termination signal
while (!stopEvent)
{
@@ -231,7 +226,7 @@ extern int main(int argc, char **argv)
if ((++loopCounter) == numLoops)
{
loopCounter = 0;
- sLog->outDetail("Ping MySQL to keep connection alive");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Ping MySQL to keep connection alive");
LoginDatabase.KeepAlive();
}
}
@@ -239,11 +234,11 @@ extern int main(int argc, char **argv)
// Close the Database Pool and library
StopDB();
- sLog->outString("Halting process...");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Halting process...");
return 0;
}
-// Initialize connection to the database
+/// Initialize connection to the database
bool StartDB()
{
MySQL::Library_Init();
@@ -251,34 +246,37 @@ bool StartDB()
std::string dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("Database not specified");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Database not specified");
return false;
}
- uint8 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
+ int32 worker_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (worker_threads < 1 || worker_threads > 32)
{
- sLog->outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
worker_threads = 1;
}
- uint8 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
+ int32 synch_threads = ConfigMgr::GetIntDefault("LoginDatabase.SynchThreads", 1);
if (synch_threads < 1 || synch_threads > 32)
{
- sLog->outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
synch_threads = 1;
}
// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
- if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads))
+ if (!LoginDatabase.Open(dbstring.c_str(), uint8(worker_threads), uint8(synch_threads)))
{
- sLog->outError("Cannot connect to database");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot connect to database");
return false;
}
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Started auth database connection pool.");
+ sLog->EnableDBAppenders();
return true;
}
+/// Close the connection to the database
void StopDB()
{
LoginDatabase.Close();
diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp
index d988b940809..79df2b15605 100755..100644
--- a/src/server/authserver/Realms/RealmList.cpp
+++ b/src/server/authserver/Realms/RealmList.cpp
@@ -31,7 +31,7 @@ void RealmList::Initialize(uint32 updateInterval)
UpdateRealms(true);
}
-void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, 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, 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];
@@ -45,9 +45,7 @@ void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::strin
realm.populationLevel = popu;
// Append port to IP address.
- std::ostringstream ss;
- ss << address << ':' << port;
- realm.address = ss.str();
+ address.addr_to_string(realm.address, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16);
realm.gamebuild = build;
}
@@ -68,7 +66,7 @@ void RealmList::UpdateIfNeed()
void RealmList::UpdateRealms(bool init)
{
- sLog->outDetail("Updating Realm List...");
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Updating Realm List...");
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST);
PreparedQueryResult result = LoginDatabase.Query(stmt);
@@ -80,8 +78,8 @@ void RealmList::UpdateRealms(bool init)
{
Field* fields = result->Fetch();
uint32 realmId = fields[0].GetUInt32();
- const std::string& name = fields[1].GetString();
- const std::string& address = fields[2].GetString();
+ 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());
@@ -90,10 +88,12 @@ void RealmList::UpdateRealms(bool init)
float pop = fields[8].GetFloat();
uint32 build = fields[9].GetUInt32();
- UpdateRealm(realmId, name, address, port, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build);
+ 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);
if (init)
- sLog->outString("Added realm \"%s\".", fields[1].GetCString());
+ sLog->outInfo(LOG_FILTER_AUTHSERVER, "Added realm \"%s\" at %s.", name.c_str(), m_realms[name].address);
}
while (result->NextRow());
}
diff --git a/src/server/authserver/Realms/RealmList.h b/src/server/authserver/Realms/RealmList.h
index c8407b0fea1..52482897ea4 100755..100644
--- a/src/server/authserver/Realms/RealmList.h
+++ b/src/server/authserver/Realms/RealmList.h
@@ -21,6 +21,7 @@
#include <ace/Singleton.h>
#include <ace/Null_Mutex.h>
+#include <ace/INET_Addr.h>
#include "Common.h"
enum RealmFlags
@@ -39,7 +40,7 @@ enum RealmFlags
// Storage object for a realm
struct Realm
{
- std::string address;
+ char address[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
std::string name;
uint8 icon;
RealmFlags flag;
@@ -71,7 +72,7 @@ public:
private:
void UpdateRealms(bool init=false);
- void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint16 port, 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, 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 15555e4d607..ed3b3cf4145 100755..100644
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -196,7 +196,7 @@ const AuthHandler table[] =
Patcher PatchesCache;
// Constructor - set the N and g values for SRP6
-AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket)
+AuthSocket::AuthSocket(RealmSocket& socket) : pPatch(NULL), socket_(socket)
{
N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
g.SetDword(7);
@@ -210,12 +210,12 @@ AuthSocket::~AuthSocket(void) {}
// Accept the connection and set the s random value for SRP6
void AuthSocket::OnAccept(void)
{
- sLog->outBasic("'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
void AuthSocket::OnClose(void)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "AuthSocket::OnClose");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "AuthSocket::OnClose");
}
// Read the packet from the client
@@ -234,11 +234,11 @@ void AuthSocket::OnRead()
{
if ((uint8)table[i].cmd == _cmd && (table[i].status == STATUS_CONNECTED || (_authed && table[i].status == STATUS_AUTHED)))
{
- sLog->outStaticDebug("[Auth] got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
if (!(*this.*table[i].handler)())
{
- sLog->outStaticDebug("Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
return;
}
break;
@@ -248,7 +248,7 @@ void AuthSocket::OnRead()
// Report unknown packets in the error log
if (i == AUTH_TOTAL_COMMANDS)
{
- sLog->outError("[Auth] got unknown packet from '%s'", socket().getRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Got unknown packet from '%s'", socket().getRemoteAddress().c_str());
socket().shutdown();
return;
}
@@ -280,7 +280,7 @@ void AuthSocket::_SetVSFields(const std::string& rI)
v = g.ModExp(x, N);
// No SQL injection (username escaped)
- const char *v_hex, *s_hex;
+ char *v_hex, *s_hex;
v_hex = v.AsHexStr();
s_hex = s.AsHexStr();
@@ -290,14 +290,14 @@ void AuthSocket::_SetVSFields(const std::string& rI)
stmt->setString(2, _login);
LoginDatabase.Execute(stmt);
- OPENSSL_free((void*)v_hex);
- OPENSSL_free((void*)s_hex);
+ OPENSSL_free(v_hex);
+ OPENSSL_free(s_hex);
}
// Logon Challenge command handler
bool AuthSocket::_HandleLogonChallenge()
{
- sLog->outStaticDebug("Entering _HandleLogonChallenge");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonChallenge");
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
@@ -312,7 +312,7 @@ bool AuthSocket::_HandleLogonChallenge()
#endif
uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size;
- sLog->outStaticDebug("[AuthChallenge] got header, body is %#04x bytes", remaining);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got header, body is %#04x bytes", remaining);
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
return false;
@@ -324,8 +324,8 @@ bool AuthSocket::_HandleLogonChallenge()
// Read the remaining of the packet
socket().recv((char *)&buf[4], remaining);
- sLog->outStaticDebug("[AuthChallenge] got full packet, %#04x bytes", ch->size);
- sLog->outStaticDebug("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] got full packet, %#04x bytes", ch->size);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
// BigEndian code, nop in little endian case
// size already converted
@@ -343,7 +343,7 @@ bool AuthSocket::_HandleLogonChallenge()
_login = (const char*)ch->I;
_build = ch->build;
- _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
+ _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -352,20 +352,20 @@ bool AuthSocket::_HandleLogonChallenge()
// Restore string order as its byte order is reversed
std::reverse(_os.begin(), _os.end());
- pkt << (uint8)AUTH_LOGON_CHALLENGE;
- pkt << (uint8)0x00;
+ pkt << uint8(AUTH_LOGON_CHALLENGE);
+ pkt << uint8(0x00);
// Verify that this IP is not in the ip_banned table
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
- const std::string& ip_address = socket().getRemoteAddress();
- PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED);
+ std::string const& ip_address = socket().getRemoteAddress();
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED);
stmt->setString(0, ip_address);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
- pkt << (uint8)WOW_FAIL_BANNED;
- sLog->outBasic("'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort());
+ pkt << uint8(WOW_FAIL_BANNED);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
else
{
@@ -383,20 +383,20 @@ bool AuthSocket::_HandleLogonChallenge()
bool locked = false;
if (fields[2].GetUInt8() == 1) // if ip is locked
{
- sLog->outStaticDebug("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString());
- sLog->outStaticDebug("[AuthChallenge] Player address is '%s'", ip_address.c_str());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str());
if (strcmp(fields[3].GetCString(), ip_address.c_str()))
{
- sLog->outStaticDebug("[AuthChallenge] Account IP differs");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs");
pkt << (uint8) WOW_FAIL_SUSPENDED;
locked = true;
}
else
- sLog->outStaticDebug("[AuthChallenge] Account IP matches");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP matches");
}
else
- sLog->outStaticDebug("[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
if (!locked)
{
@@ -409,15 +409,15 @@ bool AuthSocket::_HandleLogonChallenge()
PreparedQueryResult banresult = LoginDatabase.Query(stmt);
if (banresult)
{
- if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64())
+ if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32())
{
- pkt << (uint8)WOW_FAIL_BANNED;
- sLog->outBasic("'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
+ pkt << uint8(WOW_FAIL_BANNED);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
else
{
- pkt << (uint8)WOW_FAIL_SUSPENDED;
- sLog->outBasic("'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
+ pkt << uint8(WOW_FAIL_SUSPENDED);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
}
else
@@ -450,7 +450,10 @@ bool AuthSocket::_HandleLogonChallenge()
unk3.SetRand(16 * 8);
// Fill the response packet with the result
- pkt << uint8(WOW_SUCCESS);
+ if (AuthHelper::IsAcceptedClientBuild(_build))
+ pkt << uint8(WOW_SUCCESS);
+ else
+ pkt << uint8(WOW_FAIL_VERSION_INVALID);
// B may be calculated < 32B so we force minimal length to 32B
pkt.append(B.AsByteArray(32), 32); // 32 bytes
@@ -488,7 +491,7 @@ bool AuthSocket::_HandleLogonChallenge()
for (int i = 0; i < 4; ++i)
_localizationName[i] = ch->country[4-i-1];
- sLog->outBasic("'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(),
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(),
_login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)
);
}
@@ -505,7 +508,7 @@ bool AuthSocket::_HandleLogonChallenge()
// Logon Proof command handler
bool AuthSocket::_HandleLogonProof()
{
- sLog->outStaticDebug("Entering _HandleLogonProof");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleLogonProof");
// Read the packet
sAuthLogonProof_C lp;
@@ -600,7 +603,7 @@ bool AuthSocket::_HandleLogonProof()
// Check if SRP6 results match (password is correct), else send an error
if (!memcmp(M.AsByteArray(), lp.M1, 20))
{
- sLog->outBasic("'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
// Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account
// No SQL injection (escaped user name) and IP address as received by socket
@@ -649,7 +652,7 @@ bool AuthSocket::_HandleLogonProof()
char data[4] = { AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT, 3, 0 };
socket().send(data, sizeof(data));
- sLog->outBasic("'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
uint32 MaxWrongPassCount = ConfigMgr::GetIntDefault("WrongPass.MaxCount", 0);
if (MaxWrongPassCount > 0)
@@ -679,7 +682,7 @@ bool AuthSocket::_HandleLogonProof()
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
- sLog->outBasic("'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times",
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins);
}
else
@@ -689,7 +692,7 @@ bool AuthSocket::_HandleLogonProof()
stmt->setUInt32(1, WrongPassBanTime);
LoginDatabase.Execute(stmt);
- sLog->outBasic("'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins);
}
}
@@ -703,7 +706,7 @@ bool AuthSocket::_HandleLogonProof()
// Reconnect Challenge command handler
bool AuthSocket::_HandleReconnectChallenge()
{
- sLog->outStaticDebug("Entering _HandleReconnectChallenge");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectChallenge");
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
@@ -718,7 +721,7 @@ bool AuthSocket::_HandleReconnectChallenge()
#endif
uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size;
- sLog->outStaticDebug("[ReconnectChallenge] got header, body is %#04x bytes", remaining);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got header, body is %#04x bytes", remaining);
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
return false;
@@ -730,8 +733,8 @@ bool AuthSocket::_HandleReconnectChallenge()
// Read the remaining of the packet
socket().recv((char *)&buf[4], remaining);
- sLog->outStaticDebug("[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
- sLog->outStaticDebug("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
_login = (const char*)ch->I;
@@ -742,14 +745,14 @@ bool AuthSocket::_HandleReconnectChallenge()
// Stop if the account is not found
if (!result)
{
- sLog->outError("'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
// Reinitialize build, expansion and the account securitylevel
_build = ch->build;
- _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
+ _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG));
_os = (const char*)ch->os;
if (_os.size() > 4)
@@ -766,11 +769,11 @@ bool AuthSocket::_HandleReconnectChallenge()
// Sending response
ByteBuffer pkt;
- pkt << (uint8)AUTH_RECONNECT_CHALLENGE;
- pkt << (uint8)0x00;
+ pkt << uint8(AUTH_RECONNECT_CHALLENGE);
+ pkt << uint8(0x00);
_reconnectProof.SetRand(16 * 8);
pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random
- pkt << (uint64)0x00 << (uint64)0x00; // 16 bytes zeros
+ pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
return true;
}
@@ -778,7 +781,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Reconnect Proof command handler
bool AuthSocket::_HandleReconnectProof()
{
- sLog->outStaticDebug("Entering _HandleReconnectProof");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleReconnectProof");
// Read the packet
sAuthReconnectProof_C lp;
if (!socket().recv((char *)&lp, sizeof(sAuthReconnectProof_C)))
@@ -800,16 +803,16 @@ bool AuthSocket::_HandleReconnectProof()
{
// Sending response
ByteBuffer pkt;
- pkt << (uint8)AUTH_RECONNECT_PROOF;
- pkt << (uint8)0x00;
- pkt << (uint16)0x00; // 2 bytes zeros
+ pkt << uint8(AUTH_RECONNECT_PROOF);
+ pkt << uint8(0x00);
+ pkt << uint16(0x00); // 2 bytes zeros
socket().send((char const*)pkt.contents(), pkt.size());
_authed = true;
return true;
}
else
{
- sLog->outError("'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -818,7 +821,7 @@ bool AuthSocket::_HandleReconnectProof()
// Realm List command handler
bool AuthSocket::_HandleRealmList()
{
- sLog->outStaticDebug("Entering _HandleRealmList");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleRealmList");
if (socket().recv_len() < 5)
return false;
@@ -831,7 +834,7 @@ bool AuthSocket::_HandleRealmList()
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
{
- sLog->outError("'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@@ -849,73 +852,87 @@ bool AuthSocket::_HandleRealmList()
for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i)
{
// don't work with realms which not compatible with the client
- if ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild != _build)
- continue;
- else if ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild))
+ bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild));
+
+ // No SQL injection. id of realm is controlled by the database.
+ uint32 flag = i->second.flag;
+ RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(i->second.gamebuild);
+ if (!okBuild)
+ {
+ if (!buildInfo)
continue;
- uint8 AmountOfCharacters;
+ flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for
+ }
- // No SQL injection. id of realm is controlled by the database.
+ if (!buildInfo)
+ flag &= ~REALM_FLAG_SPECIFYBUILD;
+
+ std::string name = i->first;
+ if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD)
+ {
+ std::ostringstream ss;
+ ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')';
+ name = ss.str();
+ }
+
+ uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
+
+ uint8 AmountOfCharacters = 0;
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM);
stmt->setUInt32(0, i->second.m_ID);
stmt->setUInt32(1, id);
result = LoginDatabase.Query(stmt);
if (result)
AmountOfCharacters = (*result)[0].GetUInt8();
- else
- AmountOfCharacters = 0;
-
- uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0;
pkt << i->second.icon; // realm type
- if ( _expversion & POST_BC_EXP_FLAG ) // only 2.x and 3.x clients
+ if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
pkt << lock; // if 1, then realm locked
- pkt << uint8(i->second.flag); // RealmFlags
- pkt << i->first;
+ pkt << uint8(flag); // RealmFlags
+ pkt << name;
pkt << i->second.address;
pkt << i->second.populationLevel;
pkt << AmountOfCharacters;
pkt << i->second.timezone; // realm category
if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
- pkt << (uint8)0x2C; // unk, may be realm number/id?
+ pkt << uint8(0x2C); // unk, may be realm number/id?
else
- pkt << (uint8)0x0; // 1.12.1 and 1.12.2 clients
+ pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients
- if (i->second.flag & REALM_FLAG_SPECIFYBUILD)
+ if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD)
{
- // TODO: Make this customizable
- pkt << uint8(3);
- pkt << uint8(3);
- pkt << uint8(5);
- pkt << uint16(12340);
+ pkt << uint8(buildInfo->MajorVersion);
+ pkt << uint8(buildInfo->MinorVersion);
+ pkt << uint8(buildInfo->BugfixVersion);
+ pkt << uint16(buildInfo->Build);
}
++RealmListSize;
}
- if ( _expversion & POST_BC_EXP_FLAG ) // 2.x and 3.x clients
+ if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients
{
- pkt << (uint8)0x10;
- pkt << (uint8)0x00;
+ pkt << uint8(0x10);
+ pkt << uint8(0x00);
}
else // 1.12.1 and 1.12.2 clients
{
- pkt << (uint8)0x00;
- pkt << (uint8)0x02;
+ pkt << uint8(0x00);
+ pkt << uint8(0x02);
}
// make a ByteBuffer which stores the RealmList's size
ByteBuffer RealmListSizeBuffer;
- RealmListSizeBuffer << (uint32)0;
+ RealmListSizeBuffer << uint32(0);
if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients
- RealmListSizeBuffer << (uint16)RealmListSize;
+ RealmListSizeBuffer << uint16(RealmListSize);
else
- RealmListSizeBuffer << (uint32)RealmListSize;
+ RealmListSizeBuffer << uint32(RealmListSize);
ByteBuffer hdr;
- hdr << (uint8) REALM_LIST;
- hdr << (uint16)(pkt.size() + RealmListSizeBuffer.size());
+ hdr << uint8(REALM_LIST);
+ hdr << uint16(pkt.size() + RealmListSizeBuffer.size());
hdr.append(RealmListSizeBuffer); // append RealmList's size buffer
hdr.append(pkt); // append realms in the realmlist
@@ -927,11 +944,11 @@ bool AuthSocket::_HandleRealmList()
// Resume patch transfer
bool AuthSocket::_HandleXferResume()
{
- sLog->outStaticDebug("Entering _HandleXferResume");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume");
// Check packet length and patch existence
- if (socket().recv_len() < 9 || !pPatch)
+ if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used
{
- sLog->outError("Error while resuming patch transfer (wrong packet)");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)");
return false;
}
@@ -948,7 +965,7 @@ bool AuthSocket::_HandleXferResume()
// Cancel patch transfer
bool AuthSocket::_HandleXferCancel()
{
- sLog->outStaticDebug("Entering _HandleXferCancel");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferCancel");
// Close and delete the socket
socket().recv_skip(1); //clear input buffer
@@ -960,12 +977,12 @@ bool AuthSocket::_HandleXferCancel()
// Accept patch transfer
bool AuthSocket::_HandleXferAccept()
{
- sLog->outStaticDebug("Entering _HandleXferAccept");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferAccept");
// Check packet length and patch existence
if (!pPatch)
{
- sLog->outError("Error while accepting patch transfer (wrong packet)");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error while accepting patch transfer (wrong packet)");
return false;
}
@@ -983,7 +1000,9 @@ PatcherRunnable::PatcherRunnable(class AuthSocket* as)
}
// Send content of patch file to the client
-void PatcherRunnable::run() {}
+void PatcherRunnable::run()
+{
+}
// Preload MD5 hashes of existing patch files on server
#ifndef _WIN32
@@ -1050,7 +1069,7 @@ void Patcher::LoadPatchMD5(char *szFileName)
if (!pPatch)
{
- sLog->outError("Error loading patch %s\n", path.c_str());
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error loading patch %s\n", path.c_str());
return;
}
diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h
index 9be2136b55c..9be2136b55c 100755..100644
--- a/src/server/authserver/Server/AuthSocket.h
+++ b/src/server/authserver/Server/AuthSocket.h
diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h
index 32f4f3e4122..b764e4d2494 100755..100644
--- a/src/server/authserver/Server/RealmAcceptor.h
+++ b/src/server/authserver/Server/RealmAcceptor.h
@@ -48,7 +48,7 @@ protected:
virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/)
{
- sLog->outBasic("Resuming acceptor");
+ sLog->outDebug(LOG_FILTER_AUTHSERVER, "Resuming acceptor");
reactor()->cancel_timer(this, 1);
return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK);
}
@@ -58,7 +58,7 @@ protected:
#if defined(ENFILE) && defined(EMFILE)
if (errno == ENFILE || errno == EMFILE)
{
- sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds");
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Out of file descriptors, suspending incoming connections for 10 seconds");
reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
reactor()->schedule_timer(this, NULL, ACE_Time_Value(10));
}
diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp
index e839457d1c9..d65431eca44 100755..100644
--- a/src/server/authserver/Server/RealmSocket.cpp
+++ b/src/server/authserver/Server/RealmSocket.cpp
@@ -59,7 +59,7 @@ int RealmSocket::open(void * arg)
if (peer().get_remote_addr(addr) == -1)
{
- sLog->outError("Error %s while opening realm socket!", ACE_OS::strerror(errno));
+ sLog->outError(LOG_FILTER_AUTHSERVER, "Error %s while opening realm socket!", ACE_OS::strerror(errno));
return -1;
}
@@ -79,7 +79,7 @@ int RealmSocket::open(void * arg)
return 0;
}
-int RealmSocket::close(int)
+int RealmSocket::close(u_long)
{
shutdown();
diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h
index c03a0e3ad1e..b093691047c 100755..100644
--- a/src/server/authserver/Server/RealmSocket.h
+++ b/src/server/authserver/Server/RealmSocket.h
@@ -59,7 +59,7 @@ public:
virtual int open(void *);
- virtual int close(int);
+ virtual int close(u_long);
virtual int handle_input(ACE_HANDLE = ACE_INVALID_HANDLE);
virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE);
diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist
index e9ed4bd752d..67d22c49da1 100644
--- a/src/server/authserver/authserver.conf.dist
+++ b/src/server/authserver/authserver.conf.dist
@@ -9,6 +9,7 @@
# EXAMPLE CONFIG
# AUTH SERVER SETTINGS
# MYSQL SETTINGS
+# LOGGING SYSTEM SETTINGS
#
###################################################################################################
@@ -69,116 +70,6 @@ BindIP = "0.0.0.0"
PidFile = ""
#
-# LogLevel
-# Description: Server console level of logging
-# Default: 0 - (Minimum)
-# 1 - (Basic)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogLevel = 0
-
-#
-# LogFile
-# Description: Log file for main server log.
-# Default: "Auth.log" - (Enabled)
-# "" - (Disabled)
-
-LogFile = "Auth.log"
-
-#
-# Debug Log Mask
-# Description: Bitmask that determines which debug log output (level 3)
-# will be logged.
-# Possible flags:
-#
-# 64 - Anything related to network input/output,
-# such as packet handlers and netcode logs
-#
-# Simply add the values together to create a bitmask.
-# For more info see enum DebugLogFilters in Log.h
-#
-# Default: 0 (nothing)
-
-DebugLogMask = 64
-
-#
-# SQLDriverLogFile
-# Description: Log file for SQL driver events.
-# Example: "SQLDriver.log" - (Enabled)
-# Default: "" - (Disabled)
-
-SQLDriverLogFile = ""
-
-#
-# SQLDriverQueryLogging
-# Description: Log SQL queries to the SQLDriverLogFile and console.
-# Default: 0 - (Disabled, Query errors only)
-# 1 - (Enabled, Full query logging - may have performance impact)
-
-SQLDriverQueryLogging = 0
-
-#
-# LogTimestamp
-# Description: Append timestamp to the server log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogTimestamp = 0
-
-#
-# LogFileLevel
-# Description: Server file level of logging
-# Default: 0 - (Minimum)
-# 1 - (Basic)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogFileLevel = 0
-
-#
-# LogColors
-# Description: Colors for log messages (Format: "normal basic detail debug").
-# Colors: 0 - Black
-# 1 - Red
-# 2 - Green
-# 3 - Brown
-# 4 - Blue
-# 5 - Magenta
-# 6 - Cyan
-# 7 - Grey
-# 8 - Yellow
-# 9 - Lred
-# 10 - Lgreen
-# 11 - Lblue
-# 12 - Lmagenta
-# 13 - Lcyan
-# 14 - White
-# Example: "13 11 9 5" - (Enabled)
-# Default: "" - (Disabled)
-
-LogColors = ""
-
-#
-# EnableLogDB
-# Description: Write log messages to database (LogDatabaseInfo).
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-EnableLogDB = 0
-
-#
-# DBLogLevel
-# Description: Log level of databases logging.
-# Default: 1 - (Basic)
-# 0 - (Minimum)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-DBLogLevel = 1
-
-#
# UseProcessors
# Description: Processors mask for Windows based multi-processor systems.
# Default: 0 - (Selected by OS)
@@ -255,3 +146,108 @@ LoginDatabase.WorkerThreads = 1
#
###################################################################################################
+
+###################################################################################################
+#
+# LOGGING SYSTEM SETTINGS
+#
+# Appender config values: Given a appender "name"
+# Appender.name
+# Description: Defines 'where to log'
+# Format: Type,LogLevel,Flags,optional1,optional2
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "13 11 9 5 3 1"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+
+Appender.Console=1,2,0
+Appender.Auth=2,2,0,Auth.log,w
+
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+# Appenders
+# Description: List of Appenders to read from config
+# (Using spaces as separator).
+# Default: "Console Server"
+
+Appenders=Console Auth
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: Type,LogLevel,AppenderList
+# Type
+# 0 - Default. Each type that has no config will
+# rely on this one. Core will create this logger
+# (disabled) if it's not configured
+# 7 - Network input/output,
+# 30 - Authserver
+
+Logger.Root=0,3,Console Auth
+
+#
+# Loggers
+# Description: List of Loggers to read from config
+# (Using spaces as separator).
+# Default: "root"
+
+Loggers=Root
+
+#
+################################################################################################### \ No newline at end of file
diff --git a/src/server/authserver/authserver.rc b/src/server/authserver/authserver.rc
index 97de89432bf..97de89432bf 100755..100644
--- a/src/server/authserver/authserver.rc
+++ b/src/server/authserver/authserver.rc
diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp
index 8e90cac92f5..8e90cac92f5 100755..100644
--- a/src/server/collision/BoundingIntervalHierarchy.cpp
+++ b/src/server/collision/BoundingIntervalHierarchy.cpp
diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h
index a4bbe21006a..a4bbe21006a 100755..100644
--- a/src/server/collision/BoundingIntervalHierarchy.h
+++ b/src/server/collision/BoundingIntervalHierarchy.h
diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt
index 9fc696ab19a..3182b20d008 100644
--- a/src/server/collision/CMakeLists.txt
+++ b/src/server/collision/CMakeLists.txt
@@ -17,12 +17,10 @@ file(GLOB_RECURSE sources_Maps Maps/*.cpp Maps/*.h)
file(GLOB_RECURSE sources_Models Models/*.cpp Models/*.h)
file(GLOB sources_localdir *.cpp *.h)
-if( USE_COREPCH AND MSVC )
- set(collision_STAT_SRCS
- PrecompiledHeaders/collisionPCH.cpp
- PrecompiledHeaders/collisionPCH.h
- )
-endif()
+if (USE_COREPCH)
+ set(collision_STAT_PCH_HDR PrecompiledHeaders/collisionPCH.h)
+ set(collision_STAT_PCH_SRC PrecompiledHeaders/collisionPCH.cpp)
+endif ()
set(collision_STAT_SRCS
${collision_STAT_SRCS}
@@ -33,6 +31,7 @@ set(collision_STAT_SRCS
)
include_directories(
+ ${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
@@ -73,20 +72,16 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/Management
${CMAKE_CURRENT_SOURCE_DIR}/Maps
${CMAKE_CURRENT_SOURCE_DIR}/Models
- ${CMAKE_BINARY_DIR}
${ACE_INCLUDE_DIR}
${MYSQL_INCLUDE_DIR}
- ${OPENSSL_INCLUDE_DIR}
)
-add_library(collision STATIC ${collision_STAT_SRCS})
+add_library(collision STATIC
+ ${collision_STAT_SRCS}
+ ${collision_STAT_PCH_SRC}
+)
# Generate precompiled header
-if( USE_COREPCH )
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_precompiled_header(collision ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/collisionPCH.h)
- elseif(MSVC)
- add_native_precompiled_header(collision ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/collisionPCH)
- endif()
-endif()
-
+if (USE_COREPCH)
+ add_cxx_pch(collision ${collision_STAT_PCH_HDR} ${collision_STAT_PCH_SRC})
+endif ()
diff --git a/src/server/collision/Management/IVMapManager.h b/src/server/collision/Management/IVMapManager.h
index a645e88ef05..7cf296625f4 100755..100644
--- a/src/server/collision/Management/IVMapManager.h
+++ b/src/server/collision/Management/IVMapManager.h
@@ -35,7 +35,7 @@ namespace VMAP
{
VMAP_LOAD_RESULT_ERROR,
VMAP_LOAD_RESULT_OK,
- VMAP_LOAD_RESULT_IGNORED,
+ VMAP_LOAD_RESULT_IGNORED
};
#define VMAP_INVALID_HEIGHT -100000.0f // for check
diff --git a/src/server/collision/Management/VMapFactory.cpp b/src/server/collision/Management/VMapFactory.cpp
index 657f989a0c0..657f989a0c0 100755..100644
--- a/src/server/collision/Management/VMapFactory.cpp
+++ b/src/server/collision/Management/VMapFactory.cpp
diff --git a/src/server/collision/Management/VMapFactory.h b/src/server/collision/Management/VMapFactory.h
index 27bce523c43..27bce523c43 100755..100644
--- a/src/server/collision/Management/VMapFactory.h
+++ b/src/server/collision/Management/VMapFactory.h
diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp
index b9f0f25c2f9..81328d31d7b 100644
--- a/src/server/collision/Management/VMapManager2.cpp
+++ b/src/server/collision/Management/VMapManager2.cpp
@@ -257,7 +257,7 @@ namespace VMAP
WorldModel* worldmodel = new WorldModel();
if (!worldmodel->readFile(basepath + filename + ".vmo"))
{
- sLog->outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel;
return NULL;
}
@@ -277,7 +277,7 @@ namespace VMAP
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{
- sLog->outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
return;
}
if (model->second.decRefCount() == 0)
diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h
index 1fba108388a..1fba108388a 100755..100644
--- a/src/server/collision/Management/VMapManager2.h
+++ b/src/server/collision/Management/VMapManager2.h
diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp
index f4a3f1c7b30..89412a69c33 100644
--- a/src/server/collision/Maps/MapTree.cpp
+++ b/src/server/collision/Maps/MapTree.cpp
@@ -124,8 +124,8 @@ namespace VMAP
return intersectionCallBack.result;
}
- StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath):
- iMapID(mapID), iTreeValues(0), iBasePath(basePath)
+ StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath)
+ : iMapID(mapID), iIsTiled(false), iTreeValues(0), iBasePath(basePath)
{
if (iBasePath.length() > 0 && iBasePath[iBasePath.length()-1] != '/' && iBasePath[iBasePath.length()-1] != '\\')
{
@@ -320,7 +320,7 @@ namespace VMAP
else
{
success = false;
- sLog->outError("StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::InitMap() : could not acquire WorldModel pointer for '%s'", spawn.name.c_str());
}
}
@@ -356,7 +356,7 @@ namespace VMAP
}
if (!iTreeValues)
{
- sLog->outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY);
return false;
}
bool result = true;
@@ -382,7 +382,7 @@ namespace VMAP
// acquire model instance
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
if (!model)
- sLog->outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY);
// update tree
uint32 referencedVal;
@@ -432,7 +432,7 @@ namespace VMAP
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
if (tile == iLoadedTiles.end())
{
- sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
return;
}
if (tile->second) // file associated with tile
@@ -466,7 +466,7 @@ namespace VMAP
else
{
if (!iLoadedSpawns.count(referencedNode))
- sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
+ sLog->outError(LOG_FILTER_GENERAL, "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
else if (--iLoadedSpawns[referencedNode] == 0)
{
iTreeValues[referencedNode].setUnloaded();
diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h
index 1732209c6bc..1732209c6bc 100755..100644
--- a/src/server/collision/Maps/MapTree.h
+++ b/src/server/collision/Maps/MapTree.h
diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp
index 3bfed7d322d..434522d3515 100644
--- a/src/server/collision/Maps/TileAssembler.cpp
+++ b/src/server/collision/Maps/TileAssembler.cpp
@@ -54,11 +54,8 @@ namespace VMAP
//=================================================================
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName)
+ : iDestDir(pDestDirName), iSrcDir(pSrcDirName), iFilterMethod(NULL), iCurrentUniqueNameId(0)
{
- iCurrentUniqueNameId = 0;
- iFilterMethod = NULL;
- iSrcDir = pSrcDirName;
- iDestDir = pDestDirName;
//mkdir(iDestDir);
//init();
}
@@ -336,9 +333,15 @@ namespace VMAP
void TileAssembler::exportGameobjectModels()
{
FILE* model_list = fopen((iSrcDir + "/" + "temp_gameobject_models").c_str(), "rb");
+ if (!model_list)
+ return;
+
FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb");
- if (!model_list || !model_list_copy)
+ if (!model_list_copy)
+ {
+ fclose(model_list);
return;
+ }
uint32 name_length, displayId;
char buff[500];
diff --git a/src/server/collision/Maps/TileAssembler.h b/src/server/collision/Maps/TileAssembler.h
index 554940a4663..554940a4663 100755..100644
--- a/src/server/collision/Maps/TileAssembler.h
+++ b/src/server/collision/Maps/TileAssembler.h
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 8b63620e783..ae8465843b5 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -28,6 +28,7 @@
#include "TemporarySummon.h"
#include "Object.h"
#include "DBCStores.h"
+#include "World.h"
using G3D::Vector3;
using G3D::Ray;
@@ -53,7 +54,7 @@ void LoadGameObjectModelList()
FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
if (!model_list_file)
{
- sLog->outError("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
+ sLog->outError(LOG_FILTER_GENERAL, "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
return;
}
@@ -72,7 +73,7 @@ void LoadGameObjectModelList()
|| fread(&v1, sizeof(Vector3), 1, model_list_file) != 1
|| fread(&v2, sizeof(Vector3), 1, model_list_file) != 1)
{
- sLog->outError("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
+ sLog->outError(LOG_FILTER_GENERAL, "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
break;
}
@@ -83,8 +84,8 @@ void LoadGameObjectModelList()
}
fclose(model_list_file);
- sLog->outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
+
}
GameObjectModel::~GameObjectModel()
@@ -103,7 +104,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
// ignore models with no bounds
if (mdl_box == G3D::AABox::zero())
{
- sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
return false;
}
@@ -148,7 +149,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
GameObjectModel* GameObjectModel::Create(const GameObject& go)
{
- const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(go.GetGOInfo()->displayId);
+ const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(go.GetDisplayId());
if (!info)
return NULL;
diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h
index 0bb6c0f47bc..78a0e876676 100644
--- a/src/server/collision/Models/GameObjectModel.h
+++ b/src/server/collision/Models/GameObjectModel.h
@@ -61,6 +61,8 @@ public:
void disable() { phasemask = 0;}
void enable(uint32 ph_mask) { phasemask = ph_mask;}
+ bool isEnabled() const {return phasemask != 0;}
+
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
static GameObjectModel* Create(const GameObject& go);
diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h
index 1118b654578..b0189ad8542 100755..100644
--- a/src/server/collision/Models/ModelInstance.h
+++ b/src/server/collision/Models/ModelInstance.h
@@ -63,7 +63,7 @@ namespace VMAP
class ModelInstance: public ModelSpawn
{
public:
- ModelInstance(): iModel(0) {}
+ ModelInstance(): iInvScale(0.0f), iModel(0) {}
ModelInstance(const ModelSpawn &spawn, WorldModel* model);
void setUnloaded() { iModel = 0; }
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const;
diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h
index ebf828e4935..ebf828e4935 100755..100644
--- a/src/server/collision/Models/WorldModel.h
+++ b/src/server/collision/Models/WorldModel.h
diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h
index 00d7b0cd209..5b7d1d74987 100644
--- a/src/server/collision/RegularGrid.h
+++ b/src/server/collision/RegularGrid.h
@@ -86,7 +86,7 @@ public:
static Cell ComputeCell(float fx, float fy)
{
- Cell c = {fx * (1.f/CELL_SIZE) + (CELL_NUMBER/2), fy * (1.f/CELL_SIZE) + (CELL_NUMBER/2)};
+ Cell c = { int(fx * (1.f/CELL_SIZE) + (CELL_NUMBER/2)), int(fy * (1.f/CELL_SIZE) + (CELL_NUMBER/2)) };
return c;
}
diff --git a/src/server/collision/VMapTools.h b/src/server/collision/VMapTools.h
index 72d9e8988c1..72d9e8988c1 100755..100644
--- a/src/server/collision/VMapTools.h
+++ b/src/server/collision/VMapTools.h
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 86f2c6a28b7..d9d19c2f009 100755..100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -21,6 +21,7 @@
#include "SpellInfo.h"
#include "Vehicle.h"
#include "ObjectAccessor.h"
+#include "Player.h"
int AggressorAI::Permissible(const Creature* creature)
{
@@ -111,6 +112,11 @@ void CombatAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
+void CombatAI::SpellInterrupted(uint32 spellId, uint32 unTimeMs)
+{
+ events.RescheduleEvent(spellId, unTimeMs);
+}
+
/////////////////
//CasterAI
/////////////////
@@ -182,7 +188,7 @@ void CasterAI::UpdateAI(const uint32 diff)
ArcherAI::ArcherAI(Creature* c) : CreatureAI(c)
{
if (!me->m_spells[0])
- sLog->outError("ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
@@ -231,7 +237,7 @@ void ArcherAI::UpdateAI(const uint32 /*diff*/)
TurretAI::TurretAI(Creature* c) : CreatureAI(c)
{
if (!me->m_spells[0])
- sLog->outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
diff --git a/src/server/game/AI/CoreAI/CombatAI.h b/src/server/game/AI/CoreAI/CombatAI.h
index ad98cec0779..fa31e57d780 100755..100644
--- a/src/server/game/AI/CoreAI/CombatAI.h
+++ b/src/server/game/AI/CoreAI/CombatAI.h
@@ -46,6 +46,7 @@ class CombatAI : public CreatureAI
void EnterCombat(Unit* who);
void JustDied(Unit* killer);
void UpdateAI(const uint32 diff);
+ void SpellInterrupted(uint32 spellId, uint32 unTimeMs);
static int Permissible(const Creature*);
protected:
EventMap events;
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h
index fbc8675cc47..4561aa92741 100644
--- a/src/server/game/AI/CoreAI/GameObjectAI.h
+++ b/src/server/game/AI/CoreAI/GameObjectAI.h
@@ -37,7 +37,12 @@ class GameObjectAI
virtual void InitializeAI() { Reset(); }
- virtual void Reset() {};
+ virtual void Reset() { }
+
+ // Pass parameters between AI
+ virtual void DoAction(const int32 /*param = 0 */) {}
+ virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {}
+ virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
static int Permissible(GameObject const* go);
@@ -48,9 +53,9 @@ class GameObjectAI
virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; }
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
- virtual uint32 GetData(uint32 /*id*/) { return 0; }
+ virtual uint32 GetData(uint32 /*id*/) const { return 0; }
virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
- virtual uint64 GetData64(uint32 /*id*/) { return 0; }
+ virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 6e2326ca9d5..90ca7009098 100755..100644
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -40,8 +40,8 @@ bool GuardAI::CanSeeAlways(WorldObject const* obj)
if (!obj->isType(TYPEMASK_UNIT))
return false;
- std::list<HostileReference*> threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+ ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if ((*itr)->getUnitGuid() == obj->GetGUID())
return true;
diff --git a/src/server/game/AI/CoreAI/GuardAI.h b/src/server/game/AI/CoreAI/GuardAI.h
index c8dd9d54921..c8dd9d54921 100755..100644
--- a/src/server/game/AI/CoreAI/GuardAI.h
+++ b/src/server/game/AI/CoreAI/GuardAI.h
diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp
index 3738d5bab6c..3738d5bab6c 100755..100644
--- a/src/server/game/AI/CoreAI/PassiveAI.cpp
+++ b/src/server/game/AI/CoreAI/PassiveAI.cpp
diff --git a/src/server/game/AI/CoreAI/PassiveAI.h b/src/server/game/AI/CoreAI/PassiveAI.h
index d7bf8656f23..b4fd579d693 100755..100644
--- a/src/server/game/AI/CoreAI/PassiveAI.h
+++ b/src/server/game/AI/CoreAI/PassiveAI.h
@@ -20,7 +20,6 @@
#define TRINITY_PASSIVEAI_H
#include "CreatureAI.h"
-//#include "CreatureAIImpl.h"
class PassiveAI : public CreatureAI
{
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 97ae0581a18..9b0123ed824 100755..100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -44,10 +44,6 @@ PetAI::PetAI(Creature* c) : CreatureAI(c), i_tracker(TIME_INTERVAL_LOOK)
UpdateAllies();
}
-void PetAI::EnterEvadeMode()
-{
-}
-
bool PetAI::_needToStop()
{
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
@@ -61,7 +57,7 @@ void PetAI::_stopAttack()
{
if (!me->isAlive())
{
- sLog->outStaticDebug("Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->CombatStop();
@@ -71,13 +67,16 @@ void PetAI::_stopAttack()
}
me->AttackStop();
+ me->InterruptNonMeleeSpells(false);
+ me->SendMeleeAttackStop(); // Should stop pet's attack button from flashing
me->GetCharmInfo()->SetIsCommandAttack(false);
+ ClearCharmInfoFlags();
HandleReturnMovement();
}
void PetAI::UpdateAI(const uint32 diff)
{
- if (!me->isAlive())
+ if (!me->isAlive() || !me->GetCharmInfo())
return;
Unit* owner = me->GetCharmerOrOwner();
@@ -88,8 +87,7 @@ void PetAI::UpdateAI(const uint32 diff)
else
m_updateAlliesTimer -= diff;
- // me->getVictim() can't be used for check in case stop fighting, me->getVictim() clear at Unit death etc.
- if (me->getVictim())
+ if (me->getVictim() && me->getVictim()->isAlive())
{
// is only necessary to stop casting, the pet must not exit combat
if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
@@ -100,23 +98,30 @@ void PetAI::UpdateAI(const uint32 diff)
if (_needToStop())
{
- sLog->outStaticDebug("Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
_stopAttack();
return;
}
- DoMeleeAttackIfReady();
+ // Check before attacking to prevent pets from leaving stay position
+ if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
+ {
+ if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getVictim())))
+ DoMeleeAttackIfReady();
+ }
+ else
+ DoMeleeAttackIfReady();
}
- else if (owner && me->GetCharmInfo()) //no victim
+ else
{
- // Only aggressive pets do target search every update.
- // Defensive pets do target search only in these cases:
- // * Owner attacks something - handled by OwnerAttacked()
- // * Owner receives damage - handled by OwnerDamagedBy()
- // * Pet is in combat and current target dies - handled by KilledUnit()
- if (me->HasReactState(REACT_AGGRESSIVE))
+ if (me->HasReactState(REACT_AGGRESSIVE) || me->GetCharmInfo()->IsAtStay())
{
- Unit* nextTarget = SelectNextTarget();
+ // Every update we need to check targets only in certain cases
+ // Aggressive - Allow auto select if owner or pet don't have a target
+ // Stay - Only pick from pet or owner targets / attackers so targets won't run by
+ // while chasing our owner. Don't do auto select.
+ // All other cases (ie: defensive) - Targets are assigned by AttackedBy(), OwnerAttackedBy(), OwnerAttacked(), etc.
+ Unit* nextTarget = SelectNextTarget(me->HasReactState(REACT_AGGRESSIVE));
if (nextTarget)
AttackStart(nextTarget);
@@ -125,12 +130,8 @@ void PetAI::UpdateAI(const uint32 diff)
}
else
HandleReturnMovement();
- }
- else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim
- HandleReturnMovement();
- if (!me->GetCharmInfo())
- return;
+ }
// Autocast (casted only in combat or persistent spells in any state)
if (!me->HasUnitState(UNIT_STATE_CASTING))
@@ -181,7 +182,8 @@ void PetAI::UpdateAI(const uint32 diff)
spellUsed = true;
}
}
-
+ if (spellInfo->HasEffect(SPELL_EFFECT_JUMP_DEST))
+ continue; //pets must jump only to target
// No enemy, check friendly
if (!spellUsed)
{
@@ -301,12 +303,11 @@ void PetAI::KilledUnit(Unit* victim)
// Can't use _stopAttack() because that activates movement handlers and ignores
// next target selection
me->AttackStop();
- me->GetCharmInfo()->SetIsCommandAttack(false);
+ me->InterruptNonMeleeSpells(false);
me->SendMeleeAttackStop(); // Stops the pet's 'Attack' button from flashing
- Unit* nextTarget = SelectNextTarget();
-
- if (nextTarget)
+ // Before returning to owner, see if there are more things to attack
+ if (Unit* nextTarget = SelectNextTarget(false))
AttackStart(nextTarget);
else
HandleReturnMovement(); // Return
@@ -320,16 +321,14 @@ void PetAI::AttackStart(Unit* target)
if (!CanAttack(target))
return;
- if (Unit* owner = me->GetOwner())
- owner->SetInCombatWith(target);
-
- DoAttack(target, true);
+ // Only chase if not commanded to stay or if stay but commanded to attack
+ DoAttack(target, (!me->GetCharmInfo()->HasCommandState(COMMAND_STAY) || me->GetCharmInfo()->IsCommandAttack()));
}
-void PetAI::OwnerDamagedBy(Unit* attacker)
+void PetAI::OwnerAttackedBy(Unit* attacker)
{
- // Called when owner takes damage. Allows defensive pets to know
- // that their owner might need help
+ // Called when owner takes damage. This function helps keep pets from running off
+ // simply due to owner gaining aggro.
if (!attacker)
return;
@@ -367,34 +366,47 @@ void PetAI::OwnerAttacked(Unit* target)
AttackStart(target);
}
-Unit* PetAI::SelectNextTarget()
+Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
{
- // Provides next target selection after current target death
+ // Provides next target selection after current target death.
+ // This function should only be called internally by the AI
+ // Targets are not evaluated here for being valid targets, that is done in _CanAttack()
+ // The parameter: allowAutoSelect lets us disable aggressive pet auto targeting for certain situations
// Passive pets don't do next target selection
if (me->HasReactState(REACT_PASSIVE))
return NULL;
- Unit* target = me->getAttackerForHelper();
+ // Check pet attackers first so we don't drag a bunch of targets to the owner
+ if (Unit* myAttacker = me->getAttackerForHelper())
+ if (!myAttacker->HasBreakableByDamageCrowdControlAura())
+ return myAttacker;
+
+ // Not sure why we wouldn't have an owner but just in case...
+ if (!me->GetCharmerOrOwner())
+ return NULL;
+
+ // Check owner attackers
+ if (Unit* ownerAttacker = me->GetCharmerOrOwner()->getAttackerForHelper())
+ if (!ownerAttacker->HasBreakableByDamageCrowdControlAura())
+ return ownerAttacker;
- // Check pet's attackers first to prevent dragging mobs back to owner
- if (target && !target->HasBreakableByDamageCrowdControlAura())
- return target;
+ // Check owner victim
+ // 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does
+ if (Unit* ownerVictim = me->GetCharmerOrOwner()->getVictim())
+ return ownerVictim;
- if (me->GetCharmerOrOwner())
+ // Neither pet or owner had a target and aggressive pets can pick any target
+ // To prevent aggressive pets from chain selecting targets and running off, we
+ // only select a random target if certain conditions are met.
+ if (me->HasReactState(REACT_AGGRESSIVE) && allowAutoSelect)
{
- // Check owner's attackers if pet didn't have any
- target = me->GetCharmerOrOwner()->getAttackerForHelper();
- if (target && !target->HasBreakableByDamageCrowdControlAura())
- return target;
-
- // 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does
- target = me->GetCharmerOrOwner()->getVictim();
- if (target && !target->HasBreakableByDamageCrowdControlAura())
- return target;
+ if (!me->GetCharmInfo()->IsReturning() || me->GetCharmInfo()->IsFollowing() || me->GetCharmInfo()->IsAtStay())
+ if (Unit* nearTarget = me->ToCreature()->SelectNearestHostileUnitInAggroRange(true))
+ return nearTarget;
}
- // Default
+ // Default - no valid targets
return NULL;
}
@@ -402,6 +414,11 @@ void PetAI::HandleReturnMovement()
{
// Handles moving the pet back to stay or owner
+ // Prevent activating movement when under control of spells
+ // such as "Eyes of the Beast"
+ if (me->isCharmed())
+ return;
+
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
{
if (!me->GetCharmInfo()->IsAtStay() && !me->GetCharmInfo()->IsReturning())
@@ -412,6 +429,7 @@ void PetAI::HandleReturnMovement()
float x, y, z;
me->GetCharmInfo()->GetStayPosition(x, y, z);
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsReturning(true);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(me->GetGUIDLow(), x, y, z);
@@ -424,44 +442,44 @@ void PetAI::HandleReturnMovement()
{
if (!me->GetCharmInfo()->IsCommandAttack())
{
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsReturning(true);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveFollow(me->GetCharmerOrOwner(), PET_FOLLOW_DIST, me->GetFollowAngle());
}
}
}
-
}
void PetAI::DoAttack(Unit* target, bool chase)
{
- // Handles attack with or without chase and also resets all
- // PetAI flags for next update / creature kill
+ // Handles attack with or without chase and also resets flags
+ // for next update / creature kill
- // me->GetCharmInfo()->SetIsCommandAttack(false);
+ if (me->Attack(target, true))
+ {
+ if (Unit* owner = me->GetOwner())
+ owner->SetInCombatWith(target);
- // The following conditions are true if chase == true
- // (Follow && (Aggressive || Defensive))
- // ((Stay || Follow) && (Passive && player clicked attack))
+ // Play sound to let the player know the pet is attacking something it picked on its own
+ if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack())
+ me->SendPetAIReaction(me->GetGUID());
- if (chase)
- {
- if (me->Attack(target, true))
+
+ if (chase)
+ {
+ ClearCharmInfoFlags();
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveChase(target);
+ }
+ else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
{
- me->GetCharmInfo()->SetIsAtStay(false);
- me->GetCharmInfo()->SetIsFollowing(false);
- me->GetCharmInfo()->SetIsReturning(false);
+ ClearCharmInfoFlags();
+ me->GetCharmInfo()->SetIsAtStay(true);
me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveChase(target);
+ me->GetMotionMaster()->MoveIdle();
}
}
- else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
- {
- me->GetCharmInfo()->SetIsAtStay(true);
- me->GetCharmInfo()->SetIsFollowing(false);
- me->GetCharmInfo()->SetIsReturning(false);
- me->Attack(target, true);
- }
}
void PetAI::MovementInform(uint32 moveType, uint32 data)
@@ -475,10 +493,8 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
// pet's GUIDLow since we set that as the waypoint ID
if (data == me->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
{
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsAtStay(true);
- me->GetCharmInfo()->SetIsReturning(false);
- me->GetCharmInfo()->SetIsFollowing(false);
- me->GetCharmInfo()->SetIsCommandAttack(false);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
}
@@ -490,10 +506,8 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
// otherwise we're probably chasing a creature
if (me->GetCharmerOrOwner() && me->GetCharmInfo() && data == me->GetCharmerOrOwner()->GetGUIDLow() && me->GetCharmInfo()->IsReturning())
{
- me->GetCharmInfo()->SetIsAtStay(false);
- me->GetCharmInfo()->SetIsReturning(false);
+ ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsFollowing(true);
- me->GetCharmInfo()->SetIsCommandAttack(false);
}
break;
}
@@ -504,30 +518,55 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
bool PetAI::CanAttack(Unit* target)
{
- // Evaluates wether a pet can attack a specific
- // target based on CommandState, ReactState and other flags
+ // Evaluates wether a pet can attack a specific target based on CommandState, ReactState and other flags
+ // IMPORTANT: The order in which things are checked is important, be careful if you add or remove checks
- // Returning - check first since pets returning ignore attacks
- if (me->GetCharmInfo()->IsReturning())
+ // Hmmm...
+ if (!target)
return false;
- // Passive - check now so we don't have to worry about passive in later checks
+ if (!target->isAlive())
+ {
+ // Clear target to prevent getting stuck on dead targets
+ me->AttackStop();
+ me->InterruptNonMeleeSpells(false);
+ me->SendMeleeAttackStop();
+ return false;
+ }
+
+ // Passive - passive pets can attack if told to
if (me->HasReactState(REACT_PASSIVE))
return me->GetCharmInfo()->IsCommandAttack();
- // Pets commanded to attack should not stop their approach if attacked by another creature
- if (me->getVictim() && (me->getVictim() != target))
- return !me->GetCharmInfo()->IsCommandAttack();
+ // CC - mobs under crowd control can be attacked if owner commanded
+ if (target->HasBreakableByDamageCrowdControlAura())
+ return me->GetCharmInfo()->IsCommandAttack();
- // From this point on, pet will always be either aggressive or defensive
+ // Returning - pets ignore attacks only if owner clicked follow
+ if (me->GetCharmInfo()->IsReturning())
+ return !me->GetCharmInfo()->IsCommandFollow();
// Stay - can attack if target is within range or commanded to
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
- return (me->IsWithinMeleeRange(target, MELEE_RANGE) || me->GetCharmInfo()->IsCommandAttack());
+ return (me->IsWithinMeleeRange(target) || me->GetCharmInfo()->IsCommandAttack());
+
+ // Pets attacking something (or chasing) should only switch targets if owner tells them to
+ if (me->getVictim() && me->getVictim() != target)
+ {
+ // Check if our owner selected this target and clicked "attack"
+ Unit* ownerTarget = NULL;
+ if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
+ ownerTarget = owner->GetSelectedUnit();
+ else
+ ownerTarget = me->GetCharmerOrOwner()->getVictim();
+
+ if (ownerTarget && me->GetCharmInfo()->IsCommandAttack())
+ return (target->GetGUID() == ownerTarget->GetGUID());
+ }
// Follow
if (me->GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
- return true;
+ return !me->GetCharmInfo()->IsReturning();
// default, though we shouldn't ever get here
return false;
@@ -540,11 +579,55 @@ void PetAI::ReceiveEmote(Player* player, uint32 emote)
{
case TEXT_EMOTE_COWER:
if (me->isPet() && me->ToPet()->IsPetGhoul())
- me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR);
+ me->HandleEmoteCommand(/*EMOTE_ONESHOT_ROAR*/EMOTE_ONESHOT_OMNICAST_GHOUL);
break;
case TEXT_EMOTE_ANGRY:
if (me->isPet() && me->ToPet()->IsPetGhoul())
- me->HandleEmoteCommand(EMOTE_ONESHOT_COWER);
+ me->HandleEmoteCommand(/*EMOTE_ONESHOT_COWER*/EMOTE_STATE_STUN);
+ break;
+ case TEXT_EMOTE_GLARE:
+ if (me->isPet() && me->ToPet()->IsPetGhoul())
+ me->HandleEmoteCommand(EMOTE_STATE_STUN);
+ break;
+ case TEXT_EMOTE_SOOTHE:
+ if (me->isPet() && me->ToPet()->IsPetGhoul())
+ me->HandleEmoteCommand(EMOTE_ONESHOT_OMNICAST_GHOUL);
break;
}
}
+
+void PetAI::ClearCharmInfoFlags()
+{
+ // Quick access to set all flags to FALSE
+
+ CharmInfo* ci = me->GetCharmInfo();
+
+ if (ci)
+ {
+ ci->SetIsAtStay(false);
+ ci->SetIsCommandAttack(false);
+ ci->SetIsCommandFollow(false);
+ ci->SetIsFollowing(false);
+ ci->SetIsReturning(false);
+ }
+}
+
+void PetAI::AttackedBy(Unit* attacker)
+{
+ // Called when pet takes damage. This function helps keep pets from running off
+ // simply due to gaining aggro.
+
+ if (!attacker)
+ return;
+
+ // Passive pets don't do anything
+ if (me->HasReactState(REACT_PASSIVE))
+ return;
+
+ // Prevent pet from disengaging from current target
+ if (me->getVictim() && me->getVictim()->isAlive())
+ return;
+
+ // Continue to evaluate and attack if necessary
+ AttackStart(attacker);
+}
diff --git a/src/server/game/AI/CoreAI/PetAI.h b/src/server/game/AI/CoreAI/PetAI.h
index 8e5311fa000..8a8853b19b5 100755..100644
--- a/src/server/game/AI/CoreAI/PetAI.h
+++ b/src/server/game/AI/CoreAI/PetAI.h
@@ -31,19 +31,24 @@ class PetAI : public CreatureAI
explicit PetAI(Creature* c);
- void EnterEvadeMode();
- void JustDied(Unit* /*who*/) { _stopAttack(); }
-
void UpdateAI(const uint32);
static int Permissible(const Creature*);
void KilledUnit(Unit* /*victim*/);
void AttackStart(Unit* target);
void MovementInform(uint32 moveType, uint32 data);
- void OwnerDamagedBy(Unit* attacker);
+ void OwnerAttackedBy(Unit* attacker);
void OwnerAttacked(Unit* target);
+ void AttackedBy(Unit* attacker);
void ReceiveEmote(Player* player, uint32 textEmote);
+ // The following aren't used by the PetAI but need to be defined to override
+ // default CreatureAI functions which interfere with the PetAI
+ //
+ void MoveInLineOfSight(Unit* /*who*/) {} // CreatureAI interferes with returning pets
+ void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets
+ void EnterEvadeMode() {} // For fleeing, pets don't use this type of Evade mechanic
+
private:
bool _isVisible(Unit*) const;
bool _needToStop(void);
@@ -56,10 +61,11 @@ class PetAI : public CreatureAI
std::set<uint64> m_AllySet;
uint32 m_updateAlliesTimer;
- Unit* SelectNextTarget();
+ Unit* SelectNextTarget(bool allowAutoSelect) const;
void HandleReturnMovement();
void DoAttack(Unit* target, bool chase);
bool CanAttack(Unit* target);
+ void ClearCharmInfoFlags();
};
#endif
diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp
index 4683a75a44e..4683a75a44e 100755..100644
--- a/src/server/game/AI/CoreAI/ReactorAI.cpp
+++ b/src/server/game/AI/CoreAI/ReactorAI.cpp
diff --git a/src/server/game/AI/CoreAI/ReactorAI.h b/src/server/game/AI/CoreAI/ReactorAI.h
index 4a95dcf04e8..4a95dcf04e8 100755..100644
--- a/src/server/game/AI/CoreAI/ReactorAI.h
+++ b/src/server/game/AI/CoreAI/ReactorAI.h
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index d12d3c098e8..d12d3c098e8 100755..100644
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
diff --git a/src/server/game/AI/CoreAI/TotemAI.h b/src/server/game/AI/CoreAI/TotemAI.h
index f0d705345ef..f0d705345ef 100755..100644
--- a/src/server/game/AI/CoreAI/TotemAI.h
+++ b/src/server/game/AI/CoreAI/TotemAI.h
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index bf50909eeee..9f2c9a86094 100755..100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -60,25 +60,20 @@ void UnitAI::DoMeleeAttackIfReady()
bool UnitAI::DoSpellAttackIfReady(uint32 spell)
{
- if (me->HasUnitState(UNIT_STATE_CASTING))
+ if (me->HasUnitState(UNIT_STATE_CASTING) || !me->isAttackReady())
return true;
- if (me->isAttackReady())
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
{
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
+ if (me->IsWithinCombatRange(me->getVictim(), spellInfo->GetMaxRange(false)))
{
- if (me->IsWithinCombatRange(me->getVictim(), spellInfo->GetMaxRange(false)))
- {
- me->CastSpell(me->getVictim(), spell, false);
- me->resetAttackTimer();
- }
- else
- return false;
+ me->CastSpell(me->getVictim(), spell, false);
+ me->resetAttackTimer();
+ return true;
}
- else
- return false;
}
- return true;
+
+ return false;
}
Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float dist, bool playerOnly, int32 aura)
@@ -101,8 +96,8 @@ void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
{
if (me->isInCombat())
{
- std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (unit->GetTypeId() == TYPEID_PLAYER)
@@ -116,8 +111,8 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
{
if (me->isInCombat())
{
- std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (unit->GetTypeId() == TYPEID_PLAYER)
@@ -130,7 +125,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
void UnitAI::DoCast(uint32 spellId)
{
Unit* target = NULL;
- //sLog->outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
+ //sLog->outError(LOG_FILTER_GENERAL, "aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
switch (AISpellInfo[spellId].target)
{
default:
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 593f0d15e18..8b31bb5c54d 100755..100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -20,24 +20,15 @@
#define TRINITY_UNITAI_H
#include "Define.h"
-#include <list>
#include "Unit.h"
+#include "Containers.h"
+#include <list>
-class Unit;
class Player;
+class Quest;
+class Unit;
struct AISpellInfoType;
-// Default script texts
-enum GeneralScriptTexts
-{
- DEFAULT_TEXT = -1000000,
- EMOTE_GENERIC_FRENZY_KILL = -1000001,
- EMOTE_GENERIC_FRENZY = -1000002,
- EMOTE_GENERIC_ENRAGED = -1000003,
- EMOTE_GENERIC_BERSERK = -1000004,
- EMOTE_GENERIC_BERSERK_RAID = -1000005, // RaidBossEmote version of the previous one
-};
-
//Selection method used by SelectTarget
enum SelectAggroTarget
{
@@ -45,7 +36,7 @@ enum SelectAggroTarget
SELECT_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
SELECT_TARGET_NEAREST,
- SELECT_TARGET_FARTHEST,
+ SELECT_TARGET_FARTHEST
};
// default predicate function to select target based on distance, player and/or aura criteria
@@ -60,7 +51,7 @@ struct DefaultTargetSelector : public std::unary_function<Unit*, bool>
// dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit
// playerOnly: self explaining
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
- DefaultTargetSelector(Unit const* unit, float dist, bool playerOnly, int32 aura) : me(unit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) {}
+ DefaultTargetSelector(Unit const* unit, float dist, bool playerOnly, int32 aura) : me(unit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) { }
bool operator()(Unit const* target) const
{
@@ -145,22 +136,22 @@ class UnitAI
// Pass parameters between AI
virtual void DoAction(int32 const /*param*/) {}
- virtual uint32 GetData(uint32 /*id = 0*/) { return 0; }
+ virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {}
- virtual uint64 GetGUID(int32 /*id*/ = 0) { return 0; }
+ virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; }
Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0);
// Select the targets satifying the predicate.
// predicate shall extend std::unary_function<Unit*, bool>
template <class PREDICATE> Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE const& predicate)
{
- const std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
if (position >= threatlist.size())
return NULL;
std::list<Unit*> targetList;
- for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
if (predicate((*itr)->getTarget()))
targetList.push_back((*itr)->getTarget());
@@ -205,11 +196,11 @@ class UnitAI
// predicate shall extend std::unary_function<Unit*, bool>
template <class PREDICATE> void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectAggroTarget targetType)
{
- std::list<HostileReference*> const& threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
if (threatlist.empty())
return;
- for (std::list<HostileReference*>::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
if (predicate((*itr)->getTarget()))
targetList.push_back((*itr)->getTarget());
@@ -242,6 +233,10 @@ class UnitAI
// Called when the unit heals
virtual void HealDone(Unit* /*done_to*/, uint32& /*addhealth*/) {}
+ /// Called when a spell is interrupted by Spell::EffectInterruptCast
+ /// Use to reschedule next planned cast of spell.
+ virtual void SpellInterrupted(uint32 /*spellId*/, uint32 /*unTimeMs*/) {}
+
void AttackStartCaster(Unit* victim, float dist);
void DoAddAuraToAllHostilePlayers(uint32 spellid);
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 9c236cbd039..e5868117da8 100755..100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -54,7 +54,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
Map* map = creature->GetMap();
if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
{
- sLog->outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
+ sLog->outError(LOG_FILTER_GENERAL, "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
return;
}
@@ -77,7 +77,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
if (!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
{
- sLog->outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
return;
}
@@ -153,13 +153,20 @@ void CreatureAI::EnterEvadeMode()
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
}
else
+ {
+ // Required to prevent attacking creatures that are evading and cause them to reenter combat
+ // Does not apply to MoveFollow
+ me->AddUnitState(UNIT_STATE_EVADE);
me->GetMotionMaster()->MoveTargetedHome();
+ }
}
Reset();
if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
me->GetVehicleKit()->Reset(true);
+
+ me->SetLastDamagedTime(0);
}
/*void CreatureAI::AttackedBy(Unit* attacker)
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 68752b82e7f..4f61e168a87 100755..100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -45,7 +45,7 @@ enum SelectTargetType
SELECT_TARGET_SINGLE_FRIEND, //Only Single Friend
SELECT_TARGET_AOE_FRIEND, //Only AoE Friend
- SELECT_TARGET_ANY_FRIEND, //AoE or Single Friend
+ SELECT_TARGET_ANY_FRIEND //AoE or Single Friend
};
//Spell Effects used by SelectSpell
@@ -54,7 +54,7 @@ enum SelectEffect
SELECT_EFFECT_DONTCARE = 0, //All spell effects allowed
SELECT_EFFECT_DAMAGE, //Spell does damage
SELECT_EFFECT_HEALING, //Spell does healing
- SELECT_EFFECT_AURA, //Spell applies an aura
+ SELECT_EFFECT_AURA //Spell applies an aura
};
enum SCEquip
@@ -117,7 +117,7 @@ class CreatureAI : public UnitAI
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
- //virtual void AttackedBy(Unit* attacker);
+ virtual void AttackedBy(Unit* /*attacker*/) {}
virtual bool IsEscorted() { return false; }
// Called when creature is spawned or respawned (for reseting variables)
@@ -137,7 +137,7 @@ class CreatureAI : public UnitAI
virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) {}
// Called when owner takes damage
- virtual void OwnerDamagedBy(Unit* /*attacker*/) {}
+ virtual void OwnerAttackedBy(Unit* /*attacker*/) {}
// Called when owner attacks something
virtual void OwnerAttacked(Unit* /*target*/) {}
diff --git a/src/server/game/AI/CreatureAIFactory.h b/src/server/game/AI/CreatureAIFactory.h
index f4147826811..f4147826811 100755..100644
--- a/src/server/game/AI/CreatureAIFactory.h
+++ b/src/server/game/AI/CreatureAIFactory.h
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index d097adf38ec..981ac1f5f16 100755..100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -505,14 +505,14 @@ enum AITarget
AITARGET_ENEMY,
AITARGET_ALLY,
AITARGET_BUFF,
- AITARGET_DEBUFF,
+ AITARGET_DEBUFF
};
enum AICondition
{
AICOND_AGGRO,
AICOND_COMBAT,
- AICOND_DIE,
+ AICOND_DIE
};
#define AI_DEFAULT_COOLDOWN 5000
diff --git a/src/server/game/AI/CreatureAIRegistry.cpp b/src/server/game/AI/CreatureAIRegistry.cpp
index e4cb62c56de..e5c689da339 100755..100644
--- a/src/server/game/AI/CreatureAIRegistry.cpp
+++ b/src/server/game/AI/CreatureAIRegistry.cpp
@@ -30,7 +30,6 @@
#include "CreatureAIFactory.h"
#include "SmartAI.h"
-//#include "CreatureAIImpl.h"
namespace AIRegistry
{
void Initialize()
diff --git a/src/server/game/AI/CreatureAIRegistry.h b/src/server/game/AI/CreatureAIRegistry.h
index 39d792a0d77..39d792a0d77 100755..100644
--- a/src/server/game/AI/CreatureAIRegistry.h
+++ b/src/server/game/AI/CreatureAIRegistry.h
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index 1a0c6652e74..4ccaa174e67 100755..100644
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
@@ -125,7 +125,6 @@ namespace FactorySelector
}*/
return (mv_factory == NULL ? NULL : mv_factory->Create(creature));
-
}
GameObjectAI* SelectGameObjectAI(GameObject* go)
@@ -138,6 +137,11 @@ namespace FactorySelector
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/CreatureAISelector.h b/src/server/game/AI/CreatureAISelector.h
index 933ec16f75c..933ec16f75c 100755..100644
--- a/src/server/game/AI/CreatureAISelector.h
+++ b/src/server/game/AI/CreatureAISelector.h
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index 835705a0d7c..84e44109e58 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -40,7 +40,7 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM
Time = urand(repeatMin, repeatMax);
else
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
Enabled = false;
return false;
}
@@ -64,7 +64,6 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
std::vector<CreatureEventAI_Event>::const_iterator i;
for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i)
{
-
//Debug check
#ifndef TRINITY_DEBUG
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
@@ -83,10 +82,10 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c)
}
//EventMap had events but they were not added because they must be for instance
if (m_CreatureEventAIList.empty())
- sLog->outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry());
}
else
- sLog->outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry());
m_bEmptyList = m_CreatureEventAIList.empty();
m_Phase = 0;
@@ -319,7 +318,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& holder, Unit* actionIn
break;
}
default:
- sLog->outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), holder.Event.event_id, holder.Event.event_type);
break;
}
@@ -492,40 +491,22 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED));
}
-
}
else
- sLog->outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", eventId, me->GetEntry(), action.cast.spellId);
}
break;
}
- case ACTION_T_SUMMON:
- {
- Unit* target = GetTargetByType(action.summon.target, actionInvoker);
-
- Creature* creature = NULL;
-
- if (action.summon.duration)
- creature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration);
- else
- creature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
-
- if (!creature)
- sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, eventId, me->GetEntry());
- else if (action.summon.target != TARGET_T_SELF && target)
- creature->AI()->AttackStart(target);
- break;
- }
case ACTION_T_THREAT_SINGLE_PCT:
if (Unit* target = GetTargetByType(action.threat_single_pct.target, actionInvoker))
me->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
break;
case ACTION_T_THREAT_ALL_PCT:
{
- std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
- if (Unit* Temp = Unit::GetUnit(*me, (*i)->getUnitGuid()))
- me->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
+ ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
+ if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
+ me->getThreatManager().modifyThreatPercent(unit, action.threat_all_pct.percent);
break;
}
case ACTION_T_QUEST_EVENT:
@@ -607,12 +588,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
int32 new_phase = int32(m_Phase)+action.set_inc_phase.step;
if (new_phase < 0)
{
- sLog->outErrorDb("CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d decrease m_Phase under 0. CreatureEntry = %d", eventId, me->GetEntry());
m_Phase = 0;
}
else if (new_phase >= MAX_PHASE)
{
- sLog->outErrorDb("CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d incremented m_Phase above %u. m_Phase mask cannot be used with phases past %u. CreatureEntry = %d", eventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry());
m_Phase = MAX_PHASE-1;
}
else
@@ -636,11 +617,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_CAST_EVENT_ALL:
{
- std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
- if (Unit* Temp = Unit::GetUnit(*me, (*i)->getUnitGuid()))
- if (Temp->GetTypeId() == TYPEID_PLAYER)
- Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, me->GetGUID(), action.cast_event_all.spellId);
+ ThreatContainer::StorageType const& threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
+ if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ unit->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, me->GetGUID(), action.cast_event_all.spellId);
break;
}
case ACTION_T_REMOVEAURASFROMSPELL:
@@ -663,32 +644,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax)
m_Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax);
else
- sLog->outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", eventId, me->GetEntry());
break;
- case ACTION_T_SUMMON_ID:
- {
- Unit* target = GetTargetByType(action.summon_id.target, actionInvoker);
-
- CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr->GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
- if (i == sEventAIMgr->GetCreatureEventAISummonMap().end())
- {
- sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, eventId, me->GetEntry());
- return;
- }
-
- Creature* creature = NULL;
- if ((*i).second.SpawnTimeSecs)
- creature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
- else
- creature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
-
- if (!creature)
- sLog->outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, eventId, me->GetEntry());
- else if (action.summon_id.target != TARGET_T_SELF && target)
- creature->AI()->AttackStart(target);
-
- break;
- }
case ACTION_T_KILLED_MONSTER:
//first attempt player who tapped creature
if (Player* player = me->GetLootRecipient())
@@ -703,10 +660,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
case ACTION_T_SET_INST_DATA:
{
- InstanceScript* instance = (InstanceScript*)me->GetInstanceScript();
+ InstanceScript* instance = me->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", eventId, me->GetEntry());
return;
}
@@ -718,14 +675,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
Unit* target = GetTargetByType(action.set_inst_data64.target, actionInvoker);
if (!target)
{
- sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", eventId, me->GetEntry());
return;
}
- InstanceScript* instance = (InstanceScript*)me->GetInstanceScript();
+ InstanceScript* instance = me->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", eventId, me->GetEntry());
return;
}
@@ -735,8 +692,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_UPDATE_TEMPLATE:
if (me->GetEntry() == action.update_template.creatureId)
{
-
- sLog->outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", eventId, me->GetEntry());
return;
}
@@ -745,8 +701,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_DIE:
if (me->isDead())
{
-
- sLog->outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", eventId, me->GetEntry());
return;
}
me->Kill(me);
@@ -798,11 +753,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
object = me->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2);
if (!object)
{
- sLog->outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry());
+ sLog->outError(LOG_FILTER_TSCR, "EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, eventId, me->GetEntry());
}
break;
}
-
case ACTION_T_SET_SHEATH:
{
me->SetSheath(SheathState(action.set_sheath.sheath));
@@ -843,6 +797,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
+ default:
+ break;
}
}
@@ -886,11 +842,11 @@ void CreatureEventAI::Reset()
(*i).Enabled = true;
break;
}
- //default:
- //TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void EnterCombat()
- //(*i).Enabled = true;
- //(*i).Time = 0;
- //break;
+ default:
+ //TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void EnterCombat()
+ //(*i).Enabled = true;
+ //(*i).Time = 0;
+ break;
}
}
}
@@ -1048,7 +1004,6 @@ void CreatureEventAI::MoveInLineOfSight(Unit* who)
void CreatureEventAI::SpellHit(Unit* unit, const SpellInfo* spell)
{
-
if (m_bEmptyList)
return;
@@ -1111,6 +1066,8 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
if (me->IsInRange(me->getVictim(), (float)(*i).Event.range.minDist, (float)(*i).Event.range.maxDist))
ProcessEvent(*i);
break;
+ default:
+ break;
}
}
@@ -1230,13 +1187,13 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
{
if (!source)
{
- sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i, invalid Source pointer.", textEntry);
return;
}
if (textEntry >= 0)
{
- sLog->outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
return;
}
@@ -1244,7 +1201,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
if (i == sEventAIMgr->GetCreatureEventAITextMap().end())
{
- sLog->outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", source->GetEntry(), source->GetTypeId(), source->GetGUIDLow(), textEntry);
return;
}
@@ -1255,7 +1212,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
if (sSoundEntriesStore.LookupEntry((*i).second.SoundId))
source->PlayDirectSound((*i).second.SoundId);
else
- sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId);
}
if ((*i).second.Emote)
@@ -1265,7 +1222,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
((Unit*)source)->HandleEmoteCommand((*i).second.Emote);
}
else
- sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId());
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", textEntry, source->GetTypeId());
}
switch ((*i).second.Type)
@@ -1286,13 +1243,13 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t
{
if (target && target->GetTypeId() == TYPEID_PLAYER)
source->MonsterWhisper(textEntry, target->GetGUID());
- else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
+ else sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
case CHAT_TYPE_BOSS_WHISPER:
{
if (target && target->GetTypeId() == TYPEID_PLAYER)
source->MonsterWhisper(textEntry, target->GetGUID(), true);
- else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
+ else sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
}break;
case CHAT_TYPE_ZONE_YELL:
source->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
@@ -1318,6 +1275,10 @@ bool CreatureEventAI::CanCast(Unit* target, SpellInfo const* spell, bool trigger
if (!me->IsInRange(target, spell->GetMinRange(false), spell->GetMaxRange(false)))
return false;
+ //Spell is on cooldown
+ if (me->HasSpellCooldown(spell->Id))
+ return false;
+
return true;
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.h b/src/server/game/AI/EventAI/CreatureEventAI.h
index 3d2bcf888c8..da5f0b084cf 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAI.h
+++ b/src/server/game/AI/EventAI/CreatureEventAI.h
@@ -60,7 +60,7 @@ enum EventAI_Type
EVENT_T_TARGET_BUFFED = 24, // Param1 = SpellID, Param2 = Number of Time STacked, Param3/4 Repeat Min/Max
EVENT_T_RESET = 35, // Is it called after combat, when the creature respawn and spawn. -- TRINITY ONLY
- EVENT_T_END,
+ EVENT_T_END
};
enum EventAI_ActionType
@@ -119,7 +119,7 @@ enum EventAI_ActionType
ACTION_T_ATTACK_START_PULSE = 103, //Distance
ACTION_T_SUMMON_GO = 104, //GameObjectID, DespawnTime in ms
- ACTION_T_END = 105,
+ ACTION_T_END = 105
};
enum Target
@@ -156,7 +156,7 @@ enum CastFlags
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
- CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
+ CAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell
};
enum EventFlags
@@ -589,7 +589,6 @@ struct CreatureEventAIHolder
class CreatureEventAI : public CreatureAI
{
-
public:
explicit CreatureEventAI(Creature* c);
~CreatureEventAI()
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index a863f2f89cf..f3df332c1e9 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -26,6 +26,7 @@
#include "ConditionMgr.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
+#include "Player.h"
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
@@ -38,13 +39,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
// Load EventAI Text
sObjectMgr->LoadTrinityStrings("creature_ai_texts", MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
- // Gather Additional data from EventAI Texts 0 1 2 3 4
+ // Gather Additional data from EventAI Texts 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
if (!result)
{
- sLog->outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
return;
}
@@ -64,33 +64,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
// range negative
if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID)
{
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` is not in valid range(%d-%d)", i, MIN_CREATURE_AI_TEXT_STRING_ID, MAX_CREATURE_AI_TEXT_STRING_ID);
continue;
}
// range negative (must not happen, loaded from same table)
if (!sObjectMgr->GetTrinityStringLocale(i))
{
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` not found", i);
continue;
}
if (temp.SoundId)
{
if (!sSoundEntriesStore.LookupEntry(temp.SoundId))
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Sound %u but sound does not exist.", i, temp.SoundId);
}
if (!GetLanguageDescByID(temp.Language))
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.", i, temp.Language);
if (temp.Type > CHAT_TYPE_ZONE_YELL)
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.", i, temp.Type);
if (temp.Emote)
{
if (!sEmotesStore.LookupEntry(temp.Emote))
- sLog->outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Entry %i in table `creature_ai_texts` has Emote %u but emote does not exist.", i, temp.Emote);
}
m_CreatureEventAI_TextMap[i] = temp;
@@ -98,60 +98,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-// -------------------
-void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
-{
- uint32 oldMSTime = getMSTime();
-
- //Drop Existing EventSummon Map
- m_CreatureEventAI_Summon_Map.clear();
-
- // Gather additional data for EventAI
- QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
-
- if (!result)
- {
- sLog->outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
- sLog->outString();
- return;
- }
-
- uint32 count = 0;
-
- do
- {
- Field* fields = result->Fetch();
-
- CreatureEventAI_Summon temp;
-
- uint32 i = fields[0].GetUInt32();
- temp.position_x = fields[1].GetFloat();
- temp.position_y = fields[2].GetFloat();
- temp.position_z = fields[3].GetFloat();
- temp.orientation = fields[4].GetFloat();
- temp.SpawnTimeSecs = fields[5].GetUInt32();
-
- if (!Trinity::IsValidMapCoord(temp.position_x, temp.position_y, temp.position_z, temp.orientation))
- {
- sLog->outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation);
- continue;
- }
-
- //Add to map
- m_CreatureEventAI_Summon_Map[i] = temp;
- ++count;
- }
- while (result->NextRow());
-
- sLog->outString(">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
uint32 oldMSTime = getMSTime();
@@ -169,8 +118,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
if (!result)
{
- sLog->outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
return;
}
@@ -191,7 +139,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
//Report any errors in event
if (e_type >= EVENT_T_END)
{
- sLog->outErrorDb("CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u have wrong type (%u), skipping.", i, e_type);
continue;
}
temp.event_type = EventAI_Type(e_type);
@@ -208,21 +156,21 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
//Creature does not exist in database
if (!cInfo)
{
- sLog->outErrorDb("CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id);
continue;
}
-
+
// Only on the first script
if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty())
- sLog->outErrorDb("Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id);
+ sLog->outError(LOG_FILTER_SQL, "Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id);
//No chance of this event occuring
if (temp.event_chance == 0)
- sLog->outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
//Chance above 100, force it to be 100
else if (temp.event_chance > 100)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
temp.event_chance = 100;
}
@@ -232,23 +180,23 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_TIMER:
case EVENT_T_TIMER_OOC:
if (temp.timer.initialMax < temp.timer.initialMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
if (temp.timer.repeatMax < temp.timer.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_HP:
case EVENT_T_MANA:
case EVENT_T_TARGET_HP:
case EVENT_T_TARGET_MANA:
if (temp.percent_range.percentMax > 100)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
if (temp.percent_range.percentMax <= temp.percent_range.percentMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
if (temp.event_flags & EFLAG_REPEATABLE && !temp.percent_range.repeatMin && !temp.percent_range.repeatMax)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
temp.event_flags &= ~EFLAG_REPEATABLE;
}
break;
@@ -258,29 +206,29 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!spell)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
if ((temp.spell_hit.schoolMask & spell->SchoolMask) != spell->SchoolMask)
- sLog->outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.spell_hit.schoolMask, i);
}
if (!temp.spell_hit.schoolMask)
- sLog->outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.spell_hit.schoolMask, i);
if (temp.spell_hit.repeatMax < temp.spell_hit.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_RANGE:
if (temp.range.maxDist < temp.range.minDist)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (MaxDist < MinDist). Event will never repeat.", temp.creature_id, i);
if (temp.range.repeatMax < temp.range.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_OOC_LOS:
if (temp.ooc_los.repeatMax < temp.ooc_los.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SPAWNED:
switch (temp.spawned.condition)
@@ -289,55 +237,55 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case SPAWNED_EVENT_MAP:
if (!sMapStore.LookupEntry(temp.spawned.conditionValue1))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'map specific' but with not existed map (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
break;
case SPAWNED_EVENT_ZONE:
if (!GetAreaEntryByAreaID(temp.spawned.conditionValue1))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using spawned event(%u) with param1 = %u 'area specific' but with not existed area (%u) in param2. Event will never repeat.", temp.creature_id, i, temp.spawned.condition, temp.spawned.conditionValue1);
default:
- sLog->outErrorDb("CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using invalid spawned event %u mode (%u) in param1", temp.creature_id, i, temp.spawned.condition);
break;
}
break;
case EVENT_T_FRIENDLY_HP:
if (temp.friendly_hp.repeatMax < temp.friendly_hp.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_FRIENDLY_IS_CC:
if (temp.friendly_is_cc.repeatMax < temp.friendly_is_cc.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_FRIENDLY_MISSING_BUFF:
{
SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!spell)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
if (temp.friendly_buff.repeatMax < temp.friendly_buff.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
}
case EVENT_T_KILL:
if (temp.kill.repeatMax < temp.kill.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_TARGET_CASTING:
if (temp.target_casting.repeatMax < temp.target_casting.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_SUMMONED_UNIT:
if (!sObjectMgr->GetCreatureTemplate(temp.summon_unit.creatureId))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed creature template id (%u) in param1, skipped.", temp.creature_id, i, temp.summon_unit.creatureId);
if (temp.summon_unit.repeatMax < temp.summon_unit.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
case EVENT_T_QUEST_ACCEPT:
case EVENT_T_QUEST_COMPLETE:
if (!sObjectMgr->GetQuestTemplate(temp.quest.questId))
- sLog->outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
- sLog->outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
continue;
case EVENT_T_AGGRO:
@@ -347,7 +295,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (temp.event_flags & EFLAG_REPEATABLE)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
temp.event_flags &= ~EFLAG_REPEATABLE;
}
@@ -358,7 +306,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (!sEmotesTextStore.LookupEntry(temp.receive_emote.emoteId))
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param1 (EmoteTextId: %u) are not valid.", temp.creature_id, i, temp.receive_emote.emoteId);
continue;
}
if (temp.receive_emote.condition)
@@ -369,14 +317,14 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
cond.ConditionValue2 = temp.receive_emote.conditionValue2;
if (!sConditionMgr->isConditionTypeValid(&cond))
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition);
continue;
}
}
if (!(temp.event_flags & EFLAG_REPEATABLE))
{
- sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
temp.event_flags |= EFLAG_REPEATABLE;
}
@@ -389,16 +337,16 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
SpellInfo const* spell = sSpellMgr->GetSpellInfo(temp.buffed.spellId);
if (!spell)
{
- sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
continue;
}
if (temp.buffed.repeatMax < temp.buffed.repeatMin)
- sLog->outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
break;
}
default:
- sLog->outErrorDb("CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Creature %u using not checked at load event (%u) in event %u. Need check code update?", temp.creature_id, temp.event_id, i);
break;
}
@@ -407,7 +355,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
uint16 action_type = fields[10+(j*4)].GetUInt8();
if (action_type >= ACTION_T_END)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type);
temp.action[j].type = ACTION_T_NONE;
continue;
}
@@ -429,30 +377,30 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
if (action.text.TextId1 < 0)
{
if (m_CreatureEventAI_TextMap.find(action.text.TextId1) == m_CreatureEventAI_TextMap.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
}
if (action.text.TextId2 < 0)
{
if (m_CreatureEventAI_TextMap.find(action.text.TextId2) == m_CreatureEventAI_TextMap.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
if (!action.text.TextId1)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
}
if (action.text.TextId3 < 0)
{
if (m_CreatureEventAI_TextMap.find(action.text.TextId3) == m_CreatureEventAI_TextMap.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
if (!action.text.TextId1 || !action.text.TextId2)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
}
break;
}
case ACTION_T_SET_FACTION:
if (action.set_faction.factionId !=0 && !sFactionStore.LookupEntry(action.set_faction.factionId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent FactionId %u.", i, j+1, action.set_faction.factionId);
action.set_faction.factionId = 0;
}
break;
@@ -461,7 +409,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.morph.creatureId && !sObjectMgr->GetCreatureTemplate(action.morph.creatureId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId);
action.morph.creatureId = 0;
}
@@ -469,12 +417,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.morph.creatureId)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId, action.morph.creatureId);
action.morph.modelId = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, action.morph.modelId);
action.morph.modelId = 0;
}
}
@@ -482,33 +430,33 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case ACTION_T_SOUND:
if (!sSoundEntriesStore.LookupEntry(action.sound.soundId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, action.sound.soundId);
break;
case ACTION_T_EMOTE:
if (!sEmotesStore.LookupEntry(action.emote.emoteId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.emote.emoteId);
break;
case ACTION_T_RANDOM_SOUND:
if (!sSoundEntriesStore.LookupEntry(action.random_sound.soundId1))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId1);
if (action.random_sound.soundId2 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId2))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId2);
if (action.random_sound.soundId3 >= 0 && !sSoundEntriesStore.LookupEntry(action.random_sound.soundId3))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, action.random_sound.soundId3);
break;
case ACTION_T_RANDOM_EMOTE:
if (!sEmotesStore.LookupEntry(action.random_emote.emoteId1))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId1);
if (action.random_emote.emoteId2 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId2))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param2 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId2);
if (action.random_emote.emoteId3 >= 0 && !sEmotesStore.LookupEntry(action.random_emote.emoteId3))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param3 (EmoteId: %u) are not valid.", i, j+1, action.random_emote.emoteId3);
break;
case ACTION_T_CAST:
{
const SpellInfo* spell = sSpellMgr->GetSpellInfo(action.cast.spellId);
if (!spell)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
/* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
else
{
@@ -526,143 +474,135 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
action.cast.castFlags |= CAST_TRIGGERED;
if (action.cast.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
}
case ACTION_T_SUMMON:
if (!sObjectMgr->GetCreatureTemplate(action.summon.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId);
if (action.summon.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_THREAT_SINGLE_PCT:
if (std::abs(action.threat_single_pct.percent) > 100)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_single_pct.percent);
if (action.threat_single_pct.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_THREAT_ALL_PCT:
if (std::abs(action.threat_all_pct.percent) > 100)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
break;
case ACTION_T_QUEST_EVENT:
if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event.questId))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
}
else
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event.questId);
if (action.quest_event.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_CAST_EVENT:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
if (!sSpellMgr->GetSpellInfo(action.cast_event.spellId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
if (action.cast_event.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_UNIT_FIELD:
if (action.set_unit_field.field < OBJECT_END || action.set_unit_field.field >= UNIT_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
if (action.set_unit_field.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_UNIT_FLAG:
case ACTION_T_REMOVE_UNIT_FLAG:
if (action.unit_flag.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_PHASE:
if (action.set_phase.phase >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
break;
case ACTION_T_INC_PHASE:
if (action.set_inc_phase.step == 0)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
else if (std::abs(action.set_inc_phase.step) > MAX_PHASE-1)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
break;
case ACTION_T_QUEST_EVENT_ALL:
if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event_all.questId))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
}
else
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent Quest entry %u.", i, j+1, action.quest_event_all.questId);
break;
case ACTION_T_CAST_EVENT_ALL:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event_all.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
if (!sSpellMgr->GetSpellInfo(action.cast_event_all.spellId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
break;
case ACTION_T_REMOVEAURASFROMSPELL:
if (!sSpellMgr->GetSpellInfo(action.remove_aura.spellId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
if (action.remove_aura.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_RANDOM_PHASE: //PhaseId1, PhaseId2, PhaseId3
if (action.random_phase.phase1 >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase1 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase.phase2 >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase2 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase.phase3 >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phase3 >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
break;
case ACTION_T_RANDOM_PHASE_RANGE: //PhaseMin, PhaseMax
if (action.random_phase_range.phaseMin >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMin >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase_range.phaseMin >= MAX_PHASE)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax >= %u. Phase mask cannot be used past phase %u.", i, j+1, MAX_PHASE, MAX_PHASE-1);
if (action.random_phase_range.phaseMin >= action.random_phase_range.phaseMax)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set phaseMax <= phaseMin.", i, j+1);
std::swap(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax);
// equal case processed at call
}
break;
- case ACTION_T_SUMMON_ID:
- if (!sObjectMgr->GetCreatureTemplate(action.summon_id.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.summon_id.creatureId);
- if (action.summon_id.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
- if (m_CreatureEventAI_Summon_Map.find(action.summon_id.spawnId) == m_CreatureEventAI_Summon_Map.end())
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, action.summon_id.spawnId);
- break;
case ACTION_T_KILLED_MONSTER:
if (!sObjectMgr->GetCreatureTemplate(action.killed_monster.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.killed_monster.creatureId);
if (action.killed_monster.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_SET_INST_DATA:
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
if (action.set_inst_data.value > 4/*SPECIAL*/)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
break;
case ACTION_T_SET_INST_DATA64:
if (!(temp.event_flags & EFLAG_DIFFICULTY_ALL))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u. Cannot set instance data without difficulty event flags.", i, j+1);
if (action.set_inst_data64.target >= TARGET_T_END)
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
break;
case ACTION_T_UPDATE_TEMPLATE:
if (!sObjectMgr->GetCreatureTemplate(action.update_template.creatureId))
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
break;
case ACTION_T_SET_SHEATH:
if (action.set_sheath.sheath >= MAX_SHEATH_STATE)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
action.set_sheath.sheath = SHEATH_STATE_UNARMED;
}
break;
@@ -671,7 +611,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.invincibility_hp_level.hp_level > 100)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses wrong percent value %u.", i, j+1, action.invincibility_hp_level.hp_level);
action.invincibility_hp_level.hp_level = 100;
}
}
@@ -681,7 +621,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.mount.creatureId && !sObjectMgr->GetCreatureTemplate(action.mount.creatureId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent Creature entry %u.", i, j+1, action.mount.creatureId);
action.morph.creatureId = 0;
}
@@ -689,12 +629,12 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
{
if (action.mount.creatureId)
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.mount.modelId, action.mount.creatureId);
action.mount.modelId = 0;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(action.mount.modelId))
{
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u uses nonexistent ModelId %u.", i, j+1, action.mount.modelId);
action.mount.modelId = 0;
}
}
@@ -714,7 +654,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_RANDOM_SAY:
case ACTION_T_RANDOM_YELL:
case ACTION_T_RANDOM_TEXTEMOTE:
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
break;
case ACTION_T_MOVE_RANDOM_POINT:
@@ -728,7 +668,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
default:
- sLog->outErrorDb("CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type);
+ sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u Action %u have currently not checked at load action type (%u). Need check code update?", i, j+1, action.type);
break;
}
}
@@ -740,6 +680,5 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.h b/src/server/game/AI/EventAI/CreatureEventAIMgr.h
index 93e953681b6..75e24266fb5 100755..100644
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.h
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.h
@@ -32,16 +32,13 @@ class CreatureEventAIMgr
public:
void LoadCreatureEventAI_Texts();
- void LoadCreatureEventAI_Summons();
void LoadCreatureEventAI_Scripts();
CreatureEventAI_Event_Map const& GetCreatureEventAIMap() const { return m_CreatureEventAI_Event_Map; }
- CreatureEventAI_Summon_Map const& GetCreatureEventAISummonMap() const { return m_CreatureEventAI_Summon_Map; }
CreatureEventAI_TextMap const& GetCreatureEventAITextMap() const { return m_CreatureEventAI_TextMap; }
private:
CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map;
- CreatureEventAI_Summon_Map m_CreatureEventAI_Summon_Map;
CreatureEventAI_TextMap m_CreatureEventAI_TextMap;
};
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index 6d27d251579..67cabc6ccb1 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -5,9 +5,13 @@
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
#include "Item.h"
#include "Spell.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "ObjectMgr.h"
#include "TemporarySummon.h"
@@ -73,17 +77,13 @@ void SummonList::RemoveNotExisting()
}
}
-bool SummonList::HasEntry(uint32 entry)
+bool SummonList::HasEntry(uint32 entry) const
{
- for (iterator i = begin(); i != end();)
+ for (const_iterator i = begin(); i != end(); ++i)
{
Creature* summon = Unit::GetCreature(*me, *i);
- if (!summon)
- erase(i++);
- else if (summon->GetEntry() == entry)
+ if (summon && summon->GetEntry() == entry)
return true;
- else
- ++i;
}
return false;
@@ -153,7 +153,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
if (!sSoundEntriesStore.LookupEntry(soundId))
{
- sLog->outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
+ sLog->outError(LOG_FILTER_TSCR, "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
return;
}
@@ -246,16 +246,15 @@ void ScriptedAI::DoResetThreat()
{
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
{
- sLog->outError("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
+ sLog->outError(LOG_FILTER_TSCR, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
return;
}
- std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
-
if (unit && DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
}
@@ -295,7 +294,8 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
- sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
+ sLog->outError(LOG_FILTER_TSCR, "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.",
+ me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
}
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
@@ -327,6 +327,7 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float range)
Trinity::FriendlyCCedInRange u_check(me, range);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(me, list, u_check);
me->VisitNearbyObject(range, searcher);
+
return list;
}
@@ -336,6 +337,7 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 u
Trinity::FriendlyMissingBuffInRange u_check(me, range, uiSpellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(me, list, u_check);
me->VisitNearbyObject(range, searcher);
+
return list;
}
@@ -427,7 +429,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
return false;
break;
default: // For most of creatures that certain area is their home area.
- sLog->outDetail("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
+ sLog->outInfo(LOG_FILTER_GENERAL, "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ());
if (me->GetAreaId() == homeAreaId)
return false;
@@ -447,7 +449,6 @@ void Scripted_NoMovementAI::AttackStart(Unit* target)
}
// BossAI - for instanced bosses
-
BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
instance(creature->GetInstanceScript()),
summons(creature),
@@ -499,8 +500,9 @@ void BossAI::TeleportCheaters()
{
float x, y, z;
me->GetPosition(x, y, z);
- std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+
+ ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget())
if (target->GetTypeId() == TYPEID_PLAYER && !CheckBoundary(target))
target->NearTeleportTo(x, y, z, 0);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
index ba0a94d2590..2a221d04404 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h
@@ -41,8 +41,10 @@ class SummonList : public std::list<uint64>
template <class Predicate> void DoAction(int32 info, Predicate& predicate, uint16 max = 0)
{
- Trinity::Containers::RandomResizeList<uint64, Predicate>(*this, predicate, max);
- for (iterator i = begin(); i != end(); )
+ // We need to use a copy of SummonList here, otherwise original SummonList would be modified
+ std::list<uint64> listCopy = *this;
+ Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
+ for (iterator i = listCopy.begin(); i != listCopy.end(); )
{
Creature* summon = Unit::GetCreature(*me, *i++);
if (summon && summon->IsAIEnabled)
@@ -52,7 +54,7 @@ class SummonList : public std::list<uint64>
void DoZoneInCombat(uint32 entry = 0);
void RemoveNotExisting();
- bool HasEntry(uint32 entry);
+ bool HasEntry(uint32 entry) const;
private:
Creature* me;
};
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index c7751fc7383..3f5952a210d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -9,9 +9,10 @@ SDComment:
SDCategory: Npc
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
+#include "Player.h"
enum ePoints
{
@@ -175,7 +176,7 @@ void npc_escortAI::EnterEvadeMode()
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has left combat and is now returning to last point");
}
else
{
@@ -216,7 +217,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
{
if (DespawnAtEnd)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints");
if (m_bCanReturnToStart)
{
@@ -227,7 +228,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
m_uiWPWaitTimer = 0;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
return;
}
@@ -243,7 +244,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
}
else
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints with Despawn off");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints with Despawn off");
return;
}
@@ -252,7 +253,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
@@ -270,7 +271,7 @@ void npc_escortAI::UpdateAI(uint32 const diff)
{
if (DespawnAtFar && !IsPlayerOrGroupInRange())
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI failed because player/group was to far away or not found");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI failed because player/group was to far away or not found");
if (m_bCanInstantRespawn)
{
@@ -308,7 +309,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
//Combat start position reached, continue waypoint movement
if (pointId == POINT_LAST_POINT)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original position before combat");
me->SetWalk(!m_bIsRunning);
RemoveEscortState(STATE_ESCORT_RETURNING);
@@ -318,7 +319,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
}
else if (pointId == POINT_HOME)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
CurrentWP = WaypointList.begin();
m_uiWPWaitTimer = 1;
@@ -328,11 +329,11 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
//Make sure that we are still on the right waypoint
if (CurrentWP->id != pointId)
{
- sLog->outError("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
return;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI Waypoint %u reached", CurrentWP->id);
//Call WP function
WaypointReached(CurrentWP->id);
@@ -401,14 +402,14 @@ void npc_escortAI::SetRun(bool on)
if (!m_bIsRunning)
me->SetWalk(false);
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->SetWalk(true);
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set walk mode, but is already walking.");
}
m_bIsRunning = on;
@@ -419,13 +420,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
{
if (me->getVictim())
{
- sLog->outError("TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
- sLog->outError("TSCR: EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
+ sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
@@ -438,7 +439,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
if (WaypointList.empty())
{
- sLog->outErrorDb("TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
@@ -454,13 +455,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
m_bCanReturnToStart = canLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
@@ -471,7 +472,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
+ sLog->outDebug(LOG_FILTER_TSCR, "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 7a7fab014dc..4b4f3656a8d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -123,4 +123,3 @@ struct npc_escortAI : public ScriptedAI
bool HasImmuneToNPCFlags;
};
#endif
-
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 987af82e496..96209084240 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -9,9 +9,10 @@ SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
#include "ScriptedFollowerAI.h"
#include "Group.h"
+#include "Player.h"
const float MAX_PLAYER_DISTANCE = 100.0f;
@@ -116,7 +117,7 @@ void FollowerAI::MoveInLineOfSight(Unit* who)
}
}
-void FollowerAI::JustDied(Unit* /*pKiller*/)
+void FollowerAI::JustDied(Unit* /*killer*/)
{
if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || !m_uiLeaderGUID || !m_pQuestForFollow)
return;
@@ -165,7 +166,7 @@ void FollowerAI::EnterEvadeMode()
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI left combat, returning to CombatStartPosition.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI left combat, returning to CombatStartPosition.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
{
@@ -191,7 +192,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is set completed, despawns.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is set completed, despawns.");
me->DespawnOrUnsummon();
return;
}
@@ -202,7 +203,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is returning to leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
@@ -231,7 +232,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI failed because player/group was to far away or not found");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI failed because player/group was to far away or not found");
me->DespawnOrUnsummon();
return;
}
@@ -274,13 +275,13 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
{
if (me->getVictim())
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI attempt to StartFollow while in combat.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outError("TSCR: FollowerAI attempt to StartFollow while already following.");
+ sLog->outError(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following.");
return;
}
@@ -296,7 +297,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
@@ -305,7 +306,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID);
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
}
Player* FollowerAI::GetLeaderForFollower()
@@ -324,7 +325,7 @@ Player* FollowerAI::GetLeaderForFollower()
if (member && member->isAlive() && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE))
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader changed and returned new leader.");
m_uiLeaderGUID = member->GetGUID();
return member;
}
@@ -333,7 +334,7 @@ Player* FollowerAI::GetLeaderForFollower()
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader can not find suitable leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader can not find suitable leader.");
return NULL;
}
diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h
index 34300ff406c..ae1b5fcc12d 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedGossip.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h
@@ -8,7 +8,6 @@
#ifndef SC_GOSSIP_H
#define SC_GOSSIP_H
-#include "Player.h"
#include "GossipDef.h"
#include "QuestDef.h"
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 96fc43e0572..bd528edc432 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -27,9 +27,8 @@
#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "Group.h"
-
#include "SmartAI.h"
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
SmartAI::SmartAI(Creature* c) : CreatureAI(c)
{
@@ -108,7 +107,7 @@ WayPoint* SmartAI::GetNextWayPoint()
mLastWP = (*itr).second;
if (mLastWP->id != mCurrentWPID)
{
- sLog->outError("SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
+ sLog->outError(LOG_FILTER_GENERAL, "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
}
return (*itr).second;
}
@@ -119,7 +118,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
{
if (me->isInCombat())// no wp movement in combat
{
- sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
if (HasEscortState(SMART_ESCORT_ESCORTING))
@@ -135,8 +134,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* /*invoker*/)
SetRun(run);
- WayPoint* wp = GetNextWayPoint();
- if (wp)
+ if (WayPoint* wp = GetNextWayPoint())
{
me->GetPosition(&mLastOOCPos);
me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
@@ -164,7 +162,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
return;
if (HasEscortState(SMART_ESCORT_PAUSED))
{
- sLog->outError("SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
+ sLog->outError(LOG_FILTER_GENERAL, "SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
return;
}
mForcedPaused = forced;
@@ -302,7 +300,6 @@ void SmartAI::UpdatePath(const uint32 diff)
mWPPauseTimer = 0;
} else {
mWPPauseTimer -= diff;
-
}
}
if (HasEscortState(SMART_ESCORT_RETURNING))
@@ -324,15 +321,12 @@ void SmartAI::UpdatePath(const uint32 diff)
if (mCurrentWPID == GetWPCount())
{
EndPath();
- } else {
- WayPoint* wp = GetNextWayPoint();
- if (wp)
- {
- SetRun(mRun);
- me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
- }
}
-
+ else if (WayPoint* wp = GetNextWayPoint())
+ {
+ SetRun(mRun);
+ me->GetMotionMaster()->MovePoint(wp->id, wp->x, wp->y, wp->z);
+ }
}
}
@@ -640,8 +634,11 @@ void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* spellInfo)
void SmartAI::DamageTaken(Unit* doneBy, uint32& damage)
{
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
- if ((me->GetHealth() - damage) <= mInvincibilityHpLevel)
- damage = me->GetHealth() - mInvincibilityHpLevel;
+ if (mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel))
+ {
+ damage = 0;
+ me->SetHealth(mInvincibilityHpLevel);
+ }
}
void SmartAI::HealReceived(Unit* doneBy, uint32& addhealth)
@@ -680,7 +677,7 @@ void SmartAI::CorpseRemoved(uint32& respawnDelay)
void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
{
- GetScript()->ProcessEventsFor(SMART_EVENT_PASSENGER_BOARDED, who, (uint32)seatId, 0, apply);
+ GetScript()->ProcessEventsFor(apply ? SMART_EVENT_PASSENGER_BOARDED : SMART_EVENT_PASSENGER_REMOVED, who, uint32(seatId), 0, apply);
}
void SmartAI::InitializeAI()
@@ -701,7 +698,7 @@ void SmartAI::DoAction(const int32 param)
GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param);
}
-uint32 SmartAI::GetData(uint32 /*id*/)
+uint32 SmartAI::GetData(uint32 /*id*/) const
{
return 0;
}
@@ -715,7 +712,7 @@ void SmartAI::SetGUID(uint64 /*guid*/, int32 /*id*/)
{
}
-uint64 SmartAI::GetGUID(int32 /*id*/)
+uint64 SmartAI::GetGUID(int32 /*id*/) const
{
return 0;
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 79cef0c3b37..6f748f9dee2 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -22,7 +22,6 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "Unit.h"
-#include "ConditionMgr.h"
#include "Spell.h"
#include "SmartScript.h"
@@ -40,7 +39,7 @@ enum SmartEscortState
enum SmartEscortVars
{
SMART_ESCORT_MAX_PLAYER_DIST = 50,
- SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2,
+ SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2
};
class SmartAI : public CreatureAI
@@ -151,7 +150,7 @@ class SmartAI : public CreatureAI
void DoAction(const int32 param = 0);
// Used in scripts to share variables
- uint32 GetData(uint32 id = 0);
+ uint32 GetData(uint32 id = 0) const;
// Used in scripts to share variables
void SetData(uint32 id, uint32 value);
@@ -160,7 +159,7 @@ class SmartAI : public CreatureAI
void SetGUID(uint64 guid, int32 id = 0);
// Used in scripts to share variables
- uint64 GetGUID(int32 id = 0);
+ uint64 GetGUID(int32 id = 0) const;
//core related
static int Permissible(const Creature*);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 103cde80f43..2cd65c42f74 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -15,25 +15,25 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Cell.h"
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
#include "DatabaseEnv.h"
-#include "ObjectMgr.h"
-#include "ObjectDefines.h"
+#include "GossipDef.h"
#include "GridDefines.h"
#include "GridNotifiers.h"
-#include "SpellMgr.h"
#include "GridNotifiersImpl.h"
-#include "Cell.h"
-#include "CellImpl.h"
+#include "Group.h"
#include "InstanceScript.h"
+#include "Language.h"
+#include "ObjectDefines.h"
+#include "ObjectMgr.h"
#include "ScriptedCreature.h"
-#include "GossipDef.h"
-#include "ScriptedCreature.h"
-#include "SmartScript.h"
+#include "ScriptedGossip.h"
#include "SmartAI.h"
-#include "Group.h"
+#include "SmartScript.h"
+#include "SpellMgr.h"
#include "Vehicle.h"
-#include "ScriptedGossip.h"
-#include "CreatureTextMgr.h"
class TrinityStringTextBuilder
{
@@ -46,13 +46,13 @@ class TrinityStringTextBuilder
size_t operator()(WorldPacket* data, LocaleConstant locale) const
{
std::string text = sObjectMgr->GetTrinityString(_textId, locale);
- char const* localizedName = _source->GetNameForLocaleIdx(locale);
+ std::string localizedName = _source->GetNameForLocaleIdx(locale);
*data << uint8(_msgType);
*data << uint32(_language);
*data << uint64(_source->GetGUID());
*data << uint32(1); // 2.1.0
- *data << uint32(strlen(localizedName)+1);
+ *data << uint32(localizedName.size() + 1);
*data << localizedName;
size_t whisperGUIDpos = data->wpos();
*data << uint64(_targetGUID); // Unit Target
@@ -79,6 +79,7 @@ SmartScript::SmartScript()
{
go = NULL;
me = NULL;
+ trigger = NULL;
mEventPhase = 0;
mPathId = 0;
mTargetStorage = new ObjectListMap();
@@ -92,6 +93,7 @@ SmartScript::SmartScript()
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
+ mScriptType = SMART_SCRIPT_TYPE_CREATURE;
}
SmartScript::~SmartScript()
@@ -128,12 +130,10 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3
if (eventType == e/* && (!(*i).event.event_phase_mask || IsInPhase((*i).event.event_phase_mask)) && !((*i).event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE && (*i).runOnce)*/)
{
- bool meets = true;
ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type);
ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject());
- meets = sConditionMgr->IsObjectMeetToConditions(info, conds);
- if (meets)
+ if (sConditionMgr->IsObjectMeetToConditions(info, conds))
ProcessEvent(*i, unit, var0, var1, bvar, spell, gob);
}
}
@@ -154,7 +154,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
mLastInvoker = unit->GetGUID();
if (Unit* tempInvoker = GetLastInvoker())
- sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName(), tempInvoker->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow());
switch (e.GetActionType())
{
@@ -198,7 +198,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
mUseTextTimer = true;
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u",
- talker->GetName(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID));
+ talker->GetName().c_str(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID));
break;
}
case SMART_ACTION_SIMPLE_TALK:
@@ -216,7 +216,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer());
}
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
- (*itr)->GetName(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
+ (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
}
delete targets;
@@ -234,7 +234,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToUnit()->HandleEmoteCommand(e.action.emote.emote);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u",
- (*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.emote.emote);
+ (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.emote.emote);
}
}
@@ -253,7 +253,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.range > 0 ? true : false);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
- (*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range);
+ (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range);
}
}
@@ -366,14 +366,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsPlayer(*itr))
- {
if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
{
(*itr)->ToPlayer()->AddQuest(q, NULL);
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u",
(*itr)->GetGUIDLow(), e.action.quest.quest);
}
- }
}
delete targets;
@@ -432,8 +430,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me)
break;
- std::list<HostileReference*> const& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
+ ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
{
if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
@@ -474,6 +472,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
+ // Special handling for vehicles
+ if (IsUnit(*itr))
+ if (Vehicle* vehicle = (*itr)->ToUnit()->GetVehicleKit())
+ for (SeatMap::iterator it = vehicle->Seats.begin(); it != vehicle->Seats.end(); ++it)
+ if (Player* player = ObjectAccessor::FindPlayer(it->second.Passenger))
+ player->AreaExploredOrEventHappens(e.action.quest.quest);
+
if (IsPlayer(*itr))
{
(*itr)->ToPlayer()->AreaExploredOrEventHappens(e.action.quest.quest);
@@ -748,12 +753,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
{
+ if (!unit)
+ break;
+
if (IsPlayer(unit) && GetBaseObject())
{
unit->ToPlayer()->GroupEventHappens(e.action.quest.quest, GetBaseObject());
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u",
unit->GetGUIDLow(), e.action.quest.quest);
}
+
+ // Special handling for vehicles
+ if (Vehicle* vehicle = unit->GetVehicleKit())
+ for (SeatMap::iterator it = vehicle->Seats.begin(); it != vehicle->Seats.end(); ++it)
+ if (Player* player = ObjectAccessor::FindPlayer(it->second.Passenger))
+ player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
break;
}
case SMART_ACTION_CALL_CASTEDCREATUREORGO:
@@ -880,6 +894,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
+ // Special handling for vehicles
+ if (IsUnit(*itr))
+ if (Vehicle* vehicle = (*itr)->ToUnit()->GetVehicleKit())
+ for (SeatMap::iterator it = vehicle->Seats.begin(); it != vehicle->Seats.end(); ++it)
+ if (Player* player = ObjectAccessor::FindPlayer(it->second.Passenger))
+ player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player);
+
if (!IsPlayer(*itr))
continue;
@@ -910,7 +931,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
break;
}
@@ -931,7 +952,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
break;
}
@@ -1117,10 +1138,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SUMMON_CREATURE:
{
- float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
+ float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
(*itr)->GetPosition(x, y, z, o);
@@ -1149,10 +1170,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!GetBaseObject())
break;
- float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
+ float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (!IsUnit(*itr))
@@ -1438,7 +1459,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry);
if (!einfo)
{
- sLog->outErrorDb("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 entry %u", e.action.equip.entry);
return;
}
npc->SetCurrentEquipmentId(e.action.equip.entry);
@@ -1563,7 +1584,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1687,7 +1708,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = temp[urand(0, count)];
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1717,7 +1738,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
if (e.GetTargetType() == SMART_TARGET_NONE)
{
- sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@@ -1782,7 +1803,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsUnit(*itr))
- (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.setunitByte.byte1);
+ (*itr)->ToUnit()->SetByteFlag(UNIT_FIELD_BYTES_1, e.action.setunitByte.type, e.action.setunitByte.byte1);
delete targets;
break;
@@ -1795,7 +1816,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
if (IsUnit(*itr))
- (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 0, e.action.delunitByte.byte1);
+ (*itr)->ToUnit()->RemoveByteFlag(UNIT_FIELD_BYTES_1, e.action.delunitByte.type, e.action.delunitByte.byte1);
delete targets;
break;
@@ -1909,14 +1930,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()))
ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list
else
- sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping");
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping");
}
else if (IsGameObject(*itr))
{
if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI()))
ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list
else
- sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping");
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping");
}
}
@@ -1949,8 +1970,29 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets;
break;
}
+ case SMART_ACTION_SET_HOME_POS:
+ {
+ if (!me)
+ 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");
+
+ break;
+ }
+ case SMART_ACTION_SET_HEALTH_REGEN:
+ {
+ if (!me || me->GetTypeId() != TYPEID_UNIT)
+ break;
+ me->setRegeneratingHealth(e.action.setHealthRegen.regenHealth ? true : false);
+ break;
+ }
default:
- sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
}
@@ -1960,7 +2002,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (linked.GetActionType() && linked.GetEventType() == SMART_EVENT_LINK)
ProcessEvent(linked, unit, var0, var1, bvar, spell, gob);
else
- sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
}
}
@@ -1970,7 +2012,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
return;
if (mTemplate)
{
- sLog->outErrorDb("SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
return;
}
mTemplate = (SMARTAI_TEMPLATE)e.action.installTtemplate.id;
@@ -2227,7 +2269,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (!trigger && !GetBaseObject())
{
- sLog->outErrorDb("SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry");
+ sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_CREATURE_GUID can not be used without invoker and without entry");
break;
}
@@ -2250,7 +2292,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (!trigger && !GetBaseObject())
{
- sLog->outErrorDb("SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry");
+ sLog->outError(LOG_FILTER_SQL, "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker and without entry");
break;
}
@@ -2327,8 +2369,8 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (me)
{
- std::list<HostileReference*> const& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
+ ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid()))
l->push_back(temp);
}
@@ -2787,7 +2829,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
break;
}
default:
- sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
break;
}
}
@@ -2800,10 +2842,12 @@ void SmartScript::InitTimer(SmartScriptHolder& e)
case SMART_EVENT_UPDATE:
case SMART_EVENT_UPDATE_IC:
case SMART_EVENT_UPDATE_OOC:
- case SMART_EVENT_OOC_LOS:
- case SMART_EVENT_IC_LOS:
RecalcTimer(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max);
break;
+ case SMART_EVENT_IC_LOS:
+ case SMART_EVENT_OOC_LOS:
+ RecalcTimer(e, e.event.los.cooldownMin, e.event.los.cooldownMax);
+ break;
default:
e.active = true;
break;
@@ -2984,9 +3028,9 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn
mEvents.push_back((*i));//NOTE: 'world(0)' events still get processed in ANY instance mode
}
if (mEvents.empty() && obj)
- sLog->outErrorDb("SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry());
if (mEvents.empty() && at)
- sLog->outErrorDb("SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id);
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->id);
}
void SmartScript::GetScript()
@@ -3030,7 +3074,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry());
break;
default:
- sLog->outError("SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
+ sLog->outError(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
return;
}
} else if (at)
@@ -3041,7 +3085,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
}
else
{
- sLog->outError("SmartScript::OnInitialize: !WARNING! Initialized objects are NULL.");
+ sLog->outError(LOG_FILTER_GENERAL, "SmartScript::OnInitialize: !WARNING! Initialized objects are NULL.");
return;
}
diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h
index 03d533e69e5..61e22b25d17 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.h
+++ b/src/server/game/AI/SmartScripts/SmartScript.h
@@ -22,7 +22,6 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "Unit.h"
-#include "ConditionMgr.h"
#include "Spell.h"
#include "GridNotifiers.h"
@@ -117,7 +116,7 @@ class SmartScript
smart = false;
if (!smart)
- sLog->outErrorDb("SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
return smart;
}
@@ -131,7 +130,7 @@ class SmartScript
if (!go || go->GetAIName() != "SmartGameObjectAI")
smart = false;
if (!smart)
- sLog->outErrorDb("SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
+ sLog->outError(LOG_FILTER_SQL, "SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
return smart;
}
@@ -254,7 +253,6 @@ class SmartScript
mStoredEvents.erase(i);
return;
}
-
}
}
}
@@ -268,7 +266,6 @@ class SmartScript
{
return (*i);
}
-
}
}
SmartScriptHolder s;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index de766d2a7e1..4e2c51e50c8 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -50,8 +50,8 @@ void SmartWaypointMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
+
return;
}
@@ -78,7 +78,7 @@ void SmartWaypointMgr::LoadFromDB()
}
if (last_id != id)
- sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
+ sLog->outError(LOG_FILTER_SQL, "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
last_id++;
(*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
@@ -88,8 +88,8 @@ void SmartWaypointMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
+
}
SmartWaypointMgr::~SmartWaypointMgr()
@@ -117,8 +117,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
+
return;
}
@@ -134,7 +134,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8();
if (source_type >= SMART_SCRIPT_TYPE_MAX)
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
continue;
}
if (temp.entryOrGuid >= 0)
@@ -145,7 +145,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@@ -154,7 +154,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@@ -163,7 +163,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sAreaTriggerStore.LookupEntry((uint32)temp.entryOrGuid))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@@ -171,7 +171,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST:
break;//nothing to check, really
default:
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
continue;
}
}
@@ -179,7 +179,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
{
- sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
continue;
}
}
@@ -234,8 +234,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
@@ -249,7 +249,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
return false;
}
break;
@@ -259,7 +259,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
return false;
}
break;
@@ -281,7 +281,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.playerDistance.dist == 0)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@@ -305,7 +305,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_STORED:
break;
default:
- sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@@ -315,28 +315,28 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.type >= SMART_EVENT_END)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
return false;
}
// in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core
if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1]))
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
return false;
}
if (e.action.type <= 0 || e.action.type >= SMART_ACTION_END)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
return false;
}
if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
return false;
}
if (e.event.event_flags > SMART_EVENT_FLAGS_ALL)
{
- sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
return false;
}
if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)
@@ -377,12 +377,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
if (!spellInfo)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
}
@@ -397,12 +397,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
return false;
}
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !GetAreaEntryByAreaID(e.event.respawn.area))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
return false;
}
break;
@@ -484,7 +484,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.movementInform.type > NULL_MOTION_TYPE)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
return false;
}
break;
@@ -508,7 +508,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.link && e.link == e.event_id)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
}
break;
@@ -540,7 +540,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.doAction.eventId > EVENT_CHARGE)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
return false;
}
break;
@@ -580,7 +580,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_ON_SPELLCLICK:
break;
default:
- sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@@ -590,7 +590,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_FACTION:
if (e.action.faction.factionID && !sFactionTemplateStore.LookupEntry(e.action.faction.factionID))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
return false;
}
break;
@@ -600,7 +600,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
return false;
}
@@ -608,12 +608,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
return false;
}
}
@@ -624,7 +624,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
if (e.action.sound.range > TEXT_RANGE_WORLD)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Text Range %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.sound.range);
return false;
}
break;
@@ -642,7 +642,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
return false;
}
break;
@@ -678,13 +678,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
}
else
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
break;
@@ -695,24 +695,22 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (!IsSpellValid(e, e.action.castCreatureOrGO.spell))
return false;
break;
-
-
case SMART_ACTION_SET_EVENT_PHASE:
if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX-1);
return false;
}
break;
case SMART_ACTION_INC_EVENT_PHASE:
if (!e.action.incEventPhase.inc && !e.action.incEventPhase.dec)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@@ -736,7 +734,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@@ -746,7 +744,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax))
@@ -758,7 +756,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
return false;
}
break;
@@ -773,7 +771,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
return false;
}
break;
@@ -781,7 +779,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.react.state > REACT_AGGRESSIVE)
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
return false;
}
break;
@@ -801,14 +799,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
return false;
}
break;
case SMART_ACTION_INSTALL_AI_TEMPLATE:
if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END)
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
return false;
}
break;
@@ -820,14 +818,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
}
if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
return false;
if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
{
- sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
return false;
}
break;
@@ -906,16 +904,18 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SEND_GOSSIP_MENU:
case SMART_ACTION_GO_SET_LOOT_STATE:
case SMART_ACTION_SEND_TARGET_TO_TARGET:
+ case SMART_ACTION_SET_HOME_POS:
+ case SMART_ACTION_SET_HEALTH_REGEN:
break;
default:
- sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
+ 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);
return false;
}
return true;
}
-bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
+/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused
{
bool error = false;
uint32 entry = 0;
@@ -926,7 +926,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
CreatureData const* data = sObjectMgr->GetCreatureData(entry);
if (!data)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
else
@@ -936,8 +936,8 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
error = true;
if (error)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
return false;
}
return true;
-}
+}*/
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index cdb662edbaf..cccf5c2ce10 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -54,7 +54,7 @@ enum SMART_EVENT_PHASE
SMART_EVENT_PHASE_6 = 6,
SMART_EVENT_PHASE_MAX = 7,
- SMART_EVENT_PHASE_COUNT = 6,
+ SMART_EVENT_PHASE_COUNT = 6
};
enum SMART_EVENT_PHASE_BITS
@@ -66,7 +66,7 @@ enum SMART_EVENT_PHASE_BITS
SMART_EVENT_PHASE_4_BIT = 8,
SMART_EVENT_PHASE_5_BIT = 16,
SMART_EVENT_PHASE_6_BIT = 32,
- SMART_EVENT_PHASE_ALL = SMART_EVENT_PHASE_1_BIT + SMART_EVENT_PHASE_2_BIT + SMART_EVENT_PHASE_3_BIT + SMART_EVENT_PHASE_4_BIT + SMART_EVENT_PHASE_5_BIT + SMART_EVENT_PHASE_6_BIT,
+ SMART_EVENT_PHASE_ALL = SMART_EVENT_PHASE_1_BIT + SMART_EVENT_PHASE_2_BIT + SMART_EVENT_PHASE_3_BIT + SMART_EVENT_PHASE_4_BIT + SMART_EVENT_PHASE_5_BIT + SMART_EVENT_PHASE_6_BIT
};
const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] =
@@ -76,7 +76,7 @@ const uint32 SmartPhaseMask[SMART_EVENT_PHASE_COUNT][2] =
{SMART_EVENT_PHASE_3, SMART_EVENT_PHASE_3_BIT },
{SMART_EVENT_PHASE_4, SMART_EVENT_PHASE_4_BIT },
{SMART_EVENT_PHASE_5, SMART_EVENT_PHASE_5_BIT },
- {SMART_EVENT_PHASE_6, SMART_EVENT_PHASE_6_BIT },
+ {SMART_EVENT_PHASE_6, SMART_EVENT_PHASE_6_BIT }
};
enum SMART_EVENT
@@ -156,7 +156,7 @@ enum SMART_EVENT
SMART_EVENT_ACTION_DONE = 72, // eventId (SharedDefines.EventId)
SMART_EVENT_ON_SPELLCLICK = 73, // clicker (unit)
- SMART_EVENT_END = 74,
+ SMART_EVENT_END = 74
};
struct SmartEvent
@@ -376,7 +376,7 @@ enum SMART_SCRIPT_RESPAWN_CONDITION
SMART_SCRIPT_RESPAWN_CONDITION_NONE = 0,
SMART_SCRIPT_RESPAWN_CONDITION_MAP = 1,
SMART_SCRIPT_RESPAWN_CONDITION_AREA = 2,
- SMART_SCRIPT_RESPAWN_CONDITION_END = 3,
+ SMART_SCRIPT_RESPAWN_CONDITION_END = 3
};
enum SMART_ACTION
@@ -484,8 +484,10 @@ enum SMART_ACTION
SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId
SMART_ACTION_GO_SET_LOOT_STATE = 99, // state
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_END = 101,
+ SMART_ACTION_END = 103
};
struct SmartAction
@@ -534,7 +536,6 @@ struct SmartAction
struct
{
-
uint32 emote1;
uint32 emote2;
uint32 emote3;
@@ -827,11 +828,13 @@ struct SmartAction
struct
{
uint32 byte1;
+ uint32 type;
} setunitByte;
struct
{
uint32 byte1;
+ uint32 type;
} delunitByte;
struct
@@ -910,6 +913,11 @@ struct SmartAction
uint32 angle;
} setRangedMovement;
+ struct
+ {
+ uint32 regenHealth;
+ } setHealthRegen;
+
//! Note for any new future actions
//! All parameters must have type uint32
@@ -933,7 +941,7 @@ enum SMARTAI_TEMPLATE
SMARTAI_TEMPLATE_PASSIVE = 3,
SMARTAI_TEMPLATE_CAGED_GO_PART = 4, //creatureID, give credit at point end?,
SMARTAI_TEMPLATE_CAGED_NPC_PART = 5, //gameObjectID, despawntime, run?, dist, TextGroupID
- SMARTAI_TEMPLATE_END = 6,
+ SMARTAI_TEMPLATE_END = 6
};
enum SMARTAI_TARGETS
@@ -963,7 +971,7 @@ enum SMARTAI_TARGETS
SMART_TARGET_ACTION_INVOKER_VEHICLE = 22, // Unit's vehicle who caused this Event to occur
SMART_TARGET_OWNER_OR_SUMMONER = 23, // Unit's owner or summoner
SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list
- SMART_TARGET_END = 25,
+ SMART_TARGET_END = 25
};
struct SmartTarget
@@ -1056,12 +1064,12 @@ struct SmartTarget
enum eSmartAI
{
- SMART_EVENT_PARAM_COUNT = 4,
- SMART_ACTION_PARAM_COUNT = 6,
- SMART_SUMMON_COUNTER = 0xFFFFFF,
+ SMART_EVENT_PARAM_COUNT = 4,
+ SMART_ACTION_PARAM_COUNT = 6,
+ SMART_SUMMON_COUNTER = 0xFFFFFF,
SMART_ESCORT_LAST_OOC_POINT = 0xFFFFFF,
- SMART_RANDOM_POINT = 0xFFFFFE,
- SMART_ESCORT_TARGETS = 0xFFFFFF
+ SMART_RANDOM_POINT = 0xFFFFFE,
+ SMART_ESCORT_TARGETS = 0xFFFFFF
};
enum SmartScriptType
@@ -1090,7 +1098,7 @@ enum SmartAITypeMaskId
SMART_SCRIPT_TYPE_MASK_SPELL = 64,
SMART_SCRIPT_TYPE_MASK_TRANSPORT = 128,
SMART_SCRIPT_TYPE_MASK_INSTANCE = 256,
- SMART_SCRIPT_TYPE_MASK_TIMED_ACTIONLIST = 512,
+ SMART_SCRIPT_TYPE_MASK_TIMED_ACTIONLIST = 512
};
const uint32 SmartAITypeMask[SMART_SCRIPT_TYPE_MAX][2] =
@@ -1182,7 +1190,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] =
{SMART_EVENT_GO_STATE_CHANGED, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GO_EVENT_INFORM, SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_ACTION_DONE, SMART_SCRIPT_TYPE_MASK_CREATURE },
- {SMART_EVENT_ON_SPELLCLICK, SMART_SCRIPT_TYPE_MASK_CREATURE },
+ {SMART_EVENT_ON_SPELLCLICK, SMART_SCRIPT_TYPE_MASK_CREATURE }
};
enum SmartEventFlags
@@ -1208,22 +1216,16 @@ enum SmartCastFlags
//CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
//CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
//CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
- SMARTCAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
+ SMARTCAST_AURA_NOT_PRESENT = 0x20 //Only casts the spell if the target does not have an aura from the spell
};
// one line in DB is one event
struct SmartScriptHolder
{
- SmartScriptHolder()
- {
- timer = 0;
- active = false;
- runOnce = false;
- link = 0;
- entryOrGuid = 0;
- event_id = 0;
- enableTimed = false;
- }
+ SmartScriptHolder() : entryOrGuid(0), source_type(SMART_SCRIPT_TYPE_CREATURE)
+ , event_id(0), link(0), timer(0), active(false), runOnce(false)
+ , enableTimed(false) {}
+
int32 entryOrGuid;
SmartScriptType source_type;
uint32 event_id;
@@ -1243,7 +1245,6 @@ struct SmartScriptHolder
bool active;
bool runOnce;
bool enableTimed;
-
};
typedef UNORDERED_MAP<uint32, WayPoint*> WPPath;
@@ -1310,7 +1311,7 @@ class SmartAIMgr
{
if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
return false;
}
return true;
@@ -1320,7 +1321,7 @@ class SmartAIMgr
{
if (max < min)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
return false;
}
return true;
@@ -1330,7 +1331,7 @@ class SmartAIMgr
{
if (pct < -100 || pct > 100)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
return false;
}
return true;
@@ -1340,7 +1341,7 @@ class SmartAIMgr
{
if (!data)
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@@ -1350,7 +1351,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetCreatureTemplate(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1360,7 +1361,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetQuestTemplate(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1370,7 +1371,7 @@ class SmartAIMgr
{
if (!sObjectMgr->GetGameObjectTemplate(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1380,7 +1381,7 @@ class SmartAIMgr
{
if (!sSpellMgr->GetSpellInfo(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1390,7 +1391,7 @@ class SmartAIMgr
{
if (!sItemStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1400,7 +1401,7 @@ class SmartAIMgr
{
if (!sEmotesTextStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1410,7 +1411,7 @@ class SmartAIMgr
{
if (!sEmotesStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1420,7 +1421,7 @@ class SmartAIMgr
{
if (!sAreaTriggerStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@@ -1430,13 +1431,13 @@ class SmartAIMgr
{
if (!sSoundEntriesStore.LookupEntry(entry))
{
- sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
}
- bool IsTextValid(SmartScriptHolder const& e, uint32 id);
+ //bool IsTextValid(SmartScriptHolder const& e, uint32 id);
};
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 8076f800356..a82de501ea6 100755..100644
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -16,12 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "DatabaseEnv.h"
#include "AccountMgr.h"
+#include "DatabaseEnv.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Util.h"
#include "SHA1.h"
+#include "WorldSession.h"
namespace AccountMgr
{
@@ -176,7 +177,7 @@ AccountOpResult ChangePassword(uint32 accountId, std::string newPassword)
return AOR_OK;
}
-uint32 GetId(std::string username)
+uint32 GetId(std::string const& username)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME);
stmt->setString(0, username);
@@ -265,7 +266,7 @@ bool normalizeString(std::string& utf8String)
return WStrToUtf8(buffer, maxLength, utf8String);
}
-std::string CalculateShaPassHash(std::string& name, std::string& password)
+std::string CalculateShaPassHash(std::string const& name, std::string const& password)
{
SHA1Hash sha;
sha.Initialize();
@@ -274,10 +275,7 @@ std::string CalculateShaPassHash(std::string& name, std::string& password)
sha.UpdateData(password);
sha.Finalize();
- std::string encoded;
- hexEncodeByteArray(sha.GetDigest(), sha.GetLength(), encoded);
-
- return encoded;
+ return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
}
bool IsPlayerAccount(uint32 gmlevel)
diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h
index c69f3c0a6f3..c14bcc48bdc 100755..100644
--- a/src/server/game/Accounts/AccountMgr.h
+++ b/src/server/game/Accounts/AccountMgr.h
@@ -42,12 +42,12 @@ namespace AccountMgr
AccountOpResult ChangePassword(uint32 accountId, std::string newPassword);
bool CheckPassword(uint32 accountId, std::string password);
- uint32 GetId(std::string username);
+ uint32 GetId(std::string const& username);
uint32 GetSecurity(uint32 accountId);
uint32 GetSecurity(uint32 accountId, int32 realmId);
bool GetName(uint32 accountId, std::string& name);
uint32 GetCharactersCount(uint32 accountId);
- std::string CalculateShaPassHash(std::string& name, std::string& password);
+ std::string CalculateShaPassHash(std::string const& name, std::string const& password);
bool normalizeString(std::string& utf8String);
bool IsPlayerAccount(uint32 gmlevel);
@@ -55,6 +55,6 @@ namespace AccountMgr
bool IsGMAccount(uint32 gmlevel);
bool IsAdminAccount(uint32 gmlevel);
bool IsConsoleAccount(uint32 gmlevel);
-};
+}
#endif
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 450c05329b4..09e1de0a2bf 100755..100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -16,30 +16,31 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "DBCEnums.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "GuildMgr.h"
-#include "World.h"
-#include "WorldPacket.h"
-#include "DatabaseEnv.h"
#include "AchievementMgr.h"
#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
+#include "BattlegroundAB.h"
+#include "Battleground.h"
#include "CellImpl.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
+#include "DBCEnums.h"
+#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "GridNotifiersImpl.h"
#include "Guild.h"
+#include "GuildMgr.h"
+#include "InstanceScript.h"
#include "Language.h"
+#include "Map.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
#include "Player.h"
-#include "SpellMgr.h"
-#include "DisableMgr.h"
+#include "ReputationMgr.h"
#include "ScriptMgr.h"
-#include "MapManager.h"
-#include "Battleground.h"
-#include "BattlegroundAB.h"
-#include "Map.h"
-#include "InstanceScript.h"
+#include "SpellMgr.h"
+#include "World.h"
+#include "WorldPacket.h"
namespace Trinity
{
@@ -75,7 +76,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
{
if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
{
- sLog->outErrorDb("Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType);
return false;
}
@@ -107,7 +108,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
default:
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
{
- sLog->outErrorDb("Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType);
return false;
}
break;
@@ -122,27 +123,21 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
if (!creature.id || !sObjectMgr->GetCreatureTemplate(creature.id))
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, creature.id);
return false;
}
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
- if (!classRace.class_id && !classRace.race_id)
- {
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
- criteria->ID, criteria->requiredType, dataType);
- return false;
- }
if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.class_id);
return false;
}
if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.race_id);
return false;
}
@@ -150,7 +145,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
if (health.percent < 1 || health.percent > 100)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, health.percent);
return false;
}
@@ -158,7 +153,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
if (player_dead.own_team_flag > 1)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).",
criteria->ID, criteria->requiredType, dataType, player_dead.own_team_flag);
return false;
}
@@ -169,19 +164,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellEntry)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id);
return false;
}
if (aura.effect_idx >= 3)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx);
return false;
}
if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx);
return false;
}
@@ -190,7 +185,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
if (!GetAreaEntryByAreaID(area.id))
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, area.id);
return false;
}
@@ -198,7 +193,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL:
if (level.minlevel > STRONG_MAX_LEVEL)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, level.minlevel);
return false;
}
@@ -206,7 +201,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER:
if (gender.gender > GENDER_NONE)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, gender.gender);
return false;
}
@@ -214,7 +209,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT:
if (!ScriptId)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
@@ -222,7 +217,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
if (difficulty.difficulty >= MAX_DIFFICULTY)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, difficulty.difficulty);
return false;
}
@@ -230,7 +225,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
if (map_players.maxcount <= 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, map_players.maxcount);
return false;
}
@@ -238,7 +233,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if (team.team != ALLIANCE && team.team != HORDE)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, team.team);
return false;
}
@@ -246,7 +241,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK:
if (drunk.state >= MAX_DRUNKEN)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, drunk.state);
return false;
}
@@ -254,7 +249,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY:
if (!sHolidaysStore.LookupEntry(holiday.id))
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, holiday.id);
return false;
}
@@ -264,7 +259,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM:
if (equipped_item.item_quality >= MAX_ITEM_QUALITY)
{
- sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, equipped_item.item_quality);
return false;
}
@@ -272,7 +267,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID:
if (!sMapStore.LookupEntry(map_id.mapId))
{
- sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, map_id.mapId);
return false;
}
@@ -280,25 +275,25 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE:
if (!classRace.class_id && !classRace.race_id)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
if (classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.class_id);
return false;
}
if (classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.race_id);
return false;
}
return true;
default:
- sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType);
return false;
}
}
@@ -361,10 +356,10 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
return false;
return target->getGender() == gender.gender;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT:
- return sScriptMgr->OnCriteriaCheck(this, const_cast<Player*>(source), const_cast<Unit*>(target));
+ return sScriptMgr->OnCriteriaCheck(ScriptId, const_cast<Player*>(source), const_cast<Unit*>(target));
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
if (source->GetMap()->IsRaid())
- if (source->GetMap()->Is25ManRaid() != (difficulty.difficulty & RAID_DIFFICULTY_MASK_25MAN))
+ if (source->GetMap()->Is25ManRaid() != ((difficulty.difficulty & RAID_DIFFICULTY_MASK_25MAN) != 0))
return false;
return source->GetMap()->GetSpawnMode() >= difficulty.difficulty;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
@@ -382,7 +377,9 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
Battleground* bg = source->GetBattleground();
if (!bg)
return false;
- return bg->IsTeamScoreInRange(source->GetTeam() == ALLIANCE ? HORDE : ALLIANCE, bg_loss_team_score.min_score, bg_loss_team_score.max_score);
+
+ uint32 score = bg->GetTeamScore(source->GetTeamId() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
+ return score >= bg_loss_team_score.min_score && score <= bg_loss_team_score.max_score;
}
case ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT:
{
@@ -391,14 +388,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
Map* map = source->GetMap();
if (!map->IsDungeon())
{
- sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
InstanceScript* instance = ((InstanceMap*)map)->GetInstanceScript();
if (!instance)
{
- sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
@@ -474,7 +471,7 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin
{
AchievementCriteriaEntry const* achievementCriteria = (*i);
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementCriteria->referredAchievement);
if (!achievement)
continue;
@@ -622,7 +619,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
uint32 achievementid = fields[0].GetUInt16();
// must not happen: cleanup at server startup in sAchievementMgr->LoadCompletedAchievements()
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementid);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementid);
if (!achievement)
continue;
@@ -634,8 +631,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
if (AchievementReward const* reward = sAchievementMgr->GetAchievementReward(achievement))
if (uint32 titleId = reward->titleId[Player::TeamForRace(GetPlayer()->getRace()) == ALLIANCE ? 0 : 1])
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId))
- if (!GetPlayer()->HasTitle(titleEntry))
- GetPlayer()->SetTitle(titleEntry);
+ GetPlayer()->SetTitle(titleEntry);
} while (achievementResult->NextRow());
}
@@ -649,11 +645,11 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
uint32 counter = fields[1].GetUInt32();
time_t date = time_t(fields[2].GetUInt32());
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(id);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(id);
if (!criteria)
{
// we will remove not existed criteria for all characters
- sLog->outError("Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA);
@@ -695,10 +691,10 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
guild->BroadcastWorker(say_do, GetPlayer());
}
- if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL|ACHIEVEMENT_FLAG_REALM_FIRST_REACH))
+ if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL | ACHIEVEMENT_FLAG_REALM_FIRST_REACH))
{
// broadcast realm first reached
- WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, strlen(GetPlayer()->GetName())+1+8+4+4);
+ WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, GetPlayer()->GetName().size() + 1 + 8 + 4 + 4);
data << GetPlayer()->GetName();
data << uint64(GetPlayer()->GetGUID());
data << uint32(achievement->ID);
@@ -723,7 +719,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
data.append(GetPlayer()->GetPackGUID());
data << uint32(achievement->ID);
- data << uint32(secsToTimeBitFields(time(NULL)));
+ data.AppendPackedTime(time(NULL));
data << uint32(0);
GetPlayer()->SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
}
@@ -741,7 +737,7 @@ void AchievementMgr::SendCriteriaUpdate(AchievementCriteriaEntry const* entry, C
data << uint32(0);
else
data << uint32(timedCompleted ? 0 : 1); // this are some flags, 1 is for keeping the counter at 0 in client
- data << uint32(secsToTimeBitFields(progress->date));
+ data.AppendPackedTime(progress->date);
data << uint32(timeElapsed); // time elapsed in seconds
data << uint32(0); // unk
GetPlayer()->SendDirectMessage(&data);
@@ -784,7 +780,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i)
{
AchievementCriteriaEntry const* achievementCriteria = (*i);
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(achievementCriteria->referredAchievement);
if (!achievement)
continue;
@@ -1493,7 +1489,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
uint32 points = 0;
for (CompletedAchievementMap::iterator itr = m_completedAchievements.begin(); itr != m_completedAchievements.end(); ++itr)
- if (AchievementEntry const* pAchievement = sAchievementStore.LookupEntry(itr->first))
+ if (AchievementEntry const* pAchievement = sAchievementMgr->GetAchievement(itr->first))
points += pAchievement->points;
SetCriteriaProgress(achievementCriteria, points, PROGRESS_SET);
}
@@ -1601,6 +1597,13 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break;
}
+ case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA: // This also behaves like ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA
+ {
+ // Check map id requirement
+ if (miscValue1 == achievementCriteria->win_arena.mapID)
+ SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
+ break;
+ }
// std case: not exist in DBC, not triggered in code as result
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH:
case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER:
@@ -1611,12 +1614,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break;
// FIXME: not triggered in code as result, need to implement
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID:
- case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA:
case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA:
case ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK:
case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE:
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE:
- case ACHIEVEMENT_CRITERIA_TYPE_TOTAL:
break; // Not implemented yet :(
}
@@ -1754,6 +1755,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return progress->counter >= achievementCriteria->use_lfg.dungeonsComplete;
case ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS:
return progress->counter >= achievementCriteria->get_killing_blow.killCount;
+ case ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA:
+ return achievementCriteria->win_arena.count && progress->counter >= achievementCriteria->win_arena.count;
// handle all statistic-only criteria here
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP:
@@ -1936,7 +1939,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
if (entry->timeLimit)
{
// has to exist else we wouldn't be here
- timedCompleted = IsCompletedCriteria(entry, sAchievementStore.LookupEntry(entry->referredAchievement));
+ timedCompleted = IsCompletedCriteria(entry, sAchievementMgr->GetAchievement(entry->referredAchievement));
// Client expects this in packet
timeElapsed = entry->timeLimit - (timedIter->second/IN_MILLISECONDS);
@@ -1970,7 +1973,7 @@ void AchievementMgr::UpdateTimedAchievements(uint32 timeDiff)
// Time is up, remove timer and reset progress
if (itr->second <= timeDiff)
{
- AchievementCriteriaEntry const* entry = sAchievementCriteriaStore.LookupEntry(itr->first);
+ AchievementCriteriaEntry const* entry = sAchievementMgr->GetAchievementCriteria(itr->first);
RemoveCriteriaProgress(entry);
m_timedAchievements.erase(itr++);
}
@@ -1991,7 +1994,7 @@ void AchievementMgr::StartTimedAchievement(AchievementCriteriaTimedTypes type, u
if ((*i)->timerStartEvent != entry)
continue;
- AchievementEntry const* achievement = sAchievementStore.LookupEntry((*i)->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement((*i)->referredAchievement);
if (m_timedAchievements.find((*i)->ID) == m_timedAchievements.end() && !IsCompletedCriteria(*i, achievement))
{
// Start the timer
@@ -2029,7 +2032,7 @@ void AchievementMgr::RemoveTimedAchievement(AchievementCriteriaTimedTypes type,
void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
{
- sLog->outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
+ sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::CompletedAchievement(%u)", achievement->ID);
// disable for gamemasters with GM-mode enabled
if (m_player->isGameMaster())
@@ -2127,12 +2130,12 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const
for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter)
{
// Skip hidden achievements
- achievement = sAchievementStore.LookupEntry(iter->first);
+ achievement = sAchievementMgr->GetAchievement(iter->first);
if (achievement->flags & ACHIEVEMENT_FLAG_HIDDEN)
continue;
*data << uint32(iter->first);
- *data << uint32(secsToTimeBitFields(iter->second.date));
+ data->AppendPackedTime(iter->second.date);
}
*data << int32(-1);
@@ -2142,7 +2145,7 @@ void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const
data->appendPackGUID(iter->second.counter);
data->append(GetPlayer()->GetPackGUID());
*data << uint32(0);
- *data << uint32(secsToTimeBitFields(iter->second.date));
+ data->AppendPackedTime(iter->second.date);
*data << uint32(0);
*data << uint32(0);
}
@@ -2201,14 +2204,13 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (sAchievementCriteriaStore.GetNumRows() == 0)
{
- sLog->outErrorDb(">> Loaded 0 achievement criteria.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria.");
return;
}
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(entryId);
if (!criteria)
continue;
@@ -2219,8 +2221,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
}
- sLog->outString(">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@@ -2229,8 +2230,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (sAchievementStore.GetNumRows() == 0)
{
- sLog->outString(">> Loaded 0 achievement references.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references.");
return;
}
@@ -2238,7 +2238,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
for (uint32 entryId = 0; entryId < sAchievementStore.GetNumRows(); ++entryId)
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(entryId);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(entryId);
if (!achievement || !achievement->refAchievement)
continue;
@@ -2247,11 +2247,10 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
}
// Once Bitten, Twice Shy (10 player) - Icecrown Citadel
- if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539))
+ if (AchievementEntry const* achievement = sAchievementMgr->GetAchievement(4539))
const_cast<AchievementEntry*>(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar)
- sLog->outString(">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementCriteriaData()
@@ -2264,8 +2263,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!result)
{
- sLog->outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
return;
}
@@ -2276,11 +2274,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
Field* fields = result->Fetch();
uint32 criteria_id = fields[0].GetUInt32();
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(criteria_id);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(criteria_id);
if (!criteria)
{
- sLog->outErrorDb("Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
continue;
}
@@ -2290,7 +2288,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (strcmp(scriptName, "")) // not empty
{
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
- sLog->outErrorDb("Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
+ 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);
}
@@ -2316,7 +2314,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
// post loading checks
for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
{
- AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
+ AchievementCriteriaEntry const* criteria = sAchievementMgr->GetAchievementCriteria(entryId);
if (!criteria)
continue;
@@ -2328,7 +2326,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
break; // any cases
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(criteria->referredAchievement);
if (!achievement)
continue;
@@ -2379,7 +2377,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST:
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: // only Children's Week achievements
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(criteria->referredAchievement);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(criteria->referredAchievement);
if (!achievement)
continue;
if (achievement->categoryId != CATEGORY_CHILDRENS_WEEK)
@@ -2393,11 +2391,10 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
}
if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL))
- sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
- sLog->outString(">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadCompletedAchievements()
@@ -2408,8 +2405,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!result)
{
- sLog->outString(">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 realm first completed achievements. DB table `character_achievement` is empty.");
return;
}
@@ -2418,26 +2414,24 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
Field* fields = result->Fetch();
uint16 achievementId = fields[0].GetUInt16();
- const AchievementEntry* achievement = sAchievementStore.LookupEntry(achievementId);
+ const AchievementEntry* achievement = sAchievementMgr->GetAchievement(achievementId);
if (!achievement)
{
// Remove non existent achievements from all characters
- sLog->outError("Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
+ sLog->outError(LOG_FILTER_ACHIEVEMENTSYS, "Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT);
-
stmt->setUInt16(0, uint16(achievementId));
-
CharacterDatabase.Execute(stmt);
continue;
}
else if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
m_allCompletedAchievements.insert(achievementId);
- } while (result->NextRow());
+ }
+ while (result->NextRow());
- sLog->outString(">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu realm first completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewards()
@@ -2446,13 +2440,12 @@ void AchievementGlobalMgr::LoadRewards()
m_achievementRewards.clear(); // need for reload case
- // 0 1 2 3 4 5 6
+ // 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return;
}
@@ -2462,10 +2455,10 @@ void AchievementGlobalMgr::LoadRewards()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry);
+ const AchievementEntry* pAchievement = GetAchievement(entry);
if (!pAchievement)
{
- sLog->outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` has wrong achievement (Entry: %u), ignored.", entry);
continue;
}
@@ -2480,19 +2473,19 @@ void AchievementGlobalMgr::LoadRewards()
// must be title or mail at least
if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have title or item reward data, ignored.", entry);
continue;
}
if (pAchievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0)))
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);
if (reward.titleId[0])
{
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]);
if (!titleEntry)
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);
reward.titleId[0] = 0;
}
}
@@ -2502,7 +2495,7 @@ void AchievementGlobalMgr::LoadRewards()
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]);
if (!titleEntry)
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);
reward.titleId[1] = 0;
}
}
@@ -2512,39 +2505,37 @@ void AchievementGlobalMgr::LoadRewards()
{
if (!sObjectMgr->GetCreatureTemplate(reward.sender))
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
reward.sender = 0;
}
}
else
{
if (reward.itemId)
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);
if (!reward.subject.empty())
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);
if (!reward.text.empty())
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);
}
if (reward.itemId)
{
if (!sObjectMgr->GetItemTemplate(reward.itemId))
{
- sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);
+ sLog->outError(LOG_FILTER_SQL, "Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);
reward.itemId = 0;
}
}
m_achievementRewards[entry] = reward;
++count;
-
}
while (result->NextRow());
- sLog->outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewardLocales()
@@ -2559,8 +2550,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (!result)
{
- sLog->outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
return;
}
@@ -2572,7 +2562,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (m_achievementRewards.find(entry) == m_achievementRewards.end())
{
- sLog->outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry);
continue;
}
@@ -2584,8 +2574,18 @@ void AchievementGlobalMgr::LoadRewardLocales()
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.subject);
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.text);
}
- } while (result->NextRow());
+ }
+ while (result->NextRow());
- sLog->outString(">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
+}
+
+AchievementEntry const* AchievementGlobalMgr::GetAchievement(uint32 achievementId) const
+{
+ return sAchievementStore.LookupEntry(achievementId);
+}
+
+AchievementCriteriaEntry const* AchievementGlobalMgr::GetAchievementCriteria(uint32 criteriaId) const
+{
+ return sAchievementCriteriaStore.LookupEntry(criteriaId);
}
diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h
index c7d838fcb44..0f3d63cd60f 100755..100644
--- a/src/server/game/Achievements/AchievementMgr.h
+++ b/src/server/game/Achievements/AchievementMgr.h
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef __TRINITY_ACHIEVEMENTMGR_H
#define __TRINITY_ACHIEVEMENTMGR_H
@@ -27,11 +28,15 @@
#include "DBCEnums.h"
#include "DBCStores.h"
-typedef std::list<AchievementCriteriaEntry const*> AchievementCriteriaEntryList;
-typedef std::list<AchievementEntry const*> AchievementEntryList;
+class Unit;
+class Player;
+class WorldPacket;
+
+typedef std::vector<AchievementCriteriaEntry const*> AchievementCriteriaEntryList;
+typedef std::vector<AchievementEntry const*> AchievementEntryList;
-typedef std::map<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByAchievement;
-typedef std::map<uint32, AchievementEntryList> AchievementListByReferencedId;
+typedef UNORDERED_MAP<uint32, AchievementCriteriaEntryList> AchievementCriteriaListByAchievement;
+typedef UNORDERED_MAP<uint32, AchievementEntryList> AchievementListByReferencedId;
struct CriteriaProgress
{
@@ -63,14 +68,11 @@ enum AchievementCriteriaDataType
ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT = 18, // 0 0 maker instance script call for check current criteria requirements fit
ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM = 19, // item_level item_quality for equipped item in slot to check item level and quality
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID = 20, // map_id 0 player must be on map with id in map_id
- ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE = 21, // class_id race_id
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE = 21 // class_id race_id
};
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 22 // maximum value in AchievementCriteriaDataType enum
-class Player;
-class Unit;
-
struct AchievementCriteriaData
{
AchievementCriteriaDataType dataType;
@@ -194,7 +196,7 @@ struct AchievementCriteriaData
}
bool IsValid(AchievementCriteriaEntry const* criteria);
- bool Meets(uint32 criteria_id, Player const* source, Unit const* target, uint32 miscvalue1 = 0) const;
+ bool Meets(uint32 criteria_id, Player const* source, Unit const* target, uint32 miscValue1 = 0) const;
};
struct AchievementCriteriaDataSet
@@ -202,7 +204,7 @@ struct AchievementCriteriaDataSet
AchievementCriteriaDataSet() : criteria_id(0) {}
typedef std::vector<AchievementCriteriaData> Storage;
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
- bool Meets(Player const* source, Unit const* target, uint32 miscvalue = 0) const;
+ bool Meets(Player const* source, Unit const* target, uint32 miscValue = 0) const;
void SetCriteriaId(uint32 id) {criteria_id = id;}
private:
uint32 criteria_id;
@@ -220,15 +222,15 @@ struct AchievementReward
std::string text;
};
-typedef std::map<uint32, AchievementReward> AchievementRewards;
+typedef UNORDERED_MAP<uint32, AchievementReward> AchievementRewards;
struct AchievementRewardLocale
{
- StringVector subject;
- StringVector text;
+ std::vector<std::string> subject;
+ std::vector<std::string> text;
};
-typedef std::map<uint32, AchievementRewardLocale> AchievementRewardLocales;
+typedef UNORDERED_MAP<uint32, AchievementRewardLocale> AchievementRewardLocales;
struct CompletedAchievementData
{
@@ -239,9 +241,12 @@ struct CompletedAchievementData
typedef UNORDERED_MAP<uint32, CriteriaProgress> CriteriaProgressMap;
typedef UNORDERED_MAP<uint32, CompletedAchievementData> CompletedAchievementMap;
-class Unit;
-class Player;
-class WorldPacket;
+enum ProgressType
+{
+ PROGRESS_SET,
+ PROGRESS_ACCUMULATE,
+ PROGRESS_HIGHEST
+};
class AchievementMgr
{
@@ -253,7 +258,7 @@ class AchievementMgr
static void DeleteFromDB(uint32 lowguid);
void LoadFromDB(PreparedQueryResult achievementResult, PreparedQueryResult criteriaResult);
void SaveToDB(SQLTransaction& trans);
- void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1 = 0, uint32 miscvalue2 = 0, bool evenIfCriteriaComplete = false);
+ void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, bool evenIfCriteriaComplete = false);
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL);
void CompletedAchievement(AchievementEntry const* entry);
void CheckAllAchievementCriteria();
@@ -266,7 +271,6 @@ class AchievementMgr
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
private:
- enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST };
void SendAchievementEarned(AchievementEntry const* achievement) const;
void SendCriteriaUpdate(AchievementCriteriaEntry const* entry, CriteriaProgress const* progress, uint32 timeElapsed, bool timedCompleted) const;
CriteriaProgress* GetCriteriaProgress(AchievementCriteriaEntry const* entry);
@@ -348,14 +352,19 @@ class AchievementGlobalMgr
void LoadCompletedAchievements();
void LoadRewards();
void LoadRewardLocales();
+ AchievementEntry const* GetAchievement(uint32 achievementId) const;
+ AchievementCriteriaEntry const* GetAchievementCriteria(uint32 achievementId) const;
private:
AchievementCriteriaDataMap m_criteriaDataMap;
// store achievement criterias by type to speed up lookup
AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
+
AchievementCriteriaEntryList m_AchievementCriteriasByTimedType[ACHIEVEMENT_TIMED_TYPE_MAX];
+
// store achievement criterias by achievement to speed up lookup
AchievementCriteriaListByAchievement m_AchievementCriteriaListByAchievement;
+
// store achievements by referenced achievement id to speed up lookup
AchievementListByReferencedId m_AchievementListByReferencedId;
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index 528e682e8d4..a595c73c7c0 100755..100644
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
@@ -43,8 +43,7 @@ void LoadFromDB()
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
if (!result)
{
- sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!");
return;
}
@@ -63,8 +62,7 @@ void LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SaveAddon(AddonInfo const& addon)
diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h
index 38338b3980f..9efbabc8b9f 100755..100644
--- a/src/server/game/Addons/AddonMgr.h
+++ b/src/server/game/Addons/AddonMgr.h
@@ -25,13 +25,8 @@
struct AddonInfo
{
AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
- {
- Name = name;
- Enabled = enabled;
- CRC = crc;
- State = state;
- UsePublicKeyOrCRC = crcOrPubKey;
- }
+ : Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey)
+ { }
std::string Name;
uint8 Enabled;
@@ -62,4 +57,3 @@ namespace AddonMgr
}
#endif
-
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 683a269f508..4738d8f6f27 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -29,12 +29,12 @@
#include "AuctionHouseMgr.h"
#include "Item.h"
#include "Language.h"
-#include "Logging/Log.h"
+#include "Log.h"
#include <vector>
enum eAuctionHouse
{
- AH_MINIMUM_DEPOSIT = 100,
+ AH_MINIMUM_DEPOSIT = 100
};
AuctionHouseMgr::AuctionHouseMgr()
@@ -71,7 +71,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
if (MSV <= 0)
return AH_MINIMUM_DEPOSIT;
- float multiplier = CalculatePctN(float(entry->depositPercent), 3);
+ float multiplier = CalculatePct(float(entry->depositPercent), 3);
uint32 timeHr = (((time / 60) / 60) / 12);
uint32 deposit = uint32(((multiplier * MSV * count / 3) * timeHr * 3) * sWorld->getRate(RATE_AUCTION_DEPOSIT));
@@ -89,7 +89,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
//does not clear ram
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans)
{
- Item* pItem = GetAItem(auction->item_guidlow);
+ Item* pItem = GetAItem(auction->itemGUIDLow);
if (!pItem)
return;
@@ -134,15 +134,6 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
// receiver exist
if (bidder || bidder_accId)
{
- std::ostringstream msgAuctionWonSubject;
- msgAuctionWonSubject << auction->item_template << ":0:" << AUCTION_WON;
-
- std::ostringstream msgAuctionWonBody;
- msgAuctionWonBody.width(16);
- msgAuctionWonBody << std::right << std::hex << auction->owner;
- msgAuctionWonBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
- sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionWon body string : %s", msgAuctionWonBody.str().c_str());
-
// set owner to bidder (to prevent delete item with sender char deleting)
// owner in `data` will set at mail receive and item extracting
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
@@ -152,12 +143,12 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (bidder)
{
- bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
+ bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->itemEntry);
// FIXME: for offline player need also
- bidder->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
+ bidder->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
}
- MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str())
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_WON), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, 0, 0))
.AddItem(pItem)
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
}
@@ -170,26 +161,8 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTrans
uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid);
// owner exist (online or offline)
if (owner || owner_accId)
- {
- std::ostringstream msgAuctionSalePendingSubject;
- msgAuctionSalePendingSubject << auction->item_template << ":0:" << AUCTION_SALE_PENDING;
-
- std::ostringstream msgAuctionSalePendingBody;
- uint32 auctionCut = auction->GetAuctionCut();
-
- time_t distrTime = time(NULL) + sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY);
-
- msgAuctionSalePendingBody.width(16);
- msgAuctionSalePendingBody << std::right << std::hex << auction->bidder;
- msgAuctionSalePendingBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
- msgAuctionSalePendingBody << ':' << auction->deposit << ':' << auctionCut << ":0:";
- msgAuctionSalePendingBody << secsToTimeBitFields(distrTime);
-
- sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str());
-
- MailDraft(msgAuctionSalePendingSubject.str(), msgAuctionSalePendingBody.str())
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_SALE_PENDING), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED);
- }
}
//call this method to send mail to auction owner, when auction is successful, it does not clear ram
@@ -201,30 +174,18 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
// owner exist
if (owner || owner_accId)
{
- std::ostringstream msgAuctionSuccessfulSubject;
- msgAuctionSuccessfulSubject << auction->item_template << ":0:" << AUCTION_SUCCESSFUL;
-
- std::ostringstream auctionSuccessfulBody;
- uint32 auctionCut = auction->GetAuctionCut();
-
- auctionSuccessfulBody.width(16);
- auctionSuccessfulBody << std::right << std::hex << auction->bidder;
- auctionSuccessfulBody << std::dec << ':' << auction->bid << ':' << auction->buyout;
- auctionSuccessfulBody << ':' << auction->deposit << ':' << auctionCut;
-
- sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str());
-
- uint32 profit = auction->bid + auction->deposit - auctionCut;
+ uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut();
//FIXME: what do if owner offline
if (owner)
{
- owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit);
- owner->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid);
+ owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit);
+ owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid);
//send auction owner notification, bidder must be current!
owner->GetSession()->SendAuctionOwnerNotification(auction);
}
- MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str())
+
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_SUCCESSFUL), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.AddMoney(profit)
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
}
@@ -234,7 +195,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans)
{
//return an item in auction to its owner by mail
- Item* pItem = GetAItem(auction->item_guidlow);
+ Item* pItem = GetAItem(auction->itemGUIDLow);
if (!pItem)
return;
@@ -244,13 +205,10 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
// owner exist
if (owner || owner_accId)
{
- std::ostringstream subject;
- subject << auction->item_template << ":0:" << AUCTION_EXPIRED << ":0:0";
-
if (owner)
owner->GetSession()->SendAuctionOwnerNotification(auction);
- MailDraft(subject.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
.AddItem(pItem)
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
}
@@ -269,13 +227,10 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
// old bidder exist
if (oldBidder || oldBidder_accId)
{
- std::ostringstream msgAuctionOutbiddedSubject;
- msgAuctionOutbiddedSubject << auction->item_template << ":0:" << AUCTION_OUTBIDDED << ":0:0";
-
if (oldBidder && newBidder)
- oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
+ oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->itemEntry);
- MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.AddMoney(auction->bid)
.SendMailTo(trans, MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
}
@@ -293,14 +248,9 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
// bidder exist
if (bidder || bidder_accId)
- {
- std::ostringstream msgAuctionCancelledSubject;
- msgAuctionCancelledSubject << auction->item_template << ":0:" << AUCTION_CANCELLED_TO_BIDDER << ":0:0";
-
- MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, 0))
.AddMoney(auction->bid)
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
- }
}
void AuctionHouseMgr::LoadAuctionItems()
@@ -313,8 +263,8 @@ void AuctionHouseMgr::LoadAuctionItems()
if (!result)
{
- sLog->outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
+
return;
}
@@ -322,21 +272,20 @@ void AuctionHouseMgr::LoadAuctionItems()
do
{
-
Field* fields = result->Fetch();
uint32 item_guid = fields[11].GetUInt32();
- uint32 item_template = fields[12].GetUInt32();
+ uint32 itemEntry = fields[12].GetUInt32();
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- sLog->outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, itemEntry);
continue;
}
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(item_guid, 0, fields, item_template))
+ if (!item->LoadFromDB(item_guid, 0, fields, itemEntry))
{
delete item;
continue;
@@ -347,8 +296,8 @@ void AuctionHouseMgr::LoadAuctionItems()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void AuctionHouseMgr::LoadAuctions()
@@ -360,8 +309,8 @@ void AuctionHouseMgr::LoadAuctions()
if (!result)
{
- sLog->outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
+
return;
}
@@ -386,8 +335,8 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
- sLog->outString(">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void AuctionHouseMgr::AddAItem(Item* it)
@@ -462,7 +411,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction)
sScriptMgr->OnAuctionAdd(this, auction);
}
-bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*item_template*/)
+bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry*/)
{
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
@@ -516,14 +465,14 @@ void AuctionHouseObject::Update()
sScriptMgr->OnAuctionSuccessful(this, auction);
}
- uint32 item_template = auction->item_template;
+ uint32 itemEntry = auction->itemEntry;
///- In any case clear the auction
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
- RemoveAuction(auction, item_template);
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
+ RemoveAuction(auction, itemEntry);
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
}
while (result->NextRow());
}
@@ -569,7 +518,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
- Item* item = sAuctionMgr->GetAItem(Aentry->item_guidlow);
+ Item* item = sAuctionMgr->GetAItem(Aentry->itemGUIDLow);
if (!item)
continue;
@@ -621,7 +570,6 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
if (itemRandProp)
{
char* const* temp = itemRandProp->nameSuffix;
- //char* temp = itemRandProp->nameSuffix;
// dbc local name
if (temp)
@@ -652,10 +600,10 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
//this function inserts to WorldPacket auction's data
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
{
- Item* item = sAuctionMgr->GetAItem(item_guidlow);
+ Item* item = sAuctionMgr->GetAItem(itemGUIDLow);
if (!item)
{
- sLog->outError("AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, itemGUIDLow);
return false;
}
data << uint32(Id);
@@ -686,14 +634,14 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
uint32 AuctionEntry::GetAuctionCut() const
{
- int32 cut = int32(CalculatePctU(bid, auctionHouseEntry->cutPercent) * sWorld->getRate(RATE_AUCTION_CUT));
+ int32 cut = int32(CalculatePct(bid, auctionHouseEntry->cutPercent) * sWorld->getRate(RATE_AUCTION_CUT));
return std::max(cut, 0);
}
/// the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
uint32 AuctionEntry::GetAuctionOutBid() const
{
- uint32 outbid = CalculatePctN(bid, 5);
+ uint32 outbid = CalculatePct(bid, 5);
return outbid ? outbid : 1;
}
@@ -709,7 +657,7 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AUCTION);
stmt->setUInt32(0, Id);
stmt->setUInt32(1, auctioneer);
- stmt->setUInt32(2, item_guidlow);
+ stmt->setUInt32(2, itemGUIDLow);
stmt->setUInt32(3, owner);
stmt->setInt32 (4, int32(buyout));
stmt->setUInt64(5, uint64(expire_time));
@@ -724,27 +672,28 @@ bool AuctionEntry::LoadFromDB(Field* fields)
{
Id = fields[0].GetUInt32();
auctioneer = fields[1].GetUInt32();
- item_guidlow = fields[2].GetUInt32();
- item_template = fields[3].GetUInt32();
- owner = fields[4].GetUInt32();
- buyout = fields[5].GetUInt32();
- expire_time = fields[6].GetUInt32();
- bidder = fields[7].GetUInt32();
- bid = fields[8].GetUInt32();
- startbid = fields[9].GetUInt32();
- deposit = fields[10].GetUInt32();
+ itemGUIDLow = fields[2].GetUInt32();
+ itemEntry = fields[3].GetUInt32();
+ itemCount = fields[4].GetUInt32();
+ owner = fields[5].GetUInt32();
+ buyout = fields[6].GetUInt32();
+ expire_time = fields[7].GetUInt32();
+ bidder = fields[8].GetUInt32();
+ bid = fields[9].GetUInt32();
+ startbid = fields[10].GetUInt32();
+ deposit = fields[11].GetUInt32();
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
if (!auctioneerData)
{
- sLog->outError("Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
return false;
}
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
- sLog->outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
return false;
}
@@ -752,15 +701,15 @@ bool AuctionEntry::LoadFromDB(Field* fields)
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId);
if (!auctionHouseEntry)
{
- sLog->outError("Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
return false;
}
// check if sold item exists for guid
- // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
- if (!sAuctionMgr->GetAItem(item_guidlow))
+ // and itemEntry in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
+ if (!sAuctionMgr->GetAItem(itemGUIDLow))
{
- sLog->outError("Auction %u has not a existing item : %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, itemGUIDLow);
return false;
}
return true;
@@ -784,8 +733,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
if (!expAuctions)
{
- sLog->outString(">> No expired auctions to delete");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete");
+
return;
}
@@ -832,8 +781,8 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
} while (expAuctions->NextRow());
- sLog->outString(">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
+
}
@@ -845,27 +794,28 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
Id = fields[0].GetUInt32();
auctioneer = fields[1].GetUInt32();
- item_guidlow = fields[2].GetUInt32();
- item_template = fields[3].GetUInt32();
- owner = fields[4].GetUInt32();
- buyout = fields[5].GetUInt32();
- expire_time = fields[6].GetUInt32();
- bidder = fields[7].GetUInt32();
- bid = fields[8].GetUInt32();
- startbid = fields[9].GetUInt32();
- deposit = fields[10].GetUInt32();
+ itemGUIDLow = fields[2].GetUInt32();
+ itemEntry = fields[3].GetUInt32();
+ itemCount = fields[4].GetUInt32();
+ owner = fields[5].GetUInt32();
+ buyout = fields[6].GetUInt32();
+ expire_time = fields[7].GetUInt32();
+ bidder = fields[8].GetUInt32();
+ bid = fields[9].GetUInt32();
+ startbid = fields[10].GetUInt32();
+ deposit = fields[11].GetUInt32();
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
if (!auctioneerData)
{
- sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
return false;
}
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
- sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
return false;
}
@@ -874,9 +824,26 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
if (!auctionHouseEntry)
{
- sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
return false;
}
return true;
}
+
+std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const
+{
+ std::ostringstream strm;
+ strm << itemEntry << ":0:" << response << ':' << Id << ':' << itemCount;
+ return strm.str();
+}
+
+std::string AuctionEntry::BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut)
+{
+ std::ostringstream strm;
+ strm.width(16);
+ strm << std::right << std::hex << MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER); // HIGHGUID_PLAYER always present, even for empty guids
+ strm << std::dec << ':' << bid << ':' << buyout;
+ strm << ':' << deposit << ':' << cut;
+ return strm.str();
+}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h
index 190fbcc5107..e13b4665b7b 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.h
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h
@@ -34,11 +34,11 @@ class WorldPacket;
enum AuctionError
{
- AUCTION_OK = 0,
- AUCTION_INTERNAL_ERROR = 2,
- AUCTION_NOT_ENOUGHT_MONEY = 3,
- AUCTION_ITEM_NOT_FOUND = 4,
- CANNOT_BID_YOUR_AUCTION_ERROR = 10
+ ERR_AUCTION_OK = 0,
+ ERR_AUCTION_DATABASE_ERROR = 2,
+ ERR_AUCTION_NOT_ENOUGHT_MONEY = 3,
+ ERR_AUCTION_ITEM_NOT_FOUND = 4,
+ ERR_AUCTION_BID_OWN = 10
};
enum AuctionAction
@@ -48,12 +48,24 @@ enum AuctionAction
AUCTION_PLACE_BID = 2
};
+enum MailAuctionAnswers
+{
+ AUCTION_OUTBIDDED = 0,
+ AUCTION_WON = 1,
+ AUCTION_SUCCESSFUL = 2,
+ AUCTION_EXPIRED = 3,
+ AUCTION_CANCELLED_TO_BIDDER = 4,
+ AUCTION_CANCELED = 5,
+ AUCTION_SALE_PENDING = 6
+};
+
struct AuctionEntry
{
uint32 Id;
uint32 auctioneer; // creature low guid
- uint32 item_guidlow;
- uint32 item_template;
+ uint32 itemGUIDLow;
+ uint32 itemEntry;
+ uint32 itemCount;
uint32 owner;
uint32 startbid; //maybe useless
uint32 bid;
@@ -74,6 +86,8 @@ struct AuctionEntry
void SaveToDB(SQLTransaction& trans) const;
bool LoadFromDB(Field* fields);
bool LoadFromFieldList(Field* fields);
+ std::string BuildAuctionMailSubject(MailAuctionAnswers response) const;
+ static std::string BuildAuctionMailBody(uint32 lowGuid, uint32 bid, uint32 buyout, uint32 deposit, uint32 cut);
};
@@ -104,7 +118,7 @@ class AuctionHouseObject
void AddAuction(AuctionEntry* auction);
- bool RemoveAuction(AuctionEntry* auction, uint32 item_template);
+ bool RemoveAuction(AuctionEntry* auction, uint32 itemEntry);
void Update();
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
new file mode 100644
index 00000000000..55f38f748f2
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -0,0 +1,1166 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Map.h"
+#include "MapManager.h"
+#include "Group.h"
+#include "WorldPacket.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
+#include "GroupMgr.h"
+
+Battlefield::Battlefield()
+{
+ m_Timer = 0;
+ m_IsEnabled = true;
+ m_isActive = false;
+ m_DefenderTeam = TEAM_NEUTRAL;
+
+ m_TypeId = 0;
+ m_BattleId = 0;
+ m_ZoneId = 0;
+ m_MapId = 0;
+ m_MaxPlayer = 0;
+ m_MinPlayer = 0;
+ m_BattleTime = 0;
+ m_NoWarBattleTime = 0;
+ m_TimeForAcceptInvite = 20;
+ m_uiKickDontAcceptTimer = 1000;
+
+ m_uiKickAfkPlayersTimer = 1000;
+
+ m_LastResurectTimer = 30 * IN_MILLISECONDS;
+ m_StartGroupingTimer = 0;
+ m_StartGrouping = false;
+ StalkerGuid = 0;
+}
+
+Battlefield::~Battlefield()
+{
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ delete itr->second;
+
+ for (GraveyardVect::const_iterator itr = m_GraveyardList.begin(); itr != m_GraveyardList.end(); ++itr)
+ delete *itr;
+
+ m_capturePoints.clear();
+}
+
+// Called when a player enters the zone
+void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
+{
+ // If battle is started,
+ // If not full of players > invite player to join the war
+ // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
+ if (IsWarTime())
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
+ InvitePlayerToWar(player);
+ else // No more vacant places
+ {
+ // TODO: Send a packet to announce it to player
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ InvitePlayerToQueue(player);
+ }
+ }
+ else
+ {
+ // If time left is < 15 minutes invite player to join queue
+ if (m_Timer <= m_StartGroupingTimer)
+ InvitePlayerToQueue(player);
+ }
+
+ // Add player in the list of player in zone
+ m_players[player->GetTeamId()].insert(player->GetGUID());
+ OnPlayerEnterZone(player);
+}
+
+// Called when a player leave the zone
+void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
+{
+ if (IsWarTime())
+ {
+ // If the player is participating to the battle
+ if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
+ {
+ m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
+ player->GetSession()->SendBfLeaveMessage(m_BattleId);
+ if (Group* group = player->GetGroup()) // Remove the player from the raid group
+ group->RemoveMember(player->GetGUID());
+
+ OnPlayerLeaveWar(player);
+ }
+ }
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ itr->second->HandlePlayerLeave(player);
+
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_players[player->GetTeamId()].erase(player->GetGUID());
+ SendRemoveWorldStates(player);
+ RemovePlayerFromResurrectQueue(player->GetGUID());
+ OnPlayerLeaveZone(player);
+}
+
+bool Battlefield::Update(uint32 diff)
+{
+ if (m_Timer <= diff)
+ {
+ // Battlefield ends on time
+ if (IsWarTime())
+ EndBattle(true);
+ else // Time to start a new battle!
+ StartBattle();
+ }
+ else
+ m_Timer -= diff;
+
+ // Invite players a few minutes before the battle's beginning
+ if (!IsWarTime() && !m_StartGrouping && m_Timer <= m_StartGroupingTimer)
+ {
+ m_StartGrouping = true;
+ InvitePlayersInZoneToQueue();
+ OnStartGrouping();
+ }
+
+ bool objective_changed = false;
+ if (IsWarTime())
+ {
+ if (m_uiKickAfkPlayersTimer <= diff)
+ {
+ m_uiKickAfkPlayersTimer = 1000;
+ KickAfkPlayers();
+ }
+ else
+ m_uiKickAfkPlayersTimer -= diff;
+
+ // Kick players who chose not to accept invitation to the battle
+ if (m_uiKickDontAcceptTimer <= diff)
+ {
+ 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);
+
+ 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);
+
+ m_uiKickDontAcceptTimer = 1000;
+ }
+ else
+ m_uiKickDontAcceptTimer -= diff;
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ if (itr->second->Update(diff))
+ objective_changed = true;
+ }
+
+
+ if (m_LastResurectTimer <= diff)
+ {
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ if (GetGraveyardById(i))
+ m_GraveyardList[i]->Resurrect();
+ m_LastResurectTimer = RESURRECTION_INTERVAL;
+ }
+ else
+ m_LastResurectTimer -= diff;
+
+ return objective_changed;
+}
+
+void Battlefield::InvitePlayersInZoneToQueue()
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ InvitePlayerToQueue(player);
+}
+
+void Battlefield::InvitePlayerToQueue(Player* player)
+{
+ if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer)
+ player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
+}
+
+void Battlefield::InvitePlayersInQueueToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else
+ {
+ //Full
+ }
+ }
+ }
+ m_PlayersInQueue[team].clear();
+ }
+}
+
+void Battlefield::InvitePlayersInZoneToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ continue;
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else // Battlefield is full of players
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ }
+ }
+}
+
+void Battlefield::InvitePlayerToWar(Player* player)
+{
+ if (!player)
+ return;
+
+ // TODO : needed ?
+ if (player->isInFlight())
+ return;
+
+ if (player->InArena() || player->GetBattleground())
+ {
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+ return;
+ }
+
+ // If the player does not match minimal level requirements for the battlefield, kick him
+ if (player->getLevel() < m_MinLevel)
+ {
+ if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ return;
+ }
+
+ // Check if player is not already in war
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite;
+ player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
+}
+
+void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
+{
+ if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
+ StalkerGuid = creature->GetGUID();
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
+}
+
+void Battlefield::KickAfkPlayers()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->isAFK())
+ KickPlayerFromBattlefield(*itr);
+}
+
+void Battlefield::KickPlayerFromBattlefield(uint64 guid)
+{
+ if (Player* player = sObjectAccessor->FindPlayer(guid))
+ if (player->GetZoneId() == GetZoneId())
+ player->TeleportTo(KickPosition);
+}
+
+void Battlefield::StartBattle()
+{
+ if (m_isActive)
+ return;
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ {
+ m_PlayersInWar[team].clear();
+ m_Groups[team].clear();
+ }
+
+ m_Timer = m_BattleTime;
+ m_isActive = true;
+
+ InvitePlayersInZoneToWar();
+ InvitePlayersInQueueToWar();
+
+ DoPlaySoundToAll(BF_START);
+
+ OnBattleStart();
+}
+
+void Battlefield::EndBattle(bool endByTimer)
+{
+ if (!m_isActive)
+ return;
+
+ m_isActive = false;
+
+ m_StartGrouping = false;
+
+ if (!endByTimer)
+ SetDefenderTeam(GetAttackerTeam());
+
+ if (GetDefenderTeam() == TEAM_ALLIANCE)
+ DoPlaySoundToAll(BF_ALLIANCE_WINS);
+ else
+ DoPlaySoundToAll(BF_HORDE_WINS);
+
+ OnBattleEnd(endByTimer);
+
+ // Reset battlefield timer
+ m_Timer = m_NoWarBattleTime;
+ SendInitWorldStatesToAll();
+}
+
+void Battlefield::DoPlaySoundToAll(uint32 SoundID)
+{
+ WorldPacket data;
+ data.Initialize(SMSG_PLAY_SOUND, 4);
+ data << uint32(SoundID);
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+bool Battlefield::HasPlayer(Player* player) const
+{
+ return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end();
+}
+
+// Called in WorldSession::HandleBfQueueInviteResponse
+void Battlefield::PlayerAcceptInviteToQueue(Player* player)
+{
+ // Add player in queue
+ m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
+ // Send notification
+ player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
+}
+
+// Called in WorldSession::HandleBfExitRequest
+void Battlefield::AskToLeaveQueue(Player* player)
+{
+ // Remove player from queue
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+}
+
+// Called in WorldSession::HandleBfEntryInviteResponse
+void Battlefield::PlayerAcceptInviteToWar(Player* player)
+{
+ if (!IsWarTime())
+ return;
+
+ if (AddOrSetPlayerToCorrectBfGroup(player))
+ {
+ player->GetSession()->SendBfEntered(m_BattleId);
+ m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+
+ if (player->isAFK())
+ player->ToggleAFK();
+
+ OnPlayerJoinWar(player); //for scripting
+ }
+}
+
+void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
+{
+ if (spellId > 0)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, uint32(spellId), true);
+ }
+ else
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(uint32(-spellId));
+ }
+}
+
+void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+WorldPacket Battlefield::BuildWarningAnnPacket(std::string const& msg)
+{
+ WorldPacket data(SMSG_MESSAGECHAT, 200);
+
+ data << uint8(CHAT_MSG_RAID_BOSS_EMOTE);
+ data << uint32(LANG_UNIVERSAL);
+ data << uint64(0);
+ data << uint32(0); // 2.1.0
+ data << uint32(1);
+ data << uint8(0);
+ data << uint64(0);
+ data << uint32(msg.length() + 1);
+ data << msg;
+ data << uint8(0);
+
+ return data;
+}
+
+void Battlefield::SendWarningToAllInZone(uint32 entry)
+{
+ if (Creature* stalker = GetCreature(StalkerGuid))
+ // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
+ sCreatureTextMgr->SendChat(stalker, (uint8) entry, 0, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
+}
+
+/*void Battlefield::SendWarningToAllInWar(int32 entry,...)
+{
+ const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
+ va_list ap;
+ char str [1024];
+ va_start(ap, entry);
+ vsnprintf(str,1024,format, ap);
+ va_end(ap);
+ std::string msg = (std::string)str;
+
+ WorldPacket data = BuildWarningAnnPacket(msg);
+ BroadcastPacketWar(data);
+}*/
+
+void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
+{
+ if (player)
+ if (Creature* stalker = GetCreature(StalkerGuid))
+ sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
+}
+
+void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
+ for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void Battlefield::RegisterZone(uint32 zoneId)
+{
+ sBattlefieldMgr->AddZone(zoneId, this);
+}
+
+void Battlefield::HideNpc(Creature* creature)
+{
+ creature->CombatStop();
+ creature->SetReactState(REACT_PASSIVE);
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ creature->SetPhaseMask(2, true);
+ creature->DisappearAndDie();
+ creature->SetVisible(false);
+}
+
+void Battlefield::ShowNpc(Creature* creature, bool aggressive)
+{
+ creature->SetPhaseMask(1, true);
+ creature->SetVisible(true);
+ creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ if (!creature->isAlive())
+ creature->Respawn(true);
+ if (aggressive)
+ creature->SetReactState(REACT_AGGRESSIVE);
+ else
+ {
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ creature->SetReactState(REACT_PASSIVE);
+ }
+}
+
+// ****************************************************
+// ******************* Group System *******************
+// ****************************************************
+Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (!group->IsFull())
+ return group;
+
+ return NULL;
+}
+
+Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (group->IsMember(guid))
+ return group;
+
+ return NULL;
+}
+
+bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
+{
+ if (!player->IsInWorld())
+ return false;
+
+ if (Group* group = player->GetGroup())
+ group->RemoveMember(player->GetGUID());
+
+ Group* group = GetFreeBfRaid(player->GetTeamId());
+ if (!group)
+ {
+ group = new Group;
+ group->SetBattlefieldGroup(this);
+ group->Create(player);
+ sGroupMgr->AddGroup(group);
+ m_Groups[player->GetTeamId()].insert(group->GetGUID());
+ }
+ else if (group->IsMember(player->GetGUID()))
+ {
+ uint8 subgroup = group->GetMemberGroup(player->GetGUID());
+ player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
+ }
+ else
+ group->AddMember(player);
+
+ return true;
+}
+
+//***************End of Group System*******************
+
+//*****************************************************
+//***************Spirit Guide System*******************
+//*****************************************************
+
+//--------------------
+//-Battlefield Method-
+//--------------------
+BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const
+{
+ if (id < m_GraveyardList.size())
+ {
+ if (BfGraveyard* graveyard = m_GraveyardList.at(id))
+ return graveyard;
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u not existed", id);
+ }
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u cant be found", id);
+
+ return NULL;
+}
+
+WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player)
+{
+ BfGraveyard* closestGY = NULL;
+ float maxdist = -1;
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (m_GraveyardList[i])
+ {
+ if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId())
+ continue;
+
+ float dist = m_GraveyardList[i]->GetDistance(player);
+ if (dist < maxdist || maxdist < 0)
+ {
+ closestGY = m_GraveyardList[i];
+ maxdist = dist;
+ }
+ }
+ }
+
+ if (closestGY)
+ return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId());
+
+ return NULL;
+}
+
+void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasNpc(npcGuid))
+ {
+ m_GraveyardList[i]->AddPlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasPlayer(playerGuid))
+ {
+ m_GraveyardList[i]->RemovePlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid)
+{
+ WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
+ uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
+
+ data << guid << time;
+ ASSERT(player && player->GetSession());
+ player->GetSession()->SendPacket(&data);
+}
+
+// ----------------------
+// - BfGraveyard Method -
+// ----------------------
+BfGraveyard::BfGraveyard(Battlefield* battlefield)
+{
+ m_Bf = battlefield;
+ m_GraveyardId = 0;
+ m_ControlTeam = TEAM_NEUTRAL;
+ m_SpiritGuide[0] = 0;
+ m_SpiritGuide[1] = 0;
+ m_ResurrectQueue.clear();
+}
+
+void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
+{
+ m_ControlTeam = startControl;
+ m_GraveyardId = graveyardId;
+}
+
+void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
+{
+ if (!spirit)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "BfGraveyard::SetSpirit: Invalid Spirit.");
+ return;
+ }
+
+ m_SpiritGuide[team] = spirit->GetGUID();
+ spirit->SetReactState(REACT_PASSIVE);
+}
+
+float BfGraveyard::GetDistance(Player* player)
+{
+ const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
+ return player->GetDistance2d(safeLoc->x, safeLoc->y);
+}
+
+void BfGraveyard::AddPlayer(uint64 playerGuid)
+{
+ if (!m_ResurrectQueue.count(playerGuid))
+ {
+ m_ResurrectQueue.insert(playerGuid);
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
+ }
+}
+
+void BfGraveyard::RemovePlayer(uint64 playerGuid)
+{
+ m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
+}
+
+void BfGraveyard::Resurrect()
+{
+ if (m_ResurrectQueue.empty())
+ return;
+
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ // Get player object from his guid
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ // Check if the player is in world and on the good graveyard
+ if (player->IsInWorld())
+ if (Creature* spirit = m_Bf->GetCreature(m_SpiritGuide[m_ControlTeam]))
+ spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
+
+ // Resurect player
+ player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
+ player->ResurrectPlayer(1.0f);
+ player->CastSpell(player, 6962, true);
+ player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
+
+ sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID());
+ }
+
+ m_ResurrectQueue.clear();
+}
+
+// For changing graveyard control
+void BfGraveyard::GiveControlTo(TeamId team)
+{
+ // Guide switching
+ // Note: Visiblity changes are made by phasing
+ /*if (m_SpiritGuide[1 - team])
+ m_SpiritGuide[1 - team]->SetVisible(false);
+ if (m_SpiritGuide[team])
+ m_SpiritGuide[team]->SetVisible(true);*/
+
+ m_ControlTeam = team;
+ // Teleport to other graveyard, player witch were on this graveyard
+ RelocateDeadPlayers();
+}
+
+void BfGraveyard::RelocateDeadPlayers()
+{
+ WorldSafeLocsEntry const* closestGrave = NULL;
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ else
+ {
+ closestGrave = m_Bf->GetClosestGraveYard(player);
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ }
+ }
+}
+
+bool BfGraveyard::HasNpc(uint64 guid)
+{
+ if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
+ return false;
+
+ if (!m_Bf->GetCreature(m_SpiritGuide[0]) ||
+ !m_Bf->GetCreature(m_SpiritGuide[1]))
+ return false;
+
+ return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
+}
+
+// *******************************************************
+// *************** End Spirit Guide system ***************
+// *******************************************************
+// ********************** Misc ***************************
+// *******************************************************
+
+Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
+{
+ return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, 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));
+ if (!map)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
+ return 0;
+ }
+
+ Creature* creature = new Creature;
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
+ delete creature;
+ return NULL;
+ }
+
+ creature->SetHomePosition(x, y, z, o);
+
+ CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
+ if (!cinfo)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry);
+ return NULL;
+ }
+ // force using DB speeds -- do we really need this?
+ creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
+ creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
+
+ // Set creature in world
+ map->AddToMap(creature);
+ creature->setActive(true);
+
+ return creature;
+}
+
+// Method for spawning gameobject on map
+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*
+ if (!map)
+ return 0;
+
+ // Create gameobject
+ GameObject* go = new GameObject;
+ if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
+ delete go;
+ return NULL;
+ }
+
+ // Add to world
+ map->AddToMap(go);
+ go->setActive(true);
+
+ return go;
+}
+
+Creature* Battlefield::GetCreature(uint64 GUID)
+{
+ if (!m_Map)
+ return NULL;
+ return m_Map->GetCreature(GUID);
+}
+
+GameObject* Battlefield::GetGameObject(uint64 GUID)
+{
+ if (!m_Map)
+ return NULL;
+ return m_Map->GetGameObject(GUID);
+}
+
+// *******************************************************
+// ******************* CapturePoint **********************
+// *******************************************************
+
+BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePointGUID(0)
+{
+ m_team = TEAM_NEUTRAL;
+ m_value = 0;
+ m_minValue = 0.0f;
+ m_maxValue = 0.0f;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_capturePointEntry = 0;
+ m_neutralValuePct = 0;
+ m_maxSpeed = 0;
+}
+
+bool BfCapturePoint::HandlePlayerEnter(Player* player)
+{
+ if (m_capturePointGUID)
+ {
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
+ }
+
+ return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
+}
+
+GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
+{
+ if (m_capturePointGUID)
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ player->SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
+
+ GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
+
+ if (current == m_activePlayers[player->GetTeamId()].end())
+ return current; // return end()
+
+ m_activePlayers[player->GetTeamId()].erase(current++);
+ return current;
+}
+
+void BfCapturePoint::SendChangePhase()
+{
+ if (!m_capturePointGUID)
+ return;
+
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ // send this too, sometimes the slider disappears, dunno why :(
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ // send these updates to only the ones in this objective
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
+ // send this too, sometimes it resets :S
+ SendUpdateWorldState(capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
+}
+
+bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
+{
+ ASSERT(capturePoint);
+
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry());
+
+ m_capturePointGUID = MAKE_NEW_GUID(capturePoint->GetGUIDLow(), capturePoint->GetEntry(), HIGHGUID_GAMEOBJECT);
+
+ // check info existence
+ GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
+ if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry());
+ return false;
+ }
+
+ // get the needed values from goinfo
+ m_maxValue = goinfo->capturePoint.maxTime;
+ m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
+ m_neutralValuePct = goinfo->capturePoint.neutralPercent;
+ m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100;
+ m_capturePointEntry = capturePoint->GetEntry();
+ if (m_team == TEAM_ALLIANCE)
+ {
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ }
+ else
+ {
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ }
+
+ return true;
+}
+
+GameObject* BfCapturePoint::GetCapturePointGo()
+{
+ return m_Bf->GetGameObject(m_capturePointGUID);
+}
+
+bool BfCapturePoint::DelCapturePoint()
+{
+ if (m_capturePointGUID)
+ {
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ capturePoint->SetRespawnTime(0); // not save respawn time
+ capturePoint->Delete();
+ capturePoint = NULL;
+ }
+ m_capturePointGUID = 0;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::Update(uint32 diff)
+{
+ if (!m_capturePointGUID)
+ return false;
+
+ if (GameObject* capturePoint = m_Bf->GetGameObject(m_capturePointGUID))
+ {
+ float radius = capturePoint->GetGOInfo()->capturePoint.radius;
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (!capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ itr = HandlePlayerLeave(player);
+ else
+ ++itr;
+ }
+ else
+ ++itr;
+ }
+ }
+
+ std::list<Player*> players;
+ Trinity::AnyPlayerInObjectRangeCheck checker(capturePoint, radius);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(capturePoint, players, checker);
+ capturePoint->VisitNearbyWorldObject(radius, searcher);
+
+ for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
+ if ((*itr)->IsOutdoorPvPActive())
+ if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
+ HandlePlayerEnter(*itr);
+ }
+
+ // get the difference of numbers
+ float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
+ if (G3D::fuzzyEq(fact_diff, 0.0f))
+ return false;
+
+ uint32 Challenger = 0;
+ float maxDiff = m_maxSpeed * diff;
+
+ if (fact_diff < 0)
+ {
+ // horde is in majority, but it's already horde-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
+ return false;
+
+ if (fact_diff < -maxDiff)
+ fact_diff = -maxDiff;
+
+ Challenger = HORDE;
+ }
+ else
+ {
+ // ally is in majority, but it's already ally-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
+ return false;
+
+ if (fact_diff > maxDiff)
+ fact_diff = maxDiff;
+
+ Challenger = ALLIANCE;
+ }
+
+ float oldValue = m_value;
+ TeamId oldTeam = m_team;
+
+ m_OldState = m_State;
+
+ m_value += fact_diff;
+
+ if (m_value < -m_minValue) // red
+ {
+ if (m_value < -m_maxValue)
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ m_team = TEAM_HORDE;
+ }
+ else if (m_value > m_minValue) // blue
+ {
+ if (m_value > m_maxValue)
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ m_team = TEAM_ALLIANCE;
+ }
+ else if (oldValue * m_value <= 0) // grey, go through mid point
+ {
+ // if challenger is ally, then n->a challenge
+ if (Challenger == ALLIANCE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
+ // if challenger is horde, then n->h challenge
+ else if (Challenger == HORDE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+ else // grey, did not go through mid point
+ {
+ // old phase and current are on the same side, so one team challenges the other
+ if (Challenger == ALLIANCE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
+ else if (Challenger == HORDE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+
+ if (G3D::fuzzyNe(m_value, oldValue))
+ SendChangePhase();
+
+ if (m_OldState != m_State)
+ {
+ //sLog->outError(LOG_FILTER_BATTLEFIELD, "%u->%u", m_OldState, m_State);
+ if (oldTeam != m_team)
+ ChangeTeam(oldTeam);
+ return true;
+ }
+
+ return false;
+}
+
+void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
+{
+ uint8 team;
+ switch (m_State)
+ {
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE:
+ team = 0;
+ break;
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE:
+ team = 1;
+ break;
+ default:
+ return;
+ }
+
+ // send to all players present in the area
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->KilledMonsterCredit(id, guid);
+}
+
+bool BfCapturePoint::IsInsideObjective(Player* player) const
+{
+ return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end();
+}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
new file mode 100644
index 00000000000..28216a43758
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -0,0 +1,425 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_H_
+#define BATTLEFIELD_H_
+
+#include "Utilities/Util.h"
+#include "SharedDefines.h"
+#include "ZoneScript.h"
+#include "WorldPacket.h"
+#include "GameObject.h"
+#include "Battleground.h"
+#include "ObjectAccessor.h"
+
+enum BattlefieldTypes
+{
+ BATTLEFIELD_WG // Wintergrasp
+};
+
+enum BattlefieldIDs
+{
+ BATTLEFIELD_BATTLEID_WG = 1 // Wintergrasp battle
+};
+
+enum BattlefieldObjectiveStates
+{
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
+};
+
+enum BattlefieldSounds
+{
+ BF_HORDE_WINS = 8454,
+ BF_ALLIANCE_WINS = 8455,
+ BF_START = 3439
+};
+
+enum BattlefieldTimers
+{
+ BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000
+};
+
+// some class predefs
+class Player;
+class GameObject;
+class WorldPacket;
+class Creature;
+class Unit;
+
+class Battlefield;
+class BfGraveyard;
+
+typedef std::set<uint64> GuidSet;
+typedef std::vector<BfGraveyard*> GraveyardVect;
+typedef std::map<uint64, uint32> PlayerTimerMap;
+
+class BfCapturePoint
+{
+ public:
+ BfCapturePoint(Battlefield* bf);
+
+ virtual ~BfCapturePoint() { }
+
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ // Send world state update to all players present
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ // Send kill notify to players in the controlling faction
+ void SendObjectiveComplete(uint32 id, uint64 guid);
+
+ // Used when player is activated/inactivated in the area
+ virtual bool HandlePlayerEnter(Player* player);
+ virtual GuidSet::iterator HandlePlayerLeave(Player* player);
+ //virtual void HandlePlayerActivityChanged(Player* player);
+
+ // Checks if player is in range of a capture credit marker
+ bool IsInsideObjective(Player* player) const;
+
+ // Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
+ virtual bool Update(uint32 diff);
+ virtual void ChangeTeam(TeamId /*oldTeam*/) {}
+ virtual void SendChangePhase();
+
+ bool SetCapturePointData(GameObject* capturePoint);
+ GameObject* GetCapturePointGo();
+ uint32 GetCapturePointEntry(){ return m_capturePointEntry; }
+
+ TeamId GetTeamId() { return m_team; }
+ protected:
+ bool DelCapturePoint();
+
+ // active Players in the area of the objective, 0 - alliance, 1 - horde
+ GuidSet m_activePlayers[2];
+
+ // Total shift needed to capture the objective
+ float m_maxValue;
+ float m_minValue;
+
+ // Maximum speed of capture
+ float m_maxSpeed;
+
+ // The status of the objective
+ float m_value;
+ TeamId m_team;
+
+ // Objective states
+ BattlefieldObjectiveStates m_OldState;
+ BattlefieldObjectiveStates m_State;
+
+ // Neutral value on capture bar
+ uint32 m_neutralValuePct;
+
+ // Pointer to the Battlefield this objective belongs to
+ Battlefield* m_Bf;
+
+ // Capture point entry
+ uint32 m_capturePointEntry;
+
+ // Gameobject related to that capture point
+ uint64 m_capturePointGUID;
+};
+
+class BfGraveyard
+{
+ public:
+ BfGraveyard(Battlefield* Bf);
+
+ // Method to changing who controls the graveyard
+ void GiveControlTo(TeamId team);
+ TeamId GetControlTeamId() const { return m_ControlTeam; }
+
+ // Find the nearest graveyard to a player
+ float GetDistance(Player* player);
+
+ // Initialize the graveyard
+ void Initialize(TeamId startcontrol, uint32 gy);
+
+ // Set spirit service for the graveyard
+ void SetSpirit(Creature* spirit, TeamId team);
+
+ // Add a player to the graveyard
+ void AddPlayer(uint64 player_guid);
+
+ // Remove a player from the graveyard
+ void RemovePlayer(uint64 player_guid);
+
+ // Resurrect players
+ void Resurrect();
+
+ // Move players waiting to that graveyard on the nearest one
+ void RelocateDeadPlayers();
+
+ // Check if this graveyard has a spirit guide
+ bool HasNpc(uint64 guid);
+
+ // Check if a player is in this graveyard's ressurect queue
+ bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
+
+ // Get the graveyard's ID.
+ uint32 GetGraveyardId() const { return m_GraveyardId; }
+
+ protected:
+ TeamId m_ControlTeam;
+ uint32 m_GraveyardId;
+ uint64 m_SpiritGuide[2];
+ GuidSet m_ResurrectQueue;
+ Battlefield* m_Bf;
+};
+
+class Battlefield : public ZoneScript
+{
+ friend class BattlefieldMgr;
+
+ public:
+ /// Constructor
+ Battlefield();
+ /// Destructor
+ virtual ~Battlefield();
+
+ /// typedef of map witch store capturepoint and the associate gameobject entry
+ typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
+
+ /// Call this to init the Battlefield
+ virtual bool SetupBattlefield() { return true; }
+
+ /// Update data of a worldstate to all players present in zone
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ /**
+ * \brief Called every time for update bf data and time
+ * - Update timer for start/end battle
+ * - Invite player in zone to queue m_StartGroupingTimer minutes before start
+ * - Kick Afk players
+ * \param diff : time ellapsed since last call (in ms)
+ */
+ virtual bool Update(uint32 diff);
+
+ /// Invite all players in zone to join the queue, called x minutes before battle start in Update()
+ void InvitePlayersInZoneToQueue();
+ /// Invite all players in queue to join battle on battle start
+ void InvitePlayersInQueueToWar();
+ /// Invite all players in zone to join battle on battle start
+ void InvitePlayersInZoneToWar();
+
+ /// Called when a Unit is kill in battlefield zone
+ virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
+
+ uint32 GetTypeId() { return m_TypeId; }
+ uint32 GetZoneId() { return m_ZoneId; }
+
+ void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
+
+ /// Return true if battle is start, false if battle is not started
+ bool IsWarTime() { return m_isActive; }
+
+ /// Enable or Disable battlefield
+ void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
+ /// Return if battlefield is enable
+ bool IsEnabled() { return m_IsEnabled; }
+
+ /**
+ * \brief Kick player from battlefield and teleport him to kick-point location
+ * \param guid : guid of player who must be kick
+ */
+ void KickPlayerFromBattlefield(uint64 guid);
+
+ /// Called when player (player) enter in zone
+ void HandlePlayerEnterZone(Player* player, uint32 zone);
+ /// Called when player (player) leave the zone
+ void HandlePlayerLeaveZone(Player* player, uint32 zone);
+
+ // All-purpose data storage 64 bit
+ virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; }
+ virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
+
+ // All-purpose data storage 32 bit
+ virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; }
+ virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
+ virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
+
+ // Battlefield - generic methods
+ TeamId GetDefenderTeam() { return m_DefenderTeam; }
+ TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
+ TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
+ void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
+
+ // Group methods
+ /**
+ * \brief Find a not full battlefield group, if there is no, create one
+ * \param TeamId : Id of player team for who we search a group (player->GetTeamId())
+ */
+ Group* GetFreeBfRaid(TeamId TeamId);
+ /// Return battlefield group where player is.
+ Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
+ /// Force player to join a battlefield group
+ bool AddOrSetPlayerToCorrectBfGroup(Player* player);
+
+ // Graveyard methods
+ // Find which graveyard the player must be teleported to to be resurrected by spiritguide
+ WorldSafeLocsEntry const * GetClosestGraveYard(Player* player);
+
+ virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
+ void RemovePlayerFromResurrectQueue(uint64 player_guid);
+ void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
+ BfGraveyard* GetGraveyardById(uint32 id) const;
+
+ // Misc methods
+ Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
+ Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
+ GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
+
+ Creature* GetCreature(uint64 GUID);
+ GameObject* GetGameObject(uint64 GUID);
+
+ // Script-methods
+
+ /// Called on start
+ virtual void OnBattleStart() { }
+ /// Called at the end of battle
+ virtual void OnBattleEnd(bool /*endByTimer*/) { }
+ /// Called x minutes before battle start when player in zone are invite to join queue
+ virtual void OnStartGrouping() { }
+ /// Called when a player accept to join the battle
+ virtual void OnPlayerJoinWar(Player* /*player*/) { }
+ /// Called when a player leave the battle
+ virtual void OnPlayerLeaveWar(Player* /*player*/) { }
+ /// Called when a player leave battlefield zone
+ virtual void OnPlayerLeaveZone(Player* /*player*/) { }
+ /// Called when a player enter in battlefield zone
+ virtual void OnPlayerEnterZone(Player* /*player*/) { }
+
+ WorldPacket BuildWarningAnnPacket(std::string const& msg);
+ void SendWarningToAllInZone(uint32 entry);
+ //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
+ void SendWarningToPlayer(Player* player, uint32 entry);
+
+ void PlayerAcceptInviteToQueue(Player* player);
+ void PlayerAcceptInviteToWar(Player* player);
+ uint32 GetBattleId() { return m_BattleId; }
+ void AskToLeaveQueue(Player* player);
+
+ virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) { }
+
+ /// Send all worldstate data to all player in zone.
+ virtual void SendInitWorldStatesToAll() = 0;
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
+
+ /// Return if we can use mount in battlefield
+ bool CanFlyIn() { return !m_isActive; }
+
+ void SendAreaSpiritHealerQueryOpcode(Player* player, uint64 guid);
+
+ void StartBattle();
+ void EndBattle(bool endByTimer);
+
+ void HideNpc(Creature* creature);
+ void ShowNpc(Creature* creature, bool aggressive);
+
+ GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
+
+ uint32 GetTimer() { return m_Timer; }
+ void SetTimer(uint32 timer) { m_Timer = timer; }
+
+ void DoPlaySoundToAll(uint32 SoundID);
+
+ void InvitePlayerToQueue(Player* player);
+ void InvitePlayerToWar(Player* player);
+
+ void InitStalker(uint32 entry, float x, float y, float z, float o);
+
+ protected:
+ uint64 StalkerGuid;
+ uint32 m_Timer; // Global timer for event
+ bool m_IsEnabled;
+ bool m_isActive;
+ TeamId m_DefenderTeam;
+
+ // Map of the objectives belonging to this OutdoorPvP
+ BfCapturePointMap m_capturePoints;
+
+ // Players info maps
+ GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
+ GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
+ GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
+ PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
+ PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
+
+ // Variables that must exist for each battlefield
+ uint32 m_TypeId; // See enum BattlefieldTypes
+ uint32 m_BattleId; // BattleID (for packet)
+ uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
+ uint32 m_MapId; // MapId where is Battlefield
+ Map* m_Map;
+ uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
+ uint32 m_MinPlayer; // Minimum number of player for Battlefield start
+ uint32 m_MinLevel; // Required level to participate at Battlefield
+ uint32 m_BattleTime; // Length of a battle
+ uint32 m_NoWarBattleTime; // Time between two battles
+ uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
+ uint32 m_TimeForAcceptInvite;
+ uint32 m_uiKickDontAcceptTimer;
+ WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
+
+ uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
+
+ // Graveyard variables
+ GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
+ uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
+
+ uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
+ bool m_StartGrouping; // bool for know if all players in area has been invited
+
+ GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
+
+ std::vector<uint64> m_Data64;
+ std::vector<uint32> m_Data32;
+
+ void KickAfkPlayers();
+
+ // use for switch off all worldstate for client
+ virtual void SendRemoveWorldStates(Player* /*player*/) {}
+
+ // use for send a packet for all player list
+ void BroadcastPacketToZone(WorldPacket& data) const;
+ void BroadcastPacketToQueue(WorldPacket& data) const;
+ void BroadcastPacketToWar(WorldPacket& data) const;
+
+ // CapturePoint system
+ void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointEntry()] = cp; }
+
+ BfCapturePoint* GetCapturePoint(uint32 lowguid) const
+ {
+ Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
+ if (itr != m_capturePoints.end())
+ return itr->second;
+ return NULL;
+ }
+
+ void RegisterZone(uint32 zoneid);
+ bool HasPlayer(Player* player) const;
+ void TeamCastSpell(TeamId team, int32 spellId);
+};
+
+#endif
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
new file mode 100644
index 00000000000..6122b25e8e8
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BattlefieldMgr.h"
+#include "Zones/BattlefieldWG.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+
+BattlefieldMgr::BattlefieldMgr()
+{
+ m_UpdateTimer = 0;
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr");
+}
+
+BattlefieldMgr::~BattlefieldMgr()
+{
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr");
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ delete *itr;
+}
+
+void BattlefieldMgr::InitBattlefield()
+{
+ Battlefield* pBf = new BattlefieldWG;
+ // respawn, init variables
+ if (!pBf->SetupBattlefield())
+ {
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated.");
+ }
+
+ /* For Cataclysm: Tol Barad
+ pBf = new BattlefieldTB;
+ // respawn, init variables
+ if(!pBf->SetupBattlefield())
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
+ } */
+}
+
+void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
+{
+ m_BattlefieldMap[zoneid] = handle;
+}
+
+void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
+ return;
+
+ itr->second->HandlePlayerEnterZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ // teleport: remove once in removefromworld, once in updatezone
+ if (!itr->second->HasPlayer(player))
+ return;
+ itr->second->HandlePlayerLeaveZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ {
+ // no handle for this zone, return
+ return NULL;
+ }
+ if (!itr->second->IsEnabled())
+ return NULL;
+ return itr->second;
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
+{
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ {
+ if ((*itr)->GetBattleId() == battleid)
+ return (*itr);
+ }
+ return NULL;
+}
+
+void BattlefieldMgr::Update(uint32 diff)
+{
+ m_UpdateTimer += diff;
+ if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
+ {
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ if ((*itr)->IsEnabled())
+ (*itr)->Update(m_UpdateTimer);
+ m_UpdateTimer = 0;
+ }
+}
+
+ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
+ if (itr != m_BattlefieldMap.end())
+ return itr->second;
+ else
+ return NULL;
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h
new file mode 100644
index 00000000000..1ec1f3b1151
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_MGR_H_
+#define BATTLEFIELD_MGR_H_
+
+#include "Battlefield.h"
+#include "ace/Singleton.h"
+
+class Player;
+class GameObject;
+class Creature;
+class ZoneScript;
+struct GossipMenuItems;
+
+// class to handle player enter / leave / areatrigger / GO use events
+class BattlefieldMgr
+{
+ public:
+ // ctor
+ BattlefieldMgr();
+ // dtor
+ ~BattlefieldMgr();
+
+ // create battlefield events
+ void InitBattlefield();
+ // called when a player enters an battlefield area
+ void HandlePlayerEnterZone(Player * player, uint32 areaflag);
+ // called when player leaves an battlefield area
+ void HandlePlayerLeaveZone(Player * player, uint32 areaflag);
+ // called when player resurrects
+ void HandlePlayerResurrects(Player * player, uint32 areaflag);
+ // return assigned battlefield
+ Battlefield* GetBattlefieldToZoneId(uint32 zoneid);
+ Battlefield* GetBattlefieldByBattleId(uint32 battleid);
+
+ ZoneScript* GetZoneScript(uint32 zoneId);
+
+ void AddZone(uint32 zoneid, Battlefield * handle);
+
+ void Update(uint32 diff);
+
+ void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
+
+ bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
+
+ void HandleDropFlag(Player * player, uint32 spellId);
+
+ typedef std::vector < Battlefield * >BattlefieldSet;
+ typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
+ private:
+ // contains all initiated battlefield events
+ // used when initing / cleaning up
+ BattlefieldSet m_BattlefieldSet;
+ // maps the zone ids to an battlefield event
+ // used in player event handling
+ BattlefieldMap m_BattlefieldMap;
+ // update interval
+ uint32 m_UpdateTimer;
+};
+
+#define sBattlefieldMgr ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance()
+
+#endif
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
new file mode 100644
index 00000000000..63f95e159af
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -0,0 +1,1067 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// TODO: Implement proper support for vehicle+player teleportation
+// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor
+// TODO: Add proper implement of achievement
+
+#include "BattlefieldWG.h"
+#include "AchievementMgr.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
+#include "SpellAuras.h"
+#include "TemporarySummon.h"
+#include "Vehicle.h"
+#include "WorldSession.h"
+
+enum WGVehicles
+{
+ NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312,
+ NPC_WG_SEIGE_ENGINE_HORDE = 32627,
+ NPC_WG_DEMOLISHER = 28094,
+ NPC_WG_CATAPULT = 27881
+};
+
+BattlefieldWG::~BattlefieldWG()
+{
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ delete *itr;
+
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ delete *itr;
+}
+
+bool BattlefieldWG::SetupBattlefield()
+{
+ InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
+
+ m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes
+ m_BattleId = BATTLEFIELD_BATTLEID_WG;
+ m_ZoneId = BATTLEFIELD_WG_ZONEID;
+ m_MapId = BATTLEFIELD_WG_MAPID;
+ m_Map = sMapMgr->FindMap(m_MapId, 0);
+
+ m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
+ m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
+ m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
+ m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
+ m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;
+
+ m_TimeForAcceptInvite = 20;
+ m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS;
+ m_StartGrouping = false;
+
+ m_tenacityStack = 0;
+
+ KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
+ KickPosition.m_mapId = m_MapId;
+
+ RegisterZone(m_ZoneId);
+
+ m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);
+
+ m_saveTimer = 60000;
+
+ // Init GraveYards
+ SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);
+
+ // Load from db
+ if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
+ && (sWorld->getWorldState(ClockWorldState[0]) == 0))
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
+ sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
+ }
+
+ m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
+ m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));
+
+ m_Timer = sWorld->getWorldState(ClockWorldState[0]);
+ if (m_isActive)
+ {
+ m_isActive = false;
+ m_Timer = m_RestartAfterCrash;
+ }
+
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
+ {
+ BfGraveyardWG* graveyard = new BfGraveyardWG(this);
+
+ // When between games, the graveyard is controlled by the defending team
+ if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
+ graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
+ else
+ graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
+
+ graveyard->SetTextId(WGGraveYard[i].textid);
+ m_GraveyardList[i] = graveyard;
+ }
+
+
+ // Spawn workshop creatures and gameobjects
+ for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
+ {
+ WGWorkshop* workshop = new WGWorkshop(this, i);
+ if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ workshop->GiveControlTo(GetAttackerTeam(), true);
+ else
+ workshop->GiveControlTo(GetDefenderTeam(), true);
+
+ // Note: Capture point is added once the gameobject is created.
+ WorkshopsList.insert(workshop);
+ }
+
+ // Spawn NPCs in the defender's keep, both Horde and Alliance
+ for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
+ {
+ // Horde npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
+ KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
+ // Alliance npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
+ KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Hide NPCs from the Attacker's team in the keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
+
+ // Spawn Horde NPCs outside the keep
+ for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
+ OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
+
+ // Spawn Alliance NPCs outside the keep
+ for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
+ OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+
+ // Hide units outside the keep that are defenders
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
+
+ // Spawn turrets and hide them per default
+ for (uint8 i = 0; i < WG_MAX_TURRET; i++)
+ {
+ Position towerCannonPos;
+ WGTurret[i].GetPosition(&towerCannonPos);
+ if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
+ {
+ CanonList.insert(creature->GetGUID());
+ HideNpc(creature);
+ }
+ }
+
+ // Spawn all gameobjects
+ for (uint8 i = 0; i < WG_MAX_OBJ; i++)
+ {
+ if (GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o))
+ {
+ BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
+ b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
+ if (!IsEnabled() && go->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ BuildingsInZone.insert(b);
+ }
+ }
+
+ // Spawning portal defender
+ for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
+ {
+ if (GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o))
+ {
+ DefenderPortalList.insert(go->GetGUID());
+ go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ }
+ }
+
+ UpdateCounterVehicle(true);
+ return true;
+}
+
+bool BattlefieldWG::Update(uint32 diff)
+{
+ bool m_return = Battlefield::Update(diff);
+ if (m_saveTimer <= diff)
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive);
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam);
+ sWorld->setWorldState(ClockWorldState[0], m_Timer);
+ m_saveTimer = 60 * IN_MILLISECONDS;
+ }
+ else
+ m_saveTimer -= diff;
+
+ return m_return;
+}
+
+void BattlefieldWG::OnBattleStart()
+{
+ // Spawn titan relic
+ if (GameObject* relic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0))
+ {
+ // Update faction of relic, only attacker can click on
+ relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
+ // Set in use (not allow to click on before last door is broken)
+ relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ m_titansRelicGUID = relic->GetGUID();
+ }
+ else
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "WG: Failed to spawn titan relic.");
+
+
+ // Update tower visibility and update faction
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Creature* creature = GetCreature(*itr))
+ {
+ ShowNpc(creature, true);
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ }
+ }
+
+ // Rebuild all wall
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (*itr)
+ {
+ (*itr)->Rebuild();
+ (*itr)->UpdateTurretAttack(false);
+ }
+ }
+
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0);
+
+ // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ (*itr)->UpdateGraveyardAndWorkshop();
+
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ // Kick player in orb room, TODO: offline player ?
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ float x, y, z;
+ player->GetPosition(x, y, z);
+ if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
+ player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
+ SendInitWorldStatesTo(player);
+ }
+ }
+ // Initialize vehicle counter
+ UpdateCounterVehicle(true);
+ // Send start warning to all players
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
+}
+
+void BattlefieldWG::UpdateCounterVehicle(bool init)
+{
+ if (init)
+ {
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0);
+ }
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0);
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->teamControl == TEAM_ALLIANCE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4);
+ else if (workshop->teamControl == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4);
+ }
+ }
+
+ UpdateVehicleCountWG();
+}
+
+void BattlefieldWG::OnBattleEnd(bool endByTimer)
+{
+ // Remove relic
+ if (m_titansRelicGUID)
+ if (GameObject* relic = GetGameObject(m_titansRelicGUID))
+ relic->RemoveFromWorld();
+ m_titansRelicGUID = 0;
+
+ // Remove turret
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Creature* creature = GetCreature(*itr))
+ {
+ if (!endByTimer)
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ HideNpc(creature);
+ }
+ }
+
+ if (!endByTimer) // One player triggered the relic
+ {
+ // Change all npc in keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ ShowNpc(creature, true);
+
+ // Change all npc out of keep
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ ShowNpc(creature, true);
+ }
+
+ // Update all graveyard, control is to defender when no wartime
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
+ if (BfGraveyard* graveyard = GetGraveyardById(i))
+ graveyard->GiveControlTo(GetDefenderTeam());
+
+ for (GuidSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ if (GameObject* object = GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ for (GuidSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ if (GameObject* object = GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Update portal defender faction
+ for (GuidSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
+ if (GameObject* portal = GetGameObject(*itr))
+ portal->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+
+ // Saving data
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ (*itr)->Save();
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ (*itr)->Save();
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
+ player->CastSpell(player, SPELL_VICTORY_REWARD, true);
+ // Send Wintergrasp victory achievement
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player);
+ // Award achievement for succeeding in Wintergrasp in 10 minutes or less
+ if (!endByTimer && GetTimer() <= 10000)
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player);
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ RemoveAurasFromPlayer(player);
+
+ m_PlayersInWar[team].clear();
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ if (creature->IsVehicle())
+ creature->GetVehicleKit()->Dismiss();
+
+ m_vehicles[team].clear();
+ }
+
+ if (!endByTimer)
+ {
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID());
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ }
+ }
+ }
+ }
+
+ if (!endByTimer) // win alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
+ else // defend alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
+}
+
+// *******************************************************
+// ******************* Reward System *********************
+// *******************************************************
+void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/)
+{
+ AchievementEntry const* achievementEntry = sAchievementMgr->GetAchievement(achievement);
+
+ if (!achievementEntry)
+ return;
+
+ switch (achievement)
+ {
+ case ACHIEVEMENTS_WIN_WG_100:
+ {
+ // player->UpdateAchievementCriteria();
+ }
+ default:
+ {
+ if (player)
+ player->CompletedAchievement(achievementEntry);
+ break;
+ }
+ }
+
+}
+
+void BattlefieldWG::OnStartGrouping()
+{
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
+}
+
+uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const
+{
+ switch (areaId)
+ {
+ case AREA_WINTERGRASP_FORTRESS:
+ return BATTLEFIELD_WG_GY_KEEP;
+ case AREA_THE_SUNKEN_RING:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NE;
+ case AREA_THE_BROKEN_TEMPLATE:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NW;
+ case AREA_WESTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SW;
+ case AREA_EASTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SE;
+ case AREA_WINTERGRASP:
+ return BATTLEFIELD_WG_GY_ALLIANCE;
+ case AREA_THE_CHILLED_QUAGMIRE:
+ return BATTLEFIELD_WG_GY_HORDE;
+ default:
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
+ break;
+ }
+
+ return 0;
+}
+
+void BattlefieldWG::OnCreatureCreate(Creature* creature)
+{
+ // Accessing to db spawned creatures
+ switch (creature->GetEntry())
+ {
+ case NPC_DWARVEN_SPIRIT_GUIDE:
+ case NPC_TAUNKA_SPIRIT_GUIDE:
+ {
+ TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
+ uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId());
+ if (m_GraveyardList[graveyardId])
+ m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
+ break;
+ }
+ }
+
+ // untested code - not sure if it is valid.
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ if (!creature->ToTempSummon() || !creature->ToTempSummon()->GetSummonerGUID() || !sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID()))
+ {
+ creature->DespawnOrUnsummon();
+ return;
+ }
+
+ Player* creator = sObjectAccessor->FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
+ TeamId team = creator->GetTeamId();
+
+ if (team == TEAM_HORDE)
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
+ creature->AddAura(SPELL_HORDE_FLAG, creature);
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->DespawnOrUnsummon();
+ return;
+ }
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
+ creature->AddAura(SPELL_ALLIANCE_FLAG, creature);
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->DespawnOrUnsummon();
+ return;
+ }
+ }
+
+ creature->CastSpell(creator, SPELL_GRAB_PASSENGER, true);
+ break;
+ }
+ }
+ }
+}
+
+void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
+{
+/* possibly can be used later
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ uint8 team;
+ if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
+ team = TEAM_ALLIANCE;
+ else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
+ team = TEAM_HORDE;
+ else
+ return;
+
+ m_vehicles[team].erase(creature->GetGUID());
+ if (team == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ UpdateVehicleCountWG();
+
+ break;
+ }
+ }
+ }*/
+}
+
+void BattlefieldWG::OnGameObjectCreate(GameObject* go)
+{
+ uint8 workshopId = 0;
+
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FACTORY_BANNER_NE:
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_NW:
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NW;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SE:
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SW:
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SW;
+ break;
+ default:
+ return;
+ }
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->workshopId == workshopId)
+ {
+ WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam());
+
+ capturePoint->SetCapturePointData(go);
+ capturePoint->LinkToWorkshop(workshop);
+ AddCapturePoint(capturePoint);
+ break;
+ }
+ }
+ }
+}
+
+// Called when player kill a unit in wg zone
+void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
+{
+ if (killer == victim)
+ return;
+
+ bool again = false;
+ TeamId killerTeam = killer->GetTeamId();
+
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->GetDistance2d(killer) < 40)
+ PromotePlayer(player);
+ return;
+ }
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
+ itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
+ {
+ if (Creature* creature = GetCreature(*itr))
+ {
+ if (victim->GetEntry() == creature->GetEntry() && !again)
+ {
+ again = true;
+ for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
+ if (Player* player = sObjectAccessor->FindPlayer(*iter))
+ if (player->GetDistance2d(killer) < 40.0f)
+ PromotePlayer(player);
+ }
+ }
+ }
+ // TODO:Recent PvP activity worldstate
+}
+
+bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
+{
+ for (uint32 itr = 0; itr < 2; ++itr)
+ {
+ if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end())
+ {
+ m_vehicles[itr].erase(vehicle->GetGUID());
+ if (itr == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ return true;
+ }
+ }
+ return false;
+}
+
+void BattlefieldWG::OnUnitDeath(Unit* unit)
+{
+ if (IsWarTime())
+ if (unit->IsVehicle())
+ if (FindAndRemoveVehicleFromList(unit))
+ UpdateVehicleCountWG();
+}
+
+// Update rank for player
+void BattlefieldWG::PromotePlayer(Player* killer)
+{
+ if (!m_isActive)
+ return;
+ // Updating rank of player
+ if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_RECRUIT);
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_RECRUIT, true);
+ }
+ else if (Aura* aur = killer->GetAura(SPELL_CORPORAL))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_CORPORAL);
+ killer->CastSpell(killer, SPELL_LIEUTENANT, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ }
+}
+
+void BattlefieldWG::RemoveAurasFromPlayer(Player* player)
+{
+ player->RemoveAurasDueToSpell(SPELL_RECRUIT);
+ player->RemoveAurasDueToSpell(SPELL_CORPORAL);
+ player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
+ player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
+ player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+ player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
+ player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
+}
+
+void BattlefieldWG::OnPlayerJoinWar(Player* player)
+{
+ RemoveAurasFromPlayer(player);
+
+ player->CastSpell(player, SPELL_RECRUIT, true);
+
+ if (player->GetZoneId() != m_ZoneId)
+ {
+ if (player->GetTeamId() == GetDefenderTeam())
+ player->TeleportTo(571, 5345, 2842, 410, 3.14f);
+ else
+ {
+ if (player->GetTeamId() == TEAM_HORDE)
+ player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f);
+ else
+ player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f);
+ }
+ }
+
+ UpdateTenacity();
+
+ if (player->GetTeamId() == GetAttackerTeam())
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ SendInitWorldStatesTo(player);
+}
+
+void BattlefieldWG::OnPlayerLeaveWar(Player* player)
+{
+ // Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG
+ if (!player->GetSession()->PlayerLogout())
+ {
+ if (player->GetVehicle()) // Remove vehicle of player if he go out.
+ player->GetVehicle()->Dismiss();
+ RemoveAurasFromPlayer(player);
+ }
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerLeaveZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerEnterZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ // Send worldstate to player
+ SendInitWorldStatesTo(player);
+}
+
+uint32 BattlefieldWG::GetData(uint32 data) const
+{
+ switch (data)
+ {
+ // Used to determine when the phasing spells must be casted
+ // See: SpellArea::IsFitToRequirements
+ case AREA_THE_SUNKEN_RING:
+ case AREA_THE_BROKEN_TEMPLATE:
+ case AREA_WESTPARK_WORKSHOP:
+ case AREA_EASTPARK_WORKSHOP:
+ // Graveyards and Workshops are controlled by the same team.
+ if (BfGraveyard const* graveyard = GetGraveyardById(GetSpiritGraveyardId(data)))
+ return graveyard->GetControlTeamId();
+ }
+
+ return Battlefield::GetData(data);
+}
+
+
+void BattlefieldWG::FillInitialWorldStates(WorldPacket& data)
+{
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime() ? 0 : 1); // Note: cleanup these two, their names look awkward
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime() ? 1 : 0);
+
+ for (uint32 i = 0; i < 2; ++i)
+ data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000));
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H);
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A);
+
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ data << (*itr)->m_WorldState << (*itr)->m_State;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state;
+}
+
+void BattlefieldWG::SendInitWorldStatesTo(Player* player)
+{
+ WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8)));
+
+ data << uint32(m_MapId);
+ data << uint32(m_ZoneId);
+ data << uint32(0);
+ data << uint16(10 + BuildingsInZone.size() + WorkshopsList.size()); // Number of fields
+
+ FillInitialWorldStates(data);
+
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::SendInitWorldStatesToAll()
+{
+ for (uint8 team = 0; team < 2; team++)
+ for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ SendInitWorldStatesTo(player);
+}
+
+void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
+{
+// might be some use for this in the future. old code commented out below. KL
+/* if (team == GetDefenderTeam())
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
+ }
+ }*/
+}
+
+// Called when a tower is broke
+void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team)
+{
+ // Destroy an attack tower
+ if (team == GetAttackerTeam())
+ {
+ // Update counter
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1);
+
+ // Remove buff stack on attackers
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
+
+ // Add buff stack to defenders
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_TOWER_CONTROL, true);
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player);
+ }
+
+ // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3)
+ {
+ if (int32(m_Timer - 600000) < 0)
+ m_Timer = 0;
+ else
+ m_Timer -= 600000;
+ SendInitWorldStatesToAll();
+ }
+ }
+ else
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1);
+ }
+}
+
+void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
+{
+ if (!obj || !IsWarTime())
+ return;
+
+ // We handle only gameobjects here
+ GameObject* go = obj->ToGameObject();
+ if (!go)
+ return;
+
+ // On click on titan relic
+ if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC)
+ {
+ if (CanInteractWithRelic())
+ EndBattle(false);
+ else if (GameObject* relic = GetRelic())
+ relic->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ // if destroy or damage event, search the wall/tower and update worldstate/send warning message
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (GameObject* build = GetGameObject((*itr)->m_BuildGUID))
+ {
+ if (go->GetEntry() == build->GetEntry())
+ {
+ if (build->GetGOInfo()->building.damagedEvent == eventId)
+ (*itr)->Damaged();
+
+ if (build->GetGOInfo()->building.destroyedEvent == eventId)
+ (*itr)->Destroyed();
+
+ break;
+ }
+ }
+ }
+}
+
+// Called when a tower is damaged, used for honor reward calcul
+void BattlefieldWG::UpdateDamagedTowerCount(TeamId team)
+{
+ if (team == GetAttackerTeam())
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1);
+}
+
+// Update vehicle count WorldState to player
+void BattlefieldWG::UpdateVehicleCountWG()
+{
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A));
+}
+
+void BattlefieldWG::UpdateTenacity()
+{
+ TeamId team = TEAM_NEUTRAL;
+ uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size();
+ uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size();
+ int32 newStack = 0;
+
+ if (alliancePlayers && hordePlayers)
+ {
+ if (alliancePlayers < hordePlayers)
+ newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance
+ else if (alliancePlayers > hordePlayers)
+ newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde
+ }
+
+ if (newStack == int32(m_tenacityStack))
+ return;
+
+ if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
+ team = TEAM_ALLIANCE;
+ else if (newStack >= 0) // old buff was on horde
+ team = TEAM_HORDE;
+
+ m_tenacityStack = newStack;
+ // Remove old buff
+ if (team != TEAM_NEUTRAL)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->getLevel() >= m_MinLevel)
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
+ }
+
+ // Apply new buff
+ if (newStack)
+ {
+ team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
+
+ if (newStack < 0)
+ newStack = -newStack;
+ if (newStack > 20)
+ newStack = 20;
+
+ uint32 buff_honor = SPELL_GREATEST_HONOR;
+ if (newStack < 15)
+ buff_honor = SPELL_GREATER_HONOR;
+ if (newStack < 10)
+ buff_honor = SPELL_GREAT_HONOR;
+ if (newStack < 5)
+ buff_honor = 0;
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SetAuraStack(SPELL_TENACITY, player, newStack);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
+
+ if (buff_honor != 0)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, buff_honor, true);
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Creature* creature = GetCreature(*itr))
+ creature->CastSpell(creature, buff_honor, true);
+ }
+ }
+}
+
+WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield)
+{
+ m_Bf = battlefield;
+ m_team = teamInControl;
+ m_Workshop = NULL;
+}
+
+void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
+{
+ ASSERT(m_Workshop);
+ m_Workshop->GiveControlTo(m_team, false);
+}
+
+BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield)
+{
+ m_Bf = battlefield;
+}
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
new file mode 100644
index 00000000000..0ac87af94ba
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -0,0 +1,1696 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_WG_
+#define BATTLEFIELD_WG_
+
+#include "ObjectAccessor.h"
+#include "WorldPacket.h"
+#include "Battlefield.h"
+#include "World.h"
+
+class Group;
+class BattlefieldWG;
+class WintergraspCapturePoint;
+
+struct BfWGGameObjectBuilding;
+struct WGWorkshop;
+
+typedef std::set<GameObject*> GameObjectSet;
+typedef std::set<BfWGGameObjectBuilding*> GameObjectBuilding;
+typedef std::set<WGWorkshop*> Workshop;
+typedef std::set<Group*> GroupSet;
+//typedef std::set<WintergraspCapturePoint *> CapturePointSet; unused ?
+
+enum WintergrastData
+{
+ BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp
+ BATTLEFIELD_WG_MAPID = 571 // Northrend
+};
+
+enum WintergraspSpells
+{
+ // Wartime auras
+ SPELL_RECRUIT = 37795,
+ SPELL_CORPORAL = 33280,
+ SPELL_LIEUTENANT = 55629,
+ SPELL_TENACITY = 58549,
+ SPELL_TENACITY_VEHICLE = 59911,
+ SPELL_TOWER_CONTROL = 62064,
+ SPELL_SPIRITUAL_IMMUNITY = 58729,
+ SPELL_GREAT_HONOR = 58555,
+ SPELL_GREATER_HONOR = 58556,
+ SPELL_GREATEST_HONOR = 58557,
+ SPELL_ALLIANCE_FLAG = 14268,
+ SPELL_HORDE_FLAG = 14267,
+ SPELL_GRAB_PASSENGER = 61178,
+
+ // Reward spells
+ SPELL_VICTORY_REWARD = 56902,
+ SPELL_DEFEAT_REWARD = 58494,
+ SPELL_DAMAGED_TOWER = 59135,
+ SPELL_DESTROYED_TOWER = 59136,
+ SPELL_DAMAGED_BUILDING = 59201,
+ SPELL_INTACT_BUILDING = 59203,
+
+ SPELL_TELEPORT_BRIDGE = 59096,
+ SPELL_TELEPORT_FORTRESS = 60035,
+
+ SPELL_TELEPORT_DALARAN = 53360,
+ SPELL_VICTORY_AURA = 60044,
+
+ // Other spells
+ SPELL_WINTERGRASP_WATER = 36444,
+ SPELL_ESSENCE_OF_WINTERGRASP = 58045,
+ SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730,
+
+ // Phasing spells
+ SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618, // ADDS PHASE 16
+ SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617, // ADDS PHASE 32
+
+ SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773, // ADDS PHASE 64
+ SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774 // ADDS PHASE 128
+};
+
+enum WintergraspData
+{
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_MAX
+};
+
+enum WintergraspAchievements
+{
+ ACHIEVEMENTS_WIN_WG = 1717,
+ ACHIEVEMENTS_WIN_WG_100 = 1718, // todo
+ ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo
+ ACHIEVEMENTS_WG_TOWER_DESTROY = 1727,
+ ACHIEVEMENTS_DESTRUCTION_DERBY_A = 1737, // todo
+ ACHIEVEMENTS_WG_TOWER_CANNON_KILL = 1751, // todo
+ ACHIEVEMENTS_WG_MASTER_A = 1752, // todo
+ ACHIEVEMENTS_WIN_WG_TIMER_10 = 1755,
+ ACHIEVEMENTS_STONE_KEEPER_50 = 2085, // todo
+ ACHIEVEMENTS_STONE_KEEPER_100 = 2086, // todo
+ ACHIEVEMENTS_STONE_KEEPER_250 = 2087, // todo
+ ACHIEVEMENTS_STONE_KEEPER_500 = 2088, // todo
+ ACHIEVEMENTS_STONE_KEEPER_1000 = 2089, // todo
+ ACHIEVEMENTS_WG_RANGER = 2199, // todo
+ ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo
+ ACHIEVEMENTS_WG_MASTER_H = 2776 // todo
+};
+
+enum WintergraspWorldStates
+{
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491,
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A = 3680,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A = 3681,
+ BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801,
+ BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802,
+ BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803,
+ BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710
+};
+
+enum WintergraspAreaIds
+{
+ AREA_WINTERGRASP_FORTRESS = 4575,
+ AREA_THE_SUNKEN_RING = 4538,
+ AREA_THE_BROKEN_TEMPLATE = 4539,
+ AREA_WESTPARK_WORKSHOP = 4611,
+ AREA_EASTPARK_WORKSHOP = 4612,
+ AREA_WINTERGRASP = 4197,
+ AREA_THE_CHILLED_QUAGMIRE = 4589
+};
+
+/*#########################
+ *####### Graveyards ######
+ *#########################*/
+
+class BfGraveyardWG : public BfGraveyard
+{
+ public:
+ BfGraveyardWG(BattlefieldWG* Bf);
+
+ void SetTextId(int32 textid) { m_GossipTextId = textid; }
+ int32 GetTextId() { return m_GossipTextId; }
+ protected:
+ int32 m_GossipTextId;
+};
+
+enum WGGraveyardId
+{
+ BATTLEFIELD_WG_GY_WORKSHOP_NE,
+ BATTLEFIELD_WG_GY_WORKSHOP_NW,
+ BATTLEFIELD_WG_GY_WORKSHOP_SE,
+ BATTLEFIELD_WG_GY_WORKSHOP_SW,
+ BATTLEFIELD_WG_GY_KEEP,
+ BATTLEFIELD_WG_GY_HORDE,
+ BATTLEFIELD_WG_GY_ALLIANCE,
+ BATTLEFIELD_WG_GRAVEYARD_MAX
+};
+
+enum WGGossipText
+{
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506
+};
+
+enum WintergraspNpcs
+{
+ BATTLEFIELD_WG_NPC_GUARD_H = 30739,
+ BATTLEFIELD_WG_NPC_GUARD_A = 30740,
+ BATTLEFIELD_WG_NPC_STALKER = 15214,
+
+ BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102,
+ BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101, // <MASTER HEXXER>
+ BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151,
+ BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106,
+ BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053,
+ BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107,
+
+ BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052,
+ BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051, // <ENCHANTRESS>
+ BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172, // <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153,
+ BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
+ BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
+ BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
+
+ NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
+ NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
+ NPC_TOWER_CANNON = 28366,
+
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
+ NPC_WINTERGRASP_CATAPULT = 27881,
+ NPC_WINTERGRASP_DEMOLISHER = 28094,
+ NPC_WINTERGRASP_TOWER_CANNON = 28366
+};
+
+struct BfWGCoordGY
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 gyid;
+ uint8 type;
+ int32 textid; // for gossip menu
+ TeamId startcontrol;
+};
+
+uint32 const WGQuest[2][6] =
+{
+ { 13186, 13181, 13222, 13538, 13177, 13179 },
+ { 13185, 13183, 13223, 13539, 13178, 13180 },
+};
+// 7 in sql, 7 in header
+BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
+{
+ { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
+ { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
+ { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
+ { 4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, BATTLEFIELD_WG_GY_WORKSHOP_SW, BATTLEFIELD_WG_GOSSIPTEXT_GY_SW, TEAM_NEUTRAL },
+ { 5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP, TEAM_NEUTRAL },
+ { 5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE, TEAM_HORDE },
+ { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE },
+};
+
+/* ######################### *
+ * WintergraspCapturePoint *
+ * ######################### */
+
+class WintergraspCapturePoint : public BfCapturePoint
+{
+ public:
+ WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
+
+ void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
+
+ void ChangeTeam(TeamId oldteam);
+ TeamId GetTeam() const { return m_team; }
+
+ protected:
+ WGWorkshop* m_Workshop;
+};
+
+/* ######################### *
+ * WinterGrasp Battlefield *
+ * ######################### */
+
+class BattlefieldWG : public Battlefield
+{
+ public:
+ ~BattlefieldWG();
+ /**
+ * \brief Called when the battle start
+ * - Spawn relic and turret
+ * - Rebuild tower and wall
+ * - Invite player to war
+ */
+ void OnBattleStart();
+
+ /**
+ * \brief Called when battle end
+ * - Remove relic and turret
+ * - Change banner/npc in keep if it needed
+ * - Saving battlestate
+ * - Reward honor/mark to player
+ * - Remove vehicle
+ * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
+ */
+ void OnBattleEnd(bool endByTimer);
+
+ /**
+ * \brief Called when grouping starts (15 minutes before battlestart)
+ * - Invite all player in zone to join queue
+ */
+ void OnStartGrouping();
+
+ /**
+ * \brief Called when player accept invite to join battle
+ * - Update aura
+ * - Teleport if it needed
+ * - Update worldstate
+ * - Update tenacity
+ * \param player: Player who accepted invite
+ */
+ void OnPlayerJoinWar(Player* player);
+
+ /**
+ * \brief Called when player left the battle
+ * - Update player aura
+ * \param player : Player who left the battle
+ */
+ void OnPlayerLeaveWar(Player* player);
+
+ /**
+ * \brief Called when player left the WG zone
+ * \param player : Player who left the zone
+ */
+ void OnPlayerLeaveZone(Player* player);
+
+ /**
+ * \brief Called when player enters in WG zone
+ * - Update aura
+ * - Update worldstate
+ * \param player : Player who enters the zone
+ */
+ void OnPlayerEnterZone(Player* player);
+
+ /**
+ * \brief Called for update battlefield data
+ * - Save battle timer in database every minutes
+ * - Update imunity aura from graveyard
+ * \param diff : time elapsed since the last call (in ms)
+ */
+ bool Update(uint32 diff);
+
+ /**
+ * \brief Called when a creature is created
+ * - Update vehicle count
+ */
+ void OnCreatureCreate(Creature* creature);
+
+ /**
+ * \brief Called when a creature is removed
+ * - Update vehicle count
+ */
+ void OnCreatureRemove(Creature* creature);
+
+ /**
+ * \brief Called when a gameobject is created
+ */
+ void OnGameObjectCreate(GameObject* go);
+
+ /**
+ * \brief Called when a wall/tower is broken
+ * - Update quest
+ */
+ void BrokenWallOrTower(TeamId team);
+
+ /**
+ * \brief Called when a tower is damaged
+ * - Update tower count (for reward calcul)
+ */
+ void UpdateDamagedTowerCount(TeamId team);
+
+ /**
+ * \brief Called when tower is broken
+ * - Update tower buff
+ * - check if three south tower is down for remove 10 minutes to wg
+ */
+ void UpdatedDestroyedTowerCount(TeamId team);
+
+ void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
+
+ void RemoveAurasFromPlayer(Player* player);
+
+ /**
+ * \brief Called when battlefield is setup, at server start
+ */
+ bool SetupBattlefield();
+
+ /// Return pointer to relic object
+ GameObject* GetRelic() { return GetGameObject(m_titansRelicGUID); }
+
+ /// Define relic object
+ void SetRelic(uint64 relicGUID) { m_titansRelicGUID = relicGUID; }
+
+ /// Check if players can interact with the relic (Only if the last door has been broken)
+ bool CanInteractWithRelic() { return m_isRelicInteractible; }
+
+ /// Define if player can interact with the relic
+ void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
+
+ void UpdateVehicleCountWG();
+ void UpdateCounterVehicle(bool init);
+
+ void SendInitWorldStatesTo(Player* player);
+ void SendInitWorldStatesToAll();
+ void FillInitialWorldStates(WorldPacket& data);
+
+ void HandleKill(Player* killer, Unit* victim);
+ void OnUnitDeath(Unit* unit);
+ void PromotePlayer(Player* killer);
+
+ void UpdateTenacity();
+ void ProcessEvent(WorldObject *obj, uint32 eventId);
+
+ bool FindAndRemoveVehicleFromList(Unit* vehicle);
+
+ // returns the graveyardId in the specified area.
+ uint8 GetSpiritGraveyardId(uint32 areaId) const;
+
+ uint32 GetData(uint32 data) const;
+
+ protected:
+ bool m_isRelicInteractible;
+
+ Workshop WorkshopsList;
+
+ GuidSet DefenderPortalList;
+ GuidSet m_KeepGameObject[2];
+ GameObjectBuilding BuildingsInZone;
+
+ GuidSet m_vehicles[2];
+ GuidSet CanonList;
+ GuidSet KeepCreature[2];
+ GuidSet OutsideCreature[2];
+
+ uint32 m_tenacityStack;
+ uint32 m_saveTimer;
+
+ uint64 m_titansRelicGUID;
+};
+
+uint32 const VehNumWorldState[] = { 3680, 3490 };
+uint32 const MaxVehNumWorldState[] = { 3681, 3491 };
+uint32 const ClockWorldState[] = { 3781, 4354 };
+uint32 const WintergraspFaction[] = { 1732, 1735, 35 };
+float const WintergraspStalkerPos[] = { 4948.985f, 2937.789f, 550.5172f, 1.815142f };
+
+uint8 const WG_MAX_OBJ = 32;
+uint8 const WG_MAX_TURRET = 15;
+uint8 const WG_MAX_KEEP_NPC = 39;
+uint8 const WG_MAX_OUTSIDE_NPC = 14;
+uint8 const WG_OUTSIDE_ALLIANCE_NPC = 7;
+uint8 const WG_MAX_TELEPORTER = 12;
+uint8 const WG_MAX_WORKSHOP = 6;
+
+enum WintergraspGameObjectBuildingType
+{
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR,
+ BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC,
+ BATTLEFIELD_WG_OBJECTTYPE_WALL,
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST,
+ BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER,
+ BATTLEFIELD_WG_OBJECTTYPE_TOWER
+};
+
+enum WintergraspGameObjectState
+{
+ BATTLEFIELD_WG_OBJECTSTATE_NONE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY
+};
+
+enum WintergraspWorkshopIds
+{
+ BATTLEFIELD_WG_WORKSHOP_NE,
+ BATTLEFIELD_WG_WORKSHOP_NW,
+ BATTLEFIELD_WG_WORKSHOP_SE,
+ BATTLEFIELD_WG_WORKSHOP_SW,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_WEST,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_EAST
+};
+
+enum WintergraspWorldstates
+{
+ WORLDSTATE_WORKSHOP_NE = 3701,
+ WORLDSTATE_WORKSHOP_NW = 3700,
+ WORLDSTATE_WORKSHOP_SE = 3703,
+ WORLDSTATE_WORKSHOP_SW = 3702,
+ WORLDSTATE_WORKSHOP_K_W = 3698,
+ WORLDSTATE_WORKSHOP_K_E = 3699
+};
+
+enum WintergraspTeamControl
+{
+ BATTLEFIELD_WG_TEAM_ALLIANCE,
+ BATTLEFIELD_WG_TEAM_HORDE,
+ BATTLEFIELD_WG_TEAM_NEUTRAL
+};
+
+// TODO: Handle this with creature_text ?
+enum WintergraspText
+{
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW = 12054,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_ATTACK = 12051,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_TAKEN = 12050,
+ BATTLEFIELD_WG_TEXT_ALLIANCE = 12057,
+ BATTLEFIELD_WG_TEXT_HORDE = 12056,
+ BATTLEFIELD_WG_TEXT_WILL_START = 12058,
+ BATTLEFIELD_WG_TEXT_START = 12067,
+ BATTLEFIELD_WG_TEXT_FIRSTRANK = 12059,
+ BATTLEFIELD_WG_TEXT_SECONDRANK = 12060,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE = 12062,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW = 12064,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE = 12061,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW = 12063,
+ BATTLEFIELD_WG_TEXT_TOWER_DAMAGE = 12065,
+ BATTLEFIELD_WG_TEXT_TOWER_DESTROY = 12066,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_S = 12069,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_E = 12070,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071,
+ BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068,
+ BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072
+};
+
+enum WintergraspGameObject
+{
+ GO_WINTERGRASP_FACTORY_BANNER_NE = 190475,
+ GO_WINTERGRASP_FACTORY_BANNER_NW = 190487,
+ GO_WINTERGRASP_FACTORY_BANNER_SE = 194959,
+ GO_WINTERGRASP_FACTORY_BANNER_SW = 194962,
+
+ GO_WINTERGRASP_TITAN_S_RELIC = 192829,
+
+ GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221,
+ GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373,
+ GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377,
+ GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378,
+
+ GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356,
+ GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357,
+ GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358,
+
+ GO_WINTERGRASP_FORTRESS_GATE = 190375,
+ GO_WINTERGRASP_VAULT_GATE = 191810,
+
+ GO_WINTERGRASP_KEEP_COLLISION_WALL = 194323
+};
+
+struct WintergraspObjectPositionData
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 entryHorde;
+ uint32 entryAlliance;
+};
+
+// *****************************************************
+// ************ Destructible (Wall,Tower..) ************
+// *****************************************************
+
+struct WintergraspBuildingSpawnData
+{
+ uint32 entry;
+ uint32 WorldState;
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 type;
+ uint32 nameId;
+};
+
+struct WintergraspRebuildableBuildingData
+{
+ uint32 entry;
+ uint64 Guid;
+ uint32 WorldState;
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 type;
+ uint32 nameId;
+};
+
+const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] =
+{
+ // Wall (Not spawned in db)
+ // Entry WS X Y Z O type NameID
+ { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191796, 3772, 5384.45f, 2771.84f, 410.27f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191799, 3762, 5371.44f, 2630.61f, 408.816f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191800, 3766, 5301.84f, 2909.09f, 409.866f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191801, 3770, 5301.06f, 2771.41f, 409.901f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191802, 3751, 5280.2f, 2995.58f, 408.825f, 1.61443f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191803, 3752, 5279.14f, 2956.02f, 408.604f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191804, 3767, 5278.69f, 2882.51f, 409.539f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191806, 3769, 5279.5f, 2798.94f, 409.998f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191807, 3759, 5279.94f, 2724.77f, 409.945f, 1.56207f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191808, 3760, 5279.6f, 2683.79f, 409.849f, 1.55334f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191809, 3761, 5330.96f, 2630.78f, 409.283f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190369, 3753, 5256.08f, 2933.96f, 409.357f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190370, 3758, 5257.46f, 2747.33f, 409.743f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190371, 3754, 5214.96f, 2934.09f, 409.19f, -0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190372, 3757, 5215.82f, 2747.57f, 409.188f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190374, 3755, 5162.27f, 2883.04f, 410.256f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190376, 3756, 5163.72f, 2799.84f, 409.227f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // Tower of keep (Not spawned in db)
+ { 190221, 3711, 5281.15f, 3044.59f, 407.843f, 3.11539f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW },
+ { 190373, 3713, 5163.76f, 2932.23f, 409.19f, 3.12412f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW },
+ { 190377, 3714, 5166.4f, 2748.37f, 409.188f, -1.5708f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE },
+ { 190378, 3712, 5281.19f, 2632.48f, 409.099f, -1.58825f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE },
+
+ // Wall (with passage) (Not spawned in db)
+ { 191797, 3765, 5343.29f, 2908.86f, 409.576f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191798, 3771, 5342.72f, 2771.39f, 409.625f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191805, 3768, 5279.13f, 2840.8f, 409.783f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // South tower (Not spawned in db)
+ { 190356, 3704, 4557.17f, 3623.94f, 395.883f, 1.67552f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_W },
+ { 190357, 3705, 4398.17f, 2822.5f, 405.627f, -3.12412f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_S },
+ { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E },
+
+ // Door of forteress (Not spawned in db)
+ { GO_WINTERGRASP_FORTRESS_GATE, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 },
+
+ // Last door (Not spawned in db)
+ { GO_WINTERGRASP_VAULT_GATE, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 },
+};
+
+const Position WGTurret[WG_MAX_TURRET] =
+{
+ { 5391.19f, 3060.8f, 419.616f, 1.69557f },
+ { 5266.75f, 2976.5f, 421.067f, 3.20354f },
+ { 5234.86f, 2948.8f, 420.88f, 1.61311f },
+ { 5323.05f, 2923.7f, 421.645f, 1.5817f },
+ { 5363.82f, 2923.87f, 421.709f, 1.60527f },
+ { 5264.04f, 2861.34f, 421.587f, 3.21142f },
+ { 5264.68f, 2819.78f, 421.656f, 3.15645f },
+ { 5322.16f, 2756.69f, 421.646f, 4.69978f },
+ { 5363.78f, 2756.77f, 421.629f, 4.78226f },
+ { 5236.2f, 2732.68f, 421.649f, 4.72336f },
+ { 5265.02f, 2704.63f, 421.7f, 3.12507f },
+ { 5350.87f, 2616.03f, 421.243f, 4.72729f },
+ { 5390.95f, 2615.5f, 421.126f, 4.6409f },
+ { 5148.8f, 2820.24f, 421.621f, 3.16043f },
+ { 5147.98f, 2861.93f, 421.63f, 3.18792f },
+};
+
+// Here there is all npc keeper spawn point
+const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] =
+{
+ // X Y Z O horde alliance
+ // North East
+ { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather
+ { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ // North
+ { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar
+ { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin
+ { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster
+ { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh
+ { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath
+ // X Y Z O horde alliance
+ // North West
+ { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof
+ { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort
+ { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ // South
+ { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp
+ // X Y Z O horde alliance
+ // Portal guards (from around the fortress)
+ { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard
+};
+
+const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
+{
+ { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 },
+ { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 },
+ { 4994.85f, 3660.51f, 359.150f, 2.260f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 },
+ { 5015.46f, 3677.11f, 362.970f, 6.009f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 },
+ { 5031.12f, 3663.77f, 363.500f, 3.110f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 },
+ { 5042.74f, 3675.82f, 363.060f, 3.358f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 },
+ { 5014.45f, 3640.87f, 361.390f, 3.280f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 },
+ { 5100.07f, 2168.89f, 365.779f, 1.972f, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH },
+ { 5081.70f, 2173.73f, 365.878f, 0.855f, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA },
+ { 5078.28f, 2183.70f, 365.029f, 1.466f, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH },
+ { 5088.49f, 2188.18f, 365.647f, 5.253f, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS },
+ { 5095.67f, 2193.28f, 365.924f, 4.939f, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE },
+ { 5088.61f, 2167.66f, 365.689f, 0.680f, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA },
+ { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO },
+};
+
+struct WintergraspTeleporterData
+{
+ uint32 entry;
+ float x;
+ float y;
+ float z;
+ float o;
+};
+
+const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
+{
+ // Player teleporter
+ { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f },
+ { 190763, 5268.70f, 2666.42f, 409.099f, -0.715f },
+ { 190763, 5197.05f, 2944.81f, 409.191f, 2.3387f },
+ { 190763, 5196.67f, 2737.34f, 409.189f, -2.932f },
+ { 190763, 5314.58f, 3055.85f, 408.862f, 0.5410f },
+ { 190763, 5391.28f, 2828.09f, 418.675f, -2.164f },
+ { 190763, 5153.93f, 2781.67f, 409.246f, 1.6580f },
+ { 190763, 5311.44f, 2618.93f, 409.092f, -2.373f },
+ { 190763, 5269.21f, 3013.84f, 408.828f, -1.762f },
+ { 190763, 5401.62f, 2853.66f, 418.674f, 2.6354f },
+ // Vehicle teleporter
+ { 192951, 5314.51f, 2703.69f, 408.550f, -0.890f },
+ { 192951, 5316.25f, 2977.04f, 408.539f, -0.820f },
+};
+
+// *********************************************************
+// **********Tower Element(GameObject,Creature)*************
+// *********************************************************
+
+struct WintergraspTowerData
+{
+ uint32 towerEntry; // Gameobject id of tower
+ uint8 nbObject; // Number of gameobjects spawned on this point
+ WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance)
+
+ // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage?
+ uint8 nbCreatureBottom;
+ WintergraspObjectPositionData CreatureBottom[9];
+ uint8 nbCreatureTop;
+ WintergraspObjectPositionData CreatureTop[5];
+};
+
+uint8 const WG_MAX_ATTACKTOWERS = 3;
+// 192414 : 0 in sql, 1 in header
+// 192278 : 0 in sql, 3 in header
+const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] =
+{
+ // West tower
+ {
+ 190356,
+ 6,
+ {
+ { 4559.109863f, 3606.219971f, 419.998993f, -1.483530f, 192488, 192501 }, // Flag on tower
+ { 4539.419922f, 3622.489990f, 420.033997f, -3.071770f, 192488, 192501 }, // Flag on tower
+ { 4555.259766f, 3641.649902f, 419.973999f, 1.675510f, 192488, 192501 }, // Flag on tower
+ { 4574.870117f, 3625.909912f, 420.079010f, 0.080117f, 192488, 192501 }, // Flag on tower
+ { 4433.899902f, 3534.139893f, 360.274994f, -1.850050f, 192269, 192278 }, // Flag near workshop
+ { 4572.930176f, 3475.520020f, 363.009003f, 1.42240f, 192269, 192278 } // Flag near bridge
+ },
+ 1,
+ {
+ { 4418.688477f, 3506.251709f, 358.975494f, 4.293305f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ }
+ },
+
+ // South Tower
+ {
+ 190357,
+ 5,
+ {
+ { 4416.000000f, 2822.669922f, 429.851013f, -0.017452f, 192488, 192501 }, // Flag on tower
+ { 4398.819824f, 2804.699951f, 429.791992f, -1.588250f, 192488, 192501 }, // Flag on tower
+ { 4387.620117f, 2719.570068f, 389.934998f, -1.544620f, 192366, 192414 }, // Flag near tower
+ { 4464.120117f, 2855.449951f, 406.110992f, 0.829032f, 192366, 192429 }, // Flag near tower
+ { 4526.459961f, 2810.179932f, 391.200012f, -2.993220f, 192269, 192278 }, // Flag near bridge
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 6,
+ {
+ { 4452.859863f, 2808.870117f, 402.604004f, 6.056290f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4455.899902f, 2835.958008f, 401.122559f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.649414f, 2953.792236f, 374.799957f, 0.980838f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 4362.089844f, 2811.510010f, 407.337006f, 3.193950f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.290039f, 2753.790039f, 401.015015f, 5.829400f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4421.939941f, 2773.189941f, 400.894989f, 5.707230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+
+ // East Tower
+ {
+ 190358,
+ 4,
+ {
+ { 4466.790039f, 1960.420044f, 459.144012f, 1.151920f, 192488, 192501 }, // Flag on tower
+ { 4475.350098f, 1937.030029f, 459.070007f, -0.43633f, 192488, 192501 }, // Flag on tower
+ { 4451.759766f, 1928.099976f, 459.075989f, -2.00713f, 192488, 192501 }, // Flag on tower
+ { 4442.990234f, 1951.900024f, 459.092987f, 2.740160f, 192488, 192501 }, // Flag on tower
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 5,
+ {
+ { 4501.060059f, 1990.280029f, 431.157013f, 1.029740f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4463.830078f, 2015.180054f, 430.299988f, 1.431170f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4494.580078f, 1943.760010f, 435.627014f, 6.195920f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4450.149902f, 1897.579956f, 435.045013f, 4.398230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4428.870117f, 1906.869995f, 432.648010f, 3.996800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+};
+
+struct WintergraspTowerCannonData
+{
+ uint32 towerEntry;
+ uint8 nbTowerCannonBottom;
+ Position TowerCannonBottom[5];
+ uint8 nbTurretTop;
+ Position TurretTop[5];
+};
+
+const uint8 WG_MAX_TOWER_CANNON = 7;
+
+const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] =
+{
+ {
+ 190221,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5255.88f, 3047.63f, 438.499f, 3.13677f },
+ { 5280.9f, 3071.32f, 438.499f, 1.62879f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190373,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5138.59f, 2935.16f, 439.845f, 3.11723f },
+ { 5163.06f, 2959.52f, 439.846f, 1.47258f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190377,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5163.84f, 2723.74f, 439.844f, 1.3994f },
+ { 5139.69f, 2747.4f, 439.844f, 3.17221f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190378,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5278.21f, 2607.23f, 439.755f, 4.71944f },
+ { 5255.01f, 2631.98f, 439.755f, 3.15257f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190356,
+ 2,
+ {
+ {4537.380371f, 3599.531738f, 402.886993f, 3.998462f},
+ {4581.497559f, 3604.087158f, 402.886963f, 5.651723f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ 2,
+ {
+ {4469.448242f, 1966.623779f, 465.647217f, 1.153573f},
+ {4581.895996f, 3626.438477f, 426.539062f, 0.117806f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ },
+ {
+ 190357,
+ 2,
+ {
+ { 4421.640137f, 2799.935791f, 412.630920f, 5.459298f },
+ { 4420.263184f, 2845.340332f, 412.630951f, 0.742197f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 3,
+ {
+ { 4423.430664f, 2822.762939f, 436.283142f, 6.223487f },
+ { 4397.825684f, 2847.629639f, 436.283325f, 1.579430f },
+ { 4398.814941f, 2797.266357f, 436.283051f, 4.703747f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190358,
+ 2,
+ {
+ { 4448.138184f, 1974.998779f, 441.995911f, 1.967238f },
+ { 4448.713379f, 1955.148682f, 441.995178f, 0.380733f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 4469.448242f, 1966.623779f, 465.647217f, 1.153573f },
+ { 4481.996582f, 1933.658325f, 465.647186f, 5.873029f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+};
+
+// *********************************************************
+// *****************WorkShop Data & Element*****************
+// *********************************************************
+
+struct WGWorkshopData
+{
+ uint8 id;
+ uint32 worldstate;
+ uint32 text;
+};
+
+const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
+{
+ // NE
+ {BATTLEFIELD_WG_WORKSHOP_NE, WORLDSTATE_WORKSHOP_NE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE},
+ // NW
+ {BATTLEFIELD_WG_WORKSHOP_NW, WORLDSTATE_WORKSHOP_NW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW},
+ // SE
+ {BATTLEFIELD_WG_WORKSHOP_SE, WORLDSTATE_WORKSHOP_SE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE},
+ // SW
+ {BATTLEFIELD_WG_WORKSHOP_SW, WORLDSTATE_WORKSHOP_SW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW},
+ // KEEP WEST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, WORLDSTATE_WORKSHOP_K_W, 0},
+ // KEEP EAST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, WORLDSTATE_WORKSHOP_K_E, 0}
+};
+
+// ********************************************************************
+// * Structs using for Building,Graveyard,Workshop *
+// ********************************************************************
+// Structure for different buildings that can be destroyed during battle
+struct BfWGGameObjectBuilding
+{
+ BfWGGameObjectBuilding(BattlefieldWG* WG)
+ {
+ m_WG = WG;
+ m_Team = 0;
+ m_BuildGUID = 0;
+ m_Type = 0;
+ m_WorldState = 0;
+ m_State = 0;
+ m_NameId = 0;
+ }
+
+ // the team that controls this point
+ uint8 m_Team;
+
+ // WG object
+ BattlefieldWG* m_WG;
+
+ // Linked gameobject
+ uint64 m_BuildGUID;
+
+ // eWGGameObjectBuildingType
+ uint32 m_Type;
+
+ // WorldState
+ uint32 m_WorldState;
+
+ // eWGGameObjectState
+ uint32 m_State;
+
+ // Name id for warning text
+ uint32 m_NameId;
+
+ // GameObject associations
+ GuidSet m_GameObjectList[2];
+
+ // Creature associations
+ GuidSet m_CreatureBottomList[2];
+ GuidSet m_CreatureTopList[2];
+ GuidSet m_TowerCannonBottomList;
+ GuidSet m_TurretTopList;
+
+ void Rebuild()
+ {
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
+ {
+ // Rebuild gameobject
+ if (build->IsDestructibleBuilding())
+ {
+ build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ if (build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
+ if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f))
+ go->EnableCollision(true);
+
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+ }
+ UpdateCreatureAndGo();
+ build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
+ }
+ }
+
+ // Called when associated gameobject is damaged
+ void Damaged()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Send warning message
+ if (m_NameId) // tower damage + name
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
+
+ if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam());
+ else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam());
+ }
+
+ // Called when associated gameobject is destroyed
+ void Destroyed()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warn players
+ if (m_NameId)
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ switch (m_Type)
+ {
+ // Inform the global wintergrasp script of the destruction of this object
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team));
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
+ if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f))
+ go->EnableCollision(false);
+ m_WG->SetRelicInteractible(true);
+ if (m_WG->GetRelic())
+ m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found.");
+ break;
+ }
+
+ m_WG->BrokenWallOrTower(TeamId(m_Team));
+ }
+
+ void Init(GameObject* go, uint32 type, uint32 worldstate, uint32 nameid)
+ {
+ if (!go)
+ return;
+
+ // GameObject associated to object
+ m_BuildGUID = go->GetGUID();
+
+ // Type of building (WALL/TOWER/DOOR)
+ m_Type = type;
+
+ // WorldState for client (icon on map)
+ m_WorldState = worldstate;
+
+ // NameId for Warning text
+ m_NameId = nameid;
+
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ m_State = sWorld->getWorldState(m_WorldState);
+ switch (m_State)
+ {
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
+ go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
+ go->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
+ break;
+ }
+
+ int32 towerid = -1;
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ towerid = 0;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ towerid = 1;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ towerid = 2;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ towerid = 3;
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ towerid = 4;
+ break;
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ towerid = 5;
+ break;
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ towerid = 6;
+ break;
+ }
+
+ if (towerid > 3) // Attacker towers
+ {
+ // Spawn associate gameobjects
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++)
+ {
+ WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i];
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_HORDE].insert(go->GetGUID());
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_ALLIANCE].insert(go->GetGUID());
+ }
+
+ // Spawn associate npc bottom
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawn associate npc top
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+ }
+
+ if (towerid >= 0)
+ {
+ // Spawn Turret bottom
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++)
+ {
+ Position turretPos;
+ TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos);
+ if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE))
+ {
+ m_TowerCannonBottomList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+
+ // Spawn Turret top
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++)
+ {
+ Position towerCannonPos;
+ TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
+ if (Creature* turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0)))
+ {
+ m_TurretTopList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+ UpdateCreatureAndGo();
+ }
+ }
+
+ void UpdateCreatureAndGo()
+ {
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, true);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, true);
+
+ for (GuidSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ for (GuidSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ void UpdateTurretAttack(bool disable)
+ {
+ for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
+ {
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ {
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (build->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ {
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ {
+ if (GameObject* build = m_WG->GetGameObject(m_BuildGUID))
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (build->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+struct WGWorkshop
+{
+ // pointer to the battlefield that the workshop belongs to
+ BattlefieldWG* bf;
+ // id of the workshop, useful to retrieve data of the WorkshopsData array
+ uint8 workshopId;
+ // team that controls the node
+ uint8 teamControl;
+ // for worldstate
+ uint32 state;
+
+ WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId)
+ {
+ ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
+
+ bf = _bf;
+ workshopId = _workshopId;
+ }
+
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player to inform a faction attack to a workshop
+ // alliance / horde attacking a workshop
+ bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Updating worldstate
+ state = team == BATTLEFIELD_WG_TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text+1);
+
+ // Found associate graveyard and update it
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (bf->GetGraveyardById(workshopId))
+ bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE);
+
+ teamControl = team;
+ break;
+ }
+ }
+
+ if (!init)
+ bf->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl));
+ else
+ GiveControlTo(bf->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state);
+ }
+};
+
+// Structure for the 6 workshop
+struct WintergraspWorkshopData
+{
+ BattlefieldWG* m_WG; // Pointer to wintergrasp
+ uint64 m_BuildGUID;
+ uint32 m_Type;
+ uint32 m_State; // For worldstate
+ uint32 m_WorldState;
+ uint32 m_TeamControl; // Team witch control the workshop
+ GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
+ GuidSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
+ uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
+
+ WintergraspWorkshopData(BattlefieldWG* WG)
+ {
+ m_WG = WG;
+ m_BuildGUID = 0;
+ m_Type = 0;
+ m_State = 0;
+ m_WorldState = 0;
+ m_TeamControl = 0;
+ m_NameId = 0;
+ }
+
+ // Spawning associate creature and store them
+ void AddCreature(WintergraspObjectPositionData obj)
+ {
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
+ m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
+
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
+ m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawning Associate gameobject and store them
+ void AddGameObject(WintergraspObjectPositionData obj)
+ {
+ if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject->GetGUID());
+ if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject->GetGUID());
+ }
+
+ // Init method, setup variable
+ void Init(uint32 worldstate, uint32 type, uint32 nameid)
+ {
+ m_WorldState = worldstate;
+ m_Type = type;
+ m_NameId = nameid;
+ }
+
+ // Called on change faction in CapturePoint class
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player for inform a faction attack a workshop
+ // alliance / horde attacking workshop
+ m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ {
+ // Show Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
+
+ // Hide Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
+
+ // Show Alliance gameobject
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide Horde gameobject
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
+
+
+ // Updating worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ // Found associate graveyard and update it
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE);
+
+ m_TeamControl = team;
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Show Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
+
+ // Hide Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Creature* creature = m_WG->GetCreature(*itr))
+ m_WG->HideNpc(creature);
+
+ // Hide Alliance gameobject
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Show Horde gameobject
+ for (GuidSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ if (GameObject* object = m_WG->GetGameObject(*itr))
+ object->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Update worlstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - horde
+ m_WG->SendWarningToAllInZone(m_NameId + 1);
+
+ // Update graveyard control
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE);
+
+ m_TeamControl = team;
+ break;
+ }
+ }
+ if (!init)
+ m_WG->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl));
+ else
+ GiveControlTo(m_WG->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+#endif
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 89151b6395c..628eb5ff3c1 100755..100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -22,18 +22,14 @@
#include "World.h"
#include "Group.h"
#include "ArenaTeamMgr.h"
+#include "Player.h"
+#include "WorldSession.h"
+#include "Opcodes.h"
ArenaTeam::ArenaTeam()
+ : TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
+ BorderStyle(0), BorderColor(0)
{
- TeamId = 0;
- Type = 0;
- TeamName = "";
- CaptainGuid = 0;
- BackgroundColor = 0;
- EmblemStyle = 0;
- EmblemColor = 0;
- BorderStyle = 0;
- BorderColor = 0;
Stats.WeekGames = 0;
Stats.SeasonGames = 0;
Stats.Rank = 0;
@@ -43,17 +39,16 @@ ArenaTeam::ArenaTeam()
}
ArenaTeam::~ArenaTeam()
-{
-}
+{ }
-bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
+bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
{
// Check if captain is present
if (!ObjectAccessor::FindPlayer(captainGuid))
return false;
// Check if arena team name is already taken
- if (sArenaTeamMgr->GetArenaTeamByName(TeamName))
+ if (sArenaTeamMgr->GetArenaTeamByName(teamName))
return false;
// Generate new arena team id
@@ -87,7 +82,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin
// Add captain as member
AddMember(CaptainGuid);
- sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
+ sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
return true;
}
@@ -125,7 +120,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
- sLog->outError("Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
return false;
}
@@ -184,7 +179,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
- sLog->outArena("Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u, Name: %s].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId(), GetName().c_str());
return true;
}
@@ -250,8 +245,8 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
// Delete member if character information is missing
if (newMember.Name.empty())
{
- sLog->outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
- this->DelMember(newMember.Guid, true);
+ sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
+ DelMember(newMember.Guid, true);
continue;
}
@@ -267,7 +262,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
+ sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
@@ -291,14 +286,15 @@ void ArenaTeam::SetCaptain(uint64 guid)
CharacterDatabase.Execute(stmt);
// Enable remove/promote buttons
- Player* newCaptain = ObjectAccessor::FindPlayer(guid);
- if (newCaptain)
+ if (Player* newCaptain = ObjectAccessor::FindPlayer(guid))
{
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
- char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : "";
- uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;
- sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
- oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
+ if (oldCaptain)
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
+ oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(),
+ newCaptain->GetGUIDLow(), GetId(), GetType());
+ }
}
}
@@ -306,13 +302,11 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
{
// Remove member from team
for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
- {
if (itr->Guid == guid)
{
Members.erase(itr);
break;
}
- }
// Inform player and remove arena team info from player data
if (Player* player = ObjectAccessor::FindPlayer(guid))
@@ -321,7 +315,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
// delete all info regarding this team
for (uint32 i = 0; i < ARENA_TEAM_END; ++i)
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
- sLog->outArena("Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId());
}
// Only used for single member deletion, for arena team disband we use a single query for more efficiency
@@ -343,10 +337,10 @@ void ArenaTeam::Disband(WorldSession* session)
// Broadcast update
if (session)
{
- BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
+ BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName().c_str(), GetName(), "");
if (Player* player = session->GetPlayer())
- sLog->outArena("Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId());
}
// Update database
@@ -488,7 +482,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
player->GetSession()->SendPacket(packet);
}
-void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3)
+void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
{
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1);
data << uint8(event);
@@ -507,7 +501,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
data << str1 << str2 << str3;
break;
default:
- sLog->outError("Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
+ sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
return;
}
@@ -519,6 +513,23 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_EVENT");
}
+void ArenaTeam::MassInviteToEvent(WorldSession* session)
+{
+ WorldPacket data(SMSG_CALENDAR_ARENA_TEAM, (Members.size() - 1) * (4 + 8 + 1));
+ data << uint32(Members.size() - 1);
+
+ for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr)
+ {
+ if (itr->Guid != session->GetPlayer()->GetGUID())
+ {
+ data.appendPackGUID(itr->Guid);
+ data << uint8(0); // unk
+ }
+ }
+
+ session->SendPacket(&data);
+}
+
uint8 ArenaTeam::GetSlotByType(uint32 type)
{
switch (type)
@@ -529,7 +540,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
default:
break;
}
- sLog->outError("FATAL: Unknown arena team type %u for some arena team", type);
+ sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type);
return 0xFF;
}
diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h
index d8ad2c09e59..137ac93d3c0 100755..100644
--- a/src/server/game/Battlegrounds/ArenaTeam.h
+++ b/src/server/game/Battlegrounds/ArenaTeam.h
@@ -119,7 +119,7 @@ class ArenaTeam
ArenaTeam();
~ArenaTeam();
- bool Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
+ bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
void Disband(WorldSession* session);
typedef std::list<ArenaTeamMember> MemberList;
@@ -129,7 +129,7 @@ class ArenaTeam
uint8 GetSlot() const { return GetSlotByType(GetType()); }
static uint8 GetSlotByType(uint32 type);
uint64 GetCaptain() const { return CaptainGuid; }
- std::string GetName() const { return TeamName; }
+ std::string const& GetName() const { return TeamName; }
const ArenaTeamStats& GetStats() const { return Stats; }
uint32 GetRating() const { return Stats.Rating; }
@@ -149,7 +149,7 @@ class ArenaTeam
bool IsMember(uint64 guid) const;
ArenaTeamMember* GetMember(uint64 guid);
- ArenaTeamMember* GetMember(const std::string& name);
+ ArenaTeamMember* GetMember(std::string const& name);
bool IsFighting() const;
@@ -159,9 +159,11 @@ class ArenaTeam
void SaveToDB();
void BroadcastPacket(WorldPacket* packet);
- void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3);
+ void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
void NotifyStatsChanged();
+ void MassInviteToEvent(WorldSession* session);
+
void Roster(WorldSession* session);
void Query(WorldSession* session);
void SendStats(WorldSession* session);
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index 1c24dfc061d..8a2dcecd209 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -22,6 +22,7 @@
#include "DatabaseEnv.h"
#include "Language.h"
#include "ObjectAccessor.h"
+#include "Player.h"
ArenaTeamMgr::ArenaTeamMgr()
{
@@ -81,7 +82,7 @@ uint32 ArenaTeamMgr::GenerateArenaTeamId()
{
if (NextArenaTeamId >= 0xFFFFFFFE)
{
- sLog->outError("Arena team ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena team ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return NextArenaTeamId++;
@@ -101,8 +102,7 @@ void ArenaTeamMgr::LoadArenaTeams()
if (!result)
{
- sLog->outString(">> Loaded 0 arena teams. DB table `arena_team` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
return;
}
@@ -132,8 +132,7 @@ void ArenaTeamMgr::LoadArenaTeams()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ArenaTeamMgr::DistributeArenaPoints()
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 456915d1ca4..22f960ceaef 100755..100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -16,24 +16,24 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Player.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "World.h"
-#include "WorldPacket.h"
#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "Creature.h"
#include "Formulas.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
-#include "Language.h"
#include "MapManager.h"
#include "Object.h"
-#include "SpellAuras.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ReputationMgr.h"
#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
#include "Util.h"
+#include "World.h"
+#include "WorldPacket.h"
namespace Trinity
{
@@ -162,35 +162,34 @@ Battleground::Battleground()
m_MapId = 0;
m_Map = NULL;
+ m_StartMaxDist = 0.0f;
- m_TeamStartLocX[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocX[BG_TEAM_HORDE] = 0;
-
- m_TeamStartLocY[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocY[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocX[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocX[TEAM_HORDE] = 0;
- m_TeamStartLocZ[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocZ[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocY[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocY[TEAM_HORDE] = 0;
- m_TeamStartLocO[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocO[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocZ[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocZ[TEAM_HORDE] = 0;
- m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0;
- m_ArenaTeamIds[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocO[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocO[TEAM_HORDE] = 0;
- m_StartMaxDist = 0.0f;
+ m_ArenaTeamIds[TEAM_ALLIANCE] = 0;
+ m_ArenaTeamIds[TEAM_HORDE] = 0;
- m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0;
- m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0;
+ m_ArenaTeamRatingChanges[TEAM_ALLIANCE] = 0;
+ m_ArenaTeamRatingChanges[TEAM_HORDE] = 0;
- m_BgRaids[BG_TEAM_ALLIANCE] = NULL;
- m_BgRaids[BG_TEAM_HORDE] = NULL;
+ m_BgRaids[TEAM_ALLIANCE] = NULL;
+ m_BgRaids[TEAM_HORDE] = NULL;
- m_PlayersCount[BG_TEAM_ALLIANCE] = 0;
- m_PlayersCount[BG_TEAM_HORDE] = 0;
+ m_PlayersCount[TEAM_ALLIANCE] = 0;
+ m_PlayersCount[TEAM_HORDE] = 0;
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
+ m_TeamScores[TEAM_ALLIANCE] = 0;
+ m_TeamScores[TEAM_HORDE] = 0;
m_PrematureCountDown = false;
@@ -219,7 +218,7 @@ Battleground::~Battleground()
for (uint32 i = 0; i < size; ++i)
DelObject(i);
- sBattlegroundMgr->RemoveBattleground(GetInstanceID(), GetTypeID());
+ sBattlegroundMgr->RemoveBattleground(GetTypeID(), GetInstanceID());
// unload map
if (m_Map)
{
@@ -261,7 +260,10 @@ void Battleground::Update(uint32 diff)
{
case STATUS_WAIT_JOIN:
if (GetPlayersSize())
+ {
_ProcessJoin(diff);
+ _CheckSafePositions(diff);
+ }
break;
case STATUS_IN_PROGRESS:
_ProcessOfflineQueue();
@@ -294,11 +296,37 @@ void Battleground::Update(uint32 diff)
// Update start time and reset stats timer
m_StartTime += diff;
m_ResetStatTimer += diff;
- m_ValidStartPositionTimer += diff;
PostUpdateImpl(diff);
}
+inline void Battleground::_CheckSafePositions(uint32 diff)
+{
+ float maxDist = GetStartMaxDist();
+ if (!maxDist)
+ return;
+
+ m_ValidStartPositionTimer += diff;
+ if (m_ValidStartPositionTimer >= CHECK_PLAYER_POSITION_INVERVAL)
+ {
+ m_ValidStartPositionTimer = 0;
+
+ Position pos;
+ float x, y, z, o;
+ for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
+ if (Player* player = ObjectAccessor::FindPlayer(itr->first))
+ {
+ player->GetPosition(&pos);
+ GetTeamStartLoc(player->GetBGTeam(), x, y, z, o);
+ if (pos.GetExactDistSq(x, y, z) > maxDist)
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", player->GetName().c_str(), GetMapId());
+ player->TeleportTo(GetMapId(), x, y, z, o);
+ }
+ }
+ }
+}
+
inline void Battleground::_ProcessOfflineQueue()
{
// remove offline players from bg after 5 minutes
@@ -315,7 +343,6 @@ inline void Battleground::_ProcessOfflineQueue()
}
}
}
-
}
inline void Battleground::_ProcessRessurect(uint32 diff)
@@ -377,6 +404,17 @@ inline void Battleground::_ProcessRessurect(uint32 diff)
}
}
+uint32 Battleground::GetPrematureWinner()
+{
+ uint32 winner = 0;
+ if (GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam())
+ winner = ALLIANCE;
+ else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam())
+ winner = HORDE;
+
+ return winner;
+}
+
inline void Battleground::_ProcessProgress(uint32 diff)
{
// *********************************************************
@@ -391,13 +429,7 @@ inline void Battleground::_ProcessProgress(uint32 diff)
else if (m_PrematureCountDownTimer < diff)
{
// time's up!
- uint32 winner = 0;
- if (GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam())
- winner = ALLIANCE;
- else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam())
- winner = HORDE;
-
- EndBattleground(winner);
+ EndBattleground(GetPrematureWinner());
m_PrematureCountDown = false;
}
else if (!sBattlegroundMgr->isTesting())
@@ -440,7 +472,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
if (!FindBgMap())
{
- sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
EndNow();
return;
}
@@ -496,20 +528,23 @@ inline void Battleground::_ProcessJoin(uint32 diff)
player->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
player->ResetAllPowers();
- // remove auras with duration lower than 30s
- Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras();
- for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
+ if (!player->isGameMaster())
{
- AuraApplication * aurApp = iter->second;
- Aura* aura = aurApp->GetBase();
- if (!aura->IsPermanent()
- && aura->GetDuration() <= 30*IN_MILLISECONDS
- && aurApp->IsPositive()
- && (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
- && (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
- player->RemoveAura(iter);
- else
- ++iter;
+ // remove auras with duration lower than 30s
+ Unit::AuraApplicationMap & auraMap = player->GetAppliedAuras();
+ for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
+ {
+ AuraApplication * aurApp = iter->second;
+ Aura* aura = aurApp->GetBase();
+ if (!aura->IsPermanent()
+ && aura->GetDuration() <= 30*IN_MILLISECONDS
+ && aurApp->IsPositive()
+ && (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
+ && (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
+ player->RemoveAura(iter);
+ else
+ ++iter;
+ }
}
}
@@ -530,33 +565,6 @@ inline void Battleground::_ProcessJoin(uint32 diff)
sWorld->SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
}
}
-
- // Find if the player left our start zone; if so, teleport it back
- if (m_ValidStartPositionTimer > 1000)
- {
- m_ValidStartPositionTimer = 0;
- float maxDist = GetStartMaxDist();
- if (maxDist > 0.0f)
- {
- for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- {
- if (Player *plr = ObjectAccessor::FindPlayer(itr->first))
- {
- float x, y, z, o;
- uint32 team = plr->GetBGTeam();
- GetTeamStartLoc(team, x, y, z, o);
-
- float dist = plr->GetDistance(x, y, z);
-
- if (dist >= maxDist)
- {
- sLog->outError("BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", plr->GetName(), GetMapId());
- plr->TeleportTo(GetMapId(), x, y, z, o);
- }
- }
- }
- }
- }
}
inline void Battleground::_ProcessLeave(uint32 diff)
@@ -581,30 +589,30 @@ inline void Battleground::_ProcessLeave(uint32 diff)
}
}
-inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, const char* context) const
+inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, char const* context) const
{
Player* player = NULL;
if (!offlineRemove)
{
player = ObjectAccessor::FindPlayer(guid);
if (!player)
- sLog->outError("Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::%s: player (GUID: %u) not found for BG (map: %u, instance id: %u)!",
context, GUID_LOPART(guid), m_MapId, m_InstanceID);
}
return player;
}
-inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::iterator itr, const char* context)
+inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::iterator itr, char const* context)
{
return _GetPlayer(itr->first, itr->second.OfflineRemoveTime, context);
}
-inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::const_iterator itr, const char* context) const
+inline Player* Battleground::_GetPlayer(BattlegroundPlayerMap::const_iterator itr, char const* context) const
{
return _GetPlayer(itr->first, itr->second.OfflineRemoveTime, context);
}
-inline Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, const char* context) const
+inline Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayerMap::const_iterator itr, char const* context) const
{
Player* player = _GetPlayer(itr, context);
if (player)
@@ -620,7 +628,7 @@ inline Player* Battleground::_GetPlayerForTeam(uint32 teamId, BattlegroundPlayer
void Battleground::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O)
{
- BattlegroundTeamId idx = GetTeamIndexByTeamId(TeamID);
+ TeamId idx = GetTeamIndexByTeamId(TeamID);
m_TeamStartLocX[idx] = X;
m_TeamStartLocY[idx] = Y;
m_TeamStartLocZ[idx] = Z;
@@ -639,7 +647,12 @@ void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player*
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* player = _GetPlayerForTeam(TeamID, itr, "SendPacketToTeam"))
if (self || sender != player)
- player->GetSession()->SendPacket(packet);
+ {
+ WorldSession* session = player->GetSession();
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "%s %s - SendPacketToTeam %u, Player: %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str(),
+ session->GetPlayerInfo().c_str(), TeamID, sender ? sender->GetName().c_str() : "null");
+ session->SendPacket(packet);
+ }
}
void Battleground::PlaySoundToAll(uint32 SoundID)
@@ -674,7 +687,7 @@ void Battleground::RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID)
player->RemoveAura(SpellID);
}
-void Battleground::YellToAll(Creature* creature, const char* text, uint32 language)
+void Battleground::YellToAll(Creature* creature, char const* text, uint32 language)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* player = _GetPlayer(itr, "YellToAll"))
@@ -718,17 +731,18 @@ void Battleground::EndBattleground(uint32 winner)
{
RemoveFromBGFreeSlotQueue();
- ArenaTeam* winner_arena_team = NULL;
- ArenaTeam* loser_arena_team = NULL;
- uint32 loser_team_rating = 0;
- uint32 loser_matchmaker_rating = 0;
- int32 loser_change = 0;
- int32 loser_matchmaker_change = 0;
- uint32 winner_team_rating = 0;
- uint32 winner_matchmaker_rating = 0;
- int32 winner_change = 0;
- int32 winner_matchmaker_change = 0;
- WorldPacket data;
+ ArenaTeam* winnerArenaTeam = NULL;
+ ArenaTeam* loserArenaTeam = NULL;
+
+ uint32 loserTeamRating = 0;
+ uint32 loserMatchmakerRating = 0;
+ int32 loserChange = 0;
+ int32 loserMatchmakerChange = 0;
+ uint32 winnerTeamRating = 0;
+ uint32 winnerMatchmakerRating = 0;
+ int32 winnerChange = 0;
+ int32 winnerMatchmakerChange = 0;
+
int32 winmsg_id = 0;
if (winner == ALLIANCE)
@@ -759,37 +773,43 @@ void Battleground::EndBattleground(uint32 winner)
// arena rating calculation
if (isArena() && isRated())
{
- winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner));
- loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
- if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
+ winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(winner));
+ loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
+
+ if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
{
if (winner != WINNER_NONE)
{
- loser_team_rating = loser_arena_team->GetRating();
- loser_matchmaker_rating = GetArenaMatchmakerRating(GetOtherTeam(winner));
- winner_team_rating = winner_arena_team->GetRating();
- winner_matchmaker_rating = GetArenaMatchmakerRating(winner);
- winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change);
- loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change);
- sLog->outArena("match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
- winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change);
- SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change);
- SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change);
- SetArenaTeamRatingChangeForTeam(winner, winner_change);
- SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
- sLog->outArena("Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
+ loserTeamRating = loserArenaTeam->GetRating();
+ loserMatchmakerRating = GetArenaMatchmakerRating(GetOtherTeam(winner));
+ winnerTeamRating = winnerArenaTeam->GetRating();
+ winnerMatchmakerRating = GetArenaMatchmakerRating(winner);
+ winnerMatchmakerChange = winnerArenaTeam->WonAgainst(winnerMatchmakerRating, loserMatchmakerRating, winnerChange);
+ loserMatchmakerChange = loserArenaTeam->LostAgainst(loserMatchmakerRating, winnerMatchmakerRating, loserChange);
+ sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winnerTeamRating, winnerChange, winnerMatchmakerRating,
+ winnerMatchmakerChange, loserTeamRating, loserChange, loserMatchmakerRating, loserMatchmakerChange);
+ SetArenaMatchmakerRating(winner, winnerMatchmakerRating + winnerMatchmakerChange);
+ SetArenaMatchmakerRating(GetOtherTeam(winner), loserMatchmakerRating + loserMatchmakerChange);
+ SetArenaTeamRatingChangeForTeam(winner, winnerChange);
+ SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loserChange);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE], winnerArenaTeam->GetId(), winnerChange, loserChange);
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- sLog->outArena("Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
+ {
+ sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows",
+ m_ArenaType, player->GetName().c_str(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3),
+ player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone,
+ itr->second->KillingBlows);
+ }
}
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
{
SetArenaTeamRatingChangeForTeam(ALLIANCE, ARENA_TIMELIMIT_POINTS_LOSS);
SetArenaTeamRatingChangeForTeam(HORDE, ARENA_TIMELIMIT_POINTS_LOSS);
- winner_arena_team->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
- loser_arena_team->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
+ winnerArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
+ loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS);
}
}
else
@@ -799,6 +819,11 @@ void Battleground::EndBattleground(uint32 winner)
}
}
+ WorldPacket pvpLogData;
+ sBattlegroundMgr->BuildPvpLogDataPacket(&pvpLogData, this);
+
+ BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
+
uint8 aliveWinners = GetAlivePlayersCountByTeam(winner);
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
@@ -807,12 +832,12 @@ void Battleground::EndBattleground(uint32 winner)
if (itr->second.OfflineRemoveTime)
{
//if rated arena match - make member lost!
- if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
+ if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
{
if (team == winner)
- winner_arena_team->OfflineMemberLost(itr->first, loser_matchmaker_rating, winner_matchmaker_change);
+ winnerArenaTeam->OfflineMemberLost(itr->first, loserMatchmakerRating, winnerMatchmakerChange);
else
- loser_arena_team->OfflineMemberLost(itr->first, winner_matchmaker_rating, loser_matchmaker_change);
+ loserArenaTeam->OfflineMemberLost(itr->first, winnerMatchmakerRating, loserMatchmakerChange);
}
continue;
}
@@ -841,26 +866,24 @@ void Battleground::EndBattleground(uint32 winner)
player->getHostileRefManager().deleteReferences();
}
- //this line is obsolete - team is set ALWAYS
- //if (!team) team = player->GetTeam();
-
// per player calculation
- if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
+ if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
{
if (team == winner)
{
// update achievement BEFORE personal rating update
- uint32 rating = player->GetArenaPersonalRating(winner_arena_team->GetSlot());
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
+ uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
- winner_arena_team->MemberWon(player, loser_matchmaker_rating, winner_matchmaker_change);
+ winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
}
else
{
- loser_arena_team->MemberLost(player, winner_matchmaker_rating, loser_matchmaker_change);
+ loserArenaTeam->MemberLost(player, winnerMatchmakerRating, loserMatchmakerChange);
// Arena lost => reset the win_rated_arena having the "no_lose" condition
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
}
}
@@ -880,7 +903,7 @@ void Battleground::EndBattleground(uint32 winner)
player->SetRandomWinner(true);
}
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, 1);
}
else
{
@@ -893,27 +916,23 @@ void Battleground::EndBattleground(uint32 winner)
BlockMovement(player);
- sBattlegroundMgr->BuildPvpLogDataPacket(&data, this);
- player->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&pvpLogData);
- BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
+ WorldPacket data;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, this, player->GetBattlegroundQueueIndex(bgQueueTypeId), STATUS_IN_PROGRESS, TIME_TO_AUTOREMOVE, GetStartTime(), GetArenaType());
player->GetSession()->SendPacket(&data);
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
}
- if (isArena() && isRated() && winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
+ if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
{
- // update arena points only after increasing the player's match count!
- //obsolete: winner_arena_team->UpdateArenaPointsHelper();
- //obsolete: loser_arena_team->UpdateArenaPointsHelper();
// save the stat changes
- winner_arena_team->SaveToDB();
- loser_arena_team->SaveToDB();
+ winnerArenaTeam->SaveToDB();
+ loserArenaTeam->SaveToDB();
// send updated arena team stats to players
// this way all arena team members will get notified, not only the ones who participated in this match
- winner_arena_team->NotifyStatsChanged();
- loser_arena_team->NotifyStatsChanged();
+ winnerArenaTeam->NotifyStatsChanged();
+ loserArenaTeam->NotifyStatsChanged();
}
if (winmsg_id)
@@ -923,7 +942,7 @@ void Battleground::EndBattleground(uint32 winner)
uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const
{
//variable kills means how many honorable kills you scored (so we need kills * honor_for_one_kill)
- uint32 maxLevel = std::min(GetMaxLevel(), 80U);
+ uint32 maxLevel = std::min<uint32>(GetMaxLevel(), 80U);
return Trinity::Honor::hk_honor_at_level(maxLevel, float(kills));
}
@@ -994,10 +1013,10 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
//left a rated match while the encounter was in progress, consider as loser
- ArenaTeam* winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
- ArenaTeam* loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
- if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team)
- loser_arena_team->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
+ ArenaTeam* winnerArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
+ ArenaTeam* loserArenaTeam = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team));
+ if (winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
+ loserArenaTeam->MemberLost(player, GetArenaMatchmakerRating(GetOtherTeam(team)));
}
}
if (SendPacket)
@@ -1055,7 +1074,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
if (Transport)
player->TeleportToBGEntryPoint();
- sLog->outDetail("BATTLEGROUND: Removed player %s from Battleground.", player->GetName());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Removed player %s from Battleground.", player->GetName().c_str());
}
//battleground object will be deleted next Battleground::Update() call
@@ -1069,13 +1088,10 @@ void Battleground::Reset()
SetStartTime(0);
SetEndTime(0);
SetLastResurrectTime(0);
- SetArenaType(0);
- SetRated(false);
-
m_Events = 0;
if (m_InvitedAlliance > 0 || m_InvitedHorde > 0)
- sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!",
m_InvitedAlliance, m_InvitedHorde, m_MapId, m_InstanceID);
m_InvitedAlliance = 0;
@@ -1101,9 +1117,10 @@ void Battleground::StartBattleground()
// add bg to update list
// This must be done here, because we need to have already invited some players when first BG::Update() method is executed
// and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes
- sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this);
+ sBattlegroundMgr->AddBattleground(this);
+
if (m_IsRated)
- sLog->outArena("Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[TEAM_ALLIANCE], m_ArenaTeamIds[TEAM_HORDE]);
}
void Battleground::AddPlayer(Player* player)
@@ -1166,10 +1183,10 @@ void Battleground::AddPlayer(Player* player)
player->CastSpell(player, SPELL_ARENA_PREPARATION, true);
player->ResetAllPowers();
}
- WorldPacket teammate;
- teammate.Initialize(SMSG_ARENA_OPPONENT_UPDATE, 8);
- teammate << uint64(player->GetGUID());
- SendPacketToTeam(team, &teammate, player, false);
+
+ WorldPacket data(SMSG_ARENA_OPPONENT_UPDATE, 8);
+ data << uint64(player->GetGUID());
+ SendPacketToTeam(team, &data, player, false);
}
else
{
@@ -1177,24 +1194,21 @@ void Battleground::AddPlayer(Player* player)
player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
- player->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_BG, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
+ player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
// setup BG group membership
PlayerAddedToBGCheckIfBGIsRunning(player);
AddOrSetPlayerToCorrectBgGroup(player, team);
-
- // Log
- sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", player->GetName());
}
// this method adds player to his team's bg group, or sets his correct group if player is already in bg group
@@ -1213,7 +1227,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, uint32 team)
if (group->IsMember(playerGuid))
{
uint8 subgroup = group->GetMemberGroup(playerGuid);
- player->SetBattlegroundRaid(group, subgroup);
+ player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
}
else
{
@@ -1251,6 +1265,9 @@ void Battleground::EventPlayerLoggedIn(Player* player)
void Battleground::EventPlayerLoggedOut(Player* player)
{
uint64 guid = player->GetGUID();
+ if (!IsPlayerInBattleground(guid)) // Check if this player really is in battleground (might be a GM who teleported inside)
+ return;
+
// player is correct pointer, it is checked in WorldSession::LogoutPlayer()
m_OfflineQueue.push_back(player->GetGUID());
m_Players[guid].OfflineRemoveTime = sWorld->GetGameTime() + MAX_OFFLINE_TIME;
@@ -1261,35 +1278,28 @@ void Battleground::EventPlayerLoggedOut(Player* player)
// 1 player is logging out, if it is the last, then end arena!
if (isArena())
- if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
- EndBattleground(GetOtherTeam(player->GetTeam()));
+ if (GetAlivePlayersCountByTeam(player->GetBGTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetBGTeam())))
+ EndBattleground(GetOtherTeam(player->GetBGTeam()));
}
}
// This method should be called only once ... it adds pointer to queue
void Battleground::AddToBGFreeSlotQueue()
{
- // make sure to add only once
if (!m_InBGFreeSlotQueue && isBattleground())
{
- sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].push_front(this);
+ sBattlegroundMgr->AddToBGFreeSlotQueue(m_TypeID, this);
m_InBGFreeSlotQueue = true;
}
}
-// This method removes this battleground from free queue - it must be called when deleting battleground - not used now
+// This method removes this battleground from free queue - it must be called when deleting battleground
void Battleground::RemoveFromBGFreeSlotQueue()
{
- // set to be able to re-add if needed
- m_InBGFreeSlotQueue = false;
- // uncomment this code when battlegrounds will work like instances
- for (BGFreeSlotQueueType::iterator itr = sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].begin(); itr != sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].end(); ++itr)
+ if (m_InBGFreeSlotQueue)
{
- if ((*itr)->GetInstanceID() == m_InstanceID)
- {
- sBattlegroundMgr->BGFreeSlotQueue[m_TypeID].erase(itr);
- return;
- }
+ sBattlegroundMgr->RemoveFromBGFreeSlotQueue(m_TypeID, m_InstanceID);
+ m_InBGFreeSlotQueue = false;
}
}
@@ -1392,7 +1402,7 @@ void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value,
itr->second->HealingDone += value;
break;
default:
- sLog->outError("Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
type, m_MapId, m_InstanceID);
break;
}
@@ -1441,9 +1451,9 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
{
- sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_SQL, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
- sLog->outError("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete go;
return false;
@@ -1494,7 +1504,7 @@ void Battleground::DoorClose(uint32 type)
}
}
else
- sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
}
@@ -1506,7 +1516,7 @@ void Battleground::DoorOpen(uint32 type)
obj->SetGoState(GO_STATE_ACTIVE);
}
else
- sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
}
@@ -1514,7 +1524,7 @@ GameObject* Battleground::GetBGObject(uint32 type)
{
GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]);
if (!obj)
- sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
return obj;
}
@@ -1523,7 +1533,7 @@ Creature* Battleground::GetBGCreature(uint32 type)
{
Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]);
if (!creature)
- sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
return creature;
}
@@ -1556,7 +1566,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
Creature* creature = new Creature;
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o))
{
- sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete creature;
return NULL;
@@ -1567,7 +1577,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
- sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete creature;
return NULL;
@@ -1602,7 +1612,7 @@ bool Battleground::DelCreature(uint32 type)
return true;
}
- sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
BgCreatures[type] = 0;
return false;
@@ -1620,7 +1630,7 @@ bool Battleground::DelObject(uint32 type)
BgObjects[type] = 0;
return true;
}
- sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
BgObjects[type] = 0;
return false;
@@ -1646,7 +1656,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
//creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
return true;
}
- sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
type, entry, m_MapId, m_InstanceID);
EndNow();
return false;
@@ -1682,7 +1692,7 @@ void Battleground::SendWarningToAll(int32 entry, ...)
if (!entry)
return;
- const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
+ char const *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
char str[1024];
va_list ap;
@@ -1724,7 +1734,7 @@ void Battleground::EndNow()
}
// To be removed
-const char* Battleground::GetTrinityString(int32 entry)
+char const* Battleground::GetTrinityString(int32 entry)
{
// FIXME: now we have different DBC locales and need localized message for each target client
return sObjectMgr->GetTrinityStringForDBCLocale(entry);
@@ -1745,7 +1755,7 @@ void Battleground::HandleTriggerBuff(uint64 go_guid)
index--;
if (index < 0)
{
- sLog->outError("Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::HandleTriggerBuff: cannot find buff gameobject (GUID: %u, entry: %u, type: %u) in internal data for BG (map: %u, instance id: %u)!",
GUID_LOPART(go_guid), obj->GetEntry(), obj->GetGoType(), m_MapId, m_InstanceID);
return;
}
@@ -1869,7 +1879,7 @@ int32 Battleground::GetObjectType(uint64 guid)
for (uint32 i = 0; i < BgObjects.size(); ++i)
if (BgObjects[i] == guid)
return i;
- sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
GUID_LOPART(guid), m_MapId, m_InstanceID);
return -1;
}
@@ -1899,7 +1909,7 @@ void Battleground::UpdateArenaWorldState()
void Battleground::SetBgRaid(uint32 TeamID, Group* bg_raid)
{
- Group*& old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
+ Group*& old_raid = TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE];
if (old_raid)
old_raid->SetBattlegroundGroup(NULL);
if (bg_raid)
@@ -1912,18 +1922,11 @@ WorldSafeLocsEntry const* Battleground::GetClosestGraveYard(Player* player)
return sObjectMgr->GetClosestGraveYard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
}
-bool Battleground::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const
-{
- BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(team);
- uint32 score = std::max(m_TeamScores[teamIndex], 0);
- return score >= minScore && score <= maxScore;
-}
-
void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
{
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- player->GetAchievementMgr().StartTimedAchievement(type, entry);
+ player->StartTimedAchievement(type, entry);
}
void Battleground::SetBracket(PvPDifficultyEntry const* bracketEntry)
@@ -1937,3 +1940,18 @@ void Battleground::RewardXPAtKill(Player* killer, Player* victim)
if (sWorld->getBoolConfig(CONFIG_BG_XP_FOR_KILL) && killer && victim)
killer->RewardPlayerAndGroupAtKill(victim, true);
}
+
+uint32 Battleground::GetTeamScore(uint32 teamId) const
+{
+ if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
+ return m_TeamScores[teamId];
+
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "GetTeamScore with wrong Team %u for BG %u", teamId, GetTypeID());
+ return 0;
+}
+
+void Battleground::HandleAreaTrigger(Player* player, uint32 trigger)
+{
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Unhandled AreaTrigger %u in Battleground %u. Player coords (x: %f, y: %f, z: %f)",
+ trigger, player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+}
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 01dfbb23033..0a837f9f3c3 100755..100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -38,7 +38,7 @@ enum BattlegroundSounds
SOUND_HORDE_WINS = 8454,
SOUND_ALLIANCE_WINS = 8455,
SOUND_BG_START = 3439,
- SOUND_BG_START_L70ETC = 11803,
+ SOUND_BG_START_L70ETC = 11803
};
enum BattlegroundQuests
@@ -79,7 +79,7 @@ enum BattlegroundMarksCount
enum BattlegroundCreatures
{
BG_CREATURE_ENTRY_A_SPIRITGUIDE = 13116, // alliance
- BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117, // horde
+ BG_CREATURE_ENTRY_H_SPIRITGUIDE = 13117 // horde
};
enum BattlegroundSpells
@@ -99,11 +99,12 @@ enum BattlegroundSpells
SPELL_AURA_PLAYER_INACTIVE = 43681, // Inactive
SPELL_HONORABLE_DEFENDER_25Y = 68652, // +50% honor when standing at a capture point that you control, 25yards radius (added in 3.2)
SPELL_HONORABLE_DEFENDER_60Y = 66157, // +50% honor when standing at a capture point that you control, 60yards radius (added in 3.2), probably for 40+ player battlegrounds
- SPELL_THE_LAST_STANDING = 26549, // Arena achievement related
+ SPELL_THE_LAST_STANDING = 26549 // Arena achievement related
};
enum BattlegroundTimeIntervals
{
+ CHECK_PLAYER_POSITION_INVERVAL = 1000, // ms
RESURRECTION_INTERVAL = 30000, // ms
//REMIND_INTERVAL = 10000, // ms
INVITATION_REMIND_TIME = 20000, // ms
@@ -112,7 +113,7 @@ enum BattlegroundTimeIntervals
MAX_OFFLINE_TIME = 300, // secs
RESPAWN_ONE_DAY = 86400, // secs
RESPAWN_IMMEDIATELY = 0, // secs
- BUFF_RESPAWN_TIME = 180, // secs
+ BUFF_RESPAWN_TIME = 180 // secs
};
enum BattlegroundStartTimeIntervals
@@ -121,7 +122,7 @@ enum BattlegroundStartTimeIntervals
BG_START_DELAY_1M = 60000, // ms (1 minute)
BG_START_DELAY_30S = 30000, // ms (30 seconds)
BG_START_DELAY_15S = 15000, // ms (15 seconds) Used only in arena
- BG_START_DELAY_NONE = 0, // ms
+ BG_START_DELAY_NONE = 0 // ms
};
enum BattlegroundBuffObjects
@@ -137,8 +138,8 @@ enum BattlegroundRandomRewards
BG_REWARD_WINNER_ARENA_FIRST = 25,
BG_REWARD_WINNER_HONOR_LAST = 15,
BG_REWARD_WINNER_ARENA_LAST = 0,
- BG_REWARD_LOSER_HONOR_FIRST = 5,
- BG_REWARD_LOSER_HONOR_LAST = 5
+ BG_REWARD_LOSER_HONOR_FIRST = 5,
+ BG_REWARD_LOSER_HONOR_LAST = 5
};
const uint32 Buff_Entries[3] = { BG_OBJECTID_SPEEDBUFF_ENTRY, BG_OBJECTID_REGENBUFF_ENTRY, BG_OBJECTID_BERSERKERBUFF_ENTRY };
@@ -167,23 +168,6 @@ struct BattlegroundObjectInfo
uint32 spellid;
};
-// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time
-enum BattlegroundQueueTypeId
-{
- BATTLEGROUND_QUEUE_NONE = 0,
- BATTLEGROUND_QUEUE_AV = 1,
- BATTLEGROUND_QUEUE_WS = 2,
- BATTLEGROUND_QUEUE_AB = 3,
- BATTLEGROUND_QUEUE_EY = 4,
- BATTLEGROUND_QUEUE_SA = 5,
- BATTLEGROUND_QUEUE_IC = 6,
- BATTLEGROUND_QUEUE_RB = 7,
- BATTLEGROUND_QUEUE_2v2 = 8,
- BATTLEGROUND_QUEUE_3v3 = 9,
- BATTLEGROUND_QUEUE_5v5 = 10,
- MAX_BATTLEGROUND_QUEUE_TYPES
-};
-
enum ScoreType
{
SCORE_KILLING_BLOWS = 1,
@@ -209,7 +193,7 @@ enum ScoreType
SCORE_SECONDARY_OBJECTIVES = 17,
//SOTA
SCORE_DESTROYED_DEMOLISHER = 18,
- SCORE_DESTROYED_WALL = 19,
+ SCORE_DESTROYED_WALL = 19
};
enum ArenaType
@@ -232,11 +216,6 @@ enum BattlegroundWinner
WINNER_NONE = 2
};
-enum BattlegroundTeamId
-{
- BG_TEAM_ALLIANCE = 0,
- BG_TEAM_HORDE = 1
-};
#define BG_TEAMS_COUNT 2
enum BattlegroundStartingEvents
@@ -257,41 +236,20 @@ enum BattlegroundStartingEventsIds
};
#define BG_STARTING_EVENT_COUNT 4
-enum GroupJoinBattlegroundResult
+struct BattlegroundScore
{
- // positive values are indexes in BattlemasterList.dbc
- ERR_GROUP_JOIN_BATTLEGROUND_FAIL = 0, // Your group has joined a battleground queue, but you are not eligible (showed for non existing BattlemasterList.dbc indexes)
- ERR_BATTLEGROUND_NONE = -1, // not show anything
- ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS = -2, // You cannot join the battleground yet because you or one of your party members is flagged as a Deserter.
- ERR_ARENA_TEAM_PARTY_SIZE = -3, // Incorrect party size for this arena.
- ERR_BATTLEGROUND_TOO_MANY_QUEUES = -4, // You can only be queued for 2 battles at once
- ERR_BATTLEGROUND_CANNOT_QUEUE_FOR_RATED = -5, // You cannot queue for a rated match while queued for other battles
- ERR_BATTLEDGROUND_QUEUED_FOR_RATED = -6, // You cannot queue for another battle while queued for a rated arena match
- ERR_BATTLEGROUND_TEAM_LEFT_QUEUE = -7, // Your team has left the arena queue
- ERR_BATTLEGROUND_NOT_IN_BATTLEGROUND = -8, // You can't do that in a battleground.
- ERR_BATTLEGROUND_JOIN_XP_GAIN = -9, // wtf, doesn't exist in client...
- ERR_BATTLEGROUND_JOIN_RANGE_INDEX = -10, // Cannot join the queue unless all members of your party are in the same battleground level range.
- ERR_BATTLEGROUND_JOIN_TIMED_OUT = -11, // %s was unavailable to join the queue. (uint64 guid exist in client cache)
- ERR_BATTLEGROUND_JOIN_FAILED = -12, // Join as a group failed (uint64 guid doesn't exist in client cache)
- ERR_LFG_CANT_USE_BATTLEGROUND = -13, // You cannot queue for a battleground or arena while using the dungeon system.
- ERR_IN_RANDOM_BG = -14, // Can't do that while in a Random Battleground queue.
- ERR_IN_NON_RANDOM_BG = -15, // Can't queue for Random Battleground while in another Battleground queue.
-};
-
-class BattlegroundScore
-{
- public:
- BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0),
- BonusHonor(0), DamageDone(0), HealingDone(0)
- {}
- virtual ~BattlegroundScore() {} //virtual destructor is used when deleting score from scores map
-
- uint32 KillingBlows;
- uint32 Deaths;
- uint32 HonorableKills;
- uint32 BonusHonor;
- uint32 DamageDone;
- uint32 HealingDone;
+ BattlegroundScore() : KillingBlows(0), Deaths(0), HonorableKills(0), BonusHonor(0),
+ DamageDone(0), HealingDone(0)
+ { }
+
+ virtual ~BattlegroundScore() { } //virtual destructor is used when deleting score from scores map
+
+ uint32 KillingBlows;
+ uint32 Deaths;
+ uint32 HonorableKills;
+ uint32 BonusHonor;
+ uint32 DamageDone;
+ uint32 HealingDone;
};
enum BGHonorMode
@@ -324,17 +282,14 @@ class Battleground
return true;
}
virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass
- virtual void StartingEventCloseDoors() {}
- virtual void StartingEventOpenDoors() {}
- virtual void ResetBGSubclass() // must be implemented in BG subclass
- {
- }
+ virtual void StartingEventCloseDoors() { }
+ virtual void StartingEventOpenDoors() { }
+ virtual void ResetBGSubclass() { } // must be implemented in BG subclass
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
/* achievement req. */
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
- bool IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const;
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
/* Battleground */
@@ -437,12 +392,13 @@ class Battleground
void SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, float O);
void GetTeamStartLoc(uint32 TeamID, float &X, float &Y, float &Z, float &O) const
{
- BattlegroundTeamId idx = GetTeamIndexByTeamId(TeamID);
+ TeamId idx = GetTeamIndexByTeamId(TeamID);
X = m_TeamStartLocX[idx];
Y = m_TeamStartLocY[idx];
Z = m_TeamStartLocZ[idx];
O = m_TeamStartLocO[idx];
}
+
void SetStartMaxDist(float startMaxDist) { m_StartMaxDist = startMaxDist; }
float GetStartMaxDist() const { return m_StartMaxDist; }
@@ -475,12 +431,12 @@ class Battleground
void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0);
// Raid Group
- Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; }
+ Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; }
void SetBgRaid(uint32 TeamID, Group* bg_raid);
virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
- static BattlegroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; }
+ static TeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; }
uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; }
uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
@@ -507,7 +463,7 @@ class Battleground
// Triggers handle
// must be implemented in BG subclass
- virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
+ virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/);
// must be implemented in BG subclass if need AND call base class generic code
virtual void HandleKillPlayer(Player* player, Player* killer);
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/);
@@ -566,13 +522,14 @@ class Battleground
bool ToBeDeleted() const { return m_SetDeleteThis; }
void SetDeleteThis() { m_SetDeleteThis = true; }
- // virtual score-array - get's used in bg-subclasses
- int32 m_TeamScores[BG_TEAMS_COUNT];
-
void RewardXPAtKill(Player* killer, Player* victim);
bool CanAwardArenaPoints() const { return m_LevelMin >= BG_AWARD_ARENA_POINTS_MIN_LEVEL; }
virtual uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return 0; }
+ virtual void SetDroppedFlagGUID(uint64 /*guid*/, int32 /*team*/ = -1) {}
+ uint32 GetTeamScore(uint32 TeamID) const;
+
+ virtual uint32 GetPrematureWinner();
protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
@@ -589,6 +546,7 @@ class Battleground
void _ProcessProgress(uint32 diff);
void _ProcessLeave(uint32 diff);
void _ProcessJoin(uint32 diff);
+ void _CheckSafePositions(uint32 diff);
// Scorekeeping
BattlegroundScoreMap PlayerScores; // Player scores
@@ -610,6 +568,8 @@ class Battleground
bool m_IsRandom;
BGHonorMode m_HonorMode;
+ int32 m_TeamScores[BG_TEAMS_COUNT];
+
private:
// Battleground
BattlegroundTypeId m_TypeID;
@@ -649,7 +609,7 @@ class Battleground
*
* @see Update(), PostUpdateImpl().
*/
- virtual bool PreUpdateImpl(uint32 /* diff */) { return true; };
+ virtual bool PreUpdateImpl(uint32 /* diff */) { return true; }
/**
* @brief Post-update hook.
@@ -662,7 +622,7 @@ class Battleground
*
* @see Update(), PreUpdateImpl().
*/
- virtual void PostUpdateImpl(uint32 /* diff */) { };
+ virtual void PostUpdateImpl(uint32 /* diff */) { }
// Player lists
std::vector<uint64> m_ResurrectQueue; // Player GUID
@@ -705,4 +665,3 @@ class Battleground
uint32 ScriptId;
};
#endif
-
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 2b2265dad84..a0f95e1eaef 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -30,13 +30,11 @@
#include "BattlegroundWS.h"
#include "BattlegroundNA.h"
#include "BattlegroundBE.h"
-#include "BattlegroundAA.h"
#include "BattlegroundRL.h"
#include "BattlegroundSA.h"
#include "BattlegroundDS.h"
#include "BattlegroundRV.h"
#include "BattlegroundIC.h"
-#include "BattlegroundRB.h"
#include "Chat.h"
#include "Map.h"
#include "MapInstanced.h"
@@ -46,18 +44,16 @@
#include "SharedDefines.h"
#include "Formulas.h"
#include "DisableMgr.h"
+#include "Opcodes.h"
/*********************************************************/
/*** BATTLEGROUND MANAGER ***/
/*********************************************************/
-BattlegroundMgr::BattlegroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
-{
- for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; i++)
- m_Battlegrounds[i].clear();
- m_NextRatedArenaUpdate = sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER);
- m_Testing=false;
-}
+BattlegroundMgr::BattlegroundMgr() :
+ m_NextRatedArenaUpdate(sWorld->getIntConfig(CONFIG_ARENA_RATED_UPDATE_TIMER)),
+ m_AutoDistributionTimeChecker(0), m_ArenaTesting(false), m_Testing(false)
+{ }
BattlegroundMgr::~BattlegroundMgr()
{
@@ -66,50 +62,42 @@ BattlegroundMgr::~BattlegroundMgr()
void BattlegroundMgr::DeleteAllBattlegrounds()
{
- for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
+ for (BattlegroundDataContainer::iterator itr1 = bgDataStore.begin(); itr1 != bgDataStore.end(); ++itr1)
{
- for (BattlegroundSet::iterator itr = m_Battlegrounds[i].begin(); itr != m_Battlegrounds[i].end();)
- {
- Battleground* bg = itr->second;
- m_Battlegrounds[i].erase(itr++);
- if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
- m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
- delete bg;
- }
- }
+ BattlegroundData& data = itr1->second;
- // destroy template battlegrounds that listed only in queues (other already terminated)
- for (uint32 bgTypeId = 0; bgTypeId < MAX_BATTLEGROUND_TYPE_ID; ++bgTypeId)
- {
- // ~Battleground call unregistring BG from queue
- while (!BGFreeSlotQueue[bgTypeId].empty())
- delete BGFreeSlotQueue[bgTypeId].front();
+ while (!data.m_Battlegrounds.empty())
+ delete data.m_Battlegrounds.begin()->second;
+ data.m_Battlegrounds.clear();
+
+ while (!data.BGFreeSlotQueue.empty())
+ delete data.BGFreeSlotQueue.front();
}
+
+ bgDataStore.clear();
}
// used to update running battlegrounds, and delete finished ones
void BattlegroundMgr::Update(uint32 diff)
{
- BattlegroundSet::iterator itr, next;
- for (uint32 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
+ for (BattlegroundDataContainer::iterator itr1 = bgDataStore.begin(); itr1 != bgDataStore.end(); ++itr1)
{
- itr = m_Battlegrounds[i].begin();
- // skip updating battleground template
- if (itr != m_Battlegrounds[i].end())
- ++itr;
- for (; itr != m_Battlegrounds[i].end(); itr = next)
+ BattlegroundContainer& bgs = itr1->second.m_Battlegrounds;
+ BattlegroundContainer::iterator itrDelete = bgs.begin();
+ // first one is template and should not be deleted
+ for (BattlegroundContainer::iterator itr = ++itrDelete; itr != bgs.end();)
{
- next = itr;
- ++next;
- itr->second->Update(diff);
- // use the SetDeleteThis variable
- // direct deletion caused crashes
- if (itr->second->ToBeDeleted())
+ itrDelete = itr++;
+ Battleground* bg = itrDelete->second;
+
+ bg->Update(diff);
+ if (bg->ToBeDeleted())
{
- Battleground* bg = itr->second;
- m_Battlegrounds[i].erase(itr);
- if (!m_ClientBattlegroundIds[i][bg->GetBracketId()].empty())
- m_ClientBattlegroundIds[i][bg->GetBracketId()].erase(bg->GetClientInstanceID());
+ itrDelete->second = NULL;
+ bgs.erase(itrDelete);
+ BattlegroundClientIdsContainer& clients = itr1->second.m_ClientBattlegroundIds[bg->GetBracketId()];
+ if (!clients.empty())
+ clients.erase(bg->GetClientInstanceID());
delete bg;
}
@@ -124,12 +112,7 @@ void BattlegroundMgr::Update(uint32 diff)
if (!m_QueueUpdateScheduler.empty())
{
std::vector<uint64> scheduled;
- {
- //copy vector and clear the other
- scheduled = std::vector<uint64>(m_QueueUpdateScheduler);
- m_QueueUpdateScheduler.clear();
- //release lock
- }
+ std::swap(scheduled, m_QueueUpdateScheduler);
for (uint8 i = 0; i < scheduled.size(); i++)
{
@@ -149,7 +132,7 @@ void BattlegroundMgr::Update(uint32 diff)
if (m_NextRatedArenaUpdate < diff)
{
// forced update for rated arenas (scan all, but skipped non rated)
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr: UPDATING ARENA QUEUES");
+ sLog->outTrace(LOG_FILTER_ARENAS, "BattlegroundMgr: UPDATING ARENA QUEUES");
for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(diff,
@@ -161,6 +144,7 @@ void BattlegroundMgr::Update(uint32 diff)
else
m_NextRatedArenaUpdate -= diff;
}
+
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
if (m_AutoDistributionTimeChecker < diff)
@@ -226,7 +210,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
*data << uint8(uiFrame);
break;
default:
- sLog->outError("Unknown BG status!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Unknown BG status!");
break;
}
}
@@ -234,13 +218,13 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battlegro
void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
{
uint8 type = (bg->isArena() ? 1 : 0);
- // last check on 3.0.3
+
data->Initialize(MSG_PVP_LOG_DATA, (1+1+4+40*bg->GetPlayerScoresSize()));
*data << uint8(type); // type (battleground=0/arena=1)
- if (type) // arena
+ if (type) // arena
{
- // it seems this must be according to BG_WINNER_A/H and _NOT_ BG_TEAM_A/H
+ // it seems this must be according to BG_WINNER_A/H and _NOT_ TEAM_A/H
for (int8 i = 1; i >= 0; --i)
{
int32 rating_change = bg->GetArenaTeamRatingChangeByIndex(i);
@@ -281,7 +265,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
itr2 = itr++;
if (!bg->IsPlayerInBattleground(itr2->first))
{
- sLog->outError("Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetTypeID(true));
continue;
}
@@ -303,7 +287,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
}
*data << uint32(itr2->second->DamageDone); // damage done
*data << uint32(itr2->second->HealingDone); // healing done
- switch (bg->GetTypeID(true)) // battleground specific things
+ switch (bg->GetTypeID(true)) // battleground specific things
{
case BATTLEGROUND_RB:
switch (bg->GetMapId())
@@ -358,7 +342,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
break;
case BATTLEGROUND_AB:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted
+ *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases assaulted
*data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended
break;
case BATTLEGROUND_EY:
@@ -370,17 +354,17 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
*data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed);
*data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed);
break;
- case BATTLEGROUND_IC: // wotlk
+ case BATTLEGROUND_IC:
*data << uint32(0x00000002); // count of next fields
- *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases asssulted
+ *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases assaulted
*data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended
break;
case BATTLEGROUND_NA:
case BATTLEGROUND_BE:
case BATTLEGROUND_AA:
case BATTLEGROUND_RL:
- case BATTLEGROUND_DS: // wotlk
- case BATTLEGROUND_RV: // wotlk
+ case BATTLEGROUND_DS:
+ case BATTLEGROUND_RV:
*data << uint32(0);
break;
default:
@@ -391,7 +375,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
// should never happen
if (++scoreCount >= bg->GetMaxPlayers() && itr != bg->GetPlayerScoresEnd())
{
- sLog->outError("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers());
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetTypeID(true), bg->GetPlayerScoresSize(), bg->GetMaxPlayers());
break;
}
}
@@ -443,38 +427,59 @@ Battleground* BattlegroundMgr::GetBattlegroundThroughClientInstance(uint32 insta
if (bg->isArena())
return GetBattleground(instanceId, bgTypeId);
- for (BattlegroundSet::iterator itr = m_Battlegrounds[bgTypeId].begin(); itr != m_Battlegrounds[bgTypeId].end(); ++itr)
+ BattlegroundDataContainer::const_iterator it = bgDataStore.find(bgTypeId);
+ if (it == bgDataStore.end())
+ return NULL;
+
+ for (BattlegroundContainer::const_iterator itr = it->second.m_Battlegrounds.begin(); itr != it->second.m_Battlegrounds.end(); ++itr)
{
if (itr->second->GetClientInstanceID() == instanceId)
return itr->second;
}
+
return NULL;
}
-Battleground* BattlegroundMgr::GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId)
+Battleground* BattlegroundMgr::GetBattleground(uint32 instanceId, BattlegroundTypeId bgTypeId)
{
- if (!InstanceID)
+ if (!instanceId)
return NULL;
- //search if needed
- BattlegroundSet::iterator itr;
+
+ BattlegroundDataContainer::const_iterator begin, end;
+
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
- for (uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
- {
- itr = m_Battlegrounds[i].find(InstanceID);
- if (itr != m_Battlegrounds[i].end())
- return itr->second;
- }
- return NULL;
+ begin = bgDataStore.begin();
+ end = bgDataStore.end();
+ }
+ else
+ {
+ end = bgDataStore.find(bgTypeId);
+ if (end == bgDataStore.end())
+ return NULL;
+ begin = end++;
+ }
+
+ for (BattlegroundDataContainer::const_iterator it = begin; it != end; ++it)
+ {
+ BattlegroundContainer const& bgs = it->second.m_Battlegrounds;
+ BattlegroundContainer::const_iterator itr = bgs.find(instanceId);
+ if (itr != bgs.end())
+ return itr->second;
}
- itr = m_Battlegrounds[bgTypeId].find(InstanceID);
- return ((itr != m_Battlegrounds[bgTypeId].end()) ? itr->second : NULL);
+
+ return NULL;
}
Battleground* BattlegroundMgr::GetBattlegroundTemplate(BattlegroundTypeId bgTypeId)
{
+ BattlegroundDataContainer::const_iterator itr = bgDataStore.find(bgTypeId);
+ if (itr == bgDataStore.end())
+ return NULL;
+
+ BattlegroundContainer const& bgs = itr->second.m_Battlegrounds;
//map is sorted and we can be sure that lowest instance id has only BG template
- return m_Battlegrounds[bgTypeId].empty() ? NULL : m_Battlegrounds[bgTypeId].begin()->second;
+ return bgs.empty() ? NULL : bgs.begin()->second;
}
uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id)
@@ -488,71 +493,44 @@ uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeI
// the instance-id just needs to be as low as possible, beginning with 1
// the following works, because std::set is default ordered with "<"
// the optimalization would be to use as bitmask std::vector<uint32> - but that would only make code unreadable
+
+ BattlegroundClientIdsContainer& clientIds = bgDataStore[bgTypeId].m_ClientBattlegroundIds[bracket_id];
uint32 lastId = 0;
- for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracket_id].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracket_id].end();)
+ for (BattlegroundClientIdsContainer::const_iterator itr = clientIds.begin(); itr != clientIds.end();)
{
if ((++lastId) != *itr) //if there is a gap between the ids, we will break..
break;
lastId = *itr;
}
- m_ClientBattlegroundIds[bgTypeId][bracket_id].insert(lastId + 1);
- return lastId + 1;
+
+ clientIds.insert(++lastId);
+ return lastId;
}
// create a new battleground that will really be used to play
-Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
+Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId originalBgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated)
{
- // get the template BG
- Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
- BattlegroundSelectionWeightMap* selectionWeights = NULL;
-
- if (!bg_template)
- {
- sLog->outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
- return NULL;
- }
+ BattlegroundTypeId bgTypeId = originalBgTypeId;
bool isRandom = false;
- if (bg_template->isArena())
- selectionWeights = &m_ArenaSelectionWeights;
- else if (bgTypeId == BATTLEGROUND_RB)
+ switch (originalBgTypeId)
{
- selectionWeights = &m_BGSelectionWeights;
- isRandom = true;
+ case BATTLEGROUND_RB:
+ isRandom = true;
+ case BATTLEGROUND_AA:
+ bgTypeId = GetRandomBG(originalBgTypeId);
+ break;
+ default:
+ break;
}
- if (selectionWeights)
- {
- if (selectionWeights->empty())
- return NULL;
- uint32 Weight = 0;
- uint32 selectedWeight = 0;
- bgTypeId = BATTLEGROUND_TYPE_NONE;
- // Get sum of all weights
- for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
- Weight += it->second;
- if (!Weight)
- return NULL;
- // Select a random value
- selectedWeight = urand(0, Weight-1);
+ // get the template BG
+ Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
- // Select the correct bg (if we have in DB A(10), B(20), C(10), D(15) --> [0---A---9|10---B---29|30---C---39|40---D---54])
- Weight = 0;
- for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights->begin(); it != selectionWeights->end(); ++it)
- {
- Weight += it->second;
- if (selectedWeight < Weight)
- {
- bgTypeId = it->first;
- break;
- }
- }
- bg_template = GetBattlegroundTemplate(bgTypeId);
- if (!bg_template)
- {
- sLog->outError("Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
- return NULL;
- }
+ if (!bg_template)
+ {
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
+ return NULL;
}
Battleground* bg = NULL;
@@ -574,9 +552,6 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
case BATTLEGROUND_BE:
bg = new BattlegroundBE(*(BattlegroundBE*)bg_template);
break;
- case BATTLEGROUND_AA:
- bg = new BattlegroundAA(*(BattlegroundAA*)bg_template);
- break;
case BATTLEGROUND_EY:
bg = new BattlegroundEY(*(BattlegroundEY*)bg_template);
break;
@@ -596,57 +571,76 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId
bg = new BattlegroundIC(*(BattlegroundIC*)bg_template);
break;
case BATTLEGROUND_RB:
- bg = new BattlegroundRB(*(BattlegroundRB*)bg_template);
+ case BATTLEGROUND_AA:
+ bg = new Battleground(*bg_template);
break;
default:
- //error, but it is handled few lines above
- return 0;
+ return NULL;
}
- // set battelground difficulty before initialization
bg->SetBracket(bracketEntry);
-
- // generate a new instance id
- bg->SetInstanceID(sMapMgr->GenerateInstanceId()); // set instance id
+ bg->SetInstanceID(sMapMgr->GenerateInstanceId());
bg->SetClientInstanceID(CreateClientVisibleInstanceId(isRandom ? BATTLEGROUND_RB : bgTypeId, bracketEntry->GetBracketId()));
-
- // reset the new bg (set status to status_wait_queue from status_none)
- bg->Reset();
-
- // start the joining of the bg
- bg->SetStatus(STATUS_WAIT_JOIN);
+ bg->Reset(); // reset the new bg (set status to status_wait_queue from status_none)
+ bg->SetStatus(STATUS_WAIT_JOIN); // start the joining of the bg
bg->SetArenaType(arenaType);
+ bg->SetTypeID(originalBgTypeId);
+ bg->SetRandomTypeID(bgTypeId);
bg->SetRated(isRated);
bg->SetRandom(isRandom);
- bg->SetTypeID(isRandom ? BATTLEGROUND_RB : bgTypeId);
- bg->SetRandomTypeID(bgTypeId);
return bg;
}
// used to create the BG templates
-uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
+bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
{
// Create the BG
Battleground* bg = NULL;
switch (data.bgTypeId)
{
- case BATTLEGROUND_AV: bg = new BattlegroundAV; break;
- case BATTLEGROUND_WS: bg = new BattlegroundWS; break;
- case BATTLEGROUND_AB: bg = new BattlegroundAB; break;
- case BATTLEGROUND_NA: bg = new BattlegroundNA; break;
- case BATTLEGROUND_BE: bg = new BattlegroundBE; break;
- case BATTLEGROUND_AA: bg = new BattlegroundAA; break;
- case BATTLEGROUND_EY: bg = new BattlegroundEY; break;
- case BATTLEGROUND_RL: bg = new BattlegroundRL; break;
- case BATTLEGROUND_SA: bg = new BattlegroundSA; break;
- case BATTLEGROUND_DS: bg = new BattlegroundDS; break;
- case BATTLEGROUND_RV: bg = new BattlegroundRV; break;
- case BATTLEGROUND_IC: bg = new BattlegroundIC; break;
- case BATTLEGROUND_RB: bg = new BattlegroundRB; break;
- default:
+ case BATTLEGROUND_AV:
+ bg = new BattlegroundAV;
+ break;
+ case BATTLEGROUND_WS:
+ bg = new BattlegroundWS;
+ break;
+ case BATTLEGROUND_AB:
+ bg = new BattlegroundAB;
+ break;
+ case BATTLEGROUND_NA:
+ bg = new BattlegroundNA;
+ break;
+ case BATTLEGROUND_BE:
+ bg = new BattlegroundBE;
+ break;
+ case BATTLEGROUND_EY:
+ bg = new BattlegroundEY;
+ break;
+ case BATTLEGROUND_RL:
+ bg = new BattlegroundRL;
+ break;
+ case BATTLEGROUND_SA:
+ bg = new BattlegroundSA;
+ break;
+ case BATTLEGROUND_DS:
+ bg = new BattlegroundDS;
+ break;
+ case BATTLEGROUND_RV:
+ bg = new BattlegroundRV;
+ break;
+ case BATTLEGROUND_IC:
+ bg = new BattlegroundIC;
+ break;
+ case BATTLEGROUND_AA:
+ bg = new Battleground;
+ break;
+ case BATTLEGROUND_RB:
bg = new Battleground;
+ bg->SetRandom(true);
break;
+ default:
+ return false;
}
bg->SetMapId(data.MapID);
@@ -664,102 +658,75 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
bg->SetLevelRange(data.LevelMin, data.LevelMax);
bg->SetScriptId(data.scriptId);
- // add bg to update list
- AddBattleground(bg->GetInstanceID(), bg->GetTypeID(), bg);
+ AddBattleground(bg);
- // return some not-null value, bgTypeId is good enough for me
- return data.bgTypeId;
+ return true;
}
void BattlegroundMgr::CreateInitialBattlegrounds()
{
uint32 oldMSTime = getMSTime();
-
- uint8 selectionWeight;
- BattlemasterListEntry const* bl;
-
// 0 1 2 3 4 5 6 7 8 9 10 11
QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, StartMaxDist, Weight, ScriptName FROM battleground_template");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
return;
}
- uint32 count = 0, startId;
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
- uint32 bgTypeID_ = fields[0].GetUInt32();
- if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_, NULL))
+ uint32 bgTypeId = fields[0].GetUInt32();
+ if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, NULL))
continue;
// can be overwrite by values from DB
- bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
+ BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (!bl)
{
- sLog->outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
continue;
}
CreateBattlegroundData data;
- data.bgTypeId = BattlegroundTypeId(bgTypeID_);
+ data.bgTypeId = BattlegroundTypeId(bgTypeId);
data.IsArena = (bl->type == TYPE_ARENA);
data.MinPlayersPerTeam = fields[1].GetUInt16();
data.MaxPlayersPerTeam = fields[2].GetUInt16();
data.LevelMin = fields[3].GetUInt8();
data.LevelMax = fields[4].GetUInt8();
+ float dist = fields[9].GetFloat();
+ data.StartMaxDist = dist * dist;
+
+ data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString());
+ data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()];
+ data.MapID = bl->mapid[0];
- // check values from DB
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
{
- sLog->outErrorDb("Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
continue;
}
if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax)
{
- sLog->outErrorDb("Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
data.bgTypeId, data.LevelMin, data.LevelMax);
continue;
}
- startId = fields[5].GetUInt32();
- if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
- {
- data.Team1StartLocX = start->x;
- data.Team1StartLocY = start->y;
- data.Team1StartLocZ = start->z;
- data.Team1StartLocO = fields[6].GetFloat();
- }
- else if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
+ if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
{
data.Team1StartLocX = 0;
data.Team1StartLocY = 0;
data.Team1StartLocZ = 0;
data.Team1StartLocO = fields[6].GetFloat();
- }
- else
- {
- sLog->outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
- continue;
- }
-
- startId = fields[7].GetUInt32();
- if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
- {
- data.Team2StartLocX = start->x;
- data.Team2StartLocY = start->y;
- data.Team2StartLocZ = start->z;
- data.Team2StartLocO = fields[8].GetFloat();
- }
- else if (data.bgTypeId == BATTLEGROUND_AA || data.bgTypeId == BATTLEGROUND_RB)
- {
data.Team2StartLocX = 0;
data.Team2StartLocY = 0;
data.Team2StartLocZ = 0;
@@ -767,16 +734,34 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
- sLog->outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
- continue;
- }
+ uint32 startId = fields[5].GetUInt32();
+ if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
+ {
+ data.Team1StartLocX = start->x;
+ data.Team1StartLocY = start->y;
+ data.Team1StartLocZ = start->z;
+ data.Team1StartLocO = fields[6].GetFloat();
+ }
+ else
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
+ continue;
+ }
- data.StartMaxDist = fields[9].GetFloat();
-
- selectionWeight = fields[10].GetUInt8();
- data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString());
- data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()];
- data.MapID = bl->mapid[0];
+ startId = fields[7].GetUInt32();
+ if (WorldSafeLocsEntry const* start = sWorldSafeLocsStore.LookupEntry(startId))
+ {
+ data.Team2StartLocX = start->x;
+ data.Team2StartLocY = start->y;
+ data.Team2StartLocZ = start->z;
+ data.Team2StartLocO = fields[8].GetFloat();
+ }
+ else
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
+ continue;
+ }
+ }
if (!CreateBattleground(data))
continue;
@@ -784,16 +769,16 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
if (data.IsArena)
{
if (data.bgTypeId != BATTLEGROUND_AA)
- m_ArenaSelectionWeights[data.bgTypeId] = selectionWeight;
+ m_ArenaSelectionWeights[data.bgTypeId] = fields[10].GetUInt8();
}
else if (data.bgTypeId != BATTLEGROUND_RB)
- m_BGSelectionWeights[data.bgTypeId] = selectionWeight;
+ m_BGSelectionWeights[data.bgTypeId] = fields[10].GetUInt8();
+
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
@@ -834,10 +819,10 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
*data << uint8(0); // unk
// Rewards
- *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
- *data << uint32(winner_kills); // 3.3.3 winHonor
- *data << uint32(winner_arena); // 3.3.3 winArena
- *data << uint32(loser_kills); // 3.3.3 lossHonor
+ *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin
+ *data << uint32(winner_kills); // 3.3.3 winHonor
+ *data << uint32(winner_arena); // 3.3.3 winArena
+ *data << uint32(loser_kills); // 3.3.3 lossHonor
uint8 isRandom = bgTypeId == BATTLEGROUND_RB;
@@ -845,29 +830,29 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
if (isRandom)
{
// Rewards (random)
- *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
- *data << uint32(winner_kills); // 3.3.3 winHonor_Random
- *data << uint32(winner_arena); // 3.3.3 winArena_Random
- *data << uint32(loser_kills); // 3.3.3 lossHonor_Random
+ *data << uint8(player->GetRandomWinner()); // 3.3.3 hasWin_Random
+ *data << uint32(winner_kills); // 3.3.3 winHonor_Random
+ *data << uint32(winner_arena); // 3.3.3 winArena_Random
+ *data << uint32(loser_kills); // 3.3.3 lossHonor_Random
}
- if (bgTypeId == BATTLEGROUND_AA) // arena
- {
+ if (bgTypeId == BATTLEGROUND_AA) // arena
*data << uint32(0); // unk (count?)
- }
else // battleground
{
size_t count_pos = data->wpos();
*data << uint32(0); // number of bg instances
- if (Battleground* bgTemplate = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId))
+ BattlegroundDataContainer::iterator it = bgDataStore.find(bgTypeId);
+ if (it != bgDataStore.end())
{
// expected bracket entry
- if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bgTemplate->GetMapId(), player->getLevel()))
+ if (PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(it->second.m_Battlegrounds.begin()->second->GetMapId(), player->getLevel()))
{
uint32 count = 0;
BattlegroundBracketId bracketId = bracketEntry->GetBracketId();
- for (std::set<uint32>::iterator itr = m_ClientBattlegroundIds[bgTypeId][bracketId].begin(); itr != m_ClientBattlegroundIds[bgTypeId][bracketId].end();++itr)
+ BattlegroundClientIdsContainer& clientIds = it->second.m_ClientBattlegroundIds[bracketId];
+ for (BattlegroundClientIdsContainer::const_iterator itr = clientIds.begin(); itr != clientIds.end(); ++itr)
{
*data << uint32(*itr);
++count;
@@ -880,23 +865,20 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
{
- Battleground* bg = GetBattleground(instanceId, bgTypeId);
- if (bg)
+ if (Battleground* bg = GetBattleground(instanceId, bgTypeId))
{
- uint32 mapid = bg->GetMapId();
float x, y, z, O;
+ uint32 mapid = bg->GetMapId();
uint32 team = player->GetBGTeam();
if (team == 0)
team = player->GetTeam();
- bg->GetTeamStartLoc(team, x, y, z, O);
- sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O);
+ bg->GetTeamStartLoc(team, x, y, z, O);
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName().c_str(), mapid, x, y, z, O, bgTypeId);
player->TeleportTo(mapid, x, y, z, O);
}
else
- {
- sLog->outError("player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
- }
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str());
}
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
@@ -911,37 +893,37 @@ void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battlegrou
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
{
- return (bgTypeId == BATTLEGROUND_AA ||
- bgTypeId == BATTLEGROUND_BE ||
- bgTypeId == BATTLEGROUND_NA ||
- bgTypeId == BATTLEGROUND_DS ||
- bgTypeId == BATTLEGROUND_RV ||
- bgTypeId == BATTLEGROUND_RL);
+ return bgTypeId == BATTLEGROUND_AA
+ || bgTypeId == BATTLEGROUND_BE
+ || bgTypeId == BATTLEGROUND_NA
+ || bgTypeId == BATTLEGROUND_DS
+ || bgTypeId == BATTLEGROUND_RV
+ || bgTypeId == BATTLEGROUND_RL;
}
BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType)
{
switch (bgTypeId)
{
- case BATTLEGROUND_WS:
- return BATTLEGROUND_QUEUE_WS;
case BATTLEGROUND_AB:
return BATTLEGROUND_QUEUE_AB;
case BATTLEGROUND_AV:
return BATTLEGROUND_QUEUE_AV;
case BATTLEGROUND_EY:
return BATTLEGROUND_QUEUE_EY;
- case BATTLEGROUND_SA:
- return BATTLEGROUND_QUEUE_SA;
case BATTLEGROUND_IC:
return BATTLEGROUND_QUEUE_IC;
case BATTLEGROUND_RB:
return BATTLEGROUND_QUEUE_RB;
+ case BATTLEGROUND_SA:
+ return BATTLEGROUND_QUEUE_SA;
+ case BATTLEGROUND_WS:
+ return BATTLEGROUND_QUEUE_WS;
case BATTLEGROUND_AA:
- case BATTLEGROUND_NA:
- case BATTLEGROUND_RL:
case BATTLEGROUND_BE:
case BATTLEGROUND_DS:
+ case BATTLEGROUND_NA:
+ case BATTLEGROUND_RL:
case BATTLEGROUND_RV:
switch (arenaType)
{
@@ -1004,19 +986,13 @@ uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId)
void BattlegroundMgr::ToggleTesting()
{
m_Testing = !m_Testing;
- if (m_Testing)
- sWorld->SendWorldText(LANG_DEBUG_BG_ON);
- else
- sWorld->SendWorldText(LANG_DEBUG_BG_OFF);
+ sWorld->SendWorldText(m_Testing ? LANG_DEBUG_BG_ON : LANG_DEBUG_BG_OFF);
}
void BattlegroundMgr::ToggleArenaTesting()
{
m_ArenaTesting = !m_ArenaTesting;
- if (m_ArenaTesting)
- sWorld->SendWorldText(LANG_DEBUG_ARENA_ON);
- else
- sWorld->SendWorldText(LANG_DEBUG_ARENA_OFF);
+ sWorld->SendWorldText(m_ArenaTesting ? LANG_DEBUG_ARENA_ON : LANG_DEBUG_ARENA_OFF);
}
void BattlegroundMgr::SetHolidayWeekends(uint32 mask)
@@ -1034,18 +1010,9 @@ void BattlegroundMgr::ScheduleQueueUpdate(uint32 arenaMatchmakerRating, uint8 ar
{
//This method must be atomic, TODO add mutex
//we will use only 1 number created of bgTypeId and bracket_id
- uint64 schedule_id = ((uint64)arenaMatchmakerRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id;
- bool found = false;
- for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++)
- {
- if (m_QueueUpdateScheduler[i] == schedule_id)
- {
- found = true;
- break;
- }
- }
- if (!found)
- m_QueueUpdateScheduler.push_back(schedule_id);
+ uint64 const scheduleId = ((uint64)arenaMatchmakerRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | bracket_id;
+ if (std::find(m_QueueUpdateScheduler.begin(), m_QueueUpdateScheduler.end(), scheduleId) == m_QueueUpdateScheduler.end())
+ m_QueueUpdateScheduler.push_back(scheduleId);
}
uint32 BattlegroundMgr::GetMaxRatingDifference() const
@@ -1077,8 +1044,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
if (!result)
{
- sLog->outString(">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
return;
}
@@ -1094,7 +1060,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
uint32 bgTypeId = fields[1].GetUInt32();
if (!sBattlemasterListStore.LookupEntry(bgTypeId))
{
- sLog->outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
+ sLog->outError(LOG_FILTER_SQL, "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
continue;
}
@@ -1102,8 +1068,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
@@ -1138,3 +1103,86 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
{
return IsHolidayActive(BGTypeToWeekendHolidayId(bgTypeId));
}
+
+BattlegroundTypeId BattlegroundMgr::GetRandomBG(BattlegroundTypeId bgTypeId)
+{
+ uint32 weight = 0;
+ BattlegroundTypeId returnBgTypeId = BATTLEGROUND_TYPE_NONE;
+ BattlegroundSelectionWeightMap selectionWeights;
+
+ if (bgTypeId == BATTLEGROUND_AA)
+ {
+ for (BattlegroundSelectionWeightMap::const_iterator it = m_ArenaSelectionWeights.begin(); it != m_ArenaSelectionWeights.end(); ++it)
+ {
+ if (it->second)
+ {
+ weight += it->second;
+ selectionWeights[it->first] = it->second;
+ }
+ }
+ }
+ else if (bgTypeId == BATTLEGROUND_RB)
+ {
+ for (BattlegroundSelectionWeightMap::const_iterator it = m_BGSelectionWeights.begin(); it != m_BGSelectionWeights.end(); ++it)
+ {
+ if (it->second)
+ {
+ weight += it->second;
+ selectionWeights[it->first] = it->second;
+ }
+ }
+ }
+
+ if (weight)
+ {
+ uint32 selectedWeight = 0;
+ // Select a random value
+ selectedWeight = urand(0, weight - 1);
+ // Select the correct bg (if we have in DB A(10), B(20), C(10), D(15) --> [0---A---9|10---B---29|30---C---39|40---D---54])
+ weight = 0;
+ for (BattlegroundSelectionWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
+ {
+ weight += it->second;
+ if (selectedWeight < weight)
+ {
+ returnBgTypeId = it->first;
+ break;
+ }
+ }
+ }
+
+ return returnBgTypeId;
+}
+
+BGFreeSlotQueueContainer& BattlegroundMgr::GetBGFreeSlotQueueStore(BattlegroundTypeId bgTypeId)
+{
+ return bgDataStore[bgTypeId].BGFreeSlotQueue;
+}
+
+void BattlegroundMgr::AddToBGFreeSlotQueue(BattlegroundTypeId bgTypeId, Battleground* bg)
+{
+ bgDataStore[bgTypeId].BGFreeSlotQueue.push_front(bg);
+}
+
+void BattlegroundMgr::RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId)
+{
+ BGFreeSlotQueueContainer& queues = bgDataStore[bgTypeId].BGFreeSlotQueue;
+ for (BGFreeSlotQueueContainer::iterator itr = queues.begin(); itr != queues.end(); ++itr)
+ if ((*itr)->GetInstanceID() == instanceId)
+ {
+ queues.erase(itr);
+ return;
+ }
+}
+
+void BattlegroundMgr::AddBattleground(Battleground* bg)
+{
+ if (bg)
+ bgDataStore[bg->GetTypeID()].m_Battlegrounds[bg->GetInstanceID()] = bg;
+}
+
+void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
+{
+ bgDataStore[bgTypeId].m_Battlegrounds.erase(instanceId);
+}
+
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index 10a49408c06..22c42b0febc 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -25,7 +25,8 @@
#include "BattlegroundQueue.h"
#include <ace/Singleton.h>
-typedef std::map<uint32, Battleground*> BattlegroundSet;
+typedef std::map<uint32, Battleground*> BattlegroundContainer;
+typedef std::set<uint32> BattlegroundClientIdsContainer;
typedef UNORDERED_MAP<uint32, BattlegroundTypeId> BattleMastersMap;
@@ -54,6 +55,13 @@ struct CreateBattlegroundData
uint32 scriptId;
};
+struct BattlegroundData
+{
+ BattlegroundContainer m_Battlegrounds;
+ BattlegroundClientIdsContainer m_ClientBattlegroundIds[MAX_BATTLEGROUND_BRACKETS];
+ BGFreeSlotQueueContainer BGFreeSlotQueue;
+};
+
class BattlegroundMgr
{
friend class ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>;
@@ -72,22 +80,21 @@ class BattlegroundMgr
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
- void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
- void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
+ void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint8 uiFrame = 1);
+ void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId);
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
/* Battlegrounds */
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
- Battleground* GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
-
+ Battleground* GetBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId);
Battleground* GetBattlegroundTemplate(BattlegroundTypeId bgTypeId);
Battleground* CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated);
- uint32 CreateBattleground(CreateBattlegroundData& data);
-
- void AddBattleground(uint32 InstanceID, BattlegroundTypeId bgTypeId, Battleground* BG) { m_Battlegrounds[bgTypeId][InstanceID] = BG; };
- void RemoveBattleground(uint32 instanceID, BattlegroundTypeId bgTypeId) { m_Battlegrounds[bgTypeId].erase(instanceID); }
- uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
+ void AddBattleground(Battleground* bg);
+ void RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId);
+ void AddToBGFreeSlotQueue(BattlegroundTypeId bgTypeId, Battleground* bg);
+ void RemoveFromBGFreeSlotQueue(BattlegroundTypeId bgTypeId, uint32 instanceId);
+ BGFreeSlotQueueContainer& GetBGFreeSlotQueueStore(BattlegroundTypeId bgTypeId);
void CreateInitialBattlegrounds();
void DeleteAllBattlegrounds();
@@ -95,35 +102,18 @@ class BattlegroundMgr
void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
/* Battleground queues */
- //these queues are instantiated when creating BattlegroundMrg
- BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code
-
- BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID];
-
+ BattlegroundQueue& GetBattlegroundQueue(BattlegroundQueueTypeId bgQueueTypeId) { return m_BattlegroundQueues[bgQueueTypeId]; }
void ScheduleQueueUpdate(uint32 arenaMatchmakerRating, uint8 arenaType, BattlegroundQueueTypeId bgQueueTypeId, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
- uint32 GetMaxRatingDifference() const;
- uint32 GetRatingDiscardTimer() const;
uint32 GetPrematureFinishTime() const;
- void InitAutomaticArenaPointDistribution();
void ToggleArenaTesting();
void ToggleTesting();
void SetHolidayWeekends(uint32 mask);
- void LoadBattleMastersEntry();
- BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
- {
- BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
- if (itr != mBattleMastersMap.end())
- return itr->second;
- return BATTLEGROUND_WS;
- }
bool isArenaTesting() const { return m_ArenaTesting; }
bool isTesting() const { return m_Testing; }
- static bool IsArenaType(BattlegroundTypeId bgTypeId);
- static bool IsBattlegroundType(BattlegroundTypeId bgTypeId) { return !IsArenaType(bgTypeId); }
static BattlegroundQueueTypeId BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType);
static BattlegroundTypeId BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId);
static uint8 BGArenaType(BattlegroundQueueTypeId bgQueueTypeId);
@@ -131,23 +121,41 @@ class BattlegroundMgr
static HolidayIds BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId);
static BattlegroundTypeId WeekendHolidayIdToBGType(HolidayIds holiday);
static bool IsBGWeekend(BattlegroundTypeId bgTypeId);
+
+ uint32 GetMaxRatingDifference() const;
+ uint32 GetRatingDiscardTimer() const;
+ void InitAutomaticArenaPointDistribution();
+ void LoadBattleMastersEntry();
+ BattlegroundTypeId GetBattleMasterBG(uint32 entry) const
+ {
+ BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
+ if (itr != mBattleMastersMap.end())
+ return itr->second;
+ return BATTLEGROUND_WS;
+ }
+
private:
- BattleMastersMap mBattleMastersMap;
+ bool CreateBattleground(CreateBattlegroundData& data);
+ uint32 CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id);
+ static bool IsArenaType(BattlegroundTypeId bgTypeId);
+ BattlegroundTypeId GetRandomBG(BattlegroundTypeId id);
+
+ typedef std::map<BattlegroundTypeId, BattlegroundData> BattlegroundDataContainer;
+ BattlegroundDataContainer bgDataStore;
+
+ BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES];
typedef std::map<BattlegroundTypeId, uint8> BattlegroundSelectionWeightMap; // TypeId and its selectionWeight
- /* Battlegrounds */
- BattlegroundSet m_Battlegrounds[MAX_BATTLEGROUND_TYPE_ID];
BattlegroundSelectionWeightMap m_ArenaSelectionWeights;
BattlegroundSelectionWeightMap m_BGSelectionWeights;
std::vector<uint64> m_QueueUpdateScheduler;
- std::set<uint32> m_ClientBattlegroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_BRACKETS]; //the instanceids just visible for the client
uint32 m_NextRatedArenaUpdate;
time_t m_NextAutoDistributionTime;
uint32 m_AutoDistributionTimeChecker;
bool m_ArenaTesting;
bool m_Testing;
+ BattleMastersMap mBattleMastersMap;
};
#define sBattlegroundMgr ACE_Singleton<BattlegroundMgr, ACE_Null_Mutex>::instance()
#endif
-
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 6f4264c0faf..c610cafa1b1 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -16,14 +16,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "BattlegroundQueue.h"
#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
#include "BattlegroundMgr.h"
+#include "BattlegroundQueue.h"
#include "Chat.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "Log.h"
#include "Group.h"
+#include "Log.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+#include "Player.h"
/*********************************************************/
/*** BATTLEGROUND QUEUE SYSTEM ***/
@@ -167,31 +169,31 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
}
//add players from group to ginfo
+ if (grp)
{
- //ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
- if (grp)
- {
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* member = itr->getSource();
- if (!member)
- continue; // this should never happen
- PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
- pl_info.LastOnlineTime = lastOnlineTime;
- pl_info.GroupInfo = ginfo;
- // add the pinfo to ginfo's list
- ginfo->Players[member->GetGUID()] = &pl_info;
- }
- }
- else
+ for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
- PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()];
+ Player* member = itr->getSource();
+ if (!member)
+ continue; // this should never happen
+ PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()];
pl_info.LastOnlineTime = lastOnlineTime;
pl_info.GroupInfo = ginfo;
- ginfo->Players[leader->GetGUID()] = &pl_info;
+ // add the pinfo to ginfo's list
+ ginfo->Players[member->GetGUID()] = &pl_info;
}
+ }
+ else
+ {
+ PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()];
+ pl_info.LastOnlineTime = lastOnlineTime;
+ pl_info.GroupInfo = ginfo;
+ ginfo->Players[leader->GetGUID()] = &pl_info;
+ }
- //add GroupInfo to m_QueuedGroups
+ //add GroupInfo to m_QueuedGroups
+ {
+ //ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock);
m_QueuedGroups[bracketId][index].push_back(ginfo);
//announce to world, this code needs mutex
@@ -216,7 +218,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
// Show queue status to player only (when joining queue)
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY))
{
- ChatHandler(leader).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
+ ChatHandler(leader->GetSession()).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_max_level,
qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0);
}
// System message
@@ -236,16 +238,16 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, Battlegr
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id)
{
uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime());
- uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
+ uint8 team_index = TEAM_ALLIANCE; //default set to TEAM_ALLIANCE - or non rated arenas!
if (!ginfo->ArenaType)
{
if (ginfo->Team == HORDE)
- team_index = BG_TEAM_HORDE;
+ team_index = TEAM_HORDE;
}
else
{
if (ginfo->IsRated)
- team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
+ team_index = TEAM_HORDE; //for rated arenas use TEAM_HORDE
}
//store pointer to arrayindex of player that was added first
@@ -263,16 +265,16 @@ void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BattlegroundBracketId bracket_id) const
{
- uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
+ uint8 team_index = TEAM_ALLIANCE; //default set to TEAM_ALLIANCE - or non rated arenas!
if (!ginfo->ArenaType)
{
if (ginfo->Team == HORDE)
- team_index = BG_TEAM_HORDE;
+ team_index = TEAM_HORDE;
}
else
{
if (ginfo->IsRated)
- team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
+ team_index = TEAM_HORDE; //for rated arenas use TEAM_HORDE
}
//check if there is enought values(we always add values > 0)
if (m_WaitTimes[team_index][bracket_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1])
@@ -294,29 +296,30 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
itr = m_QueuedPlayers.find(guid);
if (itr == m_QueuedPlayers.end())
{
- sLog->outError("BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
return;
}
GroupQueueInfo* group = itr->second.GroupInfo;
- GroupsQueueType::iterator group_itr, group_itr_tmp;
+ GroupsQueueType::iterator group_itr;
// mostly people with the highest levels are in battlegrounds, thats why
// we count from MAX_BATTLEGROUND_QUEUES - 1 to 0
- // variable index removes useless searching in other team's queue
- uint32 index = (group->Team == HORDE) ? BG_TEAM_HORDE : BG_TEAM_ALLIANCE;
+
+ uint32 index = (group->Team == HORDE) ? BG_QUEUE_PREMADE_HORDE : BG_QUEUE_PREMADE_ALLIANCE;
for (int32 bracket_id_tmp = MAX_BATTLEGROUND_BRACKETS - 1; bracket_id_tmp >= 0 && bracket_id == -1; --bracket_id_tmp)
{
//we must check premade and normal team's queue - because when players from premade are joining bg,
//they leave groupinfo so we can't use its players size to find out index
- for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_QUEUE_NORMAL_ALLIANCE)
+ for (uint32 j = index; j < BG_QUEUE_GROUP_TYPES_COUNT; j += BG_TEAMS_COUNT)
{
- for (group_itr_tmp = m_QueuedGroups[bracket_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[bracket_id_tmp][j].end(); ++group_itr_tmp)
+ GroupsQueueType::iterator k = m_QueuedGroups[bracket_id_tmp][j].begin();
+ for (; k != m_QueuedGroups[bracket_id_tmp][j].end(); ++k)
{
- if ((*group_itr_tmp) == group)
+ if ((*k) == group)
{
bracket_id = bracket_id_tmp;
- group_itr = group_itr_tmp;
+ group_itr = k;
//we must store index to be able to erase iterator
index = j;
break;
@@ -328,7 +331,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
//player can't be in queue without group, but just in case
if (bracket_id == -1)
{
- sLog->outError("BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
return;
}
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: Removing player GUID %u, from bracket_id %u", GUID_LOPART(guid), (uint32)bracket_id);
@@ -345,7 +348,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
// if invited to bg, and should decrease invited count, then do it
if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
- if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : group->BgTypeId))
+ if (Battleground* bg = sBattlegroundMgr->GetBattleground(group->IsInvitedToBGInstanceGUID, group->BgTypeId))
bg->DecreaseInvitedCount(group->Team);
// remove player queue info
@@ -375,11 +378,13 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
{
m_QueuedGroups[bracket_id][index].erase(group_itr);
delete group;
+ return;
}
+
// if group wasn't empty, so it wasn't deleted, and player have left a rated
// queue -> everyone from the group should leave too
// don't remove recursively if already invited to bg!
- else if (!group->IsInvitedToBGInstanceGUID && group->IsRated)
+ if (!group->IsInvitedToBGInstanceGUID && group->IsRated)
{
// remove next player, this is recursive
// first send removal information
@@ -417,6 +422,11 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginf
return true;
}
+uint32 BattlegroundQueue::GetPlayersInQueue(TeamId id)
+{
+ return m_SelectionPools[id].GetPlayerCount();
+}
+
bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side)
{
// set side if needed
@@ -467,7 +477,8 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg,
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u",
+ player->GetName().c_str(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID());
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType);
@@ -495,13 +506,13 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, BattlegroundBracketId
uint32 aliCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_ALLIANCE].size();
//index to queue which group is current
uint32 aliIndex = 0;
- for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree); aliIndex++)
+ for (; aliIndex < aliCount && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), aliFree); aliIndex++)
++Ali_itr;
//the same thing for horde
GroupsQueueType::const_iterator Horde_itr = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].begin();
uint32 hordeCount = m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].size();
uint32 hordeIndex = 0;
- for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); hordeIndex++)
+ for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), hordeFree); hordeIndex++)
++Horde_itr;
//if ofc like BG queue invitation is set in config, then we are happy
@@ -517,45 +528,45 @@ void BattlegroundQueue::FillPlayersToBG(Battleground* bg, BattlegroundBracketId
*/
// At first we need to compare free space in bg and our selection pool
- int32 diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
- int32 diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
- while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0))
+ int32 diffAli = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
+ int32 diffHorde = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
+ while (abs(diffAli - diffHorde) > 1 && (m_SelectionPools[TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() > 0))
{
//each cycle execution we need to kick at least 1 group
if (diffAli < diffHorde)
{
//kick alliance group, add to pool new group if needed
- if (m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli))
+ if (m_SelectionPools[TEAM_ALLIANCE].KickGroup(diffHorde - diffAli))
{
- for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++)
+ for (; aliIndex < aliCount && m_SelectionPools[TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++)
++Ali_itr;
}
//if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
- if (!m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
+ if (!m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
{
if (aliFree <= diffHorde + 1)
break;
- m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffHorde - diffAli);
+ m_SelectionPools[TEAM_HORDE].KickGroup(diffHorde - diffAli);
}
}
else
{
//kick horde group, add to pool new group if needed
- if (m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde))
+ if (m_SelectionPools[TEAM_HORDE].KickGroup(diffAli - diffHorde))
{
- for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++)
+ for (; hordeIndex < hordeCount && m_SelectionPools[TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++)
++Horde_itr;
}
- if (!m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
+ if (!m_SelectionPools[TEAM_HORDE].GetPlayerCount())
{
if (hordeFree <= diffAli + 1)
break;
- m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
+ m_SelectionPools[TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
}
}
//count diffs after small update
- diffAli = aliFree - int32(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount());
- diffHorde = hordeFree - int32(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
+ diffAli = aliFree - int32(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount());
+ diffHorde = hordeFree - int32(m_SelectionPools[TEAM_HORDE].GetPlayerCount());
}
}
@@ -579,10 +590,10 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end())
{
- m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam);
- m_SelectionPools[BG_TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam);
+ m_SelectionPools[TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam);
+ m_SelectionPools[TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam);
//add groups/players from normal queue to size of bigger group
- uint32 maxPlayers = std::min(m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount());
+ uint32 maxPlayers = std::min(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount(), m_SelectionPools[TEAM_HORDE].GetPlayerCount());
GroupsQueueType::const_iterator itr;
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
{
@@ -637,11 +648,11 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, Battleground
}
}
//try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
- uint32 j = BG_TEAM_ALLIANCE;
- if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
- j = BG_TEAM_HORDE;
+ uint32 j = TEAM_ALLIANCE;
+ if (m_SelectionPools[TEAM_HORDE].GetPlayerCount() < m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())
+ j = TEAM_HORDE;
if (sWorld->getIntConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
- && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers)
+ && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers)
{
//we will try to invite more groups to team with less players indexed by j
++(itr_team[j]); //this will not cause a crash, because for cycle above reached break;
@@ -652,28 +663,28 @@ bool BattlegroundQueue::CheckNormalMatch(Battleground* bg_template, Battleground
break;
}
// do not allow to start bg with more than 2 players more on 1 faction
- if (abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2)
+ if (abs((int32)(m_SelectionPools[TEAM_HORDE].GetPlayerCount() - m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount())) > 2)
return false;
}
//allow 1v0 if debug bg
- if (sBattlegroundMgr->isTesting() && bg_template->isBattleground() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()))
+ if (sBattlegroundMgr->isTesting() && bg_template->isBattleground() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
return true;
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
- return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers;
+ return m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= minPlayers;
}
// this method will check if we can invite players to same faction skirmish match
bool BattlegroundQueue::CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam)
{
- if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
+ if (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
return false;
- uint32 teamIndex = BG_TEAM_ALLIANCE;
- uint32 otherTeam = BG_TEAM_HORDE;
+ uint32 teamIndex = TEAM_ALLIANCE;
+ uint32 otherTeam = TEAM_HORDE;
uint32 otherTeamId = HORDE;
- if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam)
+ if (m_SelectionPools[TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam)
{
- teamIndex = BG_TEAM_HORDE;
- otherTeam = BG_TEAM_ALLIANCE;
+ teamIndex = TEAM_HORDE;
+ otherTeam = TEAM_ALLIANCE;
otherTeamId = ALLIANCE;
}
//clear other team's selection
@@ -740,38 +751,32 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
m_QueuedGroups[bracket_id][BG_QUEUE_NORMAL_HORDE].empty())
return;
- //battleground with free slot for player should be always in the beggining of the queue
+ // battleground with free slot for player should be always in the beggining of the queue
// maybe it would be better to create bgfreeslotqueue for each bracket_id
- BGFreeSlotQueueType::iterator itr, next;
- for (itr = sBattlegroundMgr->BGFreeSlotQueue[bgTypeId].begin(); itr != sBattlegroundMgr->BGFreeSlotQueue[bgTypeId].end(); itr = next)
+ BGFreeSlotQueueContainer& bgQueues = sBattlegroundMgr->GetBGFreeSlotQueueStore(bgTypeId);
+ for (BGFreeSlotQueueContainer::iterator itr = bgQueues.begin(); itr != bgQueues.end();)
{
- next = itr;
- ++next;
- // DO NOT allow queue manager to invite new player to arena
- if ((*itr)->isBattleground() && (*itr)->GetTypeID() == bgTypeId && (*itr)->GetBracketId() == bracket_id &&
- (*itr)->GetStatus() > STATUS_WAIT_QUEUE && (*itr)->GetStatus() < STATUS_WAIT_LEAVE)
+ Battleground* bg = *itr; ++itr;
+ // DO NOT allow queue manager to invite new player to rated games
+ if (!bg->isRated() && bg->GetTypeID() == bgTypeId && bg->GetBracketId() == bracket_id &&
+ bg->GetStatus() > STATUS_WAIT_QUEUE && bg->GetStatus() < STATUS_WAIT_LEAVE)
{
- Battleground* bg = *itr; //we have to store battleground pointer here, because when battleground is full, it is removed from free queue (not yet implemented!!)
- // and iterator is invalid
-
// clear selection pools
- m_SelectionPools[BG_TEAM_ALLIANCE].Init();
- m_SelectionPools[BG_TEAM_HORDE].Init();
+ m_SelectionPools[TEAM_ALLIANCE].Init();
+ m_SelectionPools[TEAM_HORDE].Init();
// call a function that does the job for us
FillPlayersToBG(bg, bracket_id);
// now everything is set, invite players
- for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
+ for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg, (*citr)->Team);
- for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++citr)
+
+ for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_HORDE].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_HORDE].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg, (*citr)->Team);
if (!bg->HasFreeSlots())
- {
- // remove BG from BGFreeSlotQueue
bg->RemoveFromBGFreeSlotQueue();
- }
}
}
@@ -780,76 +785,52 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
Battleground* bg_template = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
if (!bg_template)
{
- sLog->outError("Battleground: Update: bg template not found for %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg template not found for %u", bgTypeId);
return;
}
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketById(bg_template->GetMapId(), bracket_id);
if (!bracketEntry)
{
- sLog->outError("Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: Update: bg bracket entry not found for map %u bracket id %u", bg_template->GetMapId(), bracket_id);
return;
}
// get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!)
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
- if (sBattlegroundMgr->isTesting())
- MinPlayersPerTeam = 1;
+
if (bg_template->isArena())
{
- if (sBattlegroundMgr->isArenaTesting())
- {
- MaxPlayersPerTeam = 1;
- MinPlayersPerTeam = 1;
- }
- else
- {
- //this switch can be much shorter
- MaxPlayersPerTeam = arenaType;
- MinPlayersPerTeam = arenaType;
- /*switch (arenaType)
- {
- case ARENA_TYPE_2v2:
- MaxPlayersPerTeam = 2;
- MinPlayersPerTeam = 2;
- break;
- case ARENA_TYPE_3v3:
- MaxPlayersPerTeam = 3;
- MinPlayersPerTeam = 3;
- break;
- case ARENA_TYPE_5v5:
- MaxPlayersPerTeam = 5;
- MinPlayersPerTeam = 5;
- break;
- }*/
- }
+ MaxPlayersPerTeam = arenaType;
+ MinPlayersPerTeam = sBattlegroundMgr->isArenaTesting() ? 1 : arenaType;
}
+ else if (sBattlegroundMgr->isTesting())
+ MinPlayersPerTeam = 1;
- m_SelectionPools[BG_TEAM_ALLIANCE].Init();
- m_SelectionPools[BG_TEAM_HORDE].Init();
+ m_SelectionPools[TEAM_ALLIANCE].Init();
+ m_SelectionPools[TEAM_HORDE].Init();
if (bg_template->isBattleground())
{
- //check if there is premade against premade match
if (CheckPremadeMatch(bracket_id, MinPlayersPerTeam, MaxPlayersPerTeam))
{
- //create new battleground
+ // create new battleground
Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, 0, false);
if (!bg2)
{
- sLog->outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
}
- //invite those selection pools
+ // invite those selection pools
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
- for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
+ for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->Team);
- //start bg
+
bg2->StartBattleground();
//clear structures
- m_SelectionPools[BG_TEAM_ALLIANCE].Init();
- m_SelectionPools[BG_TEAM_HORDE].Init();
+ m_SelectionPools[TEAM_ALLIANCE].Init();
+ m_SelectionPools[TEAM_HORDE].Init();
}
}
@@ -864,13 +845,13 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
Battleground* bg2 = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, false);
if (!bg2)
{
- sLog->outError("BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
}
// invite those selection pools
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
- for (GroupsQueueType::const_iterator citr = m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[BG_TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
+ for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_ALLIANCE + i].SelectedGroups.end(); ++citr)
InviteGroupToBG((*citr), bg2, (*citr)->Team);
// start bg
bg2->StartBattleground();
@@ -957,12 +938,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
//if we have 2 teams, then start new arena and invite players!
if (found == 2)
{
- GroupQueueInfo* aTeam = *itr_teams[BG_TEAM_ALLIANCE];
- GroupQueueInfo* hTeam = *itr_teams[BG_TEAM_HORDE];
+ GroupQueueInfo* aTeam = *itr_teams[TEAM_ALLIANCE];
+ GroupQueueInfo* hTeam = *itr_teams[TEAM_HORDE];
Battleground* arena = sBattlegroundMgr->CreateNewBattleground(bgTypeId, bracketEntry, arenaType, true);
if (!arena)
{
- sLog->outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
return;
}
@@ -977,12 +958,12 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
if (aTeam->Team != ALLIANCE)
{
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(aTeam);
- m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[BG_TEAM_ALLIANCE]);
+ m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].erase(itr_teams[TEAM_ALLIANCE]);
}
if (hTeam->Team != HORDE)
{
m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].push_front(hTeam);
- m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[BG_TEAM_HORDE]);
+ m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_teams[TEAM_HORDE]);
}
arena->SetArenaMatchmakerRating(ALLIANCE, aTeam->ArenaMatchmakerRating);
@@ -1017,7 +998,7 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground
{
// check if player is invited to this bg
- BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
+ BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
{
WorldPacket data;
@@ -1058,7 +1039,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground
{
// check if player is in queue for this BG and if we are removing his invite event
- BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[m_BgQueueTypeId];
+ BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(m_BgQueueTypeId);
if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime))
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.", player->GetGUIDLow(), m_BgInstanceGUID);
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h
index 5cf5afc50ca..6f8c774864d 100755..100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.h
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.h
@@ -24,8 +24,10 @@
#include "Battleground.h"
#include "EventProcessor.h"
+#include <deque>
+
//this container can't be deque, because deque doesn't like removing the last element - if you remove it, it invalidates next iterator and crash appears
-typedef std::list<Battleground*> BGFreeSlotQueueType;
+typedef std::list<Battleground*> BGFreeSlotQueueContainer;
#define COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME 10
@@ -87,7 +89,7 @@ class BattlegroundQueue
QueuedPlayersMap m_QueuedPlayers;
//we need constant add to begin and constant remove / add from the end, therefore deque suits our problem well
- typedef std::list<GroupQueueInfo*> GroupsQueueType;
+ typedef std::deque<GroupQueueInfo*> GroupsQueueType;
/*
This two dimensional array is used to store All queued groups
@@ -117,7 +119,7 @@ class BattlegroundQueue
//one selection pool for horde, other one for alliance
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
-
+ uint32 GetPlayersInQueue(TeamId id);
private:
bool InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side);
@@ -138,9 +140,8 @@ class BGQueueInviteEvent : public BasicEvent
public:
BGQueueInviteEvent(uint64 pl_guid, uint32 BgInstanceGUID, BattlegroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) :
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime)
- {
- };
- virtual ~BGQueueInviteEvent() {};
+ { }
+ virtual ~BGQueueInviteEvent() { }
virtual bool Execute(uint64 e_time, uint32 p_time);
virtual void Abort(uint64 e_time);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp
deleted file mode 100755
index e4c1b484d4d..00000000000
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Battleground.h"
-#include "BattlegroundAA.h"
-#include "Language.h"
-#include "Player.h"
-
-BattlegroundAA::BattlegroundAA()
-{
- StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
- StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
- StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
- StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
- //we must set messageIds
- StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
- StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
- StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
- StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
-}
-
-BattlegroundAA::~BattlegroundAA()
-{
-
-}
-
-void BattlegroundAA::StartingEventCloseDoors()
-{
-}
-
-void BattlegroundAA::StartingEventOpenDoors()
-{
-}
-
-void BattlegroundAA::AddPlayer(Player* player)
-{
- Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundAAScore* sc = new BattlegroundAAScore;
-
- PlayerScores[player->GetGUID()] = sc;
-}
-
-void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
-{
-}
-
-void BattlegroundAA::HandleKillPlayer(Player* player, Player* killer)
-{
- Battleground::HandleKillPlayer(player, killer);
-}
-
-void BattlegroundAA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
-{
-}
-
-bool BattlegroundAA::SetupBattleground()
-{
- return true;
-}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h
deleted file mode 100755
index 79af4269fbf..00000000000
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef __BATTLEGROUNDAA_H
-#define __BATTLEGROUNDAA_H
-
-class Battleground;
-
-class BattlegroundAAScore : public BattlegroundScore
-{
- public:
- BattlegroundAAScore() {};
- virtual ~BattlegroundAAScore() {};
- //TODO fix me
-};
-
-class BattlegroundAA : public Battleground
-{
- public:
- BattlegroundAA();
- ~BattlegroundAA();
-
- /* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
-
- void RemovePlayer(Player* player, uint64 guid, uint32 team);
- void HandleAreaTrigger(Player* Source, uint32 Trigger);
- bool SetupBattleground();
- void HandleKillPlayer(Player* player, Player* killer);
-};
-#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index d28f5ddfe6a..cb0d651ad47 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -16,17 +16,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "BattlegroundAB.h"
#include "World.h"
#include "WorldPacket.h"
#include "ObjectMgr.h"
#include "BattlegroundMgr.h"
-#include "Battleground.h"
-#include "BattlegroundAB.h"
#include "Creature.h"
#include "Language.h"
#include "Object.h"
#include "Player.h"
#include "Util.h"
+#include "WorldSession.h"
BattlegroundAB::BattlegroundAB()
{
@@ -119,17 +119,17 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
- (team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
+ (team == TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTics[team] -= m_ReputationTics;
}
if (m_HonorScoreTics[team] >= m_HonorTics)
{
- RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
+ RewardHonorToTeam(GetBonusHonorFromKill(1), (team == TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_HonorScoreTics[team] -= m_HonorTics;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
- if (team == BG_TEAM_ALLIANCE)
+ if (team == TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
@@ -139,9 +139,9 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
- if (team == BG_TEAM_ALLIANCE)
+ if (team == TEAM_ALLIANCE)
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
- if (team == BG_TEAM_HORDE)
+ if (team == TEAM_HORDE)
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
// update achievement flags
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
@@ -152,9 +152,9 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
}
// Test win condition
- if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
+ if (m_TeamScores[TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
EndBattleground(ALLIANCE);
- if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
+ if (m_TeamScores[TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
EndBattleground(HORDE);
}
}
@@ -210,24 +210,24 @@ void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*
}
-void BattlegroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundAB::HandleAreaTrigger(Player* player, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- switch (Trigger)
+ switch (trigger)
{
case 3948: // Arathi Basin Alliance Exit.
- if (Source->GetTeam() != ALLIANCE)
- Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
+ if (player->GetTeam() != ALLIANCE)
+ player->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
else
- Source->LeaveBattleground();
+ player->LeaveBattleground();
break;
case 3949: // Arathi Basin Horde Exit.
- if (Source->GetTeam() != HORDE)
- Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
+ if (player->GetTeam() != HORDE)
+ player->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
else
- Source->LeaveBattleground();
+ player->LeaveBattleground();
break;
case 3866: // Stables
case 3869: // Gold Mine
@@ -236,10 +236,10 @@ void BattlegroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 3870: // Black Smith
case 4020: // Unk1
case 4021: // Unk2
+ case 4674: // Unk3
//break;
default:
- //sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- //Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
}
@@ -322,8 +322,8 @@ void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
// Team scores
data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE);
data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE);
- data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]);
- data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]);
+ data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[TEAM_ALLIANCE]);
+ data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[TEAM_HORDE]);
// other unknown
data << uint32(0x745) << uint32(0x2); // 37 1861 unk
@@ -356,7 +356,7 @@ void BattlegroundAB::_SendNodeUpdate(uint8 node)
void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
{
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
- sLog->outError("Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Failed to spawn spirit guide! point: %u, team: %u, ", node, team);
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
@@ -364,6 +364,7 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
}
+
if (capturedNodes >= 5)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
if (capturedNodes >= 4)
@@ -371,9 +372,10 @@ void BattlegroundAB::_NodeOccupied(uint8 node, Team team)
if (node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
return;
- Creature* trigger = GetBGCreature(node+7);//0-6 spirit guides
+
+ Creature* trigger = BgCreatures[node+7] ? GetBGCreature(node+7) : NULL;//0-6 spirit guides
if (!trigger)
- trigger = AddCreature(WORLD_TRIGGER, node+7, team, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
+ trigger = AddCreature(WORLD_TRIGGER, node+7, team, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
//add bonus honor aura trigger creature when node is accupied
//cast bonus aura (+50% honor in 25yards)
@@ -439,7 +441,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
return;
}
- BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
+ TeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
// Check if player really could use this banner, not cheated
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
@@ -485,7 +487,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: node names not localized
- if (teamIndex == BG_TEAM_ALLIANCE)
+ if (teamIndex == TEAM_ALLIANCE)
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
@@ -502,15 +504,15 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
m_NodeTimers[node] = 0;
- _NodeOccupied(node, (teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE);
+ _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE:HORDE);
// FIXME: node names not localized
- if (teamIndex == BG_TEAM_ALLIANCE)
+ if (teamIndex == TEAM_ALLIANCE)
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
}
- sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
+ sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
// If node is occupied, change to enemy-contested
else
@@ -527,19 +529,19 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: node names not localized
- if (teamIndex == BG_TEAM_ALLIANCE)
+ if (teamIndex == TEAM_ALLIANCE)
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
- sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
+ sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
// If node is occupied again, send "X has taken the Y" msg.
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
{
// FIXME: team and node names not localized
- if (teamIndex == BG_TEAM_ALLIANCE)
+ if (teamIndex == TEAM_ALLIANCE)
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
@@ -547,21 +549,40 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
PlaySoundToAll(sound);
}
+uint32 BattlegroundAB::GetPrematureWinner()
+{
+ // How many bases each team owns
+ uint8 ally = 0, horde = 0;
+ for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
+ if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
+ ++ally;
+ else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
+ ++horde;
+
+ if (ally > horde)
+ return ALLIANCE;
+ else if (horde > ally)
+ return HORDE;
+
+ // If the values are equal, fall back to the original result (based on number of players on each team)
+ return Battleground::GetPrematureWinner();
+}
+
bool BattlegroundAB::SetupBattleground()
{
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i, BG_AB_OBJECTID_BANNER_CONT_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i, BG_AB_OBJECTID_AURA_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i, BG_AB_OBJECTID_AURA_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i, BG_AB_OBJECTID_AURA_C, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, std::sin(BG_AB_NodePositions[i][3]/2), std::cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
)
{
- sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
}
@@ -569,17 +590,17 @@ bool BattlegroundAB::SetupBattleground()
|| !AddObject(BG_AB_OBJECT_GATE_H, BG_AB_OBJECTID_GATE_H, BG_AB_DoorPositions[1][0], BG_AB_DoorPositions[1][1], BG_AB_DoorPositions[1][2], BG_AB_DoorPositions[1][3], BG_AB_DoorPositions[1][4], BG_AB_DoorPositions[1][5], BG_AB_DoorPositions[1][6], BG_AB_DoorPositions[1][7], RESPAWN_IMMEDIATELY)
)
{
- sLog->outErrorDb("BatteGroundAB: Failed to spawn door object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn door object Battleground not created!");
return false;
}
//buffs
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, std::sin(BG_AB_BuffPositions[i][3]/2), std::cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
)
- sLog->outErrorDb("BatteGroundAB: Failed to spawn buff object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!");
}
return true;
@@ -590,20 +611,20 @@ void BattlegroundAB::Reset()
//call parent's class reset
Battleground::Reset();
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
- m_lastTick[BG_TEAM_ALLIANCE] = 0;
- m_lastTick[BG_TEAM_HORDE] = 0;
- m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0;
- m_HonorScoreTics[BG_TEAM_HORDE] = 0;
- m_ReputationScoreTics[BG_TEAM_ALLIANCE] = 0;
- m_ReputationScoreTics[BG_TEAM_HORDE] = 0;
+ m_TeamScores[TEAM_ALLIANCE] = 0;
+ m_TeamScores[TEAM_HORDE] = 0;
+ m_lastTick[TEAM_ALLIANCE] = 0;
+ m_lastTick[TEAM_HORDE] = 0;
+ m_HonorScoreTics[TEAM_ALLIANCE] = 0;
+ m_HonorScoreTics[TEAM_HORDE] = 0;
+ m_ReputationScoreTics[TEAM_ALLIANCE] = 0;
+ m_ReputationScoreTics[TEAM_HORDE] = 0;
m_IsInformedNearVictory = false;
bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
- m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false;
- m_TeamScores500Disadvantage[BG_TEAM_HORDE] = false;
+ m_TeamScores500Disadvantage[TEAM_ALLIANCE] = false;
+ m_TeamScores500Disadvantage[TEAM_HORDE] = false;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
@@ -620,12 +641,12 @@ void BattlegroundAB::Reset()
void BattlegroundAB::EndBattleground(uint32 winner)
{
- //win reward
+ // Win reward
if (winner == ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
if (winner == HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
- //complete map_end rewards (even if no team wins)
+ // Complete map_end rewards (even if no team wins)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
@@ -634,7 +655,7 @@ void BattlegroundAB::EndBattleground(uint32 winner)
WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveYard(Player* player)
{
- BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
+ TeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
// Is there any occupied node for this team?
std::vector<uint8> nodes;
@@ -681,11 +702,11 @@ void BattlegroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
case SCORE_BASES_ASSAULTED:
((BattlegroundABScore*)itr->second)->BasesAssaulted += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_ASSAULT_BASE);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_ASSAULT_BASE);
break;
case SCORE_BASES_DEFENDED:
((BattlegroundABScore*)itr->second)->BasesDefended += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_DEFEND_BASE);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_DEFEND_BASE);
break;
default:
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 2cac5df73a9..6e01437b895 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
@@ -15,10 +15,11 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef __BATTLEGROUNDAB_H
#define __BATTLEGROUNDAB_H
-class Battleground;
+#include "Battleground.h"
enum BG_AB_WorldStates
{
@@ -102,7 +103,7 @@ enum BG_AB_ObjectType
BG_AB_OBJECT_SPEEDBUFF_GOLD_MINE = 54,
BG_AB_OBJECT_REGENBUFF_GOLD_MINE = 55,
BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE = 56,
- BG_AB_OBJECT_MAX = 57,
+ BG_AB_OBJECT_MAX = 57
};
/* Object id templates from DB */
@@ -123,7 +124,7 @@ enum BG_AB_ObjectTypes
enum BG_AB_Timers
{
- BG_AB_FLAG_CAPTURING_TIME = 60000,
+ BG_AB_FLAG_CAPTURING_TIME = 60000
};
enum BG_AB_Score
@@ -146,7 +147,7 @@ enum BG_AB_BattlegroundNodes
BG_AB_SPIRIT_ALIANCE = 5,
BG_AB_SPIRIT_HORDE = 6,
- BG_AB_ALL_NODES_COUNT = 7, // all nodes (dynamic and static)
+ BG_AB_ALL_NODES_COUNT = 7 // all nodes (dynamic and static)
};
enum BG_AB_NodeStatus
@@ -236,13 +237,12 @@ struct BG_AB_BannerTimer
uint8 teamIndex;
};
-class BattlegroundABScore : public BattlegroundScore
+struct BattlegroundABScore : public BattlegroundScore
{
- public:
- BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
- virtual ~BattlegroundABScore() {};
- uint32 BasesAssaulted;
- uint32 BasesDefended;
+ BattlegroundABScore(): BasesAssaulted(0), BasesDefended(0) { }
+ ~BattlegroundABScore() { }
+ uint32 BasesAssaulted;
+ uint32 BasesDefended;
};
class BattlegroundAB : public Battleground
@@ -252,28 +252,30 @@ class BattlegroundAB : public Battleground
~BattlegroundAB();
void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
- virtual bool SetupBattleground();
- virtual void Reset();
+ bool SetupBattleground();
+ void Reset();
void EndBattleground(uint32 winner);
- virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
+ WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */
- virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
+ void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
- virtual void FillInitialWorldStates(WorldPacket& data);
+ void FillInitialWorldStates(WorldPacket& data);
/* Nodes occupying */
- virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
+ void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
/* achievement req. */
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
+
+ uint32 GetPrematureWinner();
private:
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
/* Gameobject spawning/despawning */
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
@@ -306,4 +308,3 @@ class BattlegroundAB : public Battleground
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT];
};
#endif
-
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index d2cbab2be54..b12aec245cd 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -16,16 +16,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "BattlegroundAV.h"
+
#include "ObjectMgr.h"
#include "WorldPacket.h"
-#include "Battleground.h"
-#include "BattlegroundAV.h"
-#include "Miscellaneous/Formulas.h"
+#include "Formulas.h"
#include "GameObject.h"
-#include "Miscellaneous/Language.h"
+#include "Language.h"
#include "Player.h"
#include "SpellAuras.h"
+#include "WorldSession.h"
BattlegroundAV::BattlegroundAV()
{
@@ -93,7 +94,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
if (!m_CaptainAlive[0])
{
- sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
}
m_CaptainAlive[0]=false;
@@ -112,7 +113,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
if (!m_CaptainAlive[1])
{
- sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
}
m_CaptainAlive[1]=false;
@@ -177,7 +178,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
case AV_QUEST_H_COMMANDER3:
m_Team_QuestStatus[team][3]++;
RewardReputationToTeam(team, 1, player->GetTeam());
- if (m_Team_QuestStatus[team][1] == 120)
+ if (m_Team_QuestStatus[team][3] == 120)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_BOSS1:
@@ -242,17 +243,17 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points)
uint8 teamindex = GetTeamIndexByTeamId(team); //0=ally 1=horde
m_Team_Scores[teamindex] += points;
- UpdateWorldState(((teamindex == BG_TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
+ UpdateWorldState(((teamindex == TEAM_HORDE)?AV_Horde_Score:AV_Alliance_Score), m_Team_Scores[teamindex]);
if (points < 0)
{
if (m_Team_Scores[teamindex] < 1)
{
m_Team_Scores[teamindex]=0;
- EndBattleground(((teamindex == BG_TEAM_HORDE)?ALLIANCE:HORDE));
+ EndBattleground(((teamindex == TEAM_HORDE)?ALLIANCE:HORDE));
}
else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE)
{
- SendMessageToAll(teamindex == BG_TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == BG_TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
+ SendMessageToAll(teamindex == TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE);
PlaySoundToAll(AV_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory[teamindex] = true;
}
@@ -269,14 +270,30 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
{
type -= AV_CPLACE_MAX;
cinfoid=uint16(BG_AV_StaticCreaturePos[type][4]);
- creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0], (type+AV_CPLACE_MAX), BG_AV_StaticCreatureInfo[cinfoid][1], BG_AV_StaticCreaturePos[type][0], BG_AV_StaticCreaturePos[type][1], BG_AV_StaticCreaturePos[type][2], BG_AV_StaticCreaturePos[type][3]);
- level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3]) ? BG_AV_StaticCreatureInfo[cinfoid][2] : urand(BG_AV_StaticCreatureInfo[cinfoid][2], BG_AV_StaticCreatureInfo[cinfoid][3]);
+ creature = AddCreature(BG_AV_StaticCreatureInfo[cinfoid][0],
+ (type+AV_CPLACE_MAX),
+ BG_AV_StaticCreatureInfo[cinfoid][1],
+ BG_AV_StaticCreaturePos[type][0],
+ BG_AV_StaticCreaturePos[type][1],
+ BG_AV_StaticCreaturePos[type][2],
+ BG_AV_StaticCreaturePos[type][3]);
+ level = (BG_AV_StaticCreatureInfo[cinfoid][2] == BG_AV_StaticCreatureInfo[cinfoid][3])
+ ? BG_AV_StaticCreatureInfo[cinfoid][2]
+ : urand(BG_AV_StaticCreatureInfo[cinfoid][2], BG_AV_StaticCreatureInfo[cinfoid][3]);
isStatic = true;
}
else
{
- creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0], type, BG_AV_CreatureInfo[cinfoid][1], BG_AV_CreaturePos[type][0], BG_AV_CreaturePos[type][1], BG_AV_CreaturePos[type][2], BG_AV_CreaturePos[type][3]);
- level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3]) ? BG_AV_CreatureInfo[cinfoid][2] : urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]);
+ creature = AddCreature(BG_AV_CreatureInfo[cinfoid][0],
+ type,
+ BG_AV_CreatureInfo[cinfoid][1],
+ BG_AV_CreaturePos[type][0],
+ BG_AV_CreaturePos[type][1],
+ BG_AV_CreaturePos[type][2],
+ BG_AV_CreaturePos[type][3]);
+ level = (BG_AV_CreatureInfo[cinfoid][2] == BG_AV_CreatureInfo[cinfoid][3])
+ ? BG_AV_CreatureInfo[cinfoid][2]
+ : urand(BG_AV_CreatureInfo[cinfoid][2], BG_AV_CreatureInfo[cinfoid][3]);
}
if (!creature)
return NULL;
@@ -329,7 +346,13 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
}
if (triggerSpawnID && newFaction)
{
- if (Creature* trigger = AddCreature(WORLD_TRIGGER, triggerSpawnID, BG_AV_CreatureInfo[creature->GetEntry()][1], BG_AV_CreaturePos[triggerSpawnID][0], BG_AV_CreaturePos[triggerSpawnID][1], BG_AV_CreaturePos[triggerSpawnID][2], BG_AV_CreaturePos[triggerSpawnID][3]))
+ if (Creature* trigger = AddCreature(WORLD_TRIGGER,
+ triggerSpawnID,
+ BG_AV_CreatureInfo[creature->GetEntry()][1],
+ BG_AV_CreaturePos[triggerSpawnID][0],
+ BG_AV_CreaturePos[triggerSpawnID][1],
+ BG_AV_CreaturePos[triggerSpawnID][2],
+ BG_AV_CreaturePos[triggerSpawnID][3]))
{
trigger->setFaction(newFaction);
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
@@ -433,15 +456,14 @@ void BattlegroundAV::AddPlayer(Player* player)
PlayerScores[player->GetGUID()] = sc;
if (m_MaxLevel == 0)
m_MaxLevel=(player->getLevel()%10 == 0)? player->getLevel() : (player->getLevel()-(player->getLevel()%10))+10; //TODO: just look at the code \^_^/ --but queue-info should provide this information..
-
}
void BattlegroundAV::EndBattleground(uint32 winner)
{
//calculate bonuskills for both teams:
//first towers:
- uint8 kills[2]={0, 0}; //0=ally 1=horde
- uint8 rep[2]={0, 0}; //0=ally 1=horde
+ uint8 kills[2] = {0, 0}; // 0 = Alliance 1 = Horde
+ uint8 rep[2] = {0, 0}; // 0 = Alliance 1 = Horde
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
{
if (m_Nodes[i].State == POINT_CONTROLED)
@@ -459,7 +481,7 @@ void BattlegroundAV::EndBattleground(uint32 winner)
}
}
- for (int i=0; i <= 1; i++) //0=ally 1=horde
+ for (int i = TEAM_ALLIANCE; i <= TEAM_HORDE; ++i)
{
if (m_CaptainAlive[i])
{
@@ -467,9 +489,9 @@ void BattlegroundAV::EndBattleground(uint32 winner)
rep[i] += BG_AV_REP_SURVIVING_CAPTAIN;
}
if (rep[i] != 0)
- RewardReputationToTeam((i == 0)?730:729, rep[i], (i == 0)?ALLIANCE:HORDE);
+ RewardReputationToTeam(i == 0 ? 730 : 729, rep[i], i == 0 ? ALLIANCE : HORDE);
if (kills[i] != 0)
- RewardHonorToTeam(GetBonusHonor(kills[i]), (i == 0)?ALLIANCE:HORDE);
+ RewardHonorToTeam(GetBonusHonor(kills[i]), i == 0 ? ALLIANCE : HORDE);
}
//TODO add enterevademode for all attacking creatures
@@ -480,7 +502,7 @@ void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team
{
if (!player)
{
- sLog->outError("bg_AV no player at remove");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "bg_AV no player at remove");
return;
}
//TODO search more buffs
@@ -489,27 +511,25 @@ void BattlegroundAV::RemovePlayer(Player* player, uint64 /*guid*/, uint32 /*team
player->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN);
}
-void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundAV::HandleAreaTrigger(Player* player, uint32 trigger)
{
- // this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- uint32 SpellId = 0;
- switch (Trigger)
+ switch (trigger)
{
case 95:
case 2608:
- if (Source->GetTeam() != ALLIANCE)
- Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
+ if (player->GetTeam() != ALLIANCE)
+ player->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
else
- Source->LeaveBattleground();
+ player->LeaveBattleground();
break;
case 2606:
- if (Source->GetTeam() != HORDE)
- Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
+ if (player->GetTeam() != HORDE)
+ player->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
else
- Source->LeaveBattleground();
+ player->LeaveBattleground();
break;
case 3326:
case 3327:
@@ -520,18 +540,13 @@ void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger)
//Source->Unmount();
break;
default:
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
-// Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
-
- if (SpellId)
- Source->CastSpell(Source, SpellId, true);
}
void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
-
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == PlayerScores.end()) // player not found...
return;
@@ -540,19 +555,19 @@ void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
case SCORE_GRAVEYARDS_ASSAULTED:
((BattlegroundAVScore*)itr->second)->GraveyardsAssaulted += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_GRAVEYARD);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_GRAVEYARD);
break;
case SCORE_GRAVEYARDS_DEFENDED:
((BattlegroundAVScore*)itr->second)->GraveyardsDefended += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_GRAVEYARD);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_GRAVEYARD);
break;
case SCORE_TOWERS_ASSAULTED:
((BattlegroundAVScore*)itr->second)->TowersAssaulted += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_TOWER);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_ASSAULT_TOWER);
break;
case SCORE_TOWERS_DEFENDED:
((BattlegroundAVScore*)itr->second)->TowersDefended += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_TOWER);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AV_OBJECTIVE_DEFEND_TOWER);
break;
case SCORE_MINES_CAPTURED:
((BattlegroundAVScore*)itr->second)->MinesCaptured += value;
@@ -571,7 +586,6 @@ void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
{
-
uint32 object = GetObjectThroughNode(node);
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av: player destroyed point node %i object %i", node, object);
@@ -588,13 +602,13 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else
- sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
//spawn destroyed aura
for (uint8 i=0; i <= 9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
- UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, (-1)*BG_AV_RES_TOWER);
- RewardReputationToTeam((owner == ALLIANCE)?730:729, BG_AV_REP_TOWER, owner);
+ UpdateScore((owner == ALLIANCE) ? HORDE : ALLIANCE, -1 * BG_AV_RES_TOWER);
+ RewardReputationToTeam(owner == ALLIANCE ? 730 : 729, BG_AV_REP_TOWER, owner);
RewardHonorToTeam(GetBonusHonor(BG_AV_KILL_TOWER), owner);
SpawnBGObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+GetTeamIndexByTeamId(owner)+(2*tmp), RESPAWN_ONE_DAY);
@@ -631,8 +645,10 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
}
void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
-{ //mine=0 northmine mine=1 southmin
-//changing the owner results in setting respawntim to infinite for current creatures, spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
+{
+ // mine=0 northmine mine=1 southmin
+ // changing the owner results in setting respawntim to infinite for current creatures,
+ // spawning new mine owners creatures and changing the chest-objects so that the current owning team can use them
ASSERT(mine == AV_NORTH_MINE || mine == AV_SOUTH_MINE);
if (team != ALLIANCE && team != HORDE)
team = AV_NEUTRAL_TEAM;
@@ -695,16 +711,13 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial)
for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MIN:AV_CPLACE_MINE_S_2_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_2_MAX:AV_CPLACE_MINE_S_2_MAX); i++)
AddAVCreature(miner+(urand(1, 2)), i);
AddAVCreature(miner+3, (mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3);
- //because the gameobjects in this mine have changed, update all surrounding players:
-// for (uint16 i = ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MIN:BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i <= ((mine == AV_NORTH_MINE)?BG_AV_OBJECT_MINE_SUPPLY_N_MAX:BG_AV_OBJECT_MINE_SUPPLY_N_MAX); i++)
-// {
- //TODO: add gameobject-update code
-// }
+
if (team == ALLIANCE || team == HORDE)
{
m_Mine_Reclaim_Timer[mine]=AV_MINE_RECLAIM_TIMER;
char buf[256];
- sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
+ sprintf(buf, GetTrinityString(LANG_BG_AV_MINE_TAKEN), GetTrinityString((mine == AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH),
+ (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if (creature)
YellToAll(creature, buf, LANG_UNIVERSAL);
@@ -753,8 +766,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
if (BgCreatures[node])
DelCreature(node);
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner))
- sLog->outError("AV: couldn't spawn spiritguide at node %i", node);
-
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "AV: couldn't spawn spiritguide at node %i", node);
}
for (uint8 i=0; i<4; i++)
AddAVCreature(creatureid, c_place+i);
@@ -763,7 +775,15 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
return;
Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures
if (!trigger)
- trigger = AddCreature(WORLD_TRIGGER, node + 302, owner, BG_AV_CreaturePos[node + 302][0], BG_AV_CreaturePos[node + 302][1], BG_AV_CreaturePos[node + 302][2], BG_AV_CreaturePos[node + 302][3]);
+ {
+ trigger = AddCreature(WORLD_TRIGGER,
+ node + 302,
+ owner,
+ BG_AV_CreaturePos[node + 302][0],
+ BG_AV_CreaturePos[node + 302][1],
+ BG_AV_CreaturePos[node + 302][2],
+ BG_AV_CreaturePos[node + 302][3]);
+ }
//add bonus honor aura trigger creature when node is accupied
//cast bonus aura (+50% honor in 25yards)
@@ -811,7 +831,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
return BG_AV_Nodes(object - 29);
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE)
return BG_AV_NODES_SNOWFALL_GRAVE;
- sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :(");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: ERROR! GetPlace got a wrong object :(");
ASSERT(false);
return BG_AV_Nodes(0);
}
@@ -849,7 +869,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
}
else if (m_Nodes[node].Owner == AV_NEUTRAL_TEAM)
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
- sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
ASSERT(false);
return 0;
}
@@ -903,7 +923,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "player defends point object: %i node: %i", object, node);
if (m_Nodes[node].PrevOwner != team)
{
- sLog->outError("BG_AV: player defends point which doesn't belong to his team %i", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: player defends point which doesn't belong to his team %i", node);
return;
}
@@ -943,7 +963,8 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
}
//send a nice message to all :)
char buf[256];
- sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
+ sprintf(buf, GetTrinityString((IsTower(node)) ? LANG_BG_AV_TOWER_DEFENDED : LANG_BG_AV_GRAVE_DEFENDED), GetNodeName(node),
+ (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if (creature)
YellToAll(creature, buf, LANG_UNIVERSAL);
@@ -1057,7 +1078,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
//send a nice message to all :)
char buf[256];
- sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node), (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
+ sprintf(buf, (IsTower(node)) ? GetTrinityString(LANG_BG_AV_TOWER_ASSAULTED) : GetTrinityString(LANG_BG_AV_GRAVE_ASSAULTED), GetNodeName(node),
+ (team == ALLIANCE) ? GetTrinityString(LANG_BG_AV_ALLY) : GetTrinityString(LANG_BG_AV_HORDE));
Creature* creature = GetBGCreature(AV_CPLACE_HERALD);
if (creature)
YellToAll(creature, buf, LANG_UNIVERSAL);
@@ -1124,7 +1146,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, uint16 team) //this is used
if (state == POINT_ASSAULTED)
return 3;
}
- sLog->outError("BG_AV: should update a strange worldstate state:%i team:%i", state, team);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_AV: should update a strange worldstate state:%i team:%i", state, team);
return 5; //this will crash the game, but i want to know if something is wrong here
}
@@ -1199,11 +1221,15 @@ bool BattlegroundAV::SetupBattleground()
// Create starting objects
if (
// alliance gates
- !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A, BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3], 0, 0, sin(BG_AV_DoorPositons[0][3]/2), cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
+ !AddObject(BG_AV_OBJECT_DOOR_A, BG_AV_OBJECTID_GATE_A,
+ BG_AV_DoorPositons[0][0], BG_AV_DoorPositons[0][1], BG_AV_DoorPositons[0][2], BG_AV_DoorPositons[0][3],
+ 0, 0, std::sin(BG_AV_DoorPositons[0][3]/2), std::cos(BG_AV_DoorPositons[0][3]/2), RESPAWN_IMMEDIATELY)
// horde gates
- || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3]/2), cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
+ || !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H,
+ BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3],
+ 0, 0, std::sin(BG_AV_DoorPositons[1][3]/2), std::cos(BG_AV_DoorPositons[1][3]/2), RESPAWN_IMMEDIATELY))
{
- sLog->outErrorDb("BatteGroundAV: Failed to spawn some object Battleground not created!1");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1");
return false;
}
@@ -1212,16 +1238,30 @@ bool BattlegroundAV::SetupBattleground()
{
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
{
- if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(i, BG_AV_OBJECTID_BANNER_A_B,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+11, BG_AV_OBJECTID_BANNER_CONT_A_B,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+33, BG_AV_OBJECTID_BANNER_H_B,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H_B,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
//aura
- || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
+ || !AddObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_N,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_A,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+i*3, BG_AV_OBJECTID_AURA_H,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!2");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2");
return false;
}
}
@@ -1229,35 +1269,69 @@ bool BattlegroundAV::SetupBattleground()
{
if (i <= BG_AV_NODES_STONEHEART_BUNKER) //alliance towers
{
- if (!AddObject(i, BG_AV_OBJECTID_BANNER_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(i, BG_AV_OBJECTID_BANNER_A,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+22, BG_AV_OBJECTID_BANNER_CONT_H,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_A,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!3");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3");
return false;
}
}
else //horde towers
{
- if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3]/2), cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3], 0, 0, sin(BG_AV_ObjectPos[i+8][3]/2), cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(i+7, BG_AV_OBJECTID_BANNER_CONT_A,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(i+29, BG_AV_OBJECTID_BANNER_H,
+ BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i][3]/2), std::cos(BG_AV_ObjectPos[i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_N,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TAURA_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_AURA_H,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH+(2*(i-BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H,
+ BG_AV_ObjectPos[i+8][0], BG_AV_ObjectPos[i+8][1], BG_AV_ObjectPos[i+8][2], BG_AV_ObjectPos[i+8][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[i+8][3]/2), std::cos(BG_AV_ObjectPos[i+8][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!4");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4");
return false;
}
}
for (uint8 j=0; j <= 9; j++) //burning aura
{
- if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j,
+ BG_AV_OBJECTID_FIRE,
+ BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][0],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][1],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][2],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3],
+ 0,
+ 0,
+ std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),
+ std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH+((i-BG_AV_NODES_DUNBALDAR_SOUTH)*10)+j][3]/2),
+ RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
return false;
}
}
@@ -1269,17 +1343,37 @@ bool BattlegroundAV::SetupBattleground()
{
if (j<5)
{
- if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,
+ BG_AV_OBJECTID_SMOKE,
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3],
+ 0,
+ 0,
+ std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
+ std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
+ RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
return false;
}
}
else
{
- if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE+(i*10)+j,
+ BG_AV_OBJECTID_FIRE,
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][0],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][1],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][2],
+ BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3],
+ 0,
+ 0,
+ std::sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
+ std::cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A+(i*10)+j][3]/2),
+ RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
return false;
}
}
@@ -1287,34 +1381,72 @@ bool BattlegroundAV::SetupBattleground()
}
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_N_MAX-BG_AV_OBJECT_MINE_SUPPLY_N_MIN); i++)
{
- if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN+i,
+ BG_AV_OBJECTID_MINE_N,
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][0],
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][1],
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][2],
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3],
+ 0,
+ 0,
+ std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),
+ std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN+i][3]/2),
+ RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
return false;
}
}
for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
{
- if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i,
+ BG_AV_OBJECTID_MINE_S,
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0],
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1],
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2],
+ BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3],
+ 0,
+ 0,
+ std::sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),
+ std::cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2),
+ RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
return false;
}
}
- if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE,
+ BG_AV_OBJECTID_BANNER_SNOWFALL_N,
+ BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0],
+ BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1],
+ BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2],
+ BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3],
+ 0,
+ 0,
+ std::sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2),
+ std::cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3]/2),
+ RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
{
- if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
- || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
+ if (!AddObject(BG_AV_OBJECT_SNOW_EYECANDY_A+i, BG_AV_OBJECTID_SNOWFALL_CANDY_A,
+ BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PA+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PA,
+ BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H+i, BG_AV_OBJECTID_SNOWFALL_CANDY_H,
+ BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY)
+ || !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH+i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH,
+ BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3],
+ 0, 0, std::sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), std::cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1+i][3]/2), RESPAWN_ONE_DAY))
{
- sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
return false;
}
}
@@ -1361,10 +1493,10 @@ bool BattlegroundAV::SetupBattleground()
//creatures
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
- for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
+ for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
{
if (m_Nodes[i].Owner)
- PopulateNode(BG_AV_Nodes(i));
+ PopulateNode(i);
}
//all creatures which don't get despawned through the script are static
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures");
@@ -1382,7 +1514,7 @@ bool BattlegroundAV::SetupBattleground()
return true;
}
-const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
+char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
{
switch (node)
{
@@ -1402,7 +1534,7 @@ const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
case BG_AV_NODES_FROSTWOLF_WTOWER: return GetTrinityString(LANG_BG_AV_NODE_TOWER_FROST_W);
case BG_AV_NODES_FROSTWOLF_HUT: return GetTrinityString(LANG_BG_AV_NODE_GRAVE_FROST_HUT);
default:
- sLog->outError("tried to get name for node %u", node);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "tried to get name for node %u", node);
break;
}
@@ -1413,23 +1545,23 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
{
if (m_Nodes[node].TotalOwner == team)
{
- sLog->outCrash("Assaulting team is TotalOwner of node");
- ASSERT (false);
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node");
+ ASSERT(false);
}
if (m_Nodes[node].Owner == team)
{
- sLog->outCrash("Assaulting team is owner of node");
- ASSERT (false);
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node");
+ ASSERT(false);
}
if (m_Nodes[node].State == POINT_DESTROYED)
{
- sLog->outCrash("Destroyed node is being assaulted");
- ASSERT (false);
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted");
+ ASSERT(false);
}
if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists
{
- sLog->outCrash("Assault on an not assaulted node with total owner");
- ASSERT (false);
+ sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner");
+ ASSERT(false);
}
//the timer gets another time, if the previous owner was 0 == Neutral
m_Nodes[node].Timer = (m_Nodes[node].PrevOwner)? BG_AV_CAPTIME : BG_AV_SNOWFALL_FIRSTCAP;
@@ -1477,6 +1609,7 @@ void BattlegroundAV::DefendNode(BG_AV_Nodes node, uint16 team)
void BattlegroundAV::ResetBGSubclass()
{
m_MaxLevel=0;
+
for (uint8 i=0; i<2; i++) //forloop for both teams (it just make 0 == alliance and 1 == horde also for both mines 0=north 1=south
{
for (uint8 j=0; j<9; j++)
@@ -1488,6 +1621,7 @@ void BattlegroundAV::ResetBGSubclass()
m_Mine_Owner[i] = AV_NEUTRAL_TEAM;
m_Mine_PrevOwner[i] = m_Mine_Owner[i];
}
+
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_STONEHEART_GRAVE; ++i) //alliance graves
InitNode(i, ALLIANCE, false);
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) //alliance towers
@@ -1562,3 +1696,16 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(uint32 team) const
return false;
}
+
+uint32 BattlegroundAV::GetPrematureWinner()
+{
+ uint32 allianceScore = m_Team_Scores[GetTeamIndexByTeamId(ALLIANCE)];
+ uint32 hordeScore = m_Team_Scores[GetTeamIndexByTeamId(HORDE)];
+
+ if (allianceScore > hordeScore)
+ return ALLIANCE;
+ else if (hordeScore > allianceScore)
+ return HORDE;
+
+ return Battleground::GetPrematureWinner();
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index f073b69a779..b7fa8d6ece8 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
@@ -19,7 +19,7 @@
#ifndef __BATTLEGROUNDAV_H
#define __BATTLEGROUNDAV_H
-class Battleground;
+#include "Battleground.h"
#define LANG_BG_AV_A_CAPTAIN_BUFF "Begone. Uncouth scum! The Alliance shall prevail in Alterac Valley!"
#define LANG_BG_AV_H_CAPTAIN_BUFF "Now is the time to attack! For the Horde!"
@@ -95,8 +95,7 @@ horde:
AV_SOUND_BOTH_TOWER_DEFEND = 8192,
AV_SOUND_ALLIANCE_CAPTAIN = 8232, //gets called when someone attacks them and at the beginning after 3min+rand(x)*10sec (maybe buff)
- AV_SOUND_HORDE_CAPTAIN = 8333,
-
+ AV_SOUND_HORDE_CAPTAIN = 8333
};
enum BG_AV_OTHER_VALUES
@@ -986,7 +985,6 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] =
enum BG_AV_CreatureIds
{
-
AV_NPC_A_TOWERDEFENSE = 0, // stormpike bowman
AV_NPC_A_GRAVEDEFENSE0 = 1, // stormpike Defender
AV_NPC_A_GRAVEDEFENSE1 = 2, // seasoned defender
@@ -1038,7 +1036,6 @@ enum BG_AV_CreatureIds
AV_NPC_S_MINE_H_4 = 46,
AV_NPC_HERALD = 47,
AV_NPC_INFO_MAX = 48
-
};
//entry, team, minlevel, maxlevel
@@ -1100,7 +1097,6 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] =
{13089, 67, 54, 55}, //guard
{13088, 67, 58, 58},
{14848, 67, 58, 58} //Herald
-
};
//x, y, z, o, static_creature_info-id
@@ -1230,7 +1226,6 @@ const float BG_AV_StaticCreaturePos[AV_STATICCPLACE_MAX][5] =
{773.651f, -497.482f, 99.0408f, 2.11185f, 46 }, //14284 - Stormpike Battleguard
{949.1f, -506.913f, 95.4237f, 3.31613f, 46 }, //14284 - Stormpike Battleguard
{-1370.9f, -219.793f, 98.4258f, 5.04381f, 47}, //drek thar
-
};
const uint32 BG_AV_StaticCreatureInfo[51][4] =
@@ -1359,7 +1354,7 @@ enum BG_AV_WorldStates
//Neutral
//Snowfall Grave
*/
- AV_SNOWFALL_N = 1966, //over aa
+ AV_SNOWFALL_N = 1966 //over aa
/*
AV_SNOWFALL_A_C = 1341, //over hc
AV_SNOWFALL_A_A = 1343, //over ha
@@ -1439,7 +1434,6 @@ enum BG_AV_WorldStates
AV_FROSTWOLFE_UNUSED = 1393,
AV_FROSTWOLFW_UNUSED = 1392
*/
-
};
//alliance_control neutral_control horde_control
@@ -1520,29 +1514,28 @@ enum BG_AV_Objectives
struct BG_AV_NodeInfo
{
- uint16 TotalOwner;
- uint16 Owner;
- uint16 PrevOwner;
BG_AV_States State;
BG_AV_States PrevState;
uint32 Timer;
+ uint16 TotalOwner;
+ uint16 Owner;
+ uint16 PrevOwner;
bool Tower;
};
inline BG_AV_Nodes &operator++(BG_AV_Nodes &i){ return i = BG_AV_Nodes(i + 1); }
-class BattlegroundAVScore : public BattlegroundScore
+struct BattlegroundAVScore : public BattlegroundScore
{
- public:
- BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) {};
- virtual ~BattlegroundAVScore() {};
- uint32 GraveyardsAssaulted;
- uint32 GraveyardsDefended;
- uint32 TowersAssaulted;
- uint32 TowersDefended;
- uint32 MinesCaptured;
- uint32 LeadersKilled;
- uint32 SecondaryObjectives;
+ BattlegroundAVScore() : GraveyardsAssaulted(0), GraveyardsDefended(0), TowersAssaulted(0), TowersDefended(0), MinesCaptured(0), LeadersKilled(0), SecondaryObjectives(0) { }
+ ~BattlegroundAVScore() { }
+ uint32 GraveyardsAssaulted;
+ uint32 GraveyardsDefended;
+ uint32 TowersAssaulted;
+ uint32 TowersDefended;
+ uint32 MinesCaptured;
+ uint32 LeadersKilled;
+ uint32 SecondaryObjectives;
};
class BattlegroundAV : public Battleground
@@ -1552,21 +1545,21 @@ class BattlegroundAV : public Battleground
~BattlegroundAV();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
- virtual void ResetBGSubclass();
+ void ResetBGSubclass();
/*general stuff*/
void UpdateScore(uint16 team, int16 points);
- void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
+ void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
/*handlestuff*/ //these are functions which get called from extern
- virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
+ void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj);
void HandleKillPlayer(Player* player, Player* killer);
void HandleKillUnit(Creature* unit, Player* killer);
void HandleQuestComplete(uint32 questid, Player* player);
@@ -1574,14 +1567,16 @@ class BattlegroundAV : public Battleground
void EndBattleground(uint32 winner);
- virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
+ WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* achievement req. */
bool IsBothMinesControlledByTeam(uint32 team) const;
bool IsAllTowersControlledAndCaptainAlive(uint32 team) const;
+ uint32 GetPrematureWinner();
+
private:
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
/* Nodes occupying */
void EventPlayerAssaultsPoint(Player* player, uint32 object);
@@ -1598,7 +1593,7 @@ class BattlegroundAV : public Battleground
BG_AV_Nodes GetNodeThroughObject(uint32 object);
uint32 GetObjectThroughNode(BG_AV_Nodes node);
- const char* GetNodeName(BG_AV_Nodes node);
+ char const* GetNodeName(BG_AV_Nodes node);
bool IsTower(BG_AV_Nodes node) { return m_Nodes[node].Tower; }
/*mine*/
@@ -1629,8 +1624,6 @@ class BattlegroundAV : public Battleground
uint8 m_MaxLevel; //TODO remove this when battleground-getmaxlevel() returns something usefull
bool m_IsInformedNearVictory[2];
-
};
#endif
-
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
index c7eddbb67a9..402406f7fd0 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundBE.h"
#include "Language.h"
#include "Object.h"
@@ -65,11 +64,7 @@ void BattlegroundBE::StartingEventOpenDoors()
void BattlegroundBE::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundBEScore* sc = new BattlegroundBEScore;
-
- PlayerScores[player->GetGUID()] = sc;
-
+ PlayerScores[player->GetGUID()] = new BattlegroundScore;
UpdateArenaWorldState();
}
@@ -89,7 +84,7 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killer player not found");
return;
}
@@ -101,34 +96,24 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer)
bool BattlegroundBE::HandlePlayerUnderMap(Player* player)
{
- player->TeleportTo(GetMapId(), 6238.930176f, 262.963470f, 0.889519f, player->GetOrientation(), false);
+ player->TeleportTo(GetMapId(), 6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());
return true;
}
-void BattlegroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger)
{
- // this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- //uint32 SpellId = 0;
- //uint64 buff_guid = 0;
- switch (Trigger)
+ switch (trigger)
{
case 4538: // buff trigger?
- //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_1];
- break;
case 4539: // buff trigger?
- //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2];
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
-
- //if (buff_guid)
- // HandleTriggerBuff(buff_guid, Source);
}
void BattlegroundBE::FillInitialWorldStates(WorldPacket &data)
@@ -154,7 +139,7 @@ bool BattlegroundBE::SetupBattleground()
|| !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|| !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
{
- sLog->outErrorDb("BatteGroundBE: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundBE: Failed to spawn some object!");
return false;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index 8c0df2bc329..27a88fcfc33 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
@@ -15,10 +15,11 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#ifndef __BATTLEGROUNDBE_H
#define __BATTLEGROUNDBE_H
-class Battleground;
+#include "Battleground.h"
enum BattlegroundBEObjectTypes
{
@@ -41,13 +42,6 @@ enum BattlegroundBEObjects
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
};
-class BattlegroundBEScore : public BattlegroundScore
-{
- public:
- BattlegroundBEScore() {};
- virtual ~BattlegroundBEScore() {};
-};
-
class BattlegroundBE : public Battleground
{
public:
@@ -55,15 +49,15 @@ class BattlegroundBE : public Battleground
~BattlegroundBE();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
- virtual void Reset();
- virtual void FillInitialWorldStates(WorldPacket &d);
+ void Reset();
+ void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* player);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
index ccc6a2305b4..02c5167c9ec 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -16,12 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundDS.h"
+#include "Creature.h"
+#include "GameObject.h"
#include "Language.h"
+#include "ObjectAccessor.h"
#include "Player.h"
-#include "Object.h"
-#include "ObjectMgr.h"
#include "WorldPacket.h"
BattlegroundDS::BattlegroundDS()
@@ -147,11 +147,7 @@ void BattlegroundDS::StartingEventOpenDoors()
void BattlegroundDS::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundDSScore* score = new BattlegroundDSScore;
-
- PlayerScores[player->GetGUID()] = score;
-
+ PlayerScores[player->GetGUID()] = new BattlegroundScore;
UpdateArenaWorldState();
}
@@ -171,7 +167,7 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("BattlegroundDS: Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundDS: Killer player not found");
return;
}
@@ -181,18 +177,18 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer)
CheckArenaWinConditions();
}
-void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- switch (Trigger)
+ switch (trigger)
{
case 5347:
case 5348:
// Remove effects of Demonic Circle Summon
- if (Source->HasAura(48018))
- Source->RemoveAurasDueToSpell(48018);
+ if (player->HasAura(48018))
+ player->RemoveAurasDueToSpell(48018);
// Someone has get back into the pipes and the knockback has already been performed,
// so we reset the knockback count for kicking the player again into the arena.
@@ -200,15 +196,14 @@ void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger)
setPipeKnockBackCount(0);
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
}
bool BattlegroundDS::HandlePlayerUnderMap(Player* player)
{
- player->TeleportTo(GetMapId(), 1299.046f, 784.825f, 9.338f, 2.422f, false);
+ player->TeleportTo(GetMapId(), 1299.046f, 784.825f, 9.338f, 2.422f);
return true;
}
@@ -240,7 +235,7 @@ bool BattlegroundDS::SetupBattleground()
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_1, 0, 1369.977f, 817.2882f, 16.08718f, 3.106686f, RESPAWN_IMMEDIATELY)
|| !AddCreature(BG_DS_NPC_TYPE_WATER_SPOUT, BG_DS_NPC_PIPE_KNOCKBACK_2, 0, 1212.833f, 765.3871f, 16.09484f, 0.0f, RESPAWN_IMMEDIATELY))
{
- sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundDS: Failed to spawn some object!");
return false;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index aaf08ba1313..ff4b279a2cf 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -19,7 +19,7 @@
#ifndef __BATTLEGROUNDDS_H
#define __BATTLEGROUNDDS_H
-class Battleground;
+#include "Battleground.h"
enum BattlegroundDSObjectTypes
{
@@ -52,14 +52,14 @@ enum BattlegroundDSCreatureTypes
enum BattlegroundDSCreatures
{
- BG_DS_NPC_TYPE_WATER_SPOUT = 28567,
+ BG_DS_NPC_TYPE_WATER_SPOUT = 28567
};
enum BattlegroundDSSpells
{
BG_DS_SPELL_FLUSH = 57405, // Visual and target selector for the starting knockback from the pipe
BG_DS_SPELL_FLUSH_KNOCKBACK = 61698, // Knockback effect for previous spell (triggered, not need to be casted)
- BG_DS_SPELL_WATER_SPOUT = 58873, // Knockback effect of the central waterfall
+ BG_DS_SPELL_WATER_SPOUT = 58873 // Knockback effect of the central waterfall
};
enum BattlegroundDSData
@@ -76,15 +76,7 @@ enum BattlegroundDSData
BG_DS_WATERFALL_STATUS_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking
BG_DS_WATERFALL_STATUS_ON = 2, // LoS and Movement blocking active
- BG_DS_WATERFALL_STATUS_OFF = 3,
-};
-
-class BattlegroundDSScore : public BattlegroundScore
-{
- public:
- BattlegroundDSScore() {};
- virtual ~BattlegroundDSScore() {};
- //TODO fix me
+ BG_DS_WATERFALL_STATUS_OFF = 3
};
class BattlegroundDS : public Battleground
@@ -94,15 +86,15 @@ class BattlegroundDS : public Battleground
~BattlegroundDS();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
- virtual void Reset();
- virtual void FillInitialWorldStates(WorldPacket &d);
+ void Reset();
+ void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* player);
private:
@@ -112,7 +104,7 @@ class BattlegroundDS : public Battleground
uint32 _pipeKnockBackTimer;
uint8 _pipeKnockBackCount;
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
protected:
uint32 getWaterFallStatus() { return _waterfallStatus; };
void setWaterFallStatus(uint8 status) { _waterfallStatus = status; };
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 8269a04a383..ab0f94b74f6 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -16,12 +16,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "BattlegroundEY.h"
#include "ObjectMgr.h"
#include "World.h"
#include "WorldPacket.h"
#include "BattlegroundMgr.h"
-#include "Battleground.h"
-#include "BattlegroundEY.h"
#include "Creature.h"
#include "Language.h"
#include "Object.h"
@@ -63,10 +62,10 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
if (m_PointAddingTimer <= 0)
{
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
- if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
- AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]);
- if (m_TeamPointsCount[BG_TEAM_HORDE] > 0)
- AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
+ if (m_TeamPointsCount[TEAM_ALLIANCE] > 0)
+ AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[TEAM_ALLIANCE] - 1]);
+ if (m_TeamPointsCount[TEAM_HORDE] > 0)
+ AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[TEAM_HORDE] - 1]);
}
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
@@ -128,7 +127,7 @@ void BattlegroundEY::StartingEventOpenDoors()
void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
{
- BattlegroundTeamId team_index = GetTeamIndexByTeamId(Team);
+ TeamId team_index = GetTeamIndexByTeamId(Team);
m_TeamScores[team_index] += Points;
m_HonorScoreTics[team_index] += Points;
if (m_HonorScoreTics[team_index] >= m_HonorTics)
@@ -136,7 +135,7 @@ void BattlegroundEY::AddPoints(uint32 Team, uint32 Points)
RewardHonorToTeam(GetBonusHonorFromKill(1), Team);
m_HonorScoreTics[team_index] -= m_HonorTics;
}
- UpdateTeamScore(Team);
+ UpdateTeamScore(team_index);
}
void BattlegroundEY::CheckSomeoneJoinedPoint()
@@ -153,7 +152,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
if (!player)
{
- sLog->outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
++j;
continue;
}
@@ -193,7 +192,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]);
if (!player)
{
- sLog->outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
@@ -281,10 +280,13 @@ void BattlegroundEY::UpdateTeamScore(uint32 Team)
if (score >= BG_EY_MAX_TEAM_SCORE)
{
score = BG_EY_MAX_TEAM_SCORE;
- EndBattleground(Team);
+ if (Team == TEAM_ALLIANCE)
+ EndBattleground(ALLIANCE);
+ else
+ EndBattleground(HORDE);
}
- if (Team == ALLIANCE)
+ if (Team == TEAM_ALLIANCE)
UpdateWorldState(EY_ALLIANCE_RESOURCES, score);
else
UpdateWorldState(EY_HORDE_RESOURCES, score);
@@ -292,12 +294,12 @@ void BattlegroundEY::UpdateTeamScore(uint32 Team)
void BattlegroundEY::EndBattleground(uint32 winner)
{
- //win reward
+ // Win reward
if (winner == ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
if (winner == HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
- //complete map reward
+ // Complete map reward
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
@@ -307,9 +309,9 @@ void BattlegroundEY::EndBattleground(uint32 winner)
void BattlegroundEY::UpdatePointsCount(uint32 Team)
{
if (Team == ALLIANCE)
- UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
+ UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[TEAM_ALLIANCE]);
else
- UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
+ UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[TEAM_HORDE]);
}
void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
@@ -368,35 +370,35 @@ void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
}
}
-void BattlegroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- if (!Source->isAlive()) //hack code, must be removed later
+ if (!player->isAlive()) //hack code, must be removed later
return;
- switch (Trigger)
+ switch (trigger)
{
case TR_BLOOD_ELF_POINT:
- if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
- if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
- EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_BLOOD_ELF);
+ if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == player->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == player->GetGUID())
+ EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_BLOOD_ELF);
break;
case TR_FEL_REAVER_POINT:
- if (m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REAVER] == Source->GetTeam())
- if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
- EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_FEL_REAVER);
+ if (m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REAVER] == player->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == player->GetGUID())
+ EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_FEL_REAVER);
break;
case TR_MAGE_TOWER_POINT:
- if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
- if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
- EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_MAGE_TOWER);
+ if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == player->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == player->GetGUID())
+ EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_MAGE_TOWER);
break;
case TR_DRAENEI_RUINS_POINT:
- if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
- if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
- EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
+ if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == player->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == player->GetGUID())
+ EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
break;
case 4512:
case 4515:
@@ -411,8 +413,7 @@ void BattlegroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 5866:
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
}
@@ -474,7 +475,7 @@ bool BattlegroundEY::SetupBattleground()
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY)
)
{
- sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn some object Battleground not created!");
return false;
}
@@ -484,28 +485,28 @@ bool BattlegroundEY::SetupBattleground()
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
if (!at)
{
- sLog->outError("BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
continue;
}
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
)
- sLog->outError("BattlegroundEY: Cannot spawn buff");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Cannot spawn buff");
}
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
- sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
- sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundEY: Failed to spawn spirit guide! Battleground not created!");
return false;
}
@@ -517,12 +518,12 @@ void BattlegroundEY::Reset()
//call parent's class reset
Battleground::Reset();
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
- m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0;
- m_TeamPointsCount[BG_TEAM_HORDE] = 0;
- m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0;
- m_HonorScoreTics[BG_TEAM_HORDE] = 0;
+ m_TeamScores[TEAM_ALLIANCE] = 0;
+ m_TeamScores[TEAM_HORDE] = 0;
+ m_TeamPointsCount[TEAM_ALLIANCE] = 0;
+ m_TeamPointsCount[TEAM_HORDE] = 0;
+ m_HonorScoreTics[TEAM_ALLIANCE] = 0;
+ m_HonorScoreTics[TEAM_HORDE] = 0;
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
m_FlagCapturedBgObjectType = 0;
m_FlagKeeper = 0;
@@ -570,7 +571,7 @@ void BattlegroundEY::RespawnFlagAfterDrop()
if (obj)
obj->Delete();
else
- sLog->outError("BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID()));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID()));
SetDroppedFlagGUID(0);
}
@@ -647,9 +648,9 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
- PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName());
+ PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName().c_str());
else
- PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
+ PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName().c_str());
}
void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
@@ -665,14 +666,14 @@ void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point)
if (Team == ALLIANCE)
{
- m_TeamPointsCount[BG_TEAM_ALLIANCE]--;
+ m_TeamPointsCount[TEAM_ALLIANCE]--;
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeAlliance, RESPAWN_ONE_DAY);
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeAlliance + 1, RESPAWN_ONE_DAY);
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeAlliance + 2, RESPAWN_ONE_DAY);
}
else
{
- m_TeamPointsCount[BG_TEAM_HORDE]--;
+ m_TeamPointsCount[TEAM_HORDE]--;
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeHorde, RESPAWN_ONE_DAY);
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY);
SpawnBGObject(m_LosingPointTypes[Point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY);
@@ -713,14 +714,14 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
if (Team == ALLIANCE)
{
- m_TeamPointsCount[BG_TEAM_ALLIANCE]++;
+ m_TeamPointsCount[TEAM_ALLIANCE]++;
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY);
}
else
{
- m_TeamPointsCount[BG_TEAM_HORDE]++;
+ m_TeamPointsCount[TEAM_HORDE]++;
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY);
@@ -742,7 +743,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point)
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
- sLog->outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
// SpawnBGCreature(Point, RESPAWN_IMMEDIATELY);
@@ -791,12 +792,12 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType
uint8 team_id = 0;
if (Source->GetTeam() == ALLIANCE)
{
- team_id = BG_TEAM_ALLIANCE;
+ team_id = TEAM_ALLIANCE;
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
}
else
{
- team_id = BG_TEAM_HORDE;
+ team_id = TEAM_HORDE;
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
}
@@ -816,7 +817,7 @@ void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
case SCORE_FLAG_CAPTURES: // flags captured
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, EY_OBJECTIVE_CAPTURE_FLAG);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, EY_OBJECTIVE_CAPTURE_FLAG);
break;
default:
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
@@ -826,8 +827,8 @@ void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
{
- data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]);
- data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_ALLIANCE]);
+ data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[TEAM_HORDE]);
+ data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[TEAM_ALLIANCE]);
data << uint32(0xab6) << uint32(0x0);
data << uint32(0xab5) << uint32(0x0);
data << uint32(0xab4) << uint32(0x0);
@@ -865,8 +866,8 @@ void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
data << uint32(0xad2) << uint32(0x1);
data << uint32(0xad1) << uint32(0x1);
- data << uint32(0xabe) << uint32(GetTeamScore(HORDE));
- data << uint32(0xabd) << uint32(GetTeamScore(ALLIANCE));
+ data << uint32(0xabe) << uint32(GetTeamScore(TEAM_HORDE));
+ data << uint32(0xabd) << uint32(GetTeamScore(TEAM_ALLIANCE));
data << uint32(0xa05) << uint32(0x8e);
data << uint32(0xaa0) << uint32(0x0);
data << uint32(0xa9f) << uint32(0x0);
@@ -894,7 +895,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player)
if (!entry)
{
- sLog->outError("BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found the main team graveyard. Graveyard system isn't working!");
return NULL;
}
@@ -911,7 +912,7 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player)
{
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
if (!entry)
- sLog->outError("BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Not found graveyard: %u", m_CapturingPointTypes[i].GraveYardId);
else
{
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
@@ -936,3 +937,13 @@ bool BattlegroundEY::IsAllNodesConrolledByTeam(uint32 team) const
return count == EY_POINTS_MAX;
}
+
+uint32 BattlegroundEY::GetPrematureWinner()
+{
+ if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
+ return ALLIANCE;
+ else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE))
+ return HORDE;
+
+ return Battleground::GetPrematureWinner();
+} \ No newline at end of file
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index 534a40484ce..43e7fb4f933 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -20,13 +20,12 @@
#define __BATTLEGROUNDEY_H
#include "Language.h"
-
-class Battleground;
+#include "Battleground.h"
enum BG_EY_Misc
{
BG_EY_FLAG_RESPAWN_TIME = (8*IN_MILLISECONDS),
- BG_EY_FPOINTS_TICK_TIME = (2*IN_MILLISECONDS),
+ BG_EY_FPOINTS_TICK_TIME = (2*IN_MILLISECONDS)
};
enum BG_EY_WorldStates
@@ -105,11 +104,11 @@ enum EYBattlegroundObjectEntry
enum EYBattlegroundPointsTrigger
{
TR_BLOOD_ELF_POINT = 4476,
- TR_FEL_REAVER_POINT = 4514,
+ TR_FEL_REAVER_POINT = 4514,
TR_MAGE_TOWER_POINT = 4516,
TR_DRAENEI_RUINS_POINT = 4518,
TR_BLOOD_ELF_BUFF = 4568,
- TR_FEL_REAVER_BUFF = 4569,
+ TR_FEL_REAVER_BUFF = 4569,
TR_MAGE_TOWER_BUFF = 4570,
TR_DRAENEI_RUINS_BUFF = 4571
};
@@ -324,12 +323,11 @@ const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER)
};
-class BattlegroundEYScore : public BattlegroundScore
+struct BattlegroundEYScore : public BattlegroundScore
{
- public:
- BattlegroundEYScore() : FlagCaptures(0) {};
- virtual ~BattlegroundEYScore() {};
- uint32 FlagCaptures;
+ BattlegroundEYScore() : FlagCaptures(0) { }
+ ~BattlegroundEYScore() { }
+ uint32 FlagCaptures;
};
class BattlegroundEY : public Battleground
@@ -339,9 +337,9 @@ class BattlegroundEY : public Battleground
~BattlegroundEY();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
/* BG Flags */
uint64 GetFlagPickerGUID(int32 /*team*/ = -1) const { return m_FlagKeeper; }
@@ -355,24 +353,26 @@ class BattlegroundEY : public Battleground
void HandleBuffUse(uint64 buff_guid);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
- virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
- virtual bool SetupBattleground();
- virtual void Reset();
+ WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
+ bool SetupBattleground();
+ void Reset();
void UpdateTeamScore(uint32 Team);
void EndBattleground(uint32 winner);
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
- virtual void FillInitialWorldStates(WorldPacket& data);
- void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
+ void FillInitialWorldStates(WorldPacket& data);
+ void SetDroppedFlagGUID(uint64 guid, int32 /*TeamID*/ = -1) { m_DroppedFlagGUID = guid;}
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
/* Battleground Events */
- virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
- virtual void EventPlayerDroppedFlag(Player* Source);
+ void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
+ void EventPlayerDroppedFlag(Player* Source);
/* achievement req. */
bool IsAllNodesConrolledByTeam(uint32 team) const;
+
+ uint32 GetPrematureWinner();
private:
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType);
void EventTeamCapturedPoint(Player* Source, uint32 Point);
@@ -386,7 +386,6 @@ class BattlegroundEY : public Battleground
void UpdatePointStatuses();
/* Scorekeeping */
- uint32 GetTeamScore(uint32 Team) const { return m_TeamScores[GetTeamIndexByTeamId(Team)]; }
void AddPoints(uint32 Team, uint32 Points);
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index ccc9493e234..dbffc318c78 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -25,6 +25,7 @@
#include "ObjectMgr.h"
#include "Vehicle.h"
#include "Transport.h"
+#include "WorldSession.h"
BattlegroundIC::BattlegroundIC()
{
@@ -36,17 +37,17 @@ BattlegroundIC::BattlegroundIC()
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN;
- for (uint8 i = 0; i < 2; i++)
+ for (uint8 i = 0; i < 2; ++i)
factionReinforcements[i] = MAX_REINFORCEMENTS;
- for (uint8 i = 0; i < BG_IC_MAXDOOR; i++)
+ for (uint8 i = 0; i < BG_IC_MAXDOOR; ++i)
GateStatus[i] = BG_IC_GATE_OK;
closeFortressDoorsTimer = CLOSE_DOORS_TIME; // the doors are closed again... in a special way
doorsClosed = false;
resourceTimer = IC_RESOURCE_TIME;
- for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
+ for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
nodePoint[i] = nodePointInitial[i];
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
@@ -57,7 +58,8 @@ BattlegroundIC::BattlegroundIC()
BattlegroundIC::~BattlegroundIC()
{
-
+ delete gunshipHorde;
+ delete gunshipAlliance;
}
void BattlegroundIC::HandlePlayerResurrect(Player* player)
@@ -90,13 +92,12 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
if (action != ACTION_TELEPORT_PLAYER_TO_TRANSPORT)
return;
- Player* player = ObjectAccessor::FindPlayer(var);
-
- if (!player || !gunshipAlliance || !gunshipHorde)
+ if (!gunshipAlliance || !gunshipHorde)
return;
- player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
- player->CastSpell(player, SPELL_SLOW_FALL, true);
+ Player* player = ObjectAccessor::FindPlayer(var);
+ if (!player)
+ return;
player->SetTransport(player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde);
@@ -105,7 +106,15 @@ void BattlegroundIC::DoAction(uint32 action, uint64 var)
player->m_movementInfo.t_pos.m_positionZ = TransportMovementInfo.GetPositionZ();
player->m_movementInfo.t_guid = (player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->GetGUID();
- player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(), TeleportToTransportPosition.GetPositionY(), TeleportToTransportPosition.GetPositionZ(), TeleportToTransportPosition.GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
+ if (player->TeleportTo(GetMapId(), TeleportToTransportPosition.GetPositionX(),
+ TeleportToTransportPosition.GetPositionY(),
+ TeleportToTransportPosition.GetPositionZ(),
+ TeleportToTransportPosition.GetOrientation(),
+ TELE_TO_NOT_LEAVE_TRANSPORT))
+ {
+ player->CastSpell(player, SPELL_PARACHUTE, true); // this must be changed, there is a trigger in each transport that casts the spell.
+ player->CastSpell(player, SPELL_SLOW_FALL, true);
+ }
}
void BattlegroundIC::PostUpdateImpl(uint32 diff)
@@ -128,7 +137,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
} else closeFortressDoorsTimer -= diff;
}
- for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; i++)
+ for (uint8 i = NODE_TYPE_REFINERY; i < MAX_NODE_TYPES; ++i)
{
if (nodePoint[i].nodeType == NODE_TYPE_DOCKS)
{
@@ -138,7 +147,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
if (docksTimer <= diff)
{
// we need to confirm this, i am not sure if this every 3 minutes
- for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); u++)
+ for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_A : BG_IC_NPC_CATAPULT_4_H); ++u)
{
if (Creature* catapult = GetBGCreature(u))
{
@@ -148,7 +157,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
}
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
- for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); u++)
+ for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_A : BG_IC_NPC_GLAIVE_THROWER_2_H); ++u)
{
if (Creature* glaiveThrower = GetBGCreature(u))
{
@@ -186,7 +195,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
}
// we need to confirm if it is every 3 minutes
- for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); u++)
+ for (uint8 u = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H); u < (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_A : BG_IC_NPC_DEMOLISHER_4_H); ++u)
{
if (Creature* demolisher = GetBGCreature(u))
{
@@ -235,7 +244,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
if (resourceTimer <= diff)
{
- for (uint8 i = 0; i < NODE_TYPE_DOCKS; i++)
+ for (uint8 i = 0; i < NODE_TYPE_DOCKS; ++i)
{
if (nodePoint[i].nodeState == NODE_STATE_CONTROLLED_A ||
nodePoint[i].nodeState == NODE_STATE_CONTROLLED_H)
@@ -269,13 +278,15 @@ void BattlegroundIC::StartingEventOpenDoors()
DoorOpen(BG_IC_GO_DOODAD_VR_PORTCULLIS01_1);
DoorOpen(BG_IC_GO_DOODAD_VR_PORTCULLIS01_2);
- for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; i++)
+ for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i)
{
if (!AddObject(BG_IC_Teleporters[i].type, BG_IC_Teleporters[i].entry,
- BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y,
- BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o,
- 0, 0, 0, 0, RESPAWN_ONE_DAY))
- sLog->outError("Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
+ BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y,
+ BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o,
+ 0, 0, 0, 0, RESPAWN_ONE_DAY))
+ {
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
+ }
}
}
@@ -286,7 +297,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
for (int i = 0; i < NODE_TYPE_WORKSHOP; ++i)
{
if (nodePoint[i].nodeState == controlledState)
- count++;
+ ++count;
}
return count == NODE_TYPE_WORKSHOP;
@@ -295,10 +306,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const
void BattlegroundIC::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundICScore* sc = new BattlegroundICScore;
-
- PlayerScores[player->GetGUID()] = sc;
+ PlayerScores[player->GetGUID()] = new BattlegroundICScore;
if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H))
player->CastSpell(player, SPELL_QUARRY, true);
@@ -353,38 +361,38 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_IC_ALLIANCE_RENFORT) << uint32(factionReinforcements[TEAM_ALLIANCE]);
data << uint32(BG_IC_HORDE_RENFORT) << uint32(factionReinforcements[TEAM_HORDE]);
- for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; i++)
+ for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i)
{
uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false));
data << uint32(uws) << uint32(1);
}
- for (uint8 i = 0; i < MAX_NODE_TYPES; i++)
+ for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1);
}
bool BattlegroundIC::SetupBattleground()
{
- for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; i++)
+ for (uint8 i = 0; i < MAX_NORMAL_GAMEOBJECTS_SPAWNS; ++i)
{
if (!AddObject(BG_IC_ObjSpawnlocs[i].type, BG_IC_ObjSpawnlocs[i].entry,
BG_IC_ObjSpawnlocs[i].x, BG_IC_ObjSpawnlocs[i].y,
BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o,
0, 0, 0, 0, RESPAWN_ONE_DAY))
{
- sLog->outError("Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
return false;
}
}
- for (uint8 i = 0; i < MAX_NORMAL_NPCS_SPAWNS; i++)
+ for (uint8 i = 2; i < MAX_NORMAL_NPCS_SPAWNS; ++i)
{
if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].team,
BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y,
BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o,
RESPAWN_ONE_DAY))
{
- sLog->outError("Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
return false;
}
}
@@ -394,7 +402,7 @@ bool BattlegroundIC::SetupBattleground()
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+3, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+4, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], HORDE))
{
- sLog->outError("Isle of Conquest: Failed to spawn initial spirit guide!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn initial spirit guide!");
return false;
}
@@ -403,7 +411,7 @@ bool BattlegroundIC::SetupBattleground()
if (!gunshipAlliance || !gunshipHorde)
{
- sLog->outError("Isle of Conquest: There was an error creating gunships!");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error creating gunships!");
return false;
}
@@ -415,13 +423,13 @@ bool BattlegroundIC::SetupBattleground()
}
// setting correct factions for Keep Cannons
- for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; i++)
+ for (uint8 i = BG_IC_NPC_KEEP_CANNON_1; i < BG_IC_NPC_KEEP_CANNON_12; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[0]);
- for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; i++)
+ for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i < BG_IC_NPC_KEEP_CANNON_25; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[1]);
// correcting spawn time for keeps bombs
- for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; i++)
+ for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i)
GetBGObject(i)->SetRespawnTime(10);
return true;
@@ -501,7 +509,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
return;
// All the node points are iterated to find the clicked one
- for (uint8 i = 0; i < MAX_NODE_TYPES; i++)
+ for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
{
if (nodePoint[i].gameobject_entry == target_obj->GetEntry())
{
@@ -588,7 +596,7 @@ void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* nodePoint)
uint32 worldstate = nodePoint->worldStates[nodePoint->nodeState];
// with this we are sure we dont bug the client
- for (uint8 i = 0; i < 4; i++)
+ for (uint8 i = 0; i < 4; ++i)
UpdateWorldState(nodePoint->worldStates[i], 0);
UpdateWorldState(worldstate, 1);
@@ -615,7 +623,7 @@ uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool r
return nodePoint->last_entry;
// we should never be here...
- sLog->outError("Isle Of Conquest: Unexpected return in GetNextBanner function");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle Of Conquest: Unexpected return in GetNextBanner function");
return 0;
}
@@ -626,7 +634,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
if (gunshipAlliance && gunshipHorde)
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
- for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; u++)
+ for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u < BG_IC_GO_HANGAR_TELEPORTER_3; ++u)
DelObject(u);
}
}
@@ -639,7 +647,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1],
BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3],
(nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE)))
- sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
}
switch (nodePoint->gameobject_type)
@@ -649,7 +657,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (!gunshipAlliance || !gunshipHorde)
break;
- for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; u++)
+ for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1+u;
AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL),
@@ -658,7 +666,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
0, 0, 0, 0, RESPAWN_ONE_DAY);
}
- //sLog->outError("BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
+ //sLog->outError(LOG_FILTER_BATTLEGROUND, "BG_IC_GO_HANGAR_BANNER CAPTURED Faction: %u", nodePoint->faction);
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap());
(nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->BuildStopMovePacket(GetBgMap());
@@ -681,7 +689,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
docksTimer = DOCKS_UPDATE_TIME;
// we must del opposing faction vehicles when the node is captured (unused ones)
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); i++)
+ for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i)
{
if (Creature* glaiveThrower = GetBGCreature(i))
{
@@ -693,7 +701,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); i++)
+ for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i)
{
if (Creature* catapult = GetBGCreature(i))
{
@@ -706,7 +714,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
// spawning glaive throwers
- for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; i++)
+ for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++i)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
@@ -721,7 +729,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
// spawning catapults
- for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; i++)
+ for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++i)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
@@ -743,7 +751,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (!recapture)
{
// we must del opposing faction vehicles when the node is captured (unused ones)
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); i++)
+ for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i)
{
if (Creature* demolisher = GetBGCreature(i))
{
@@ -756,7 +764,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
- for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; i++)
+ for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
{
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
@@ -799,7 +807,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
- for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; i++)
+ for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; ++i)
{
AddObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i, GO_SEAFORIUM_BOMBS,
workshopBombs[i].GetPositionX(), workshopBombs[i].GetPositionY(),
@@ -853,6 +861,17 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
break;
}
+ if (go->GetEntry() == GO_HORDE_GATE_1 || go->GetEntry() == GO_HORDE_GATE_2 || go->GetEntry() == GO_HORDE_GATE_3)
+ {
+ if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].team, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].o, RESPAWN_ONE_DAY))
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_OVERLORD_AGMAR].entry);
+ }
+ else if (go->GetEntry() == GO_ALLIANCE_GATE_1 || go->GetEntry() == GO_ALLIANCE_GATE_2 || go->GetEntry() == GO_ALLIANCE_GATE_3)
+ {
+ if (!GetBgMap()->GetCreature(BgCreatures[BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type]) && !AddCreature(BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].type, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].team, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].x, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].y, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].z, BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].o, RESPAWN_ONE_DAY))
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry);
+ }
+
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
}
@@ -863,7 +882,7 @@ void BattlegroundIC::EventPlayerDamagedGO(Player* /*player*/, GameObject* /*go*/
WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveYard(Player* player)
{
- BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
+ TeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
// Is there any occupied node for this team?
std::vector<uint8> nodes;
@@ -908,7 +927,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
if (!goinfo)
{
- sLog->outErrorDb("Transport ID: %u will not be loaded, gameobject_template missing", goEntry);
+ sLog->outError(LOG_FILTER_SQL, "Transport ID: %u will not be loaded, gameobject_template missing", goEntry);
delete t;
return NULL;
}
@@ -918,7 +937,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
// skip transports with empty waypoints list
{
- sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
+ sLog->outError(LOG_FILTER_SQL, "Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
delete t;
return NULL;
}
@@ -940,7 +959,7 @@ Transport* BattlegroundIC::CreateTransport(uint32 goEntry, uint32 period)
//If we someday decide to use the grid to track transports, here:
t->SetMap(GetBgMap());
- for (uint8 i = 0; i < 5; i++)
+ for (uint8 i = 0; i < 5; ++i)
t->AddNPCPassenger(0, (goEntry == GO_HORDE_GUNSHIP ? NPC_HORDE_GUNSHIP_CANNON : NPC_ALLIANCE_GUNSHIP_CANNON), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionX() : allianceGunshipPassengers[i].GetPositionX()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionY() : allianceGunshipPassengers[i].GetPositionY()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetPositionZ() : allianceGunshipPassengers[i].GetPositionZ()), (goEntry == GO_HORDE_GUNSHIP ? hordeGunshipPassengers[i].GetOrientation() : allianceGunshipPassengers[i].GetOrientation()));
return t;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index 90f39a61e12..9e58a93fd2d 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -19,7 +19,9 @@
#ifndef __BATTLEGROUNDIC_H
#define __BATTLEGROUNDIC_H
-class Battleground;
+#include "Battleground.h"
+#include "Language.h"
+#include "Object.h"
const uint32 BG_IC_Factions[2] =
{
@@ -178,19 +180,19 @@ enum gameobjectsIC
GO_HORDE_BANNER_GRAVEYARD_H_CONT = 195394,
GO_HORDE_GUNSHIP = 195276,
- GO_ALLIANCE_GUNSHIP = 195121,
+ GO_ALLIANCE_GUNSHIP = 195121
};
#define MAX_REINFORCEMENTS 300
enum Times
{
- WORKSHOP_UPDATE_TIME = 180000, // 3 minutes
- DOCKS_UPDATE_TIME = 180000, // not sure if it is 3 minutes
- IC_RESOURCE_TIME = 45000, // not sure, need more research
- CLOSE_DOORS_TIME = 20000,
+ WORKSHOP_UPDATE_TIME = 180000, // 3 minutes
+ DOCKS_UPDATE_TIME = 180000, // not sure if it is 3 minutes
+ IC_RESOURCE_TIME = 45000, // not sure, need more research
+ CLOSE_DOORS_TIME = 20000,
BANNER_STATE_CHANGE_TIME = 60000,
- TRANSPORT_PERIOD_TIME = 120000
+ TRANSPORT_PERIOD_TIME = 120000
};
enum Actions
@@ -336,7 +338,7 @@ enum BG_IC_GOs
BG_IC_GO_TELEPORTER_EFFECTS_H_3,
BG_IC_GO_TELEPORTER_EFFECTS_H_4,
BG_IC_GO_TELEPORTER_EFFECTS_H_5,
- BG_IC_GO_TELEPORTER_EFFECTS_H_6,
+ BG_IC_GO_TELEPORTER_EFFECTS_H_6
};
enum BG_IC_NPCs
@@ -411,7 +413,7 @@ enum BG_IC_NPCs
BG_IC_NPC_SPIRIT_GUIDE_4,
BG_IC_NPC_SPIRIT_GUIDE_5,
BG_IC_NPC_SPIRIT_GUIDE_6,
- BG_IC_NPC_SPIRIT_GUIDE_7,
+ BG_IC_NPC_SPIRIT_GUIDE_7
};
enum BannersTypes
@@ -654,18 +656,15 @@ const Position workshopBombs[2] =
enum Spells
{
- SPELL_OIL_REFINERY = 68719,
- SPELL_QUARRY = 68720,
-
- SPELL_PARACHUTE = 66656,
- SPELL_SLOW_FALL = 12438,
-
- SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
-
- SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
- SPELL_DRIVING_CREDIT_GLAIVE = 68363,
- SPELL_DRIVING_CREDIT_SIEGE = 68364,
- SPELL_DRIVING_CREDIT_CATAPULT = 68362
+ SPELL_OIL_REFINERY = 68719,
+ SPELL_QUARRY = 68720,
+ SPELL_PARACHUTE = 66656,
+ SPELL_SLOW_FALL = 12438,
+ SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
+ SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
+ SPELL_DRIVING_CREDIT_GLAIVE = 68363,
+ SPELL_DRIVING_CREDIT_SIEGE = 68364,
+ SPELL_DRIVING_CREDIT_CATAPULT = 68362,
};
enum BG_IC_Objectives
@@ -751,7 +750,7 @@ enum ICDoorList
BG_IC_A_FRONT,
BG_IC_A_WEST,
BG_IC_A_EAST,
- BG_IC_MAXDOOR,
+ BG_IC_MAXDOOR
};
enum ICNodePointType
@@ -847,13 +846,12 @@ enum HonorRewards
WINNER_HONOR_AMOUNT = 500
};
-class BattlegroundICScore : public BattlegroundScore
+struct BattlegroundICScore : public BattlegroundScore
{
- public:
- BattlegroundICScore() : BasesAssaulted(0), BasesDefended(0) {};
- virtual ~BattlegroundICScore() {};
- uint32 BasesAssaulted;
- uint32 BasesDefended;
+ BattlegroundICScore() : BasesAssaulted(0), BasesDefended(0) { }
+ ~BattlegroundICScore() { }
+ uint32 BasesAssaulted;
+ uint32 BasesDefended;
};
class BattlegroundIC : public Battleground
@@ -863,10 +861,10 @@ class BattlegroundIC : public Battleground
~BattlegroundIC();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
- virtual void PostUpdateImpl(uint32 diff);
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
+ void PostUpdateImpl(uint32 diff);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
@@ -880,7 +878,7 @@ class BattlegroundIC : public Battleground
void EventPlayerDamagedGO(Player* /*player*/, GameObject* go, uint32 eventType);
void DestroyGate(Player* player, GameObject* go);
- virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
+ WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/* Scorekeeping */
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
@@ -889,11 +887,11 @@ class BattlegroundIC : public Battleground
void DoAction(uint32 action, uint64 var);
- virtual void HandlePlayerResurrect(Player* player);
+ void HandlePlayerResurrect(Player* player);
- uint32 GetNodeState(uint8 nodeType) { return (uint8)nodePoint[nodeType].nodeState; }
+ uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
- virtual bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
+ bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
private:
uint32 closeFortressDoorsTimer;
bool doorsClosed;
@@ -959,4 +957,5 @@ class BattlegroundIC : public Battleground
Transport* CreateTransport(uint32 goEntry, uint32 period);
void SendTransportInit(Player* player);
};
+
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
index 0974c96a991..6677d665290 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundNA.h"
#include "Language.h"
#include "Object.h"
@@ -62,11 +61,7 @@ void BattlegroundNA::StartingEventOpenDoors()
void BattlegroundNA::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundNAScore* sc = new BattlegroundNAScore;
-
- PlayerScores[player->GetGUID()] = sc;
-
+ PlayerScores[player->GetGUID()] = new BattlegroundScore;
UpdateArenaWorldState();
}
@@ -86,7 +81,7 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("BattlegroundNA: Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundNA: Killer player not found");
return;
}
@@ -98,30 +93,24 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer)
bool BattlegroundNA::HandlePlayerUnderMap(Player* player)
{
- player->TeleportTo(GetMapId(), 4055.504395f, 2919.660645f, 13.611241f, player->GetOrientation(), false);
+ player->TeleportTo(GetMapId(), 4055.504395f, 2919.660645f, 13.611241f, player->GetOrientation());
return true;
}
-void BattlegroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- //uint32 SpellId = 0;
- //uint64 buff_guid = 0;
- switch (Trigger)
+ switch (trigger)
{
case 4536: // buff trigger?
case 4537: // buff trigger?
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
-
- //if (buff_guid)
- // HandleTriggerBuff(buff_guid, Source);
}
void BattlegroundNA::FillInitialWorldStates(WorldPacket &data)
@@ -147,19 +136,9 @@ bool BattlegroundNA::SetupBattleground()
|| !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|| !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
{
- sLog->outErrorDb("BatteGroundNA: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundNA: Failed to spawn some object!");
return false;
}
return true;
}
-
-/*
-20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
-0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r...........
-0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................
-0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
-0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
-0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
-0050: 00 00 00 00 00 00 | ......
-*/
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
index 53c0faf1c6f..0241cf182a7 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h
@@ -18,7 +18,7 @@
#ifndef __BATTLEGROUNDNA_H
#define __BATTLEGROUNDNA_H
-class Battleground;
+#include "Battleground.h"
enum BattlegroundNAObjectTypes
{
@@ -41,14 +41,6 @@ enum BattlegroundNAObjects
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
};
-class BattlegroundNAScore : public BattlegroundScore
-{
- public:
- BattlegroundNAScore() {};
- virtual ~BattlegroundNAScore() {};
- //TODO fix me
-};
-
class BattlegroundNA : public Battleground
{
public:
@@ -56,15 +48,15 @@ class BattlegroundNA : public Battleground
~BattlegroundNA();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
bool SetupBattleground();
- virtual void Reset();
- virtual void FillInitialWorldStates(WorldPacket &d);
+ void Reset();
+ void FillInitialWorldStates(WorldPacket &d);
void HandleKillPlayer(Player* player, Player* killer);
bool HandlePlayerUnderMap(Player* player);
};
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp
deleted file mode 100755
index 98985b41b5a..00000000000
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Player.h"
-#include "Battleground.h"
-#include "BattlegroundRB.h"
-#include "Language.h"
-
-BattlegroundRB::BattlegroundRB()
-{
- //TODO FIX ME!
- StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
- StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
- StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
- StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
-}
-
-BattlegroundRB::~BattlegroundRB()
-{
-
-}
-
-void BattlegroundRB::StartingEventCloseDoors()
-{
-}
-
-void BattlegroundRB::StartingEventOpenDoors()
-{
-}
-
-void BattlegroundRB::AddPlayer(Player* player)
-{
- Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundRBScore* sc = new BattlegroundRBScore;
-
- PlayerScores[player->GetGUID()] = sc;
-}
-
-void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/)
-{
-}
-
-void BattlegroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/)
-{
- // this is wrong way to implement these things. On official it done by gameobject spell cast.
- if (GetStatus() != STATUS_IN_PROGRESS)
- return;
-}
-
-void BattlegroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
-{
- std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID());
-
- if (itr == PlayerScores.end()) // player not found...
- return;
-
- Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
-}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h
deleted file mode 100755
index cda1351ca12..00000000000
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __BATTLEGROUNDRB_H
-#define __BATTLEGROUNDRB_H
-
-class Battleground;
-
-class BattlegroundRBScore : public BattlegroundScore
-{
- public:
- BattlegroundRBScore() {};
- virtual ~BattlegroundRBScore() {};
-};
-
-class BattlegroundRB : public Battleground
-{
- public:
- BattlegroundRB();
- ~BattlegroundRB();
-
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
-
- void RemovePlayer(Player* player, uint64 guid, uint32 team);
- void HandleAreaTrigger(Player* Source, uint32 Trigger);
-
- /* Scorekeeping */
- void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
-
- private:
-};
-#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
index 6a626217a4e..2c715193a3b 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundRL.h"
#include "Language.h"
#include "Object.h"
@@ -62,11 +61,7 @@ void BattlegroundRL::StartingEventOpenDoors()
void BattlegroundRL::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundRLScore* sc = new BattlegroundRLScore;
-
- PlayerScores[player->GetGUID()] = sc;
-
+ PlayerScores[player->GetGUID()] = new BattlegroundScore;
UpdateArenaWorldState();
}
@@ -86,7 +81,7 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "Killer player not found");
return;
}
@@ -98,31 +93,24 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer)
bool BattlegroundRL::HandlePlayerUnderMap(Player* player)
{
- player->TeleportTo(GetMapId(), 1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation(), false);
+ player->TeleportTo(GetMapId(), 1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation());
return true;
}
-void BattlegroundRL::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger)
{
- // this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- //uint32 SpellId = 0;
- //uint64 buff_guid = 0;
- switch (Trigger)
+ switch (trigger)
{
case 4696: // buff trigger?
case 4697: // buff trigger?
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
-
- //if (buff_guid)
- // HandleTriggerBuff(buff_guid, Source);
}
void BattlegroundRL::FillInitialWorldStates(WorldPacket &data)
@@ -146,19 +134,9 @@ bool BattlegroundRL::SetupBattleground()
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
|| !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
{
- sLog->outErrorDb("BatteGroundRL: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundRL: Failed to spawn some object!");
return false;
}
return true;
}
-
-/*
-Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86
-0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <...............
-0010: 00 00 01 00 00 00 B9 0B 00 00 02 00 00 00 B8 0B | ................
-0020: 00 00 00 00 00 00 D8 08 00 00 00 00 00 00 D7 08 | ................
-0030: 00 00 00 00 00 00 D6 08 00 00 00 00 00 00 D5 08 | ................
-0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................
-0050: 00 00 00 00 00 00 | ......
-*/
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
index dc041a18a1c..56d089909e0 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h
@@ -18,7 +18,7 @@
#ifndef __BATTLEGROUNDRL_H
#define __BATTLEGROUNDRL_H
-class Battleground;
+#include "Battleground.h"
enum BattlegroundRLObjectTypes
{
@@ -37,14 +37,6 @@ enum BattlegroundRLObjects
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
};
-class BattlegroundRLScore : public BattlegroundScore
-{
- public:
- BattlegroundRLScore() {};
- virtual ~BattlegroundRLScore() {};
- //TODO fix me
-};
-
class BattlegroundRL : public Battleground
{
public:
@@ -52,11 +44,11 @@ class BattlegroundRL : public Battleground
~BattlegroundRL();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void Reset();
- virtual void FillInitialWorldStates(WorldPacket &d);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void Reset();
+ void FillInitialWorldStates(WorldPacket &d);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
index 6869a899305..130ba4f3290 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp
@@ -32,17 +32,13 @@ BattlegroundRV::BattlegroundRV()
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
- // we must set messageIds
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
}
-BattlegroundRV::~BattlegroundRV()
-{
-
-}
+BattlegroundRV::~BattlegroundRV() { }
void BattlegroundRV::PostUpdateImpl(uint32 diff)
{
@@ -103,10 +99,7 @@ void BattlegroundRV::StartingEventOpenDoors()
void BattlegroundRV::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
- //create score and add it to map, default values are set in constructor
- BattlegroundRVScore* sc = new BattlegroundRVScore;
-
- PlayerScores[player->GetGUID()] = sc;
+ PlayerScores[player->GetGUID()] = new BattlegroundScore;
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
@@ -130,7 +123,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
- sLog->outError("BattlegroundRV: Killer player not found");
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundRV: Killer player not found");
return;
}
@@ -144,16 +137,16 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer)
bool BattlegroundRV::HandlePlayerUnderMap(Player* player)
{
- player->TeleportTo(GetMapId(), 763.5f, -284, 28.276f, 2.422f, false);
+ player->TeleportTo(GetMapId(), 763.5f, -284, 28.276f, 2.422f);
return true;
}
-void BattlegroundRV::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
- switch (Trigger)
+ switch (trigger)
{
case 5224:
case 5226:
@@ -162,8 +155,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 5474:
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
}
@@ -214,7 +206,7 @@ bool BattlegroundRV::SetupBattleground()
)
{
- sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundRV: Failed to spawn some object!");
return false;
}
return true;
@@ -245,6 +237,6 @@ void BattlegroundRV::TogglePillarCollision()
gob->SendUpdateToPlayer(player);
}
}
-
+
SetPillarCollision(!apply);
-} \ No newline at end of file
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
index 8c5746931e3..115fd95d1b0 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h
@@ -18,7 +18,7 @@
#ifndef __BATTLEGROUNDRV_H
#define __BATTLEGROUNDRV_H
-class Battleground;
+#include "Battleground.h"
enum BattlegroundRVObjectTypes
{
@@ -46,7 +46,7 @@ enum BattlegroundRVObjectTypes
BG_RV_OBJECT_ELEVATOR_1,
BG_RV_OBJECT_ELEVATOR_2,
- BG_RV_OBJECT_MAX,
+ BG_RV_OBJECT_MAX
};
enum BattlegroundRVObjects
@@ -73,7 +73,7 @@ enum BattlegroundRVObjects
BG_RV_OBJECT_TYPE_PILAR_1 = 194583, // axe
BG_RV_OBJECT_TYPE_PILAR_2 = 194584, // arena
BG_RV_OBJECT_TYPE_PILAR_3 = 194585, // lightning
- BG_RV_OBJECT_TYPE_PILAR_4 = 194587, // ivory
+ BG_RV_OBJECT_TYPE_PILAR_4 = 194587 // ivory
};
enum BattlegroundRVData
@@ -88,14 +88,7 @@ enum BattlegroundRVData
BG_RV_FIRST_TIMER = 20133,
BG_RV_WORLD_STATE_A = 0xe10,
BG_RV_WORLD_STATE_H = 0xe11,
- BG_RV_WORLD_STATE = 0xe1a,
-};
-
-class BattlegroundRVScore : public BattlegroundScore
-{
- public:
- BattlegroundRVScore() {};
- virtual ~BattlegroundRVScore() {};
+ BG_RV_WORLD_STATE = 0xe1a
};
class BattlegroundRV : public Battleground
@@ -105,11 +98,11 @@ class BattlegroundRV : public Battleground
~BattlegroundRV();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
- virtual void Reset();
- virtual void FillInitialWorldStates(WorldPacket &d);
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
+ void Reset();
+ void FillInitialWorldStates(WorldPacket &d);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
@@ -122,7 +115,7 @@ class BattlegroundRV : public Battleground
uint32 State;
bool PillarCollision;
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
protected:
uint32 getTimer() { return Timer; };
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index d15c7943bab..ab479eeff2d 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -16,13 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundSA.h"
#include "Language.h"
#include "Player.h"
#include "GameObject.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
+#include "WorldSession.h"
BattlegroundSA::BattlegroundSA()
{
@@ -56,8 +56,8 @@ void BattlegroundSA::Reset()
GateStatus[i] = BG_SA_GATE_OK;
ShipsStarted = false;
gateDestroyed = false;
- _notEvenAScratch[BG_TEAM_ALLIANCE] = true;
- _notEvenAScratch[BG_TEAM_HORDE] = true;
+ _notEvenAScratch[TEAM_ALLIANCE] = true;
+ _notEvenAScratch[TEAM_HORDE] = true;
Status = BG_SA_WARMUP;
}
@@ -75,7 +75,7 @@ bool BattlegroundSA::ResetObjs()
uint32 atF = BG_SA_Factions[Attackers];
uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE];
- for (uint8 i = 0; i <BG_SA_MAXOBJ; i++)
+ for (uint8 i = 0; i < BG_SA_MAXOBJ; i++)
DelObject(i);
for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
@@ -87,22 +87,24 @@ bool BattlegroundSA::ResetObjs()
for (uint8 i = 0; i < 6; i++)
GateStatus[i] = BG_SA_GATE_OK;
- for (uint8 i = 0; i < BG_SA_BOAT_ONE; i++)
+ for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++)
{
if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
return false;
}
- for (uint8 i = BG_SA_BOAT_ONE; i < BG_SA_SIGIL_1; i++)
+ for (uint8 i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
{
- uint32 boatid=0;
+ uint32 boatid = 0;
switch (i)
{
case BG_SA_BOAT_ONE:
- boatid= Attackers ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A;
+ boatid = Attackers ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A;
break;
case BG_SA_BOAT_TWO:
- boatid= Attackers ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A;
+ boatid = Attackers ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A;
+ break;
+ default:
break;
}
if (!AddObject(i, boatid, BG_SA_ObjSpawnlocs[i][0],
@@ -111,7 +113,8 @@ bool BattlegroundSA::ResetObjs()
BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
return false;
}
- for (uint8 i = BG_SA_SIGIL_1; i < BG_SA_CENTRAL_FLAG; i++)
+
+ for (uint8 i = BG_SA_SIGIL_1; i <= BG_SA_LEFT_FLAGPOLE; i++)
{
if (!AddObject(i, BG_SA_ObjEntries[i],
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
@@ -128,7 +131,7 @@ bool BattlegroundSA::ResetObjs()
//Cannons and demolishers - NPCs are spawned
//By capturing GYs.
- for (uint8 i = 0; i < BG_SA_NPC_SPARKLIGHT; i++)
+ for (uint8 i = 0; i < BG_SA_DEMOLISHER_5; i++)
{
if (!AddCreature(BG_SA_NpcEntries[i], i, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
@@ -139,7 +142,7 @@ bool BattlegroundSA::ResetObjs()
OverrideGunFaction();
DemolisherStartState(true);
- for (uint8 i = 0; i <= BG_SA_TITAN_RELIC; i++)
+ for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
@@ -154,15 +157,15 @@ bool BattlegroundSA::ResetObjs()
TotalTime = 0;
ShipsStarted = false;
- //Graveyards!
- for (uint8 i = 0;i < BG_SA_MAX_GY; i++)
+ //Graveyards
+ for (uint8 i = 0; i < BG_SA_MAX_GY; i++)
{
WorldSafeLocsEntry const* sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
if (!sg)
{
- sLog->outError("SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
return false;
}
@@ -175,29 +178,20 @@ bool BattlegroundSA::ResetObjs()
{
GraveyardStatus[i] = ((Attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE);
if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((Attackers == TEAM_HORDE)? ALLIANCE : HORDE)))
- sLog->outError("SOTA: couldn't spawn GY: %u", i);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "SOTA: couldn't spawn GY: %u", i);
}
}
//GY capture points
- for (uint8 i = BG_SA_CENTRAL_FLAG; i < BG_SA_PORTAL_DEFFENDER_BLUE; i++)
+ for (uint8 i = BG_SA_CENTRAL_FLAG; i <= BG_SA_LEFT_FLAG; i++)
{
- AddObject(i, (BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1:0)),
+ AddObject(i, (BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1 : 0)),
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
0, 0, 0, 0, RESPAWN_ONE_DAY);
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
}
- for (uint8 i = BG_SA_PORTAL_DEFFENDER_BLUE; i < BG_SA_BOMB; i++)
- {
- AddObject(i, BG_SA_ObjEntries[i],
- BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
- BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
- 0, 0, 0, 0, RESPAWN_ONE_DAY);
- GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
- }
-
for (uint8 i = BG_SA_BOMB; i < BG_SA_MAXOBJ; i++)
{
AddObject(i, BG_SA_ObjEntries[BG_SA_BOMB],
@@ -207,14 +201,14 @@ bool BattlegroundSA::ResetObjs()
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
}
- //Player may enter BEFORE we set up bG - lets update his worldstates anyway...
- UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
- UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
- UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
+ //Player may enter BEFORE we set up BG - lets update his worldstates anyway...
+ UpdateWorldState(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
+ UpdateWorldState(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
+ UpdateWorldState(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
- UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
- UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
- UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
+ UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
+ UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
+ UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
if (Attackers == TEAM_ALLIANCE)
{
@@ -255,6 +249,9 @@ bool BattlegroundSA::ResetObjs()
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
SendTransportInit(player);
+ // set status manually so preparation is cast correctly in 2nd round too
+ SetStatus(STATUS_WAIT_JOIN);
+
TeleportPlayers();
return true;
}
@@ -296,7 +293,8 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
InitSecondRound = false;
SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
- }else
+ }
+ else
{
UpdateWaitTimer -= diff;
return;
@@ -313,7 +311,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
ToggleTimer();
DemolisherStartState(false);
Status = BG_SA_ROUND_ONE;
- StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702);
+ StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE) ? 23748 : 21702);
}
if (TotalTime >= BG_SA_BOAT_START)
StartShips();
@@ -333,7 +331,12 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
ToggleTimer();
DemolisherStartState(false);
Status = BG_SA_ROUND_TWO;
- StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702);
+ StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE) ? 23748 : 21702);
+ // status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now
+ SetStatus(STATUS_IN_PROGRESS);
+ for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
+ if (Player* p = ObjectAccessor::FindPlayer(itr->first))
+ p->RemoveAurasDueToSpell(SPELL_PREPARATION);
}
if (TotalTime >= 30000)
{
@@ -372,7 +375,6 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
{
RoundScores[1].time = BG_SA_ROUNDLENGTH;
RoundScores[1].winner = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
-
if (RoundScores[0].time == RoundScores[1].time)
EndBattleground(0);
else if (RoundScores[0].time < RoundScores[1].time)
@@ -412,7 +414,7 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_SA_BONUS_TIMER) << uint32(0);
- data << uint32(BG_SA_HORDE_ATTACKS)<< horde_attacks;
+ data << uint32(BG_SA_HORDE_ATTACKS) << horde_attacks;
data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks;
//Time will be sent on first update...
@@ -421,13 +423,13 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0);
data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0);
- data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
- data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
- data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
+ data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
+ data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
+ data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0);
- data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
- data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
- data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
+ data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
+ data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
+ data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0);
data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks;
data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks;
@@ -451,9 +453,9 @@ void BattlegroundSA::AddPlayer(Player* player)
player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
if (urand(0, 1))
- player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
+ player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
else
- player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
+ player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
}
else
@@ -514,14 +516,18 @@ void BattlegroundSA::TeleportPlayers()
player->ResetAllPowers();
player->CombatStopWithPets(true);
+ for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
+ if (Player* p = ObjectAccessor::FindPlayer(itr->first))
+ p->CastSpell(p, SPELL_PREPARATION, true);
+
if (player->GetTeamId() == Attackers)
{
player->CastSpell(player, 12438, true); //Without this player falls before boat loads...
if (urand(0, 1))
- player->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
+ player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
else
- player->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
+ player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
}
else
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
@@ -573,13 +579,13 @@ void BattlegroundSA::OverrideGunFaction()
if (!BgCreatures[0])
return;
- for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
+ for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10; i++)
{
if (Creature* gun = GetBGCreature(i))
- gun->setFaction(BG_SA_Factions[Attackers? TEAM_ALLIANCE : TEAM_HORDE]);
+ gun->setFaction(BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE]);
}
- for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++)
+ for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
{
if (Creature* dem = GetBGCreature(i))
dem->setFaction(BG_SA_Factions[Attackers]);
@@ -591,6 +597,7 @@ void BattlegroundSA::DemolisherStartState(bool start)
if (!BgCreatures[0])
return;
+ // set flags only for the demolishers on the beach, factory ones dont need it
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
{
if (Creature* dem = GetBGCreature(i))
@@ -637,10 +644,12 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED)
rewardHonor = false;
break;
+ default:
+ break;
}
if (i < 5)
- DelObject(i+9);
+ DelObject(i + 14);
UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
if (rewardHonor)
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
@@ -664,7 +673,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player)
safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY];
closest = sWorldSafeLocsStore.LookupEntry(safeloc);
- nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y)+(closest->z - z)*(closest->z - z));
+ nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y) + (closest->z - z)*(closest->z - z));
for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++)
{
@@ -672,7 +681,7 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveYard(Player* player)
continue;
ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
- dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y)+(ret->z - z)*(ret->z - z));
+ dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y) + (ret->z - z)*(ret->z - z));
if (dist < nearest)
{
closest = ret;
@@ -725,7 +734,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
if (!sg)
{
- sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
return;
}
@@ -738,7 +747,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
case BG_SA_LEFT_CAPTURABLE_GY:
flag = BG_SA_LEFT_FLAG;
DelObject(flag);
- AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
+ AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
@@ -747,8 +756,18 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
- UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
- UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
+ for (uint8 j = BG_SA_DEMOLISHER_7; j <= BG_SA_DEMOLISHER_8; j++)
+ {
+ AddCreature(BG_SA_NpcEntries[j], j, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
+ BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1],
+ BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
+
+ if (Creature* dem = GetBGCreature(j))
+ dem->setFaction(BG_SA_Factions[Attackers]);
+ }
+
+ UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
+ UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
SendWarningToAll(LANG_BG_SA_A_GY_WEST);
else
@@ -757,7 +776,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
case BG_SA_RIGHT_CAPTURABLE_GY:
flag = BG_SA_RIGHT_FLAG;
DelObject(flag);
- AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
+ AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
@@ -766,8 +785,18 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
- UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
- UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
+ for (uint8 j = BG_SA_DEMOLISHER_5; j <= BG_SA_DEMOLISHER_6; j++)
+ {
+ AddCreature(BG_SA_NpcEntries[j], j, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
+ BG_SA_NpcSpawnlocs[j][0], BG_SA_NpcSpawnlocs[j][1],
+ BG_SA_NpcSpawnlocs[j][2], BG_SA_NpcSpawnlocs[j][3], 600);
+
+ if (Creature* dem = GetBGCreature(j))
+ dem->setFaction(BG_SA_Factions[Attackers]);
+ }
+
+ UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
+ UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
SendWarningToAll(LANG_BG_SA_A_GY_EAST);
else
@@ -776,12 +805,12 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
case BG_SA_CENTRAL_CAPTURABLE_GY:
flag = BG_SA_CENTRAL_FLAG;
DelObject(flag);
- AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
+ AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0 : 1)),
BG_SA_ObjSpawnlocs[flag][0], BG_SA_ObjSpawnlocs[flag][1],
BG_SA_ObjSpawnlocs[flag][2], BG_SA_ObjSpawnlocs[flag][3], 0, 0, 0, 0, RESPAWN_ONE_DAY);
- UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
- UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
+ UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 1 : 0));
+ UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE ? 0 : 1));
if (Source->GetTeamId() == TEAM_ALLIANCE)
SendWarningToAll(LANG_BG_SA_A_GY_SOUTH);
else
@@ -795,7 +824,11 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
{
- if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] && GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED && GateStatus[BG_SA_YELLOW_GATE] == BG_SA_GATE_DESTROYED && (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) && (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED))
+ if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] &&
+ GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED &&
+ GateStatus[BG_SA_YELLOW_GATE] == BG_SA_GATE_DESTROYED &&
+ (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED) &&
+ (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED))
{
if (Source->GetTeamId() == Attackers)
{
@@ -873,7 +906,7 @@ void BattlegroundSA::EndBattleground(uint32 winner)
void BattlegroundSA::UpdateDemolisherSpawns()
{
- for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
+ for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_8; i++)
{
if (BgCreatures[i])
{
@@ -882,21 +915,16 @@ void BattlegroundSA::UpdateDemolisherSpawns()
if (Demolisher->isDead())
{
// Demolisher is not in list
- if (DemoliserRespawnList.find(i)==DemoliserRespawnList.end())
+ if (DemoliserRespawnList.find(i) == DemoliserRespawnList.end())
{
- DemoliserRespawnList[i]=getMSTime()+30000;
+ DemoliserRespawnList[i] = getMSTime()+30000;
}
else
{
if (DemoliserRespawnList[i] < getMSTime())
{
- uint8 gy = (i >= BG_SA_DEMOLISHER_3 ? 3 : 2);
- if (GraveyardStatus[gy] == Attackers)
- Demolisher->Relocate(BG_SA_NpcSpawnlocs[i + 11][0], BG_SA_NpcSpawnlocs[i + 11][1],
- BG_SA_NpcSpawnlocs[i + 11][2], BG_SA_NpcSpawnlocs[i + 11][3]);
- else
- Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
- BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);
+ Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
+ BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);
Demolisher->Respawn();
DemoliserRespawnList.erase(i);
@@ -937,4 +965,3 @@ void BattlegroundSA::SendTransportsRemove(Player* player)
player->GetSession()->SendPacket(&packet);
}
}
-
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index fd11cb2c5ea..9089f0c2818 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
@@ -19,13 +19,12 @@
#ifndef __BATTLEGROUNDSA_H
#define __BATTLEGROUNDSA_H
-class Battleground;
+#include "Battleground.h"
-class BattlegroundSAScore : public BattlegroundScore
+struct BattlegroundSAScore : public BattlegroundScore
{
- public:
- BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {};
- virtual ~BattlegroundSAScore() {};
+ BattlegroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) { }
+ ~BattlegroundSAScore() { }
uint8 demolishers_destroyed;
uint8 gates_destroyed;
};
@@ -104,7 +103,7 @@ enum BG_SA_WorldStates
BG_SA_LEFT_GY_HORDE = 3633,
BG_SA_CENTER_GY_HORDE = 3634,
BG_SA_BONUS_TIMER = 0xdf3,
- BG_SA_ENABLE_TIMER = 3564,
+ BG_SA_ENABLE_TIMER = 3564
};
enum npc
@@ -112,7 +111,7 @@ enum npc
NPC_ANTI_PERSONNAL_CANNON = 27894,
NPC_DEMOLISHER_SA = 28781,
NPC_RIGGER_SPARKLIGHT = 29260,
- NPC_GORGRIL_RIGSPARK = 29262,
+ NPC_GORGRIL_RIGSPARK = 29262
};
enum BG_SA_NPCs
@@ -127,15 +126,19 @@ enum BG_SA_NPCs
BG_SA_GUN_8,
BG_SA_GUN_9,
BG_SA_GUN_10,
- BG_SA_DEMOLISHER_1,
- BG_SA_DEMOLISHER_2,
- BG_SA_DEMOLISHER_3,
- BG_SA_DEMOLISHER_4,
BG_SA_NPC_TRIGGER_1,
BG_SA_NPC_TRIGGER_2,
BG_SA_NPC_TRIGGER_3,
BG_SA_NPC_TRIGGER_4,
BG_SA_NPC_TRIGGER_5,
+ BG_SA_DEMOLISHER_1,
+ BG_SA_DEMOLISHER_2,
+ BG_SA_DEMOLISHER_3,
+ BG_SA_DEMOLISHER_4,
+ BG_SA_DEMOLISHER_5,
+ BG_SA_DEMOLISHER_6,
+ BG_SA_DEMOLISHER_7,
+ BG_SA_DEMOLISHER_8,
BG_SA_NPC_SPARKLIGHT,
BG_SA_NPC_RIGSPARK,
BG_SA_MAXNPC
@@ -146,7 +149,7 @@ enum BG_SA_Boat
BG_SA_BOAT_ONE_A = 193182,
BG_SA_BOAT_TWO_H = 193183,
BG_SA_BOAT_ONE_H = 193184,
- BG_SA_BOAT_TWO_A = 193185,
+ BG_SA_BOAT_TWO_A = 193185
};
uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] =
@@ -161,17 +164,22 @@ uint32 const BG_SA_NpcEntries[BG_SA_MAXNPC] =
NPC_ANTI_PERSONNAL_CANNON,
NPC_ANTI_PERSONNAL_CANNON,
NPC_ANTI_PERSONNAL_CANNON,
- // 4 beach demolishers
- NPC_DEMOLISHER_SA,
- NPC_DEMOLISHER_SA,
- NPC_DEMOLISHER_SA,
- NPC_DEMOLISHER_SA,
// Triggers
23472,
23472,
23472,
23472,
23472,
+ // 4 beach demolishers
+ NPC_DEMOLISHER_SA,
+ NPC_DEMOLISHER_SA,
+ NPC_DEMOLISHER_SA,
+ NPC_DEMOLISHER_SA,
+ // 4 factory demolishers
+ NPC_DEMOLISHER_SA,
+ NPC_DEMOLISHER_SA,
+ NPC_DEMOLISHER_SA,
+ NPC_DEMOLISHER_SA,
// Used Demolisher Salesman
NPC_RIGGER_SPARKLIGHT,
NPC_GORGRIL_RIGSPARK
@@ -190,25 +198,25 @@ float const BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] =
{ 1249.634f, -224.189f, 66.72f, 0.635f },
{ 1236.213f, 92.287f, 64.965f, 5.751f },
{ 1215.11f, 57.772f, 64.739f, 5.78f },
- // Demolishers
- { 1611.597656f, -117.270073f, 8.719355f, 2.513274f},
- { 1575.562500f, -158.421875f, 5.024450f, 2.129302f},
- { 1618.047729f, 61.424641f, 7.248210f, 3.979351f},
- { 1575.103149f, 98.873344f, 2.830360f, 3.752458f},
// Triggers
{ 1453.49f, -250.453f, 30.896f, 4.2883f},
{ 1377.05f, 97.036f, 30.8605f, 2.46539f},
{ 1186.05f, 58.8048f, 56.5491f, 2.75992f},
{ 1042.83f, -72.839f, 84.8145f, 3.58615f},
{ 1233.62f, -250.49f, 55.4036f, 3.7016f},
- // Npcs
- { 1348.644165f, -298.786469f, 31.080130f, 1.710423f},
- { 1358.191040f, 195.527786f, 31.018187f, 4.171337f},
+ // Demolishers
+ { 1611.597656f, -117.270073f, 8.719355f, 2.513274f},
+ { 1575.562500f, -158.421875f, 5.024450f, 2.129302f},
+ { 1618.047729f, 61.424641f, 7.248210f, 3.979351f},
+ { 1575.103149f, 98.873344f, 2.830360f, 3.752458f},
// Demolishers 2
{ 1371.055786f, -317.071136f, 35.007359f, 1.947460f},
{ 1424.034912f, -260.195190f, 31.084425f, 2.820013f},
{ 1353.139893f, 223.745438f, 35.265411f, 4.343684f},
- { 1404.809570f, 197.027237f, 32.046032f, 3.605401f}
+ { 1404.809570f, 197.027237f, 32.046032f, 3.605401f},
+ // Npcs
+ { 1348.644165f, -298.786469f, 31.080130f, 1.710423f},
+ { 1358.191040f, 195.527786f, 31.018187f, 4.171337f}
};
enum BG_SA_Objects
@@ -220,6 +228,11 @@ enum BG_SA_Objects
BG_SA_PURPLE_GATE,
BG_SA_ANCIENT_GATE,
BG_SA_TITAN_RELIC,
+ BG_SA_PORTAL_DEFFENDER_BLUE,
+ BG_SA_PORTAL_DEFFENDER_GREEN,
+ BG_SA_PORTAL_DEFFENDER_YELLOW,
+ BG_SA_PORTAL_DEFFENDER_PURPLE,
+ BG_SA_PORTAL_DEFFENDER_RED,
BG_SA_BOAT_ONE,
BG_SA_BOAT_TWO,
BG_SA_SIGIL_1,
@@ -233,11 +246,6 @@ enum BG_SA_Objects
BG_SA_CENTRAL_FLAG,
BG_SA_RIGHT_FLAG,
BG_SA_LEFT_FLAG,
- BG_SA_PORTAL_DEFFENDER_BLUE,
- BG_SA_PORTAL_DEFFENDER_GREEN,
- BG_SA_PORTAL_DEFFENDER_YELLOW,
- BG_SA_PORTAL_DEFFENDER_PURPLE,
- BG_SA_PORTAL_DEFFENDER_RED,
BG_SA_BOMB,
BG_SA_MAXOBJ = BG_SA_BOMB+68
};
@@ -251,6 +259,12 @@ float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
{ 1214.681f, 81.21f, 53.413f, 5.745f },
{ 878.555f, -108.2f, 117.845f, 0.0f },
{ 836.5f, -108.8f, 120.219f, 0.0f },
+ // Portal
+ {1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue
+ {1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green
+ {1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow
+ {1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple
+ {1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red
// Ships
{ 2679.696777f, -826.891235f, 3.712860f, 5.78367f}, //rot2 1 rot3 0.0002f
{ 2574.003662f, 981.261475f, 2.603424f, 0.807696f},
@@ -268,12 +282,6 @@ float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
{ 1215.108032f, -65.715767f, 70.084267f, -3.124123f},
{ 1338.859253f, -153.327316f, 30.895077f, -2.530723f},
{ 1309.192017f, 9.416233f, 30.893402f, 1.518436f},
- // Portal
- {1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue
- {1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green
- {1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow
- {1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple
- {1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red
// Bombs
{1333.45f, 211.354f, 31.0538f, 5.03666f},
{1334.29f, 209.582f, 31.0532f, 1.28088f},
@@ -367,6 +375,11 @@ uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] =
190723,
192549,
192834,
+ 192819,
+ 192819,
+ 192819,
+ 192819,
+ 192819,
0, // Boat
0, // Boat
192687,
@@ -380,11 +393,6 @@ uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] =
191310,
191306,
191308,
- 192819,
- 192819,
- 192819,
- 192819,
- 192819,
190753
};
@@ -444,25 +452,25 @@ class BattlegroundSA : public Battleground
/* inherited from BattlegroundClass */
/// Called when a player join battle
- virtual void AddPlayer(Player* player);
+ void AddPlayer(Player* player);
/// Called when battle start
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
/// Called for ini battleground, after that the first player be entered
- virtual bool SetupBattleground();
- virtual void Reset();
+ bool SetupBattleground();
+ void Reset();
/// Called for generate packet contain worldstate data
- virtual void FillInitialWorldStates(WorldPacket& data);
+ void FillInitialWorldStates(WorldPacket& data);
/// Called when a player deal damage to building (door)
- virtual void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
+ void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType);
/// Called when a player kill a unit in bg
- virtual void HandleKillUnit(Creature* creature, Player* killer);
+ void HandleKillUnit(Creature* creature, Player* killer);
/// Return the nearest graveyard where player can respawn
- virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
+ WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
/// Called when a player click on flag (graveyard flag)
- virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
+ void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
/// Called when a player use a gamobject (relic)
- virtual void EventPlayerUsedGO(Player* Source, GameObject* object);
+ void EventPlayerUsedGO(Player* Source, GameObject* object);
/// Return gate id, relative to bg data, according to gameobject id
uint32 getGateIdFromDamagedOrDestroyEventId(uint32 id)
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index d100dc645a2..63204129f24 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundWS.h"
#include "Creature.h"
#include "GameObject.h"
@@ -52,6 +51,8 @@ BattlegroundWS::BattlegroundWS()
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
+ _flagSpellForceTimer = 0;
+ _bothFlagsKept = false;
_flagDebuffState = 0;
}
@@ -63,72 +64,77 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
- if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS)
+ if (GetStartTime() >= 27*MINUTE*IN_MILLISECONDS)
{
- if (GetTeamScore(ALLIANCE) == 0)
+ if (GetTeamScore(TEAM_ALLIANCE) == 0)
{
- if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
- EndBattleground(0);
+ if (GetTeamScore(TEAM_HORDE) == 0) // No one scored - result is tie
+ EndBattleground(WINNER_NONE);
else // Horde has more points and thus wins
EndBattleground(HORDE);
}
- else if (GetTeamScore(HORDE) == 0)
+ else if (GetTeamScore(TEAM_HORDE) == 0)
EndBattleground(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
- else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
+ else if (GetTeamScore(TEAM_HORDE) == GetTeamScore(TEAM_ALLIANCE)) // Team score equal, winner is team that scored the last flag
EndBattleground(_lastFlagCaptureTeam);
- else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
+ else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE)) // Last but not least, check who has the higher score
EndBattleground(HORDE);
else
EndBattleground(ALLIANCE);
}
- else if (GetStartTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS))
+ // first update needed after 1 minute of game already in progress
+ else if (GetStartTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS) + 3 * MINUTE * IN_MILLISECONDS)
{
++_minutesElapsed;
UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed);
}
- if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
+ if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
- _flagsTimer[BG_TEAM_ALLIANCE] -= diff;
+ _flagsTimer[TEAM_ALLIANCE] -= diff;
- if (_flagsTimer[BG_TEAM_ALLIANCE] < 0)
+ if (_flagsTimer[TEAM_ALLIANCE] < 0)
{
- _flagsTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsTimer[TEAM_ALLIANCE] = 0;
RespawnFlag(ALLIANCE, true);
}
}
- if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
+
+ if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
{
- _flagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
+ _flagsDropTimer[TEAM_ALLIANCE] -= diff;
- if (_flagsDropTimer[BG_TEAM_ALLIANCE] < 0)
+ if (_flagsDropTimer[TEAM_ALLIANCE] < 0)
{
- _flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsDropTimer[TEAM_ALLIANCE] = 0;
RespawnFlagAfterDrop(ALLIANCE);
_bothFlagsKept = false;
}
}
- if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
+
+ if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
- _flagsTimer[BG_TEAM_HORDE] -= diff;
+ _flagsTimer[TEAM_HORDE] -= diff;
- if (_flagsTimer[BG_TEAM_HORDE] < 0)
+ if (_flagsTimer[TEAM_HORDE] < 0)
{
- _flagsTimer[BG_TEAM_HORDE] = 0;
+ _flagsTimer[TEAM_HORDE] = 0;
RespawnFlag(HORDE, true);
}
}
- if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
+
+ if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
{
- _flagsDropTimer[BG_TEAM_HORDE] -= diff;
+ _flagsDropTimer[TEAM_HORDE] -= diff;
- if (_flagsDropTimer[BG_TEAM_HORDE] < 0)
+ if (_flagsDropTimer[TEAM_HORDE] < 0)
{
- _flagsDropTimer[BG_TEAM_HORDE] = 0;
+ _flagsDropTimer[TEAM_HORDE] = 0;
RespawnFlagAfterDrop(HORDE);
_bothFlagsKept = false;
}
}
+
if (_bothFlagsKept)
{
_flagSpellForceTimer += diff;
@@ -157,6 +163,17 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
}
else
{
+ if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
+ {
+ player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
+ player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
+ }
+ if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1]))
+ {
+ player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
+ player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
+ }
+
_flagSpellForceTimer = 0; //reset timer.
_flagDebuffState = 0;
}
@@ -210,12 +227,12 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured)
if (Team == ALLIANCE)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag");
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
+ _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
}
else
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag");
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
+ _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
}
if (captured)
@@ -251,9 +268,9 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)))
obj->Delete();
else
- sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
- SetDroppedFlagGUID(0, team);
+ SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team));
_bothFlagsKept = false;
}
@@ -267,36 +284,36 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
{
- if (!this->IsHordeFlagPickedup())
+ if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
+ _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
- if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(TEAM_ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
}
else
{
- if (!this->IsAllianceFlagPickedup())
+ if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
+ _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
- if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(TEAM_HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
@@ -313,17 +330,17 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source)
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
- UpdateTeamScore(Source->GetTeam());
+ UpdateTeamScore(Source->GetTeamId());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
// update last flag capture to be used if teamscore is equal
SetLastFlagCapture(Source->GetTeam());
- if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
- if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
@@ -351,9 +368,9 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
// just take off the aura
if (Source->GetTeam() == ALLIANCE)
{
- if (!this->IsHordeFlagPickedup())
+ if (!IsHordeFlagPickedup())
return;
- if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
+ if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID())
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -361,9 +378,9 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
}
else
{
- if (!this->IsAllianceFlagPickedup())
+ if (!IsAllianceFlagPickedup())
return;
- if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
+ if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID())
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
@@ -378,7 +395,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!IsHordeFlagPickedup())
return;
- if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
+ if (GetFlagPickerGUID(TEAM_HORDE) == Source->GetGUID())
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -386,7 +403,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
+ _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
set = true;
}
@@ -395,7 +412,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
{
if (!IsAllianceFlagPickedup())
return;
- if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
+ if (GetFlagPickerGUID(TEAM_ALLIANCE) == Source->GetGUID())
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
@@ -403,7 +420,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
+ _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
set = true;
}
@@ -446,12 +463,12 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
SetAllianceFlagPicker(Source->GetGUID());
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
+ _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
- Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
+ Source->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
}
@@ -465,18 +482,19 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
SetHordeFlagPicker(Source->GetGUID());
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
+ _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
//update world state to show correct flag carrier
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
- Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
+ Source->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
}
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
- if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
+ if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)
+ && target_obj->GetGOInfo()->entry == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
{
if (Source->GetTeam() == ALLIANCE)
{
@@ -497,7 +515,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
SetAllianceFlagPicker(Source->GetGUID());
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
+ _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
if (_flagDebuffState == 1)
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
@@ -510,7 +528,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
}
//Horde flag on ground(not in base) (returned or picked up again)
- if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
+ if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)
+ && target_obj->GetGOInfo()->entry == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
{
if (Source->GetTeam() == HORDE)
{
@@ -531,7 +550,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
SetHordeFlagPicker(Source->GetGUID());
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
+ _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
if (_flagDebuffState == 1)
Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true);
@@ -553,27 +572,27 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
void BattlegroundWS::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/)
{
// sometimes flag aura not removed :(
- if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
+ if (IsAllianceFlagPickedup() && m_FlagKeepers[TEAM_ALLIANCE] == guid)
{
if (!player)
{
- sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
- this->SetAllianceFlagPicker(0);
- this->RespawnFlag(ALLIANCE, false);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
+ SetAllianceFlagPicker(0);
+ RespawnFlag(ALLIANCE, false);
}
else
- this->EventPlayerDroppedFlag(player);
+ EventPlayerDroppedFlag(player);
}
- if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
+ if (IsHordeFlagPickedup() && m_FlagKeepers[TEAM_HORDE] == guid)
{
if (!player)
{
- sLog->outError("BattlegroundWS: Removing offline player who has the FLAG!!");
- this->SetHordeFlagPicker(0);
- this->RespawnFlag(HORDE, false);
+ sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
+ SetHordeFlagPicker(0);
+ RespawnFlag(HORDE, false);
}
else
- this->EventPlayerDroppedFlag(player);
+ EventPlayerDroppedFlag(player);
}
}
@@ -587,21 +606,20 @@ void BattlegroundWS::UpdateFlagState(uint32 team, uint32 value)
void BattlegroundWS::UpdateTeamScore(uint32 team)
{
- if (team == ALLIANCE)
+ if (team == TEAM_ALLIANCE)
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
else
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
}
-void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
+void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
{
- // this is wrong way to implement these things. On official it done by gameobject spell cast.
if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
//uint64 buff_guid = 0;
- switch (Trigger)
+ switch (trigger)
{
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update().
//buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
@@ -622,14 +640,14 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
//buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
break;
case 3646: // Alliance Flag spawn
- if (_flagState[BG_TEAM_HORDE] && !_flagState[BG_TEAM_ALLIANCE])
- if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID())
- EventPlayerCapturedFlag(Source);
+ if (_flagState[TEAM_HORDE] && !_flagState[TEAM_ALLIANCE])
+ if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID())
+ EventPlayerCapturedFlag(player);
break;
case 3647: // Horde Flag spawn
- if (_flagState[BG_TEAM_ALLIANCE] && !_flagState[BG_TEAM_HORDE])
- if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID())
- EventPlayerCapturedFlag(Source);
+ if (_flagState[TEAM_ALLIANCE] && !_flagState[TEAM_HORDE])
+ if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID())
+ EventPlayerCapturedFlag(player);
break;
case 3649: // unk1
case 3688: // unk2
@@ -637,8 +655,7 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4629: // unk4
break;
default:
- sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
- Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
+ Battleground::HandleAreaTrigger(player, trigger);
break;
}
@@ -672,21 +689,21 @@ bool BattlegroundWS::SetupBattleground()
|| !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY)
)
{
- sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
- sLog->outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
- sLog->outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!");
+ sLog->outError(LOG_FILTER_SQL, "BatteGroundWS: Failed to spawn Horde spirit guide! Battleground not created!");
return false;
}
@@ -700,38 +717,46 @@ void BattlegroundWS::Reset()
//call parent's class reset
Battleground::Reset();
- m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
- m_FlagKeepers[BG_TEAM_HORDE] = 0;
- m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
- m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
- bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
- m_ReputationCapture = (isBGWeekend) ? 45 : 35;
- m_HonorWinKills = (isBGWeekend) ? 3 : 1;
- m_HonorEndKills = (isBGWeekend) ? 4 : 2;
- // For WorldState
- _minutesElapsed = 0;
- _lastFlagCaptureTeam = 0;
-
- /* Spirit nodes is static at this BG and then not required deleting at BG reset.
- if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
- DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
- if (BgCreatures[WS_SPIRIT_MAIN_HORDE])
- DelCreature(WS_SPIRIT_MAIN_HORDE);
- */
+ m_FlagKeepers[TEAM_ALLIANCE] = 0;
+ m_FlagKeepers[TEAM_HORDE] = 0;
+ m_DroppedFlagGUID[TEAM_ALLIANCE] = 0;
+ m_DroppedFlagGUID[TEAM_HORDE] = 0;
+ _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
+ _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
+ m_TeamScores[TEAM_ALLIANCE] = 0;
+ m_TeamScores[TEAM_HORDE] = 0;
+
+ if (sBattlegroundMgr->IsBGWeekend(GetTypeID()))
+ {
+ m_ReputationCapture = 45;
+ m_HonorWinKills = 3;
+ m_HonorEndKills = 4;
+ }
+ else
+ {
+ m_ReputationCapture = 35;
+ m_HonorWinKills = 1;
+ m_HonorEndKills = 2;
+ }
+ _minutesElapsed = 0;
+ _lastFlagCaptureTeam = 0;
+ _bothFlagsKept = false;
+ _flagDebuffState = 0;
+ _flagSpellForceTimer = 0;
+ _flagsDropTimer[TEAM_ALLIANCE] = 0;
+ _flagsDropTimer[TEAM_HORDE] = 0;
+ _flagsTimer[TEAM_ALLIANCE] = 0;
+ _flagsTimer[TEAM_HORDE] = 0;
}
void BattlegroundWS::EndBattleground(uint32 winner)
{
- //win reward
+ // Win reward
if (winner == ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
if (winner == HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
- //complete map_end rewards (even if no team wins)
+ // Complete map_end rewards (even if no team wins)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
@@ -750,7 +775,6 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer)
void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
{
-
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID());
if (itr == PlayerScores.end()) // player not found
return;
@@ -759,11 +783,11 @@ void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value
{
case SCORE_FLAG_CAPTURES: // flags captured
((BattlegroundWGScore*)itr->second)->FlagCaptures += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
break;
case SCORE_FLAG_RETURNS: // flags returned
((BattlegroundWGScore*)itr->second)->FlagReturns += value;
- Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
+ Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
break;
default:
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor);
@@ -796,19 +820,19 @@ WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveYard(Player* player)
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
{
- data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
- data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
+ data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(TEAM_ALLIANCE));
+ data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(TEAM_HORDE));
- if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
+ if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
- else if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
+ else if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
else
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
- if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
+ if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
- else if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
+ else if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
else
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0);
@@ -823,15 +847,23 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
else
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0);
- if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
- data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2);
- else
- data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1);
-
- if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
+ if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2);
else
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1);
+ if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
+ data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2);
+ else
+ data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1);
}
+uint32 BattlegroundWS::GetPrematureWinner()
+{
+ if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
+ return ALLIANCE;
+ else if (GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE))
+ return HORDE;
+
+ return Battleground::GetPrematureWinner();
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index a014840f273..b0d68177072 100755..100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
@@ -146,13 +146,12 @@ enum BG_WS_Objectives
#define WS_EVENT_START_BATTLE 8563
-class BattlegroundWGScore : public BattlegroundScore
+struct BattlegroundWGScore : public BattlegroundScore
{
- public:
- BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
- virtual ~BattlegroundWGScore() {};
- uint32 FlagCaptures;
- uint32 FlagReturns;
+ BattlegroundWGScore() : FlagCaptures(0), FlagReturns(0) { }
+ ~BattlegroundWGScore() { }
+ uint32 FlagCaptures;
+ uint32 FlagReturns;
};
class BattlegroundWS : public Battleground
@@ -163,51 +162,57 @@ class BattlegroundWS : public Battleground
~BattlegroundWS();
/* inherited from BattlegroundClass */
- virtual void AddPlayer(Player* player);
- virtual void StartingEventCloseDoors();
- virtual void StartingEventOpenDoors();
+ void AddPlayer(Player* player);
+ void StartingEventCloseDoors();
+ void StartingEventOpenDoors();
/* BG Flags */
uint64 GetFlagPickerGUID(int32 team) const
{
- if (team == BG_TEAM_ALLIANCE || team == BG_TEAM_HORDE)
+ if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
return m_FlagKeepers[team];
return 0;
}
- void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
- void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
- bool IsAllianceFlagPickedup() const { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; }
- bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; }
+ void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_ALLIANCE] = guid; }
+ void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[TEAM_HORDE] = guid; }
+ bool IsAllianceFlagPickedup() const { return m_FlagKeepers[TEAM_ALLIANCE] != 0; }
+ bool IsHordeFlagPickedup() const { return m_FlagKeepers[TEAM_HORDE] != 0; }
void RespawnFlag(uint32 Team, bool captured);
void RespawnFlagAfterDrop(uint32 Team);
uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; }
/* Battleground Events */
- virtual void EventPlayerDroppedFlag(Player* Source);
- virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
- virtual void EventPlayerCapturedFlag(Player* Source);
+ void EventPlayerDroppedFlag(Player* Source);
+ void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj);
+ void EventPlayerCapturedFlag(Player* Source);
void RemovePlayer(Player* player, uint64 guid, uint32 team);
void HandleAreaTrigger(Player* Source, uint32 Trigger);
void HandleKillPlayer(Player* player, Player* killer);
bool SetupBattleground();
- virtual void Reset();
+ void Reset();
void EndBattleground(uint32 winner);
- virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
+ WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
void UpdateFlagState(uint32 team, uint32 value);
void SetLastFlagCapture(uint32 team) { _lastFlagCaptureTeam = team; }
void UpdateTeamScore(uint32 team);
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true);
- void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
+ void SetDroppedFlagGUID(uint64 guid, int32 team = -1)
+ {
+ if (team == TEAM_ALLIANCE || team == TEAM_HORDE)
+ m_DroppedFlagGUID[team] = guid;
+ }
+
uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
- virtual void FillInitialWorldStates(WorldPacket& data);
+ void FillInitialWorldStates(WorldPacket& data);
/* Scorekeeping */
- uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
+
+ uint32 GetPrematureWinner();
private:
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
uint64 m_DroppedFlagGUID[2];
@@ -224,7 +229,6 @@ class BattlegroundWS : public Battleground
uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault
uint8 _minutesElapsed;
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
};
#endif
-
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index 8b81a48c33b..cf71bb1b2fa 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -8,15 +8,12 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-if( USE_COREPCH )
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
file(GLOB_RECURSE sources_Accounts Accounts/*.cpp Accounts/*.h)
file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
+file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
@@ -54,12 +51,10 @@ file(GLOB_RECURSE sources_World World/*.cpp World/*.h)
# Create game-libary
-if( USE_COREPCH AND MSVC )
- set(game_STAT_SRCS
- PrecompiledHeaders/gamePCH.cpp
- PrecompiledHeaders/gamePCH.h
- )
-endif()
+if (USE_COREPCH)
+ set(game_STAT_PCH_HDR PrecompiledHeaders/gamePCH.h)
+ set(game_STAT_PCH_SRC PrecompiledHeaders/gamePCH.cpp)
+endif ()
set(game_STAT_SRCS
${game_STAT_SRCS}
@@ -68,6 +63,7 @@ set(game_STAT_SRCS
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
+ ${sources_Battlefield}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
@@ -136,12 +132,13 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Calendar
${CMAKE_CURRENT_SOURCE_DIR}/Chat
${CMAKE_CURRENT_SOURCE_DIR}/Chat/Channels
- ${CMAKE_CURRENT_SOURCE_DIR}/Chat/Commands
${CMAKE_CURRENT_SOURCE_DIR}/Combat
${CMAKE_CURRENT_SOURCE_DIR}/Conditions
${CMAKE_CURRENT_SOURCE_DIR}/DataStores
@@ -202,15 +199,14 @@ include_directories(
${OPENSSL_INCLUDE_DIR}
)
-add_library(game STATIC ${game_STAT_SRCS})
+add_library(game STATIC
+ ${game_STAT_SRCS}
+ ${game_STAT_PCH_SRC}
+)
add_dependencies(game revision.h)
# Generate precompiled header
-if( USE_COREPCH )
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_precompiled_header(game ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/gamePCH.h)
- elseif(MSVC)
- add_native_precompiled_header(game ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/gamePCH)
- endif()
-endif()
+if (USE_COREPCH)
+ add_cxx_pch(game ${game_STAT_PCH_HDR} ${game_STAT_PCH_SRC})
+endif ()
diff --git a/src/server/game/Calendar/Calendar.cpp b/src/server/game/Calendar/Calendar.cpp
deleted file mode 100755
index 139e63614cc..00000000000
--- a/src/server/game/Calendar/Calendar.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Player.h"
-#include "Calendar.h"
-
-std::string CalendarInvite::GetDebugString() const
-{
- std::ostringstream data;
-
- data << "CalendarInvite::"
- << " inviteId: " << _inviteId
- << " EventId: " << _eventId
- << " Status: " << uint32(_status)
- << " Invitee: " << _invitee
- << " Sender: " << _senderGUID
- << " Rank: " << uint32(_rank)
- << " Text: " << _text;
-
- return data.str();
-}
-
-void CalendarInvite::Init()
-{
- _eventId = 0;
- _invitee = 0;
- _senderGUID = 0;
- _statusTime = 0;
- _status = CALENDAR_STATUS_INVITED; // default (0)?
- _rank = CALENDAR_RANK_PLAYER;
- _text = "";
-}
-
-std::string CalendarEvent::GetDebugString() const
-{
- std::ostringstream data;
-
- data << "CalendarEvent::"
- << " EventId: " << _eventId
- << " Title: " << _title
- << " Description" << _description
- << " Type: " << uint32(_type)
- << " Max Invites: " << _maxInvites
- << " Creator: " << _creatorGUID
- << " Flags: " << _flags
- << " Guild: " << _guildId
- << " Time: " << _eventTime
- << " Time2: " << _timezoneTime
- << " Repeatable: " << uint32(_repeatable)
- << " DungeonId: " << _dungeonId;
-
- return data.str();
-}
-
-void CalendarEvent::Init()
-{
- _creatorGUID = 0;
- _guildId = 0;
- _type = CALENDAR_TYPE_OTHER;
- _dungeonId = -1;
- _maxInvites = 0;
- _eventTime = 0;
- _flags = 0;
- _repeatable = false;
- _timezoneTime = 0;
- _title = "";
- _description = "";
-
-}
-
-std::string CalendarAction::GetDebugString() const
-{
- std::ostringstream data;
-
- data << "CalendarAction::"
- << " Action: " << GetAction()
- << " Guid: " << GetPlayer()->GetGUID()
- << " Invite Id: " << GetInviteId()
- << " Extra data: " << GetExtraData()
- << " Event: " << Event.GetDebugString()
- << " Invite: " << Invite.GetDebugString();
-
- return data.str();
-}
diff --git a/src/server/game/Calendar/Calendar.h b/src/server/game/Calendar/Calendar.h
deleted file mode 100755
index a2d2dc2ffb7..00000000000
--- a/src/server/game/Calendar/Calendar.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TRINITY_CALENDAR_H
-#define TRINITY_CALENDAR_H
-
-#include "Errors.h"
-#include "SharedDefines.h"
-#include <map>
-
-class CalendarInvite
-{
- public:
- CalendarInvite() : _inviteId(0) { Init(); }
- explicit CalendarInvite(uint64 inviteId) : _inviteId(inviteId) { Init(); }
-
- ~CalendarInvite() { }
-
- void SetInviteId(uint64 inviteId) { _inviteId = inviteId; }
- uint64 GetInviteId() const { return _inviteId; }
-
- void SetEventId(uint64 eventId) { _eventId = eventId; }
- uint64 GetEventId() const { return _eventId; }
-
- void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
- uint64 GetSenderGUID() const { return _senderGUID; }
-
- void SetInvitee(uint64 guid) { _invitee = guid; }
- uint64 GetInvitee() const { return _invitee; }
-
- void SetStatusTime(uint32 statusTime) { _statusTime = statusTime; }
- uint32 GetStatusTime() const { return _statusTime; }
-
- void SetText(std::string text) { _text = text; }
- std::string GetText() const { return _text; }
-
- void SetStatus(CalendarInviteStatus status) { _status = status; }
- CalendarInviteStatus GetStatus() const { return _status; }
-
- void SetRank(CalendarModerationRank rank) { _rank = rank; }
- CalendarModerationRank GetRank() const { return _rank; }
-
- std::string GetDebugString() const;
-
- private:
- void Init();
-
- uint64 _inviteId;
- uint64 _eventId;
- uint64 _invitee;
- uint64 _senderGUID;
- uint32 _statusTime;
- CalendarInviteStatus _status;
- CalendarModerationRank _rank;
- std::string _text;
-};
-
-typedef std::set<uint64> CalendarInviteIdList;
-
-class CalendarEvent
-{
- public:
- CalendarEvent() : _eventId(0) { Init(); }
- explicit CalendarEvent(uint64 eventId) : _eventId(eventId) { Init(); }
-
- ~CalendarEvent() { }
-
- void SetEventId(uint64 eventId) { _eventId = eventId; }
- uint64 GetEventId() const { return _eventId; }
-
- void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
- uint64 GetCreatorGUID() const { return _creatorGUID; }
-
- void SetGuildId(uint32 guildId) { _guildId = guildId; }
- uint32 GetGuildId() const { return _guildId; }
-
- void SetTitle(std::string title) { _title = title; }
- std::string GetTitle() const { return _title; }
-
- void SetDescription(std::string description) { _description = description; }
- std::string GetDescription() const { return _description; }
-
- void SetType(CalendarEventType type) { _type = type; }
- CalendarEventType GetType() const { return _type; }
-
- void SetMaxInvites(uint32 limit) { _maxInvites = limit; }
- uint32 GetMaxInvites() const { return _maxInvites; }
-
- void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; }
- int32 GetDungeonId() const { return _dungeonId; }
-
- void SetTime(uint32 eventTime) { _eventTime = eventTime; }
- uint32 GetTime() const { return _eventTime; }
-
- void SetFlags(uint32 flags) { _flags = flags; }
- uint32 GetFlags() const { return _flags; }
-
- void SetRepeatable(bool repeatable) { _repeatable = repeatable; }
- bool GetRepeatable() const { return _repeatable; }
-
- void SetTimeZoneTime(uint32 timezoneTime) { _timezoneTime = timezoneTime; }
- uint32 GetTimeZoneTime() const { return _timezoneTime; }
-
- void AddInvite(uint64 inviteId)
- {
- if (inviteId)
- _invites.insert(inviteId);
- }
-
- void RemoveInvite(uint64 inviteId) { _invites.erase(inviteId); }
- bool HasInvite(uint64 inviteId) const { return _invites.find(inviteId) != _invites.end(); }
- CalendarInviteIdList const& GetInviteIdList() const { return _invites; }
- void SetInviteIdList(CalendarInviteIdList const& list) { _invites = list; }
- void ClearInviteIdList() { _invites.clear(); }
-
- std::string GetDebugString() const;
-
- private:
- void Init();
-
- uint64 _eventId;
- uint64 _creatorGUID;
- uint32 _guildId;
- CalendarEventType _type;
- int32 _dungeonId;
- uint32 _maxInvites;
- uint32 _eventTime;
- uint32 _flags;
- bool _repeatable;
- uint32 _timezoneTime;
- std::string _title;
- std::string _description;
- CalendarInviteIdList _invites;
-};
-
-typedef std::set<uint64> CalendarEventIdList;
-typedef std::map<uint64, CalendarInviteIdList> CalendarPlayerInviteIdMap;
-typedef std::map<uint64, CalendarEventIdList> CalendarPlayerEventIdMap;
-typedef std::map<uint64, CalendarInvite> CalendarInviteMap;
-typedef std::map<uint64, CalendarEvent> CalendarEventMap;
-
-class Player;
-
-struct CalendarAction
-{
- CalendarAction(): _action(CALENDAR_ACTION_NONE), _player(NULL), _inviteId(0), _data(0)
- {
- }
-
- void SetAction(CalendarActionData data) { _action = data; }
- CalendarActionData GetAction() const { return _action; }
-
- void SetPlayer(Player* player) { ASSERT(player); _player = player; }
- Player* GetPlayer() const { return _player; }
-
- void SetInviteId(uint64 id) { _inviteId = id; }
- uint64 GetInviteId() const { return _inviteId; }
-
- void SetExtraData(uint32 data) { _data = data; }
- uint32 GetExtraData() const { return _data; }
-
- CalendarEvent Event;
- CalendarInvite Invite;
-
- std::string GetDebugString() const;
-
- private:
- CalendarActionData _action;
- Player* _player;
- uint64 _inviteId;
- uint32 _data;
-};
-
-#endif
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index 62bc0ab3205..9f4816d6c7c 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -15,579 +15,621 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
-
-DROP TABLE IF EXISTS `calendar_events`;
-CREATE TABLE IF NOT EXISTS `calendar_events` (
- `id` int(11) unsigned NOT NULL DEFAULT '0',
- `creator` int(11) unsigned NOT NULL DEFAULT '0',
- `title` varchar(255) NOT NULL DEFAULT '',
- `description` varchar(255) NOT NULL DEFAULT '',
- `type` tinyint(1) unsigned NOT NULL DEFAULT '4',
- `dungeon` tinyint(3) NOT NULL DEFAULT '-1',
- `eventtime` int(10) unsigned NOT NULL DEFAULT '0',
- `flags` int(10) unsigned NOT NULL DEFAULT '0',
- `repeatable` tinyint(1) unsigned NOT NULL DEFAULT '0',
- `time2` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
-);
-
-DROP TABLE IF EXISTS `calendar_invites`;
-CREATE TABLE IF NOT EXISTS `calendar_invites` (
- `id` int(11) unsigned NOT NULL DEFAULT '0',
- `event` int(11) unsigned NOT NULL DEFAULT '0',
- `invitee` int(11) unsigned NOT NULL DEFAULT '0',
- `sender` int(11) unsigned NOT NULL DEFAULT '0',
- `status` tinyint(1) unsigned NOT NULL DEFAULT '0',
- `statustime` int(10) unsigned NOT NULL DEFAULT '0',
- `rank` tinyint(1) unsigned NOT NULL DEFAULT '0',
- `text` varchar(255) NOT NULL DEFAULT '',
- PRIMARY KEY (`id`)
-);
-*/
-
#include "CalendarMgr.h"
#include "QueryResult.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "Player.h"
+#include "GuildMgr.h"
#include "ObjectAccessor.h"
+#include "Opcodes.h"
-CalendarMgr::CalendarMgr() :
- _eventNum(0), _inviteNum(0)
+CalendarInvite::~CalendarInvite()
{
+ sCalendarMgr->FreeInviteId(_inviteId);
}
-CalendarMgr::~CalendarMgr()
+CalendarEvent::~CalendarEvent()
{
+ sCalendarMgr->FreeEventId(_eventId);
}
-uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
+CalendarMgr::CalendarMgr()
{
- if (!guid)
- return 0;
-
- CalendarPlayerInviteIdMap::const_iterator itr = _playerInvites.find(guid);
- if (itr == _playerInvites.end())
- return 0;
-
- uint32 pendingNum = 0;
- for (CalendarInviteIdList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
- if (CalendarInvite* invite = GetInvite(*it))
- if (invite->GetRank() != CALENDAR_RANK_OWNER
- && invite->GetStatus() != CALENDAR_STATUS_CONFIRMED
- && invite->GetStatus() != CALENDAR_STATUS_8
- && invite->GetStatus() != CALENDAR_STATUS_9) // FIXME Check the proper value
- ++pendingNum;
-
- return pendingNum;
}
-CalendarInviteIdList const& CalendarMgr::GetPlayerInvites(uint64 guid)
+CalendarMgr::~CalendarMgr()
{
- return _playerInvites[guid];
}
-CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid)
+void CalendarMgr::LoadFromDB()
{
- return _playerEvents[guid];
-}
+ uint32 count = 0;
+ _maxEventId = 0;
+ _maxInviteId = 0;
-CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
-{
- CalendarInviteMap::iterator itr = _invites.find(inviteId);
- if (itr != _invites.end())
- return &(itr->second);
+ // 0 1 2 3 4 5 6 7 8
+ if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, time2 FROM calendar_events"))
+ do
+ {
+ Field* fields = result->Fetch();
- sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
- return NULL;
-}
+ uint64 eventId = fields[0].GetUInt64();
+ uint64 creatorGUID = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER);
+ std::string title = fields[2].GetString();
+ std::string description = fields[3].GetString();
+ CalendarEventType type = CalendarEventType(fields[4].GetUInt8());
+ int32 dungeonId = fields[5].GetInt32();
+ uint32 eventTime = fields[6].GetUInt32();
+ uint32 flags = fields[7].GetUInt32();
+ uint32 timezoneTime = fields[8].GetUInt32();
+ uint32 guildId = 0;
-CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
-{
- CalendarEventMap::iterator itr = _events.find(eventId);
- if (itr != _events.end())
- return &(itr->second);
+ if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
+ guildId = Player::GetGuildIdFromDB(creatorGUID);
- sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
- return NULL;
-}
+ CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID , guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
+ _events.insert(calendarEvent);
-uint64 CalendarMgr::GetFreeEventId()
-{
- return ++_eventNum;
-}
-uint64 CalendarMgr::GetFreeInviteId()
-{
- return ++_inviteNum;
-}
+ _maxEventId = std::max(_maxEventId, eventId);
-void CalendarMgr::LoadFromDB()
-{
- /*
- uint32 count = 0;
- // 0 1 2 3 4 5 6 7 8 9
- if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, repeatable, time2 FROM calendar_events"))
- do
- {
- Field * fields = result->Fetch();
-
- uint64 eventId = fields[0].GetUInt64();
- CalendarEvent& calendarEvent = _events[eventId];
-
- calendarEvent.SetEventId(eventId);
- calendarEvent.SetCreatorGUID(fields[1].GetUInt64());
- calendarEvent.SetTitle(fields[2].GetString());
- calendarEvent.SetDescription(fields[3].GetString());
- calendarEvent.SetType(fields[4].GetUInt8());
- calendarEvent.SetDungeonId(fields[5].GetInt32());
- calendarEvent.SetTime(fields[6].GetUInt32());
- calendarEvent.SetFlags(fields[7].GetUInt32());
- calendarEvent.SetRepeatable(fields[8].GetBool());
- calendarEvent.SetTimeZoneTime(fields[9].GetUInt32());
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u calendar events", count);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u calendar events", count);
count = 0;
// 0 1 2 3 4 5 6 7
if (QueryResult result = CharacterDatabase.Query("SELECT id, event, invitee, sender, status, statustime, rank, text FROM calendar_invites"))
do
{
- Field * fields = result->Fetch();
+ Field* fields = result->Fetch();
- uint64 inviteId = fields[0].GetUInt64();
- uint64 eventId = fields[1].GetUInt64();
+ uint64 inviteId = fields[0].GetUInt64();
+ uint64 eventId = fields[1].GetUInt64();
+ uint64 invitee = MAKE_NEW_GUID(fields[2].GetUInt32(), 0, HIGHGUID_PLAYER);
+ uint64 senderGUID = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
+ CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8());
+ uint32 statusTime = fields[5].GetUInt32();
+ CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8());
+ std::string text = fields[7].GetString();
- CalendarInvite& invite = _invites[inviteId];
+ CalendarInvite* invite = new CalendarInvite(inviteId, eventId, invitee, senderGUID, time_t(statusTime), status, rank, text);
+ _invites[eventId].push_back(invite);
- invite.SetEventId(eventId);
- invite.SetInvitee(fields[2].GetUInt64());
- invite.SetSenderGUID(fields[3].GetUInt64());
- invite.SetStatus(fields[4].GetUInt8());
- invite.SetStatusTime(fields[5].GetUInt32());
- invite.SetRank(fields[6].GetUInt8());
- invite.SetText(fields[7].GetString());
+ _maxInviteId = std::max(_maxInviteId, inviteId);
- CalendarEvent& calendarEvent = _events[eventId];
- calendarEvent.AddInvite(inviteId);
+ ++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u calendar Invites", count);
- */
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u calendar invites", count);
+
+ for (uint64 i = 1; i < _maxEventId; ++i)
+ if (!GetEvent(i))
+ _freeEventIds.push_back(i);
+
+ for (uint64 i = 1; i < _maxInviteId; ++i)
+ if (!GetInvite(i))
+ _freeInviteIds.push_back(i);
}
-CalendarEvent* CalendarMgr::CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank)
+void CalendarMgr::AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType)
{
- if (!player)
- return NULL; // CALENDAR_ERROR_INTERNAL
+ _events.insert(calendarEvent);
+ UpdateEvent(calendarEvent);
+ SendCalendarEvent(calendarEvent->GetCreatorGUID(), *calendarEvent, sendType);
+}
- CalendarEvent* calendarEvent = GetEvent(eventId);
- if (!calendarEvent)
- {
- player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_EVENT_INVALID);
- return NULL;
- }
+void CalendarMgr::AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite)
+{
+ if (!calendarEvent->IsGuildAnnouncement())
+ SendCalendarEventInvite(*invite);
- CalendarInvite* invite = GetInvite(inviteId);
- if (!invite)
- {
- player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NO_INVITE);
- return NULL;
- }
+ if (!calendarEvent->IsGuildEvent() || invite->GetInviteeGUID() == calendarEvent->GetCreatorGUID())
+ SendCalendarEventInviteAlert(*calendarEvent, *invite);
- if (!calendarEvent->HasInvite(inviteId))
+ if (!calendarEvent->IsGuildAnnouncement())
{
- player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NOT_INVITED);
- return NULL;
+ _invites[invite->GetEventId()].push_back(invite);
+ UpdateInvite(invite);
}
+}
+
+void CalendarMgr::RemoveEvent(uint64 eventId, uint64 remover)
+{
+ CalendarEvent* calendarEvent = GetEvent(eventId);
- if (invite->GetEventId() != calendarEvent->GetEventId() || invite->GetInvitee() != player->GetGUID())
+ if (!calendarEvent)
{
- player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_INTERNAL);
- return NULL;
+ SendCalendarCommandResult(remover, CALENDAR_ERROR_EVENT_INVALID);
+ return;
}
- if (invite->GetRank() < minRank)
+ SendCalendarEventRemovedAlert(*calendarEvent);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ PreparedStatement* stmt;
+ MailDraft mail(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody());
+
+ std::vector<CalendarInvite*>::iterator itr = _invites[eventId].begin();
+ while (itr != _invites[eventId].end())
{
- player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_PERMISSIONS);
- return NULL;
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
+ stmt->setUInt64(0, (*itr)->GetInviteId());
+ trans->Append(stmt);
+
+ // guild events only? check invite status here?
+ // When an event is deleted, all invited (accepted/declined? - verify) guildies are notified via in-game mail. (wowwiki)
+ if (remover && (*itr)->GetInviteeGUID() != remover)
+ mail.SendMailTo(trans, MailReceiver((*itr)->GetInviteeGUID()), calendarEvent, MAIL_CHECK_MASK_COPIED);
+
+ delete *itr;
+ _invites[eventId].erase(itr);
}
- return calendarEvent;
+ _invites.erase(eventId);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_EVENT);
+ stmt->setUInt64(0, eventId);
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
+
+ delete calendarEvent;
+ _events.erase(calendarEvent);
}
-void CalendarMgr::AddAction(CalendarAction const& action)
+void CalendarMgr::RemoveInvite(uint64 inviteId, uint64 eventId, uint64 /*remover*/)
{
- switch (action.GetAction())
- {
- case CALENDAR_ACTION_ADD_EVENT:
- {
- if (AddEvent(action.Event) && AddInvite(action.Invite))
- {
- SendCalendarEventInviteAlert(action.Event, action.Invite);
- SendCalendarEvent(action.Event, CALENDAR_SENDTYPE_ADD);
- }
- break;
- }
- case CALENDAR_ACTION_MODIFY_EVENT:
- {
- uint64 eventId = action.Event.GetEventId();
- CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
- if (!calendarEvent)
- return;
-
- calendarEvent->SetEventId(action.Event.GetEventId());
- calendarEvent->SetType(action.Event.GetType());
- calendarEvent->SetFlags(action.Event.GetFlags());
- calendarEvent->SetTime(action.Event.GetTime());
- calendarEvent->SetTimeZoneTime(action.Event.GetTimeZoneTime());
- calendarEvent->SetRepeatable(action.Event.GetRepeatable());
- calendarEvent->SetDungeonId(action.Event.GetDungeonId());
- calendarEvent->SetTitle(action.Event.GetTitle());
- calendarEvent->SetDescription(action.Event.GetDescription());
- calendarEvent->SetMaxInvites(action.Event.GetMaxInvites());
-
- CalendarInviteIdList const& invites = calendarEvent->GetInviteIdList();
- for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
- if (CalendarInvite* invite = GetInvite(*itr))
- SendCalendarEventUpdateAlert(invite->GetInvitee(), *calendarEvent, CALENDAR_SENDTYPE_ADD);
+ CalendarEvent* calendarEvent = GetEvent(eventId);
- break;
- }
- case CALENDAR_ACTION_COPY_EVENT:
- {
- CalendarEvent* calendarEvent = CheckPermisions(action.Event.GetEventId(), action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER);
-
- if (!calendarEvent)
- return;
-
- uint64 eventId = GetFreeEventId();
- CalendarEvent newEvent(eventId);
- newEvent.SetType(calendarEvent->GetType());
- newEvent.SetFlags(calendarEvent->GetFlags());
- newEvent.SetTime(action.Event.GetTime());
- newEvent.SetTimeZoneTime(calendarEvent->GetTimeZoneTime());
- newEvent.SetRepeatable(calendarEvent->GetRepeatable());
- newEvent.SetDungeonId(calendarEvent->GetDungeonId());
- newEvent.SetTitle(calendarEvent->GetTitle());
- newEvent.SetDescription(calendarEvent->GetDescription());
- newEvent.SetMaxInvites(calendarEvent->GetMaxInvites());
- newEvent.SetCreatorGUID(calendarEvent->GetCreatorGUID());
- newEvent.SetGuildId(calendarEvent->GetGuildId());
-
- CalendarInviteIdList const invites = calendarEvent->GetInviteIdList();
- for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
- {
- if (CalendarInvite* invite = GetInvite(*itr))
- {
- uint64 inviteId = GetFreeInviteId();
- CalendarInvite newInvite(inviteId);
- newInvite.SetEventId(eventId);
- newInvite.SetSenderGUID(action.GetPlayer()->GetGUID());
- newInvite.SetInvitee(invite->GetInvitee());
- newInvite.SetStatus(invite->GetStatus());
- newInvite.SetStatusTime(invite->GetStatusTime());
- newInvite.SetText(invite->GetText());
- newInvite.SetRank(invite->GetRank());
- if (AddInvite(newInvite))
- {
- SendCalendarEventInviteAlert(newEvent, newInvite);
- newEvent.AddInvite(inviteId);
- }
- }
- }
-
- if (AddEvent(newEvent))
- SendCalendarEvent(newEvent, CALENDAR_SENDTYPE_COPY);
+ if (!calendarEvent)
+ return;
+ std::vector<CalendarInvite*>::iterator itr = _invites[eventId].begin();
+ for (; itr != _invites[eventId].end(); ++itr)
+ if ((*itr)->GetInviteId() == inviteId)
break;
- }
- case CALENDAR_ACTION_REMOVE_EVENT:
- {
- uint64 eventId = action.Event.GetEventId();
- //uint32 flags = action.Event.GetFlags();
- // FIXME - Use of Flags here!
- CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER);
- if (!calendarEvent)
- return;
+ if (itr == _invites[eventId].end())
+ return;
- RemoveEvent(eventId);
- break;
- }
- case CALENDAR_ACTION_ADD_EVENT_INVITE:
- {
- uint64 eventId = action.Invite.GetEventId();
- CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
- if (!calendarEvent)
- return;
-
- if (AddInvite(action.Invite))
- {
- calendarEvent->AddInvite(action.Invite.GetInviteId());
- SendCalendarEventInvite(action.Invite, (!(calendarEvent->GetFlags() & CALENDAR_FLAG_INVITES_LOCKED) &&
- !action.Invite.GetStatusTime()));
- SendCalendarEventInviteAlert(*calendarEvent, action.Invite);
- }
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CALENDAR_INVITE);
+ stmt->setUInt64(0, (*itr)->GetInviteId());
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
- break;
- }
- case CALENDAR_ACTION_SIGNUP_TO_EVENT:
- {
- uint64 eventId = action.Event.GetEventId();
- CalendarEvent* calendarEvent = GetEvent(eventId);
- CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
+ if (!calendarEvent->IsGuildEvent())
+ SendCalendarEventInviteRemoveAlert((*itr)->GetInviteeGUID(), *calendarEvent, CALENDAR_STATUS_REMOVED);
- if (!calendarEvent || !(calendarEvent->GetFlags() & CALENDAR_FLAG_GUILD_ONLY)
- || !calendarEvent->GetGuildId() || calendarEvent->GetGuildId() != action.GetExtraData())
- return;
+ SendCalendarEventInviteRemove(*calendarEvent, **itr, calendarEvent->GetFlags());
- CalendarInviteStatus status = action.Invite.GetStatus();
+ // we need to find out how to use CALENDAR_INVITE_REMOVED_MAIL_SUBJECT to force client to display different mail
+ //if ((*itr)->GetInviteeGUID() != remover)
+ // MailDraft(calendarEvent->BuildCalendarMailSubject(remover), calendarEvent->BuildCalendarMailBody())
+ // .SendMailTo(trans, MailReceiver((*itr)->GetInvitee()), calendarEvent, MAIL_CHECK_MASK_COPIED);
- if (status == CALENDAR_STATUS_INVITED)
- status = CALENDAR_STATUS_CONFIRMED;
- else if (status == CALENDAR_STATUS_ACCEPTED)
- status = CALENDAR_STATUS_8;
+ delete *itr;
+ _invites[eventId].erase(itr);
+}
- CalendarInvite newInvite(GetFreeInviteId());
- newInvite.SetStatus(status);
- newInvite.SetStatusTime(uint32(time(NULL)));
- newInvite.SetEventId(eventId);
- newInvite.SetInvitee(action.GetPlayer()->GetGUID());
- newInvite.SetSenderGUID(action.GetPlayer()->GetGUID());
+void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent)
+{
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT);
+ stmt->setUInt64(0, calendarEvent->GetEventId());
+ stmt->setUInt32(1, GUID_LOPART(calendarEvent->GetCreatorGUID()));
+ stmt->setString(2, calendarEvent->GetTitle());
+ stmt->setString(3, calendarEvent->GetDescription());
+ stmt->setUInt8(4, calendarEvent->GetType());
+ stmt->setInt32(5, calendarEvent->GetDungeonId());
+ stmt->setUInt32(6, uint32(calendarEvent->GetEventTime()));
+ stmt->setUInt32(7, calendarEvent->GetFlags());
+ stmt->setUInt32(8, calendarEvent->GetTimeZoneTime()); // correct?
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
+}
- if (AddInvite(newInvite))
- SendCalendarEventInvite(newInvite, false);
+void CalendarMgr::UpdateInvite(CalendarInvite* invite)
+{
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE);
+ stmt->setUInt64(0, invite->GetInviteId());
+ stmt->setUInt64(1, invite->GetEventId());
+ stmt->setUInt32(2, GUID_LOPART(invite->GetInviteeGUID()));
+ stmt->setUInt32(3, GUID_LOPART(invite->GetSenderGUID()));
+ stmt->setUInt8(4, invite->GetStatus());
+ stmt->setUInt32(5, uint32(invite->GetStatusTime()));
+ stmt->setUInt8(6, invite->GetRank());
+ stmt->setString(7, invite->GetText());
+ trans->Append(stmt);
+ CharacterDatabase.CommitTransaction(trans);
+}
- break;
- }
- case CALENDAR_ACTION_MODIFY_EVENT_INVITE:
- {
- uint64 eventId = action.Invite.GetEventId();
- uint64 inviteId = action.Invite.GetInviteId();
+void CalendarMgr::RemoveAllPlayerEventsAndInvites(uint64 guid)
+{
+ for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
+ if ((*itr)->GetCreatorGUID() == guid)
+ RemoveEvent((*itr)->GetEventId(), 0); // don't send mail if removing a character
- CalendarEvent* calendarEvent = NULL;
- if (action.GetInviteId() != action.Invite.GetInviteId())
- calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
- else
- calendarEvent = GetEvent(eventId);
+ std::vector<CalendarInvite*> playerInvites = GetPlayerInvites(guid);
+ for (std::vector<CalendarInvite*>::const_iterator itr = playerInvites.begin(); itr != playerInvites.end(); ++itr)
+ RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
+}
- CalendarInvite* invite = GetInvite(inviteId);
+void CalendarMgr::RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId)
+{
+ for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
+ 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)
+ if (CalendarEvent* calendarEvent = GetEvent((*itr)->GetEventId()))
+ if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == guildId)
+ RemoveInvite((*itr)->GetInviteId(), (*itr)->GetEventId(), guid);
+}
- if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId))
- return;
+CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
+{
+ for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
+ if ((*itr)->GetEventId() == eventId)
+ return *itr;
- invite->SetStatus(action.Invite.GetStatus());
- SendCalendarEventStatus(invite->GetSenderGUID(), *calendarEvent, *invite);
- break;
- }
- case CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE:
- {
- uint64 eventId = action.Invite.GetEventId();
- uint64 inviteId = action.Invite.GetInviteId();
+ sLog->outDebug(LOG_FILTER_CALENDAR, "CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
+ return NULL;
+}
- CalendarEvent* calendarEvent = NULL;
- if (action.GetInviteId() != action.Invite.GetInviteId())
- calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER);
- else
- calendarEvent = GetEvent(eventId);
+CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
+{
+ 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)
+ if ((*itr2)->GetInviteId() == inviteId)
+ return *itr2;
- CalendarInvite* invite = GetInvite(inviteId);
+ sLog->outDebug(LOG_FILTER_CALENDAR, "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
+ return NULL;
+}
- if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId))
- return;
+void CalendarMgr::FreeEventId(uint64 id)
+{
+ if (id == _maxEventId)
+ --_maxEventId;
+ else
+ _freeEventIds.push_back(id);
+}
- invite->SetStatus(action.Invite.GetStatus());
- SendCalendarEventModeratorStatusAlert(*invite);
- break;
- }
- case CALENDAR_ACTION_REMOVE_EVENT_INVITE:
- {
- uint64 eventId = action.Invite.GetEventId();
- uint64 inviteId = action.Invite.GetInviteId();
- CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
- if (!calendarEvent)
- return;
-
- // already checked in CheckPermisions
- CalendarInvite* invite = GetInvite(inviteId);
- if (!invite)
- return;
-
- if (calendarEvent->GetCreatorGUID() == invite->GetInvitee())
- {
- action.GetPlayer()->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_DELETE_CREATOR_FAILED);
- return;
- }
-
- if (uint64 invitee = RemoveInvite(inviteId))
- {
- SendCalendarEventInviteRemoveAlert(invitee, *calendarEvent, CALENDAR_STATUS_9);
- SendCalendarEventInviteRemove(action.GetPlayer()->GetGUID(), action.Invite, calendarEvent->GetFlags());
- }
- break;
- }
- default:
- break;
+uint64 CalendarMgr::GetFreeEventId()
+{
+ if (_freeEventIds.empty())
+ return ++_maxEventId;
+ else
+ {
+ uint64 eventId = _freeEventIds.front();
+ _freeEventIds.pop_front();
+ return eventId;
}
+}
+void CalendarMgr::FreeInviteId(uint64 id)
+{
+ if (id == _maxInviteId)
+ --_maxInviteId;
+ else
+ _freeInviteIds.push_back(id);
}
-bool CalendarMgr::AddEvent(CalendarEvent const& newEvent)
+uint64 CalendarMgr::GetFreeInviteId()
{
- uint64 eventId = newEvent.GetEventId();
- if (_events.find(eventId) != _events.end())
+ if (_freeInviteIds.empty())
+ return ++_maxInviteId;
+ else
{
- sLog->outError("CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId);
- return false;
+ 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)
+ if ((*itr2)->GetInviteeGUID() == guid)
+ events.insert(GetEvent(itr->first));
- _events[eventId] = newEvent;
- return true;
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ for (CalendarEventStore::const_iterator itr = _events.begin(); itr != _events.end(); ++itr)
+ if ((*itr)->GetGuildId() == player->GetGuildId())
+ events.insert(*itr);
+
+ return events;
}
-bool CalendarMgr::RemoveEvent(uint64 eventId)
+std::vector<CalendarInvite*> CalendarMgr::GetEventInvites(uint64 eventId)
{
- CalendarEventMap::iterator itr = _events.find(eventId);
- if (itr == _events.end())
- {
- sLog->outError("CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId);
- return false;
- }
+ return _invites[eventId];
+}
- bool val = true;
+std::vector<CalendarInvite*> CalendarMgr::GetPlayerInvites(uint64 guid)
+{
+ std::vector<CalendarInvite*> invites;
- CalendarInviteIdList const& invites = itr->second.GetInviteIdList();
- for (CalendarInviteIdList::const_iterator itrInvites = invites.begin(); itrInvites != invites.end(); ++itrInvites)
- {
- CalendarInvite* invite = GetInvite(*itrInvites);
- if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId))
- val = false;
+ 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)
+ if ((*itr2)->GetInviteeGUID() == guid)
+ invites.push_back(*itr2);
- if (uint64 invitee = RemoveInvite(*itrInvites))
- SendCalendarEventRemovedAlert(invitee, itr->second);
- }
+ return invites;
+}
+
+uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
+{
+ std::vector<CalendarInvite*> const& invites = GetPlayerInvites(guid);
- _events.erase(itr);
+ 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;
- return val;
+ return pendingNum;
}
-bool CalendarMgr::AddPlayerEvent(uint64 guid, uint64 eventId)
+std::string CalendarEvent::BuildCalendarMailSubject(uint64 remover) const
{
- _playerEvents[guid].insert(eventId);
- return true;
+ std::ostringstream strm;
+ strm << remover << ':' << _title;
+ return strm.str();
}
-bool CalendarMgr::RemovePlayerEvent(uint64 guid, uint64 eventId)
+std::string CalendarEvent::BuildCalendarMailBody() const
{
- _playerEvents[guid].erase(eventId);
- return true;
+ WorldPacket data;
+ uint32 time;
+ std::ostringstream strm;
+
+ // we are supposed to send PackedTime so i used WorldPacket to pack it
+ data.AppendPackedTime(_eventTime);
+ data >> time;
+ strm << time;
+ return strm.str();
}
-bool CalendarMgr::AddInvite(CalendarInvite const& newInvite)
+void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
{
- uint64 inviteId = newInvite.GetInviteId();
- if (!inviteId)
+ CalendarEvent* calendarEvent = GetEvent(invite.GetEventId());
+ time_t statusTime = invite.GetStatusTime();
+ bool hasStatusTime = statusTime != 946684800; // 01/01/2000 00:00:00
+
+ uint64 invitee = invite.GetInviteeGUID();
+ Player* player = ObjectAccessor::FindPlayer(invitee);
+
+ uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
+
+ WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
+ data.appendPackGUID(invitee);
+ data << uint64(invite.GetEventId());
+ data << uint64(invite.GetInviteId());
+ data << uint8(level);
+ data << uint8(invite.GetStatus());
+ data << uint8(hasStatusTime);
+ if (hasStatusTime)
+ data.AppendPackedTime(statusTime);
+ data << uint8(invite.GetSenderGUID() != invite.GetInviteeGUID()); // false only if the invite is sign-up
+
+ if (!calendarEvent) // Pre-invite
{
- sLog->outError("CalendarMgr::AddInvite: Cant add Invite 0");
- return false;
+ if (Player* player = ObjectAccessor::FindPlayer(invite.GetSenderGUID()))
+ player->SendDirectMessage(&data);
}
-
- if (_invites.find(inviteId) != _invites.end())
+ else
{
- sLog->outError("CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId);
- return false;
+ if (calendarEvent->GetCreatorGUID() != invite.GetInviteeGUID()) // correct?
+ SendPacketToAllEventRelatives(data, *calendarEvent);
}
-
- _invites[inviteId] = newInvite;
- uint64 guid = newInvite.GetInvitee();
- bool inviteAdded = AddPlayerInvite(guid, inviteId);
- bool eventAdded = AddPlayerEvent(guid, newInvite.GetEventId());
- return eventAdded && inviteAdded;
}
-uint64 CalendarMgr::RemoveInvite(uint64 inviteId)
+void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime)
{
- CalendarInviteMap::iterator itr = _invites.find(inviteId);
- if (itr == _invites.end())
- {
- sLog->outError("CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId);
- return 0;
- }
-
- uint64 invitee = itr->second.GetInvitee();
- _invites.erase(itr);
-
- return RemovePlayerInvite(invitee, inviteId) ? invitee : 0;
+ WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 +
+ calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
+ data << uint8(1); // unk
+ data << uint64(calendarEvent.GetEventId());
+ data.AppendPackedTime(oldEventTime);
+ data << uint32(calendarEvent.GetFlags());
+ data.AppendPackedTime(calendarEvent.GetEventTime());
+ data << uint8(calendarEvent.GetType());
+ data << int32(calendarEvent.GetDungeonId());
+ data << calendarEvent.GetTitle();
+ data << calendarEvent.GetDescription();
+ data << uint8(CALENDAR_REPEAT_NEVER); // repeatable
+ data << uint32(CALENDAR_MAX_INVITES);
+ data << uint32(0); // unk
+
+ SendPacketToAllEventRelatives(data, calendarEvent);
}
-bool CalendarMgr::AddPlayerInvite(uint64 guid, uint64 inviteId)
+void CalendarMgr::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
- _playerInvites[guid].insert(inviteId);
- return true;
+ WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
+ data.appendPackGUID(invite.GetInviteeGUID());
+ data << uint64(calendarEvent.GetEventId());
+ data.AppendPackedTime(calendarEvent.GetEventTime());
+ data << uint32(calendarEvent.GetFlags());
+ data << uint8(invite.GetStatus());
+ data << uint8(invite.GetRank());
+ data.AppendPackedTime(invite.GetStatusTime());
+
+ SendPacketToAllEventRelatives(data, calendarEvent);
}
-bool CalendarMgr::RemovePlayerInvite(uint64 guid, uint64 inviteId)
+void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent)
{
- _playerInvites[guid].erase(inviteId);
- return true;
+ WorldPacket data(SMSG_CALENDAR_EVENT_REMOVED_ALERT, 1 + 8 + 1);
+ data << uint8(1); // FIXME: If true does not SignalEvent(EVENT_CALENDAR_ACTION_PENDING)
+ data << uint64(calendarEvent.GetEventId());
+ data.AppendPackedTime(calendarEvent.GetEventTime());
+
+ SendPacketToAllEventRelatives(data, calendarEvent);
}
-void CalendarMgr::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type)
+void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags)
{
- if (Player* player = ObjectAccessor::FindPlayer(calendarEvent.GetCreatorGUID()))
- player->GetSession()->SendCalendarEvent(calendarEvent, type);
+ WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
+ data.appendPackGUID(invite.GetInviteeGUID());
+ data << uint64(invite.GetEventId());
+ data << uint32(flags);
+ data << uint8(1); // FIXME
+
+ SendPacketToAllEventRelatives(data, calendarEvent);
}
-void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite, bool pending)
+void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
- if (Player* player = ObjectAccessor::FindPlayer(invite.GetSenderGUID()))
- player->GetSession()->SendCalendarEventInvite(invite, pending);
+ WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1);
+ data.appendPackGUID(invite.GetInviteeGUID());
+ data << uint64(invite.GetEventId());
+ data << uint8(invite.GetRank());
+ data << uint8(1); // Unk boolean - Display to client?
+
+ SendPacketToAllEventRelatives(data, calendarEvent);
}
void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
- if (Player* player = ObjectAccessor::FindPlayer(invite.GetInvitee()))
- player->GetSession()->SendCalendarEventInviteAlert(calendarEvent, invite);
+ WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
+ data << uint64(calendarEvent.GetEventId());
+ data << calendarEvent.GetTitle();
+ data.AppendPackedTime(calendarEvent.GetEventTime());
+ data << uint32(calendarEvent.GetFlags());
+ data << uint32(calendarEvent.GetType());
+ data << int32(calendarEvent.GetDungeonId());
+ data << uint64(invite.GetInviteId());
+ data << uint8(invite.GetStatus());
+ data << uint8(invite.GetRank());
+ data.appendPackGUID(calendarEvent.GetCreatorGUID());
+ data.appendPackGUID(invite.GetSenderGUID());
+
+ if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
+ {
+ if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
+ guild->BroadcastPacket(&data);
+ }
+ else
+ if (Player* player = ObjectAccessor::FindPlayer(invite.GetInviteeGUID()))
+ player->SendDirectMessage(&data);
}
-void CalendarMgr::SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type)
+void CalendarMgr::SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType)
{
- if (Player* player = ObjectAccessor::FindPlayer(guid))
- player->GetSession()->SendCalendarEventUpdateAlert(calendarEvent, type);
-}
+ Player* player = ObjectAccessor::FindPlayer(guid);
+ if (!player)
+ return;
+
+ std::vector<CalendarInvite*> const& eventInviteeList = _invites[calendarEvent.GetEventId()];
+
+ WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
+ data << uint8(sendType);
+ data.appendPackGUID(calendarEvent.GetCreatorGUID());
+ data << uint64(calendarEvent.GetEventId());
+ data << calendarEvent.GetTitle();
+ data << calendarEvent.GetDescription();
+ data << uint8(calendarEvent.GetType());
+ data << uint8(CALENDAR_REPEAT_NEVER); // repeatable
+ data << uint32(CALENDAR_MAX_INVITES);
+ data << int32(calendarEvent.GetDungeonId());
+ data << uint32(calendarEvent.GetFlags());
+ data.AppendPackedTime(calendarEvent.GetEventTime());
+ data.AppendPackedTime(calendarEvent.GetTimeZoneTime());
+ data << uint32(calendarEvent.GetGuildId());
+
+ data << uint32(eventInviteeList.size());
+ for (std::vector<CalendarInvite*>::const_iterator itr = eventInviteeList.begin(); itr != eventInviteeList.end(); ++itr)
+ {
+ CalendarInvite const* calendarInvite = (*itr);
+ uint64 inviteeGuid = calendarInvite->GetInviteeGUID();
+ Player* invitee = ObjectAccessor::FindPlayer(inviteeGuid);
+
+ uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
+ uint32 inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
+
+ data.appendPackGUID(inviteeGuid);
+ data << uint8(inviteeLevel);
+ data << uint8(calendarInvite->GetStatus());
+ data << uint8(calendarInvite->GetRank());
+ data << uint8(calendarEvent.IsGuildEvent() && calendarEvent.GetGuildId() == inviteeGuildId);
+ data << uint64(calendarInvite->GetInviteId());
+ data.AppendPackedTime(calendarInvite->GetStatusTime());
+ data << calendarInvite->GetText();
+ }
-void CalendarMgr::SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite)
-{
- if (Player* player = ObjectAccessor::FindPlayer(guid))
- player->GetSession()->SendCalendarEventStatus(calendarEvent, invite);
+ player->SendDirectMessage(&data);
}
-void CalendarMgr::SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent)
+void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
- player->GetSession()->SendCalendarEventRemovedAlert(calendarEvent);
+ {
+ WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT, 8 + 4 + 4 + 1);
+ data << uint64(calendarEvent.GetEventId());
+ data.AppendPackedTime(calendarEvent.GetEventTime());
+ data << uint32(calendarEvent.GetFlags());
+ data << uint8(status);
+
+ player->SendDirectMessage(&data);
+ }
}
-void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
+void CalendarMgr::SendCalendarClearPendingAction(uint64 guid)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
- player->GetSession()->SendCalendarEventInviteRemoveAlert(calendarEvent, status);
+ {
+ WorldPacket data(SMSG_CALENDAR_CLEAR_PENDING_ACTION, 0);
+ player->SendDirectMessage(&data);
+ }
}
-void CalendarMgr::SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags)
+void CalendarMgr::SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param /*= NULL*/)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
- player->GetSession()->SendCalendarEventInviteRemove(invite, flags);
+ {
+ WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
+ data << uint32(0);
+ data << uint8(0);
+ switch (err)
+ {
+ case CALENDAR_ERROR_OTHER_INVITES_EXCEEDED:
+ case CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S:
+ case CALENDAR_ERROR_IGNORING_YOU_S:
+ data << param;
+ break;
+ default:
+ data << uint8(0);
+ break;
+ }
+
+ data << uint32(err);
+
+ player->SendDirectMessage(&data);
+ }
}
-void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite)
+void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent)
{
- if (Player* player = ObjectAccessor::FindPlayer(invite.GetInvitee()))
- player->GetSession()->SendCalendarEventModeratorStatusAlert(invite);
+ // Send packet to all guild members
+ if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
+ if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
+ 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)
+ 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 a8749778cb3..db6acb667ec 100644
--- a/src/server/game/Calendar/CalendarMgr.h
+++ b/src/server/game/Calendar/CalendarMgr.h
@@ -19,60 +19,311 @@
#define TRINITY_CALENDARMGR_H
#include <ace/Singleton.h>
-#include "Calendar.h"
+#include "Common.h"
+#include "WorldPacket.h"
+
+enum CalendarMailAnswers
+{
+ // else
+ CALENDAR_EVENT_REMOVED_MAIL_SUBJECT = 0,
+ // if ( *(_DWORD *)(a1 + 8292) & 0x100 )
+ CALENDAR_INVITE_REMOVED_MAIL_SUBJECT = 0x100
+};
+
+enum CalendarFlags
+{
+ CALENDAR_FLAG_ALL_ALLOWED = 0x001,
+ CALENDAR_FLAG_INVITES_LOCKED = 0x010,
+ CALENDAR_FLAG_WITHOUT_INVITES = 0x040,
+ CALENDAR_FLAG_GUILD_EVENT = 0x400
+};
+
+enum CalendarModerationRank
+{
+ CALENDAR_RANK_PLAYER = 0,
+ CALENDAR_RANK_MODERATOR = 1,
+ CALENDAR_RANK_OWNER = 2
+};
+
+enum CalendarSendEventType
+{
+ CALENDAR_SENDTYPE_GET = 0,
+ CALENDAR_SENDTYPE_ADD = 1,
+ CALENDAR_SENDTYPE_COPY = 2
+};
+
+enum CalendarEventType
+{
+ CALENDAR_TYPE_RAID = 0,
+ CALENDAR_TYPE_DUNGEON = 1,
+ CALENDAR_TYPE_PVP = 2,
+ CALENDAR_TYPE_MEETING = 3,
+ CALENDAR_TYPE_OTHER = 4
+};
+
+enum CalendarRepeatType
+{
+ CALENDAR_REPEAT_NEVER = 0,
+ CALENDAR_REPEAT_WEEKLY = 1,
+ CALENDAR_REPEAT_BIWEEKLY = 2,
+ CALENDAR_REPEAT_MONTHLY = 3
+};
+
+enum CalendarInviteStatus
+{
+ CALENDAR_STATUS_INVITED = 0,
+ CALENDAR_STATUS_ACCEPTED = 1,
+ CALENDAR_STATUS_DECLINED = 2,
+ CALENDAR_STATUS_CONFIRMED = 3,
+ CALENDAR_STATUS_OUT = 4,
+ CALENDAR_STATUS_STANDBY = 5,
+ CALENDAR_STATUS_SIGNED_UP = 6,
+ CALENDAR_STATUS_NOT_SIGNED_UP = 7,
+ CALENDAR_STATUS_TENTATIVE = 8,
+ CALENDAR_STATUS_REMOVED = 9 // correct name?
+};
+
+enum CalendarError
+{
+ CALENDAR_OK = 0,
+ CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1,
+ CALENDAR_ERROR_EVENTS_EXCEEDED = 2,
+ CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3,
+ CALENDAR_ERROR_OTHER_INVITES_EXCEEDED = 4,
+ CALENDAR_ERROR_PERMISSIONS = 5,
+ CALENDAR_ERROR_EVENT_INVALID = 6,
+ CALENDAR_ERROR_NOT_INVITED = 7,
+ CALENDAR_ERROR_INTERNAL = 8,
+ CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9,
+ CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10,
+ CALENDAR_ERROR_PLAYER_NOT_FOUND = 11,
+ CALENDAR_ERROR_NOT_ALLIED = 12,
+ CALENDAR_ERROR_IGNORING_YOU_S = 13,
+ CALENDAR_ERROR_INVITES_EXCEEDED = 14,
+ CALENDAR_ERROR_INVALID_DATE = 16,
+ CALENDAR_ERROR_INVALID_TIME = 17,
+
+ CALENDAR_ERROR_NEEDS_TITLE = 19,
+ CALENDAR_ERROR_EVENT_PASSED = 20,
+ CALENDAR_ERROR_EVENT_LOCKED = 21,
+ CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22,
+ CALENDAR_ERROR_SYSTEM_DISABLED = 24,
+ CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25,
+ CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26,
+ CALENDAR_ERROR_RESTRICTED_LEVEL = 27,
+ CALENDAR_ERROR_USER_SQUELCHED = 28,
+ CALENDAR_ERROR_NO_INVITE = 29,
+
+ CALENDAR_ERROR_EVENT_WRONG_SERVER = 36,
+ CALENDAR_ERROR_INVITE_WRONG_SERVER = 37,
+ CALENDAR_ERROR_NO_GUILD_INVITES = 38,
+ CALENDAR_ERROR_INVALID_SIGNUP = 39,
+ CALENDAR_ERROR_NO_MODERATOR = 40
+};
+
+#define CALENDAR_MAX_EVENTS 30
+#define CALENDAR_MAX_GUILD_EVENTS 100
+#define CALENDAR_MAX_INVITES 100
+
+struct CalendarInvite
+{
+ public:
+ CalendarInvite(CalendarInvite const& calendarInvite, uint64 inviteId, uint64 eventId)
+ {
+ _inviteId = inviteId;
+ _eventId = eventId;
+ _invitee = calendarInvite.GetInviteeGUID();
+ _senderGUID = calendarInvite.GetSenderGUID();
+ _statusTime = calendarInvite.GetStatusTime();
+ _status = calendarInvite.GetStatus();
+ _rank = calendarInvite.GetRank();
+ _text = calendarInvite.GetText();
+ }
+
+ CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(NULL)),
+ _status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
+
+ CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
+ CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
+ _inviteId(inviteId), _eventId(eventId), _invitee(invitee), _senderGUID(senderGUID), _statusTime(statusTime),
+ _status(status), _rank(rank), _text(text) { }
+
+ ~CalendarInvite();
+
+ void SetInviteId(uint64 inviteId) { _inviteId = inviteId; }
+ uint64 GetInviteId() const { return _inviteId; }
+
+ void SetEventId(uint64 eventId) { _eventId = eventId; }
+ uint64 GetEventId() const { return _eventId; }
+
+ void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
+ uint64 GetSenderGUID() const { return _senderGUID; }
+
+ void SetInvitee(uint64 guid) { _invitee = guid; }
+ uint64 GetInviteeGUID() const { return _invitee; }
+
+ void SetStatusTime(time_t statusTime) { _statusTime = statusTime; }
+ time_t GetStatusTime() const { return _statusTime; }
+
+ void SetText(std::string text) { _text = text; }
+ std::string GetText() const { return _text; }
+
+ void SetStatus(CalendarInviteStatus status) { _status = status; }
+ CalendarInviteStatus GetStatus() const { return _status; }
+
+ void SetRank(CalendarModerationRank rank) { _rank = rank; }
+ CalendarModerationRank GetRank() const { return _rank; }
+
+ private:
+ uint64 _inviteId;
+ uint64 _eventId;
+ uint64 _invitee;
+ uint64 _senderGUID;
+ time_t _statusTime;
+ CalendarInviteStatus _status;
+ CalendarModerationRank _rank;
+ std::string _text;
+};
+
+struct CalendarEvent
+{
+ public:
+ CalendarEvent(CalendarEvent const& calendarEvent, uint64 eventId)
+ {
+ _eventId = eventId;
+ _creatorGUID = calendarEvent.GetCreatorGUID();
+ _guildId = calendarEvent.GetGuildId();
+ _type = calendarEvent.GetType();
+ _dungeonId = calendarEvent.GetDungeonId();
+ _eventTime = calendarEvent.GetEventTime();
+ _flags = calendarEvent.GetFlags();
+ _timezoneTime = calendarEvent.GetTimeZoneTime();
+ _title = calendarEvent.GetTitle();
+ _description = calendarEvent.GetDescription();
+ }
+
+ CalendarEvent(uint64 eventId, uint64 creatorGUID, uint32 guildId, CalendarEventType type, int32 dungeonId,
+ time_t eventTime, uint32 flags, time_t timezoneTime, std::string title, std::string description) :
+ _eventId(eventId), _creatorGUID(creatorGUID), _guildId(guildId), _type(type), _dungeonId(dungeonId),
+ _eventTime(eventTime), _flags(flags), _timezoneTime(timezoneTime), _title(title),
+ _description(description) { }
+
+ CalendarEvent() : _eventId(1), _creatorGUID(0), _guildId(0), _type(CALENDAR_TYPE_OTHER), _dungeonId(-1), _eventTime(0),
+ _flags(0), _timezoneTime(0), _title(""), _description("") { }
+
+ ~CalendarEvent();
+
+ void SetEventId(uint64 eventId) { _eventId = eventId; }
+ uint64 GetEventId() const { return _eventId; }
+
+ void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
+ uint64 GetCreatorGUID() const { return _creatorGUID; }
+
+ void SetGuildId(uint32 guildId) { _guildId = guildId; }
+ uint32 GetGuildId() const { return _guildId; }
+
+ void SetTitle(std::string title) { _title = title; }
+ std::string GetTitle() const { return _title; }
+
+ void SetDescription(std::string description) { _description = description; }
+ std::string GetDescription() const { return _description; }
+
+ void SetType(CalendarEventType type) { _type = type; }
+ CalendarEventType GetType() const { return _type; }
+
+ void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; }
+ int32 GetDungeonId() const { return _dungeonId; }
+
+ void SetEventTime(time_t eventTime) { _eventTime = eventTime; }
+ time_t GetEventTime() const { return _eventTime; }
+
+ void SetFlags(uint32 flags) { _flags = flags; }
+ uint32 GetFlags() const { return _flags; }
+
+ void SetTimeZoneTime(time_t timezoneTime) { _timezoneTime = timezoneTime; }
+ time_t GetTimeZoneTime() const { return _timezoneTime; }
+
+ bool IsGuildEvent() const { return _flags & CALENDAR_FLAG_GUILD_EVENT; }
+ bool IsGuildAnnouncement() const { return _flags & CALENDAR_FLAG_WITHOUT_INVITES; }
+
+ std::string BuildCalendarMailSubject(uint64 remover) const;
+ std::string BuildCalendarMailBody() const;
+
+ private:
+ uint64 _eventId;
+ uint64 _creatorGUID;
+ uint32 _guildId;
+ CalendarEventType _type;
+ int32 _dungeonId;
+ time_t _eventTime;
+ uint32 _flags;
+ time_t _timezoneTime;
+ std::string _title;
+ std::string _description;
+};
+
+typedef std::set<CalendarEvent*> CalendarEventStore;
+typedef std::map<uint64 /* eventId */, std::vector<CalendarInvite*> > CalendarInviteStore;
class CalendarMgr
{
- friend class ACE_Singleton<CalendarMgr, ACE_Null_Mutex>;
+ friend class ACE_Singleton<CalendarMgr, ACE_Null_Mutex>;
+ private:
CalendarMgr();
~CalendarMgr();
+ CalendarEventStore _events;
+ CalendarInviteStore _invites;
+
+ std::deque<uint64> _freeEventIds;
+ std::deque<uint64> _freeInviteIds;
+ uint64 _maxEventId;
+ uint64 _maxInviteId;
+
public:
void LoadFromDB();
- CalendarInvite* GetInvite(uint64 inviteId);
CalendarEvent* GetEvent(uint64 eventId);
+ CalendarEventStore const& GetEvents() const { return _events; }
+ CalendarEventStore GetPlayerEvents(uint64 guid);
- CalendarInviteIdList const& GetPlayerInvites(uint64 guid);
- CalendarEventIdList const& 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);
- uint32 GetPlayerNumPending(uint64 guid);
+ void FreeEventId(uint64 id);
uint64 GetFreeEventId();
+ void FreeInviteId(uint64 id);
uint64 GetFreeInviteId();
- void AddAction(CalendarAction const& action);
-
- void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type);
- void SendCalendarEventInvite(CalendarInvite const& invite, bool pending);
- void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
- void SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags);
- void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
- void SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type);
- void SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite);
- void SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent);
- void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite);
+ uint32 GetPlayerNumPending(uint64 guid);
- private:
- CalendarEvent* CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank);
+ void AddEvent(CalendarEvent* calendarEvent, CalendarSendEventType sendType);
+ void RemoveEvent(uint64 eventId, uint64 remover);
+ void UpdateEvent(CalendarEvent* calendarEvent);
- bool AddEvent(CalendarEvent const& calendarEvent);
- bool RemoveEvent(uint64 eventId);
- bool AddPlayerEvent(uint64 guid, uint64 eventId);
- bool RemovePlayerEvent(uint64 guid, uint64 eventId);
+ void AddInvite(CalendarEvent* calendarEvent, CalendarInvite* invite);
+ void RemoveInvite(uint64 inviteId, uint64 eventId, uint64 remover);
+ void UpdateInvite(CalendarInvite* invite);
- bool AddInvite(CalendarInvite const& invite);
- uint64 RemoveInvite(uint64 inviteId);
- bool AddPlayerInvite(uint64 guid, uint64 inviteId);
- bool RemovePlayerInvite(uint64 guid, uint64 inviteId);
+ void RemoveAllPlayerEventsAndInvites(uint64 guid);
+ void RemovePlayerGuildEventsAndSignups(uint64 guid, uint32 guildId);
- CalendarEventMap _events;
- CalendarInviteMap _invites;
- CalendarPlayerInviteIdMap _playerInvites;
- CalendarPlayerEventIdMap _playerEvents;
+ void SendCalendarEvent(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType sendType);
+ void SendCalendarEventInvite(CalendarInvite const& invite);
+ void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
+ void SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags);
+ void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
+ void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, time_t oldEventTime);
+ void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
+ void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
+ void SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
+ void SendCalendarClearPendingAction(uint64 guid);
+ void SendCalendarCommandResult(uint64 guid, CalendarError err, char const* param = NULL);
- uint64 _eventNum;
- uint64 _inviteNum;
+ void SendPacketToAllEventRelatives(WorldPacket packet, CalendarEvent const& calendarEvent);
};
#define sCalendarMgr ACE_Singleton<CalendarMgr, ACE_Null_Mutex>::instance()
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index 0e89601e987..8ce7d7d2139 100755..100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -23,61 +23,68 @@
#include "World.h"
#include "DatabaseEnv.h"
#include "AccountMgr.h"
-
-Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
- : m_announce(true), m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), m_ownerGUID(0), m_Team(Team)
+#include "Player.h"
+
+Channel::Channel(std::string const& name, uint32 channelId, uint32 team):
+ _announce(true),
+ _ownership(true),
+ _IsSaved(false),
+ _flags(0),
+ _channelId(channelId),
+ _Team(team),
+ _ownerGUID(0),
+ _name(name),
+ _password("")
{
- m_IsSaved = false;
// set special flags if built-in channel
- if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channel_id)) // check whether it's a built-in channel
+ if (ChatChannelsEntry const* ch = sChatChannelsStore.LookupEntry(channelId)) // check whether it's a built-in channel
{
- m_announce = false; // no join/leave announces
- m_ownership = false; // no ownership handout
+ _announce = false; // no join/leave announces
+ _ownership = false; // no ownership handout
- m_flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
+ _flags |= CHANNEL_FLAG_GENERAL; // for all built-in channels
- if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
- m_flags |= CHANNEL_FLAG_TRADE;
+ if (ch->flags & CHANNEL_DBC_FLAG_TRADE) // for trade channel
+ _flags |= CHANNEL_FLAG_TRADE;
- if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
- m_flags |= CHANNEL_FLAG_CITY;
+ if (ch->flags & CHANNEL_DBC_FLAG_CITY_ONLY2) // for city only channels
+ _flags |= CHANNEL_FLAG_CITY;
- if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
- m_flags |= CHANNEL_FLAG_LFG;
+ if (ch->flags & CHANNEL_DBC_FLAG_LFG) // for LFG channel
+ _flags |= CHANNEL_FLAG_LFG;
else // for all other channels
- m_flags |= CHANNEL_FLAG_NOT_LFG;
+ _flags |= CHANNEL_FLAG_NOT_LFG;
}
else // it's custom channel
{
- m_flags |= CHANNEL_FLAG_CUSTOM;
+ _flags |= CHANNEL_FLAG_CUSTOM;
// If storing custom channels in the db is enabled either load or save the channel
if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS))
{
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHANNEL);
stmt->setString(0, name);
- stmt->setUInt32(1, m_Team);
+ stmt->setUInt32(1, _Team);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result) //load
{
Field* fields = result->Fetch();
- m_announce = fields[0].GetBool();
- m_ownership = fields[1].GetBool();
- m_password = fields[2].GetString();
+ _announce = fields[0].GetBool();
+ _ownership = fields[1].GetBool();
+ _password = fields[2].GetString();
const char* db_BannedList = fields[3].GetCString();
if (db_BannedList)
{
- Tokens tokens(db_BannedList, ' ');
- Tokens::iterator iter;
- for (iter = tokens.begin(); iter != tokens.end(); ++iter)
+ Tokenizer tokens(db_BannedList, ' ');
+ for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
{
- uint64 banned_guid = atol(*iter);
+ uint64 banned_guid = atol(*i);
if (banned_guid)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded banned guid:" UI64FMTD "", name.c_str(), banned_guid);
- banned.insert(banned_guid);
+ sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded bannedStore guid:" UI64FMTD "", name.c_str(), banned_guid);
+ bannedStore.insert(banned_guid);
}
}
}
@@ -86,46 +93,45 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
stmt->setString(0, name);
- stmt->setUInt32(1, m_Team);
+ stmt->setUInt32(1, _Team);
CharacterDatabase.Execute(stmt);
sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) saved in database", name.c_str());
}
- m_IsSaved = true;
+ _IsSaved = true;
}
}
}
void Channel::UpdateChannelInDB() const
{
- if (m_IsSaved)
+ if (_IsSaved)
{
std::ostringstream banlist;
- BannedList::const_iterator iter;
- for (iter = banned.begin(); iter != banned.end(); ++iter)
+ BannedContainer::const_iterator iter;
+ for (iter = bannedStore.begin(); iter != bannedStore.end(); ++iter)
banlist << (*iter) << ' ';
std::string banListStr = banlist.str();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
- stmt->setBool(0, m_announce);
- stmt->setBool(1, m_ownership);
- stmt->setString(2, m_password);
+ stmt->setBool(0, _announce);
+ stmt->setBool(1, _ownership);
+ stmt->setString(2, _password);
stmt->setString(3, banListStr);
- stmt->setString(4, m_name);
- stmt->setUInt32(5, m_Team);
+ stmt->setString(4, _name);
+ stmt->setUInt32(5, _Team);
CharacterDatabase.Execute(stmt);
- sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", m_name.c_str());
+ sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str());
}
-
}
void Channel::UpdateChannelUseageInDB() const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
- stmt->setString(0, m_name);
- stmt->setUInt32(1, m_Team);
+ stmt->setString(0, _name);
+ stmt->setUInt32(1, _Team);
CharacterDatabase.Execute(stmt);
}
@@ -141,531 +147,507 @@ void Channel::CleanOldChannelsInDB()
}
}
-void Channel::Join(uint64 p, const char *pass)
+void Channel::JoinChannel(Player* player, std::string const& pass)
{
- WorldPacket data;
- if (IsOn(p))
+ uint64 guid = player->GetGUID();
+ if (IsOn(guid))
{
- if (!IsConstant()) // non send error message for built-in channels
+ // Do not send error message for built-in channels
+ if (!IsConstant())
{
- MakePlayerAlreadyMember(&data, p);
- SendToOne(&data, p);
+ WorldPacket data;
+ MakePlayerAlreadyMember(&data, guid);
+ SendToOne(&data, guid);
}
return;
}
- if (IsBanned(p))
+ if (IsBanned(guid))
{
+ WorldPacket data;
MakeBanned(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- if (m_password.length() > 0 && strcmp(pass, m_password.c_str()))
+ if (!_password.empty() && pass != _password)
{
+ WorldPacket data;
MakeWrongPassword(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- Player* player = ObjectAccessor::FindPlayer(p);
-
- if (player)
+ if (HasFlag(CHANNEL_FLAG_LFG) &&
+ sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) &&
+ AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) &&
+ player->GetGroup())
{
- if (HasFlag(CHANNEL_FLAG_LFG) &&
- sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && player->GetGroup())
- {
- MakeNotInLfg(&data);
- SendToOne(&data, p);
- return;
- }
-
- player->JoinedChannel(this);
+ WorldPacket data;
+ MakeNotInLfg(&data);
+ SendToOne(&data, guid);
+ return;
}
- if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ player->JoinedChannel(this);
+
+ if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
+ !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
- MakeJoined(&data, p);
+ WorldPacket data;
+ MakeJoined(&data, guid);
SendToAll(&data);
}
- data.clear();
-
PlayerInfo pinfo;
- pinfo.player = p;
+ pinfo.player = guid;
pinfo.flags = MEMBER_FLAG_NONE;
- players[p] = pinfo;
+ playersStore[guid] = pinfo;
+ WorldPacket data;
MakeYouJoined(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
- JoinNotify(p);
+ JoinNotify(guid);
// Custom channel handling
if (!IsConstant())
{
// Update last_used timestamp in db
- if (!players.empty())
+ if (!playersStore.empty())
UpdateChannelUseageInDB();
// If the channel has no owner yet and ownership is allowed, set the new owner.
- if (!m_ownerGUID && m_ownership)
+ if (!_ownerGUID && _ownership)
{
- SetOwner(p, (players.size() > 1 ? true : false));
- players[p].SetModerator(true);
+ SetOwner(guid, playersStore.size() > 1);
+ playersStore[guid].SetModerator(true);
}
}
}
-void Channel::Leave(uint64 p, bool send)
+void Channel::LeaveChannel(Player* player, bool send)
{
- if (!IsOn(p))
+ uint64 guid = player->GetGUID();
+ if (!IsOn(guid))
{
if (send)
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
}
+ return;
}
- else
+
+ if (send)
{
- Player* player = ObjectAccessor::FindPlayer(p);
+ WorldPacket data;
+ MakeYouLeft(&data);
+ SendToOne(&data, guid);
+ player->LeftChannel(this);
+ data.clear();
+ }
- if (send)
- {
- WorldPacket data;
- MakeYouLeft(&data);
- SendToOne(&data, p);
- if (player)
- player->LeftChannel(this);
- data.clear();
- }
+ bool changeowner = playersStore[guid].IsOwner();
- bool changeowner = players[p].IsOwner();
+ playersStore.erase(guid);
+ if (_announce && (!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) ||
+ !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
+ {
+ WorldPacket data;
+ MakeLeft(&data, guid);
+ SendToAll(&data);
+ }
- players.erase(p);
- if (m_announce && (!player || !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
- {
- WorldPacket data;
- MakeLeft(&data, p);
- SendToAll(&data);
- }
+ LeaveNotify(guid);
- LeaveNotify(p);
+ if (!IsConstant())
+ {
+ // Update last_used timestamp in db
+ UpdateChannelUseageInDB();
- if (!IsConstant())
+ // If the channel owner left and there are still playersStore inside, pick a new owner
+ if (changeowner && _ownership && !playersStore.empty())
{
- // Update last_used timestamp in db
- UpdateChannelUseageInDB();
-
- // If the channel owner left and there are still players inside, pick a new owner
- if (changeowner && m_ownership && !players.empty())
- {
- uint64 newowner = players.begin()->second.player;
- players[newowner].SetModerator(true);
- SetOwner(newowner);
- }
+ uint64 newowner = playersStore.begin()->second.player;
+ playersStore[newowner].SetModerator(true);
+ SetOwner(newowner);
}
}
}
-void Channel::KickOrBan(uint64 good, const char *badname, bool ban)
+void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
- AccountTypes sec = SEC_PLAYER;
- Player* gplr = ObjectAccessor::FindPlayer(good);
- if (gplr)
- sec = gplr->GetSession()->GetSecurity();
+ AccountTypes sec = player->GetSession()->GetSecurity();
+ uint64 good = player->GetGUID();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
+ return;
}
- else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
+ return;
}
- else
- {
- Player* bad = sObjectAccessor->FindPlayerByName(badname);
- if (bad == NULL || !IsOn(bad->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, badname);
- SendToOne(&data, good);
- }
- else if (!AccountMgr::IsGMAccount(sec) && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID)
- {
- WorldPacket data;
- MakeNotOwner(&data);
- SendToOne(&data, good);
- }
- else
- {
- bool changeowner = (m_ownerGUID == bad->GetGUID());
- WorldPacket data;
- bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
+ Player* bad = sObjectAccessor->FindPlayerByName(badname);
+ uint64 victim = bad ? bad->GetGUID() : 0;
+ if (!victim || !IsOn(victim))
+ {
+ WorldPacket data;
+ MakePlayerNotFound(&data, badname);
+ SendToOne(&data, good);
+ return;
+ }
- if (ban && !IsBanned(bad->GetGUID()))
- {
- banned.insert(bad->GetGUID());
- UpdateChannelInDB();
+ bool changeowner = _ownerGUID == victim;
- if (notify)
- MakePlayerBanned(&data, bad->GetGUID(), good);
- }
- else if (notify)
- MakePlayerKicked(&data, bad->GetGUID(), good);
+ if (!AccountMgr::IsGMAccount(sec) && changeowner && good != _ownerGUID)
+ {
+ WorldPacket data;
+ MakeNotOwner(&data);
+ SendToOne(&data, good);
+ return;
+ }
- if (notify)
- SendToAll(&data);
+ bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
- players.erase(bad->GetGUID());
- bad->LeftChannel(this);
+ if (ban && !IsBanned(victim))
+ {
+ bannedStore.insert(victim);
+ UpdateChannelInDB();
- if (changeowner && m_ownership && !players.empty())
- {
- uint64 newowner = good;
- players[newowner].SetModerator(true);
- SetOwner(newowner);
- }
+ if (notify)
+ {
+ WorldPacket data;
+ MakePlayerBanned(&data, victim, good);
+ SendToAll(&data);
}
}
+ else if (notify)
+ {
+ WorldPacket data;
+ MakePlayerKicked(&data, victim, good);
+ SendToAll(&data);
+ }
+
+ playersStore.erase(victim);
+ bad->LeftChannel(this);
+
+ if (changeowner && _ownership && !playersStore.empty())
+ {
+ uint64 newowner = good;
+ playersStore[newowner].SetModerator(true);
+ SetOwner(newowner);
+ }
}
-void Channel::UnBan(uint64 good, const char *badname)
+void Channel::UnBan(Player const* player, std::string const& badname)
{
- uint32 sec = 0;
- Player* gplr = ObjectAccessor::FindPlayer(good);
- if (gplr)
- sec = gplr->GetSession()->GetSecurity();
+ uint32 sec = player->GetSession()->GetSecurity();
+ uint64 good = player->GetGUID();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
+ return;
}
- else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
+ return;
}
- else
- {
- Player* bad = sObjectAccessor->FindPlayerByName(badname);
- if (bad == NULL || !IsBanned(bad->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, badname);
- SendToOne(&data, good);
- }
- else
- {
- banned.erase(bad->GetGUID());
- WorldPacket data;
- MakePlayerUnbanned(&data, bad->GetGUID(), good);
- SendToAll(&data);
+ Player* bad = sObjectAccessor->FindPlayerByName(badname);
+ uint64 victim = bad ? bad->GetGUID(): 0;
- UpdateChannelInDB();
- }
+ if (!victim || !IsBanned(victim))
+ {
+ WorldPacket data;
+ MakePlayerNotFound(&data, badname);
+ SendToOne(&data, good);
+ return;
}
+
+ bannedStore.erase(victim);
+
+ WorldPacket data;
+ MakePlayerUnbanned(&data, victim, good);
+ SendToAll(&data);
+
+ UpdateChannelInDB();
}
-void Channel::Password(uint64 p, const char *pass)
+void Channel::Password(Player const* player, std::string const& pass)
{
- uint32 sec = 0;
- Player* player = ObjectAccessor::FindPlayer(p);
- if (player)
- sec = player->GetSession()->GetSecurity();
+ uint64 guid = player->GetGUID();
- ChatHandler chat(player);
-
- if (!IsOn(p))
+ ChatHandler chat(player->GetSession());
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()))
{
WorldPacket data;
MakeNotModerator(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- m_password = pass;
- WorldPacket data;
- MakePasswordChanged(&data, p);
- SendToAll(&data);
+ _password = pass;
- UpdateChannelInDB();
- }
+ WorldPacket data;
+ MakePasswordChanged(&data, guid);
+ SendToAll(&data);
+
+ UpdateChannelInDB();
}
-void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set)
+void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bool set)
{
- Player* player = ObjectAccessor::FindPlayer(p);
- if (!player)
- return;
-
+ uint64 guid = player->GetGUID();
uint32 sec = player->GetSession()->GetSecurity();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- Player* newp = sObjectAccessor->FindPlayerByName(p2n);
- if (!newp)
- {
- WorldPacket data;
- MakePlayerNotFound(&data, p2n);
- SendToOne(&data, p);
- return;
- }
- if (p == m_ownerGUID && newp->GetGUID() == m_ownerGUID && mod)
- return;
+ if (guid == _ownerGUID && std::string(p2n) == player->GetName() && mod)
+ return;
- if (!IsOn(newp->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, p2n);
- SendToOne(&data, p);
- return;
- }
+ Player* newp = sObjectAccessor->FindPlayerByName(p2n);
+ uint64 victim = newp ? newp->GetGUID() : 0;
+ if (!victim || !IsOn(victim) ||
// 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
- if ((!AccountMgr::IsGMAccount(player->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) &&
- player->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, p2n);
- SendToOne(&data, p);
- return;
- }
-
- if (m_ownerGUID == newp->GetGUID() && m_ownerGUID != p)
- {
- WorldPacket data;
- MakeNotOwner(&data);
- SendToOne(&data, p);
- return;
- }
+ ((!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);
+ SendToOne(&data, guid);
+ return;
+ }
- if (mod)
- SetModerator(newp->GetGUID(), set);
- else
- SetMute(newp->GetGUID(), set);
+ if (_ownerGUID == victim && _ownerGUID != guid)
+ {
+ WorldPacket data;
+ MakeNotOwner(&data);
+ SendToOne(&data, guid);
+ return;
}
+
+ if (mod)
+ SetModerator(newp->GetGUID(), set);
+ else
+ SetMute(newp->GetGUID(), set);
}
-void Channel::SetOwner(uint64 p, const char *newname)
+void Channel::SetOwner(Player const* player, std::string const& newname)
{
- Player* player = ObjectAccessor::FindPlayer(p);
- if (!player)
- return;
-
+ uint64 guid = player->GetGUID();
uint32 sec = player->GetSession()->GetSecurity();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- if (!AccountMgr::IsGMAccount(sec) && p != m_ownerGUID)
+ if (!AccountMgr::IsGMAccount(sec) && guid != _ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
Player* newp = sObjectAccessor->FindPlayerByName(newname);
- if (newp == NULL || !IsOn(newp->GetGUID()))
- {
- WorldPacket data;
- MakePlayerNotFound(&data, newname);
- SendToOne(&data, p);
- return;
- }
+ uint64 victim = newp ? newp->GetGUID() : 0;
- if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
+ if (!victim || !IsOn(victim) ||
+ (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- players[newp->GetGUID()].SetModerator(true);
- SetOwner(newp->GetGUID());
+ playersStore[victim].SetModerator(true);
+ SetOwner(victim);
}
-void Channel::SendWhoOwner(uint64 p)
+void Channel::SendWhoOwner(uint64 guid)
{
- if (!IsOn(p))
- {
- WorldPacket data;
- MakeNotMember(&data);
- SendToOne(&data, p);
- }
- else
- {
- WorldPacket data;
+ WorldPacket data;
+ if (IsOn(guid))
MakeChannelOwner(&data);
- SendToOne(&data, p);
- }
+ else
+ MakeNotMember(&data);
+ SendToOne(&data, guid);
}
-void Channel::List(Player* player)
+void Channel::List(Player const* player)
{
- uint64 p = player->GetGUID();
+ uint64 guid = player->GetGUID();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+players.size()*(8+1));
- data << uint8(1); // channel type?
- data << GetName(); // channel name
- data << uint8(GetFlags()); // channel flags?
- size_t pos = data.wpos();
- data << uint32(0); // size of list, placeholder
+ sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_LIST %s Channel: %s",
+ player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str());
- uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
+ WorldPacket data(SMSG_CHANNEL_LIST, 1+(GetName().size()+1)+1+4+playersStore.size()*(8+1));
+ data << uint8(1); // channel type?
+ data << GetName(); // channel name
+ data << uint8(GetFlags()); // channel flags?
- uint32 count = 0;
- for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
- {
- Player* member = ObjectAccessor::FindPlayer(i->first);
+ size_t pos = data.wpos();
+ data << uint32(0); // size of list, placeholder
- // 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)) &&
- member->IsVisibleGloballyFor(player))
- {
- data << uint64(i->first);
- data << uint8(i->second.flags); // flags seems to be changed...
- ++count;
- }
- }
+ uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
- data.put<uint32>(pos, count);
+ uint32 count = 0;
+ for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
+ {
+ Player* member = ObjectAccessor::FindPlayer(i->first);
- SendToOne(&data, p);
+ // 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)) &&
+ member->IsVisibleGloballyFor(player))
+ {
+ data << uint64(i->first);
+ data << uint8(i->second.flags); // flags seems to be changed...
+ ++count;
+ }
}
+
+ data.put<uint32>(pos, count);
+
+ SendToOne(&data, guid);
}
-void Channel::Announce(uint64 p)
+void Channel::Announce(Player const* player)
{
- uint32 sec = 0;
- Player* player = ObjectAccessor::FindPlayer(p);
- if (player)
- sec = player->GetSession()->GetSecurity();
+ uint64 guid = player->GetGUID();
+ uint32 sec = player->GetSession()->GetSecurity();
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec))
+
+ if (!playersStore[guid].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else
- {
- m_announce = !m_announce;
- WorldPacket data;
- if (m_announce)
- MakeAnnouncementsOn(&data, p);
- else
- MakeAnnouncementsOff(&data, p);
- SendToAll(&data);
+ _announce = !_announce;
- UpdateChannelInDB();
- }
+ WorldPacket data;
+ if (_announce)
+ MakeAnnouncementsOn(&data, guid);
+ else
+ MakeAnnouncementsOff(&data, guid);
+ SendToAll(&data);
+
+ UpdateChannelInDB();
}
-void Channel::Say(uint64 p, const char *what, uint32 lang)
+void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
{
- if (!what)
+ if (what.empty())
return;
+
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
- Player* player = ObjectAccessor::FindPlayer(p);
-
- if (!IsOn(p))
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
+ return;
}
- else if (players[p].IsMuted())
+
+ if (playersStore[guid].IsMuted())
{
WorldPacket data;
MakeMuted(&data);
- SendToOne(&data, p);
- }
- else
- {
- uint32 messageLength = strlen(what) + 1;
-
- WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+m_name.size()+1+8+4+messageLength+1);
- data << (uint8)CHAT_MSG_CHANNEL;
- data << (uint32)lang;
- data << p; // 2.1.0
- data << uint32(0); // 2.1.0
- data << m_name;
- data << p;
- data << messageLength;
- data << what;
- data << uint8(player ? player->GetChatTag() : 0);
-
- SendToAll(&data, !players[p].IsModerator() ? p : false);
+ SendToOne(&data, guid);
+ return;
}
+
+ WorldPacket data(SMSG_MESSAGECHAT, 1 + 4 + 8 + 4 + _name.size() + 8 + 4 + what.size() + 1);
+ data << uint8(CHAT_MSG_CHANNEL);
+ data << uint32(lang);
+ data << uint64(guid);
+ data << uint32(0);
+ data << _name;
+ data << uint64(guid);
+ data << uint32(what.size() + 1);
+ data << what;
+ Player* player = ObjectAccessor::FindPlayer(guid);
+ data << uint8(player ? player->GetChatTag() : 0);
+
+ SendToAll(&data, !playersStore[guid].IsModerator() ? guid : false);
}
-void Channel::Invite(uint64 p, const char *newname)
+void Channel::Invite(Player const* player, std::string const& newname)
{
- if (!IsOn(p))
+ uint64 guid = player->GetGUID();
+
+ if (!IsOn(guid))
{
WorldPacket data;
MakeNotMember(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
@@ -674,7 +656,7 @@ void Channel::Invite(uint64 p, const char *newname)
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
@@ -682,19 +664,15 @@ void Channel::Invite(uint64 p, const char *newname)
{
WorldPacket data;
MakePlayerInviteBanned(&data, newname);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- Player* player = ObjectAccessor::FindPlayer(p);
- if (!player)
- return;
-
if (newp->GetTeam() != player->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakeInviteWrongFaction(&data);
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
@@ -702,45 +680,47 @@ void Channel::Invite(uint64 p, const char *newname)
{
WorldPacket data;
MakePlayerAlreadyMember(&data, newp->GetGUID());
- SendToOne(&data, p);
+ SendToOne(&data, guid);
return;
}
- WorldPacket data;
- if (!newp->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ if (!newp->GetSocial()->HasIgnore(GUID_LOPART(guid)))
{
- MakeInvite(&data, p);
+ WorldPacket data;
+ MakeInvite(&data, guid);
SendToOne(&data, newp->GetGUID());
data.clear();
}
+
+ WorldPacket data;
MakePlayerInvited(&data, newp->GetName());
- SendToOne(&data, p);
+ SendToOne(&data, guid);
}
void Channel::SetOwner(uint64 guid, bool exclaim)
{
- if (m_ownerGUID)
+ if (_ownerGUID)
{
// [] will re-add player after it possible removed
- PlayerList::iterator p_itr = players.find(m_ownerGUID);
- if (p_itr != players.end())
+ PlayerContainer::iterator p_itr = playersStore.find(_ownerGUID);
+ if (p_itr != playersStore.end())
p_itr->second.SetOwner(false);
}
- m_ownerGUID = guid;
- if (m_ownerGUID)
+ _ownerGUID = guid;
+ if (_ownerGUID)
{
- uint8 oldFlag = GetPlayerFlags(m_ownerGUID);
- players[m_ownerGUID].SetModerator(true);
- players[m_ownerGUID].SetOwner(true);
+ uint8 oldFlag = GetPlayerFlags(_ownerGUID);
+ playersStore[_ownerGUID].SetModerator(true);
+ playersStore[_ownerGUID].SetOwner(true);
WorldPacket data;
- MakeModeChange(&data, m_ownerGUID, oldFlag);
+ MakeModeChange(&data, _ownerGUID, oldFlag);
SendToAll(&data);
if (exclaim)
{
- MakeOwnerChanged(&data, m_ownerGUID);
+ MakeOwnerChanged(&data, _ownerGUID);
SendToAll(&data);
}
@@ -748,36 +728,25 @@ void Channel::SetOwner(uint64 guid, bool exclaim)
}
}
-void Channel::SendToAll(WorldPacket* data, uint64 p)
+void Channel::SendToAll(WorldPacket* data, uint64 guid)
{
- for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
- {
- Player* player = ObjectAccessor::FindPlayer(i->first);
- if (player)
- {
- if (!p || !player->GetSocial()->HasIgnore(GUID_LOPART(p)))
+ for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
+ if (Player* player = ObjectAccessor::FindPlayer(i->first))
+ if (!guid || !player->GetSocial()->HasIgnore(GUID_LOPART(guid)))
player->GetSession()->SendPacket(data);
- }
- }
}
void Channel::SendToAllButOne(WorldPacket* data, uint64 who)
{
- for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
- {
+ for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (i->first != who)
- {
- Player* player = ObjectAccessor::FindPlayer(i->first);
- if (player)
+ if (Player* player = ObjectAccessor::FindPlayer(i->first))
player->GetSession()->SendPacket(data);
- }
- }
}
void Channel::SendToOne(WorldPacket* data, uint64 who)
{
- Player* player = ObjectAccessor::FindPlayer(who);
- if (player)
+ if (Player* player = ObjectAccessor::FindPlayer(who))
player->GetSession()->SendPacket(data);
}
@@ -791,29 +760,25 @@ void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/)
}
-// done
void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type)
{
- data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
+ data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + _name.size());
*data << uint8(notify_type);
- *data << m_name;
+ *data << _name;
}
-// done 0x00
void Channel::MakeJoined(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_JOINED_NOTICE);
*data << uint64(guid);
}
-// done 0x01
void Channel::MakeLeft(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_LEFT_NOTICE);
*data << uint64(guid);
}
-// done 0x02
void Channel::MakeYouJoined(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE);
@@ -822,7 +787,6 @@ void Channel::MakeYouJoined(WorldPacket* data)
*data << uint32(0);
}
-// done 0x03
void Channel::MakeYouLeft(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE);
@@ -830,64 +794,55 @@ void Channel::MakeYouLeft(WorldPacket* data)
*data << uint8(IsConstant());
}
-// done 0x04
void Channel::MakeWrongPassword(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE);
}
-// done 0x05
void Channel::MakeNotMember(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE);
}
-// done 0x06
void Channel::MakeNotModerator(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE);
}
-// done 0x07
void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE);
*data << uint64(guid);
}
-// done 0x08
void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE);
*data << uint64(guid);
}
-// done 0x09
-void Channel::MakePlayerNotFound(WorldPacket* data, const std::string& name)
+void Channel::MakePlayerNotFound(WorldPacket* data, std::string const& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
*data << name;
}
-// done 0x0A
void Channel::MakeNotOwner(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE);
}
-// done 0x0B
void Channel::MakeChannelOwner(WorldPacket* data)
{
std::string name = "";
- if (!sObjectMgr->GetPlayerNameByGUID(m_ownerGUID, name) || name.empty())
+ if (!sObjectMgr->GetPlayerNameByGUID(_ownerGUID, name) || name.empty())
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
- *data << ((IsConstant() || !m_ownerGUID) ? "Nobody" : name);
+ *data << ((IsConstant() || !_ownerGUID) ? "Nobody" : name);
}
-// done 0x0C
void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
{
MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE);
@@ -896,27 +851,23 @@ void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags)
*data << uint8(GetPlayerFlags(guid));
}
-// done 0x0D
void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE);
*data << uint64(guid);
}
-// done 0x0E
void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE);
*data << uint64(guid);
}
-// done 0x11
void Channel::MakeMuted(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_MUTED_NOTICE);
}
-// done 0x12
void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
{
MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE);
@@ -924,13 +875,11 @@ void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good)
*data << uint64(good);
}
-// done 0x13
void Channel::MakeBanned(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_BANNED_NOTICE);
}
-// done 0x14
void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
{
MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE);
@@ -938,7 +887,6 @@ void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good)
*data << uint64(good);
}
-// done 0x15
void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
{
MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE);
@@ -946,91 +894,77 @@ void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good)
*data << uint64(good);
}
-// done 0x16
void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name)
{
MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE);
*data << name;
}
-// done 0x17
void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE);
*data << uint64(guid);
}
-// done 0x18
void Channel::MakeInvite(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_INVITE_NOTICE);
*data << uint64(guid);
}
-// done 0x19
void Channel::MakeInviteWrongFaction(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE);
}
-// done 0x1A
void Channel::MakeWrongFaction(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE);
}
-// done 0x1B
void Channel::MakeInvalidName(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE);
}
-// done 0x1C
void Channel::MakeNotModerated(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE);
}
-// done 0x1D
void Channel::MakePlayerInvited(WorldPacket* data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE);
*data << name;
}
-// done 0x1E
void Channel::MakePlayerInviteBanned(WorldPacket* data, const std::string& name)
{
MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE);
*data << name;
}
-// done 0x1F
void Channel::MakeThrottled(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE);
}
-// done 0x20
void Channel::MakeNotInArea(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE);
}
-// done 0x21
void Channel::MakeNotInLfg(WorldPacket* data)
{
MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE);
}
-// done 0x22
void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE);
*data << uint64(guid);
}
-// done 0x23
void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
{
MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE);
@@ -1039,13 +973,7 @@ void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
void Channel::JoinNotify(uint64 guid)
{
- WorldPacket data;
-
- if (IsConstant())
- data.Initialize(SMSG_USERLIST_ADD, 8+1+1+4+GetName().size()+1);
- else
- data.Initialize(SMSG_USERLIST_UPDATE, 8+1+1+4+GetName().size()+1);
-
+ WorldPacket data(IsConstant() ? SMSG_USERLIST_ADD : SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(guid);
data << uint8(GetPlayerFlags(guid));
data << uint8(GetFlags());
@@ -1060,7 +988,7 @@ void Channel::JoinNotify(uint64 guid)
void Channel::LeaveNotify(uint64 guid)
{
- WorldPacket data(SMSG_USERLIST_REMOVE, 8+1+4+GetName().size()+1);
+ WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
data << uint64(guid);
data << uint8(GetFlags());
data << uint32(GetNumPlayers());
diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h
index 9564dbb381e..b9883144cbc 100755..100644
--- a/src/server/game/Chat/Channels/Channel.h
+++ b/src/server/game/Chat/Channels/Channel.h
@@ -26,9 +26,10 @@
#include "Common.h"
#include "Opcodes.h"
-#include "Player.h"
#include "WorldPacket.h"
+class Player;
+
enum ChatNotify
{
CHAT_JOINED_NOTICE = 0x00, //+ "%s joined channel.";
@@ -52,10 +53,10 @@ enum ChatNotify
// 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 banned from that channel.";
- CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s banned by %s.";
+ CHAT_BANNED_NOTICE = 0x13, //+ "[%s] You are bannedStore from that channel.";
+ CHAT_PLAYER_BANNED_NOTICE = 0x14, //? "[%s] Player %s bannedStore by %s.";
CHAT_PLAYER_UNBANNED_NOTICE = 0x15, //? "[%s] Player %s unbanned by %s.";
- CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not banned.";
+ CHAT_PLAYER_NOT_BANNED_NOTICE = 0x16, //+ "[%s] Player %s is not bannedStore.";
CHAT_PLAYER_ALREADY_MEMBER_NOTICE = 0x17, //+ "[%s] Player %s is already on the channel.";
CHAT_INVITE_NOTICE = 0x18, //+ "%2$s has invited you to join the channel '%1$s'.";
CHAT_INVITE_WRONG_FACTION_NOTICE = 0x19, //+ "Target is in the wrong alliance for %s.";
@@ -63,12 +64,12 @@ enum ChatNotify
CHAT_INVALID_NAME_NOTICE = 0x1B, //+ "Invalid channel name";
CHAT_NOT_MODERATED_NOTICE = 0x1C, //+ "%s is not moderated";
CHAT_PLAYER_INVITED_NOTICE = 0x1D, //+ "[%s] You invited %s to join the channel";
- CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been banned.";
+ CHAT_PLAYER_INVITE_BANNED_NOTICE = 0x1E, //+ "[%s] %s has been bannedStore.";
CHAT_THROTTLED_NOTICE = 0x1F, //+ "[%s] The number of messages that can be sent to this channel is limited, please wait to send another message.";
CHAT_NOT_IN_AREA_NOTICE = 0x20, //+ "[%s] You are not in the correct area for this channel."; -- The user is trying to send a chat to a zone specific channel, and they're not physically in that zone.
CHAT_NOT_IN_LFG_NOTICE = 0x21, //+ "[%s] You must be queued in looking for group before joining this channel."; -- The user must be in the looking for group system to join LFG chat channels.
CHAT_VOICE_ON_NOTICE = 0x22, //+ "[%s] Channel voice enabled by %s.";
- CHAT_VOICE_OFF_NOTICE = 0x23, //+ "[%s] Channel voice disabled by %s.";
+ CHAT_VOICE_OFF_NOTICE = 0x23 //+ "[%s] Channel voice disabled by %s.";
};
enum ChannelFlags
@@ -101,7 +102,7 @@ enum ChannelDBCFlags
CHANNEL_DBC_FLAG_DEFENSE = 0x10000, // LocalDefense, WorldDefense
CHANNEL_DBC_FLAG_GUILD_REQ = 0x20000, // GuildRecruitment
CHANNEL_DBC_FLAG_LFG = 0x40000, // LFG
- CHANNEL_DBC_FLAG_UNK1 = 0x80000, // General
+ CHANNEL_DBC_FLAG_UNK1 = 0x80000 // General
};
enum ChannelMemberFlags
@@ -112,7 +113,7 @@ enum ChannelMemberFlags
MEMBER_FLAG_VOICED = 0x04,
MEMBER_FLAG_MUTED = 0x08,
MEMBER_FLAG_CUSTOM = 0x10,
- MEMBER_FLAG_MIC_MUTED = 0x20,
+ MEMBER_FLAG_MIC_MUTED = 0x20
// 0x40
// 0x80
};
@@ -146,18 +147,45 @@ class Channel
}
};
- typedef std::map<uint64, PlayerInfo> PlayerList;
- PlayerList players;
- typedef std::set<uint64> BannedList;
- BannedList banned;
- bool m_announce;
- bool m_ownership;
- std::string m_name;
- std::string m_password;
- uint8 m_flags;
- uint32 m_channelId;
- uint64 m_ownerGUID;
- bool m_IsSaved;
+ public:
+ Channel(std::string const& name, uint32 channel_id, uint32 Team = 0);
+ std::string const& GetName() const { return _name; }
+ uint32 GetChannelId() const { return _channelId; }
+ bool IsConstant() const { return _channelId != 0; }
+ bool IsAnnounce() const { return _announce; }
+ bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
+ std::string const& GetPassword() const { return _password; }
+ void SetPassword(std::string const& npassword) { _password = npassword; }
+ void SetAnnounce(bool nannounce) { _announce = nannounce; }
+ uint32 GetNumPlayers() const { return playersStore.size(); }
+ uint8 GetFlags() const { return _flags; }
+ bool HasFlag(uint8 flag) const { return _flags & flag; }
+
+ void JoinChannel(Player* player, std::string const& pass);
+ void LeaveChannel(Player* player, bool send = true);
+ void KickOrBan(Player const* player, std::string const& badname, bool ban);
+ void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
+ void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
+ void UnBan(Player const* player, std::string const& badname);
+ void Password(Player const* player, std::string const& pass);
+ void SetMode(Player const* player, std::string const& p2n, bool mod, bool set);
+ void SetOwner(uint64 guid, bool exclaim = true);
+ void SetOwner(Player const* player, std::string const& name);
+ void SendWhoOwner(uint64 guid);
+ void SetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, true); }
+ void UnsetModerator(Player const* player, std::string const& newname) { SetMode(player, newname, true, false); }
+ void SetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, true); }
+ void UnsetMute(Player const* player, std::string const& newname) { SetMode(player, newname, false, false); }
+ void List(Player const* player);
+ void Announce(Player const* player);
+ void Say(uint64 guid, std::string const& what, uint32 lang);
+ void Invite(Player const* player, std::string const& newp);
+ void Voice(uint64 guid1, uint64 guid2);
+ void DeVoice(uint64 guid1, uint64 guid2);
+ void JoinNotify(uint64 guid); // invisible notify
+ void LeaveNotify(uint64 guid); // invisible notify
+ void SetOwnership(bool ownership) { _ownership = ownership; };
+ static void CleanOldChannelsInDB();
private:
// initial packet data (notify type and channel name)
@@ -172,7 +200,7 @@ class Channel
void MakeNotModerator(WorldPacket* data); //? 0x06
void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
- void MakePlayerNotFound(WorldPacket* data, const std::string& name); //+ 0x09
+ void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
void MakeNotOwner(WorldPacket* data); //? 0x0A
void MakeChannelOwner(WorldPacket* data); //? 0x0B
void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
@@ -183,106 +211,77 @@ class Channel
void MakeBanned(WorldPacket* data); //? 0x13
void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
- void MakePlayerNotBanned(WorldPacket* data, const std::string& name); //? 0x16
+ void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
void MakeWrongFaction(WorldPacket* data); //? 0x1A
void MakeInvalidName(WorldPacket* data); //? 0x1B
void MakeNotModerated(WorldPacket* data); //? 0x1C
- void MakePlayerInvited(WorldPacket* data, const std::string& name); //+ 0x1D
- void MakePlayerInviteBanned(WorldPacket* data, const std::string &name);//? 0x1E
+ void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
+ void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22
void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23
- void SendToAll(WorldPacket* data, uint64 p = 0);
+ void SendToAll(WorldPacket* data, uint64 guid = 0);
void SendToAllButOne(WorldPacket* data, uint64 who);
void SendToOne(WorldPacket* data, uint64 who);
- bool IsOn(uint64 who) const { return players.find(who) != players.end(); }
- bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); }
+ bool IsOn(uint64 who) const { return playersStore.find(who) != playersStore.end(); }
+ bool IsBanned(uint64 guid) const { return bannedStore.find(guid) != bannedStore.end(); }
void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const;
- uint8 GetPlayerFlags(uint64 p) const
+ uint8 GetPlayerFlags(uint64 guid) const
{
- PlayerList::const_iterator p_itr = players.find(p);
- if (p_itr == players.end())
- return 0;
-
- return p_itr->second.flags;
+ PlayerContainer::const_iterator itr = playersStore.find(guid);
+ return itr != playersStore.end() ? itr->second.flags : 0;
}
- void SetModerator(uint64 p, bool set)
+ void SetModerator(uint64 guid, bool set)
{
- if (players[p].IsModerator() != set)
+ if (playersStore[guid].IsModerator() != set)
{
- uint8 oldFlag = GetPlayerFlags(p);
- players[p].SetModerator(set);
+ uint8 oldFlag = GetPlayerFlags(guid);
+ playersStore[guid].SetModerator(set);
WorldPacket data;
- MakeModeChange(&data, p, oldFlag);
+ MakeModeChange(&data, guid, oldFlag);
SendToAll(&data);
}
}
- void SetMute(uint64 p, bool set)
+ void SetMute(uint64 guid, bool set)
{
- if (players[p].IsMuted() != set)
+ if (playersStore[guid].IsMuted() != set)
{
- uint8 oldFlag = GetPlayerFlags(p);
- players[p].SetMuted(set);
+ uint8 oldFlag = GetPlayerFlags(guid);
+ playersStore[guid].SetMuted(set);
WorldPacket data;
- MakeModeChange(&data, p, oldFlag);
+ MakeModeChange(&data, guid, oldFlag);
SendToAll(&data);
}
}
- public:
- uint32 m_Team;
- Channel(const std::string& name, uint32 channel_id, uint32 Team = 0);
- std::string GetName() const { return m_name; }
- uint32 GetChannelId() const { return m_channelId; }
- bool IsConstant() const { return m_channelId != 0; }
- bool IsAnnounce() const { return m_announce; }
- bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
- std::string GetPassword() const { return m_password; }
- void SetPassword(const std::string& npassword) { m_password = npassword; }
- void SetAnnounce(bool nannounce) { m_announce = nannounce; }
- uint32 GetNumPlayers() const { return players.size(); }
- uint8 GetFlags() const { return m_flags; }
- bool HasFlag(uint8 flag) const { return m_flags & flag; }
+ typedef std::map<uint64, PlayerInfo> PlayerContainer;
+ typedef std::set<uint64> BannedContainer;
- void Join(uint64 p, const char *pass);
- void Leave(uint64 p, bool send = true);
- void KickOrBan(uint64 good, const char *badname, bool ban);
- void Kick(uint64 good, const char *badname) { KickOrBan(good, badname, false); }
- void Ban(uint64 good, const char *badname) { KickOrBan(good, badname, true); }
- void UnBan(uint64 good, const char *badname);
- void Password(uint64 p, const char *pass);
- void SetMode(uint64 p, const char *p2n, bool mod, bool set);
- void SetOwner(uint64 p, bool exclaim = true);
- void SetOwner(uint64 p, const char *newname);
- void SendWhoOwner(uint64 p);
- void SetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, true); }
- void UnsetModerator(uint64 p, const char *newname) { SetMode(p, newname, true, false); }
- void SetMute(uint64 p, const char *newname) { SetMode(p, newname, false, true); }
- void UnsetMute(uint64 p, const char *newname) { SetMode(p, newname, false, false); }
- void List(Player* p);
- void Announce(uint64 p);
- void Say(uint64 p, const char *what, uint32 lang);
- void Invite(uint64 p, const char *newp);
- void Voice(uint64 guid1, uint64 guid2);
- void DeVoice(uint64 guid1, uint64 guid2);
- void JoinNotify(uint64 guid); // invisible notify
- void LeaveNotify(uint64 guid); // invisible notify
- void SetOwnership(bool ownership) { m_ownership = ownership; };
- static void CleanOldChannelsInDB();
+ bool _announce;
+ bool _ownership;
+ bool _IsSaved;
+ uint8 _flags;
+ uint32 _channelId;
+ uint32 _Team;
+ uint64 _ownerGUID;
+ std::string _name;
+ std::string _password;
+ PlayerContainer playersStore;
+ BannedContainer bannedStore;
};
#endif
diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp
index 75436e1eb5f..acd85f11ed8 100755..100644
--- a/src/server/game/Chat/Channels/ChannelMgr.cpp
+++ b/src/server/game/Chat/Channels/ChannelMgr.cpp
@@ -17,47 +17,50 @@
*/
#include "ChannelMgr.h"
-
+#include "Player.h"
#include "World.h"
-ChannelMgr* channelMgr(uint32 team)
+ChannelMgr::~ChannelMgr()
+{
+ for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
+ delete itr->second;
+
+ channels.clear();
+}
+
+ChannelMgr* ChannelMgr::forTeam(uint32 team)
{
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
if (team == ALLIANCE)
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
+
if (team == HORDE)
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
return NULL;
}
-ChannelMgr::~ChannelMgr()
-{
- for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
- delete itr->second;
-
- channels.clear();
-}
-
-Channel* ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id)
+Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channelId)
{
std::wstring wname;
Utf8toWStr(name, wname);
wstrToLower(wname);
- if (channels.find(wname) == channels.end())
+ ChannelMap::const_iterator i = channels.find(wname);
+
+ if (i == channels.end())
{
- Channel* nchan = new Channel(name, channel_id, team);
+ Channel* nchan = new Channel(name, channelId, team);
channels[wname] = nchan;
return nchan;
}
- return channels[wname];
+ return i->second;
}
-Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt)
+Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pkt)
{
std::wstring wname;
Utf8toWStr(name, wname);
@@ -71,16 +74,16 @@ Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt)
{
WorldPacket data;
MakeNotOnPacket(&data, name);
- p->GetSession()->SendPacket(&data);
+ player->GetSession()->SendPacket(&data);
}
return NULL;
}
- else
- return i->second;
+
+ return i->second;
}
-void ChannelMgr::LeftChannel(std::string name)
+void ChannelMgr::LeftChannel(std::string const& name)
{
std::wstring wname;
Utf8toWStr(name, wname);
@@ -93,15 +96,15 @@ void ChannelMgr::LeftChannel(std::string name)
Channel* channel = i->second;
- if (channel->GetNumPlayers() == 0 && !channel->IsConstant())
+ if (!channel->GetNumPlayers() && !channel->IsConstant())
{
channels.erase(wname);
delete channel;
}
}
-void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string name)
+void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
{
- data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
- (*data) << (uint8)0x05 << name;
+ data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
+ (*data) << uint8(5) << name;
}
diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h
index ac030ffb73f..c1d1793c446 100755..100644
--- a/src/server/game/Chat/Channels/ChannelMgr.h
+++ b/src/server/game/Chat/Channels/ChannelMgr.h
@@ -29,24 +29,29 @@
class ChannelMgr
{
+ typedef std::map<std::wstring, Channel*> ChannelMap;
+
public:
- uint32 team;
- typedef std::map<std::wstring, Channel*> ChannelMap;
- ChannelMgr() {team = 0;}
+ ChannelMgr() : team(0)
+ { }
+
~ChannelMgr();
- Channel* GetJoinChannel(std::string name, uint32 channel_id);
- Channel* GetChannel(std::string name, Player* p, bool pkt = true);
- void LeftChannel(std::string name);
+ static ChannelMgr * forTeam(uint32 team);
+ void setTeam(uint32 newTeam) { team = newTeam; }
+
+ Channel* GetJoinChannel(std::string const& name, uint32 channel_id);
+ Channel* GetChannel(std::string const& name, Player* p, bool pkt = true);
+ void LeftChannel(std::string const& name);
+
private:
ChannelMap channels;
- void MakeNotOnPacket(WorldPacket* data, std::string name);
+ uint32 team;
+
+ void MakeNotOnPacket(WorldPacket* data, std::string const& name);
};
class AllianceChannelMgr : public ChannelMgr {};
class HordeChannelMgr : public ChannelMgr {};
-ChannelMgr* channelMgr(uint32 team);
-
#endif
-
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 110be872b9a..6441bd1bcb6 100755..100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -38,13 +38,6 @@
bool ChatHandler::load_command_table = true;
-// wrapper for old-style handlers
-template<bool (ChatHandler::*F)(const char*)>
-bool OldHandler(ChatHandler* chatHandler, const char* args)
-{
- return (chatHandler->*F)(args);
-}
-
// get number of commands in table
static size_t getCommandTableSize(const ChatCommand* commands)
{
@@ -67,157 +60,10 @@ static size_t appendCommandTable(ChatCommand* target, const ChatCommand* source)
ChatCommand* ChatHandler::getCommandTable()
{
- static ChatCommand channelSetCommandTable[] =
- {
- { "ownership", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChannelSetOwnership>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand channelCommandTable[] =
- {
- { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand groupCommandTable[] =
- {
- { "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL },
- { "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL },
- { "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand petCommandTable[] =
- {
- { "create", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleCreatePetCommand>, "", NULL },
- { "learn", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePetLearnCommand>, "", NULL },
- { "unlearn", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePetUnlearnCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand pdumpCommandTable[] =
- {
- { "load", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpLoadCommand>, "", NULL },
- { "write", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandlePDumpWriteCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand sendCommandTable[] =
- {
- { "items", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendItemsCommand>, "", NULL },
- { "mail", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSendMailCommand>, "", NULL },
- { "message", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendMessageCommand>, "", NULL },
- { "money", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleSendMoneyCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand ticketResponseCommandTable[] =
- {
- { "append", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendCommand>, "", NULL },
- { "appendln", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketResponseAppendLnCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand ticketCommandTable[] =
- {
- { "list", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListCommand>, "", NULL },
- { "onlinelist", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListOnlineCommand>, "", NULL },
- { "viewname", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketGetByNameCommand>, "", NULL },
- { "viewid", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketGetByIdCommand>, "", NULL },
- { "close", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCloseByIdCommand>, "", NULL },
- { "closedlist", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketListClosedCommand>, "", NULL },
- { "escalatedlist", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketListEscalatedCommand>, "", NULL },
- { "delete", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleGMTicketDeleteByIdCommand>, "", NULL },
- { "reset", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleGMTicketResetCommand>, "", NULL },
- { "assign", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketAssignToCommand>, "", NULL },
- { "unassign", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleGMTicketUnAssignCommand>, "", NULL },
- { "comment", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCommentCommand>, "", NULL },
- { "togglesystem", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleToggleGMTicketSystem>, "", NULL },
- { "escalate", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketEscalateCommand>, "", NULL },
- { "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable },
- { "complete", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMTicketCompleteCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand commandTable[] =
- {
- { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
- { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
-
- { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
-
- { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
- { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
-
- { "aura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAuraCommand>, "", NULL },
- { "unaura", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnAuraCommand>, "", NULL },
- { "nameannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleNameAnnounceCommand>, "", NULL },
- { "gmnameannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMNameAnnounceCommand>, "", NULL },
- { "announce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleAnnounceCommand>, "", NULL },
- { "gmannounce", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMAnnounceCommand>, "", NULL },
- { "notify", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleNotifyCommand>, "", NULL },
- { "gmnotify", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleGMNotifyCommand>, "", NULL },
- { "appear", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleAppearCommand>, "", NULL },
- { "summon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleSummonCommand>, "", NULL },
- { "groupsummon", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleGroupSummonCommand>, "", NULL },
- { "commands", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleCommandsCommand>, "", NULL },
- { "die", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDieCommand>, "", NULL },
- { "revive", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleReviveCommand>, "", NULL },
- { "dismount", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleDismountCommand>, "", NULL },
- { "guid", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleGUIDCommand>, "", NULL },
- { "help", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleHelpCommand>, "", NULL },
- { "itemmove", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleItemMoveCommand>, "", NULL },
- { "cooldown", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleCooldownCommand>, "", NULL },
- { "unlearn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnLearnCommand>, "", NULL },
- { "distance", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGetDistanceCommand>, "", NULL },
- { "recall", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleRecallCommand>, "", NULL },
- { "save", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleSaveCommand>, "", NULL },
- { "saveall", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleSaveAllCommand>, "", NULL },
- { "kick", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleKickPlayerCommand>, "", NULL },
- { "start", SEC_PLAYER, false, OldHandler<&ChatHandler::HandleStartCommand>, "", NULL },
- { "taxicheat", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleTaxiCheatCommand>, "", NULL },
- { "linkgrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLinkGraveCommand>, "", NULL },
- { "neargrave", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleNearGraveCommand>, "", NULL },
- { "explorecheat", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleExploreCheatCommand>, "", NULL },
- { "levelup", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleLevelUpCommand>, "", NULL },
- { "showarea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleShowAreaCommand>, "", NULL },
- { "hidearea", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleHideAreaCommand>, "", NULL },
- { "additem", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAddItemCommand>, "", NULL },
- { "additemset", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleAddItemSetCommand>, "", NULL },
- { "bank", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBankCommand>, "", NULL },
- { "wchange", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleChangeWeather>, "", NULL },
- { "maxskill", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMaxSkillCommand>, "", NULL },
- { "setskill", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleSetSkillCommand>, "", NULL },
- { "whispers", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleWhispersCommand>, "", NULL },
- { "pinfo", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandlePInfoCommand>, "", NULL },
- { "respawn", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleRespawnCommand>, "", NULL },
- { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
- { "mute", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleMuteCommand>, "", NULL },
- { "unmute", SEC_MODERATOR, true, OldHandler<&ChatHandler::HandleUnmuteCommand>, "", NULL },
- { "movegens", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleMovegensCommand>, "", NULL },
- { "cometome", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleComeToMeCommand>, "", NULL },
- { "damage", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleDamageCommand>, "", NULL },
- { "combatstop", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleCombatStopCommand>, "", NULL },
- { "flusharenapoints", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleFlushArenaPointsCommand>, "", NULL },
- { "repairitems", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleRepairitemsCommand>, "", NULL },
- { "waterwalk", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandleWaterwalkCommand>, "", NULL },
-
- { "freeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleFreezeCommand>, "", NULL },
- { "unfreeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleUnFreezeCommand>, "", NULL },
- { "listfreeze", SEC_MODERATOR, false, OldHandler<&ChatHandler::HandleListFreezeCommand>, "", NULL },
-
- { "possess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandlePossessCommand>, "", NULL },
- { "unpossess", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnPossessCommand>, "", NULL },
- { "bindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleBindSightCommand>, "", NULL },
- { "unbindsight", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleUnbindSightCommand>, "", NULL },
- { "playall", SEC_GAMEMASTER, false, OldHandler<&ChatHandler::HandlePlayAllCommand>, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
// cache for commands, needed because some commands are loaded dynamically through ScriptMgr
// cache is never freed and will show as a memory leak in diagnostic tools
// can't use vector as vector storage is implementation-dependent, eg, there can be alignment gaps between elements
- static ChatCommand* commandTableCache = 0;
+ static ChatCommand* commandTableCache = NULL;
if (LoadCommandTable())
{
@@ -225,25 +71,23 @@ ChatCommand* ChatHandler::getCommandTable()
{
// count total number of top-level commands
- size_t total = getCommandTableSize(commandTable);
+ size_t total = 0;
std::vector<ChatCommand*> const& dynamic = sScriptMgr->GetChatCommands();
for (std::vector<ChatCommand*>::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it)
total += getCommandTableSize(*it);
total += 1; // ending zero
// cache top-level commands
+ size_t added = 0;
commandTableCache = (ChatCommand*)malloc(sizeof(ChatCommand) * total);
memset(commandTableCache, 0, sizeof(ChatCommand) * total);
ACE_ASSERT(commandTableCache);
- size_t added = appendCommandTable(commandTableCache, commandTable);
for (std::vector<ChatCommand*>::const_iterator it = dynamic.begin(); it != dynamic.end(); ++it)
added += appendCommandTable(commandTableCache + added, *it);
}
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_COMMANDS);
-
PreparedQueryResult result = WorldDatabase.Query(stmt);
-
if (result)
{
do
@@ -252,8 +96,8 @@ ChatCommand* ChatHandler::getCommandTable()
std::string name = fields[0].GetString();
SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt8(), fields[2].GetString(), name);
-
- } while (result->NextRow());
+ }
+ while (result->NextRow());
}
}
@@ -505,8 +349,8 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co
Player* p = m_session->GetPlayer();
uint64 sel_guid = p->GetSelection();
sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected %s: %s (GUID: %u)]",
- fullcmd.c_str(), p->GetName(), m_session->GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(),
- GetLogNameForGuid(sel_guid), (p->GetSelectedUnit()) ? p->GetSelectedUnit()->GetName() : "", GUID_LOPART(sel_guid));
+ fullcmd.c_str(), p->GetName().c_str(), m_session->GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(),
+ GetLogNameForGuid(sel_guid), (p->GetSelectedUnit()) ? p->GetSelectedUnit()->GetName().c_str() : "", GUID_LOPART(sel_guid));
}
}
}
@@ -525,7 +369,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co
return false;
}
-bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand)
+bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, char const* text, uint32 security, std::string const& help, std::string const& fullcommand)
{
std::string cmd = "";
@@ -556,12 +400,12 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text,
// expected subcommand by full name DB content
else if (*text)
{
- sLog->outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
return false;
}
if (table[i].SecurityLevel != security)
- sLog->outDetail("Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security);
table[i].SecurityLevel = security;
table[i].Help = help;
@@ -572,15 +416,15 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text,
if (!cmd.empty())
{
if (table == getCommandTable())
- sLog->outErrorDb("Table `command` have not existed command '%s', skip.", cmd.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Table `command` have not existed command '%s', skip.", cmd.c_str());
else
- sLog->outErrorDb("Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Table `command` have not existed subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
}
return false;
}
-int ChatHandler::ParseCommands(const char* text)
+bool ChatHandler::ParseCommands(char const* text)
{
ASSERT(text);
ASSERT(*text);
@@ -588,23 +432,23 @@ int ChatHandler::ParseCommands(const char* text)
std::string fullcmd = text;
if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS))
- return 0;
+ return false;
/// chat case (.command or !command format)
if (m_session)
{
if (text[0] != '!' && text[0] != '.')
- return 0;
+ return false;
}
/// ignore single . and ! in line
if (strlen(text) < 2)
- return 0;
+ return false;
// original `text` can't be used. It content destroyed in command code processing.
/// ignore messages staring from many dots.
if ((text[0] == '.' && text[1] == '.') || (text[0] == '!' && text[1] == '!'))
- return 0;
+ return false;
/// skip first . or ! (in console allowed use command with . and ! and without its)
if (text[0] == '!' || text[0] == '.')
@@ -613,14 +457,14 @@ int ChatHandler::ParseCommands(const char* text)
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
{
if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
- return 0;
+ return false;
SendSysMessage(LANG_NO_CMD);
}
- return 1;
+ return true;
}
-bool ChatHandler::isValidChatMessage(const char* message)
+bool ChatHandler::isValidChatMessage(char const* message)
{
/*
Valid examples:
@@ -818,7 +662,7 @@ void ChatHandler::FillMessageData(WorldPacket* data, WorldSession* session, uint
{
*data << uint64(speaker->GetGUID());
*data << uint32(0); // 2.1.0
- *data << uint32(strlen(speaker->GetName()) + 1);
+ *data << uint32(speaker->GetName().size() + 1);
*data << speaker->GetName();
uint64 listener_guid = 0;
*data << uint64(listener_guid);
@@ -1175,7 +1019,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text)
if (!normalizePlayerName(name))
return 0;
- if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
+ if (Player* player = sObjectAccessor->FindPlayerByName(name))
return player->GetGUID();
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name))
@@ -1233,7 +1077,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe
return false;
}
- Player* pl = sObjectAccessor->FindPlayerByName(name.c_str());
+ Player* pl = sObjectAccessor->FindPlayerByName(name);
// if allowed player pointer
if (player)
@@ -1324,6 +1168,11 @@ int ChatHandler::GetSessionDbLocaleIndex() const
return m_session->GetSessionDbLocaleIndex();
}
+std::string ChatHandler::GetNameLink(Player* chr) const
+{
+ return playerLink(chr->GetName());
+}
+
const char *CliHandler::GetTrinityString(int32 entry) const
{
return sObjectMgr->GetTrinityStringForDBCLocale(entry);
@@ -1368,7 +1217,7 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player
return false;
}
- player = sObjectAccessor->FindPlayerByName(name.c_str());
+ player = sObjectAccessor->FindPlayerByName(name);
if (offline)
guid = sObjectMgr->GetPlayerGUIDByName(name.c_str());
}
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 47734036071..3b08fd9aa76 100755..100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -20,16 +20,18 @@
#define TRINITYCORE_CHAT_H
#include "SharedDefines.h"
-#include "Player.h"
+#include "WorldSession.h"
#include <vector>
class ChatHandler;
-class WorldSession;
-class WorldObject;
class Creature;
+class Group;
class Player;
class Unit;
+class WorldSession;
+class WorldObject;
+
struct GameTele;
class ChatCommand
@@ -47,8 +49,7 @@ class ChatHandler
{
public:
WorldSession* GetSession() { return m_session; }
- explicit ChatHandler(WorldSession* session) : m_session(session) {}
- explicit ChatHandler(Player* player) : m_session(player->GetSession()) {}
+ explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
virtual ~ChatHandler() {}
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit* speaker);
@@ -74,7 +75,7 @@ class ChatHandler
void PSendSysMessage(int32 entry, ...);
std::string PGetParseString(int32 entry, ...) const;
- int ParseCommands(const char* text);
+ bool ParseCommands(const char* text);
static ChatCommand* getCommandTable();
@@ -115,7 +116,7 @@ class ChatHandler
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL);
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
- std::string GetNameLink(Player* chr) const { return playerLink(chr->GetName()); }
+ std::string GetNameLink(Player* chr) const;
GameObject* GetNearbyGameObject();
GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry);
@@ -123,144 +124,15 @@ class ChatHandler
void SetSentErrorMessage(bool val){ sentErrorMessage = val; }
static bool LoadCommandTable() { return load_command_table; }
static void SetLoadCommandTable(bool val) { load_command_table = val; }
-
- // cs_character
- void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel);
+ bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
protected:
- explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
+ explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
- bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd);
- bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
+ bool ExecuteCommandInTable(ChatCommand* table, const char* text, std::string const& fullcmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
- bool HandleNameAnnounceCommand(const char* args);
- bool HandleGMNameAnnounceCommand(const char* args);
- bool HandleGMAnnounceCommand(const char* args);
- bool HandleGMNotifyCommand(const char* args);
-
- bool HandleChannelSetOwnership(const char *args);
-
- bool HandlePossessCommand(const char* args);
- bool HandleUnPossessCommand(const char* args);
- bool HandleBindSightCommand(const char* args);
- bool HandleUnbindSightCommand(const char* args);
-
- bool HandlePDumpLoadCommand(const char *args);
- bool HandlePDumpWriteCommand(const char *args);
-
- bool HandleSendItemsCommand(const char* args);
- bool HandleSendMailCommand(const char* args);
- bool HandleSendMessageCommand(const char * args);
- bool HandleSendMoneyCommand(const char* args);
-
- bool HandleHelpCommand(const char* args);
- bool HandleCommandsCommand(const char* args);
- bool HandleStartCommand(const char* args);
- bool HandleDismountCommand(const char* args);
- bool HandleSaveCommand(const char* args);
-
- bool HandleSummonCommand(const char* args);
- bool HandleAppearCommand(const char* args);
- bool HandleGroupSummonCommand(const char* args);
- bool HandleRecallCommand(const char* args);
- bool HandleAnnounceCommand(const char* args);
- bool HandleNotifyCommand(const char* args);
- bool HandleTaxiCheatCommand(const char* args);
- bool HandleWhispersCommand(const char* args);
-
- bool HandleGUIDCommand(const char* args);
- bool HandleItemMoveCommand(const char* args);
- bool HandleDeMorphCommand(const char* args);
- bool HandlePInfoCommand(const char* args);
- bool HandleMuteCommand(const char* args);
- bool HandleUnmuteCommand(const char* args);
- bool HandleMovegensCommand(const char* args);
- bool HandleFreezeCommand(const char *args);
- bool HandleUnFreezeCommand(const char *args);
- bool HandleListFreezeCommand(const char* args);
-
- bool HandleCooldownCommand(const char* args);
- bool HandleUnLearnCommand(const char* args);
- bool HandleGetDistanceCommand(const char* args);
- bool HandleDieCommand(const char* args);
- bool HandleDamageCommand(const char *args);
- bool HandleReviveCommand(const char* args);
- bool HandleAuraCommand(const char* args);
- bool HandleUnAuraCommand(const char* args);
- bool HandleLinkGraveCommand(const char* args);
- bool HandleNearGraveCommand(const char* args);
- bool HandleActivateObjectCommand(const char* args);
- bool HandleSpawnTransportCommand(const char* args);
- bool HandleExploreCheatCommand(const char* args);
- bool HandleWaterwalkCommand(const char* args);
- bool HandleLevelUpCommand(const char* args);
- bool HandleShowAreaCommand(const char* args);
- bool HandleHideAreaCommand(const char* args);
- bool HandleAddItemCommand(const char* args);
- bool HandleAddItemSetCommand(const char* args);
- bool HandlePetUnlearnCommand(const char* args);
- bool HandlePetLearnCommand(const char* args);
- bool HandleCreatePetCommand(const char* args);
-
- bool HandleGroupLeaderCommand(const char* args);
- bool HandleGroupDisbandCommand(const char* args);
- bool HandleGroupRemoveCommand(const char* args);
-
- bool HandleBankCommand(const char* args);
- bool HandleChangeWeather(const char* args);
- bool HandleKickPlayerCommand(const char * args);
-
- // GM ticket command handlers
- bool HandleGMTicketListCommand(const char* args);
- bool HandleGMTicketListOnlineCommand(const char* args);
- bool HandleGMTicketListClosedCommand(const char* args);
- bool HandleGMTicketListEscalatedCommand(const char* args);
- bool HandleGMTicketGetByIdCommand(const char* args);
- bool HandleGMTicketGetByNameCommand(const char* args);
- bool HandleGMTicketCloseByIdCommand(const char* args);
- bool HandleGMTicketAssignToCommand(const char* args);
- bool HandleGMTicketUnAssignCommand(const char* args);
- bool HandleGMTicketCommentCommand(const char* args);
- bool HandleGMTicketDeleteByIdCommand(const char* args);
- bool HandleGMTicketResetCommand(const char* /* args */);
- bool HandleGMTicketReloadCommand(const char*);
- bool HandleToggleGMTicketSystem(const char* args);
- bool HandleGMTicketEscalateCommand(const char* args);
- bool HandleGMTicketCompleteCommand(const char* args);
- bool HandleGMTicketResponseAppendCommand(const char* args);
- bool HandleGMTicketResponseAppendLnCommand(const char* args);
-
- bool HandleMaxSkillCommand(const char* args);
- bool HandleSetSkillCommand(const char* args);
- bool HandleRespawnCommand(const char* args);
- bool HandleComeToMeCommand(const char *args);
- bool HandleCombatStopCommand(const char *args);
-
- /*bool HandleCharDeleteCommand(const char *args);
- bool HandleSendMessageCommand(const char * args);*/
-
- bool HandleFlushArenaPointsCommand(const char *args);
- bool HandlePlayAllCommand(const char* args);
- bool HandleRepairitemsCommand(const char* args);
-
- bool HandleTempGameObjectCommand(const char* args);
-
- //! Development Commands
-
- /*bool HandleQuestAdd(const char * args);
- bool HandleQuestRemove(const char * args);
- bool HandleQuestComplete(const char * args);*/
-
- //bool HandleSet32Bit(const char* args);
- bool HandleSaveAllCommand(const char* args);
-
- // Utility methods for commands
- void HandleLearnSkillRecipesHelper(Player* player, uint32 skill_id);
-
private:
- bool _HandleGMTicketResponseAppendCommand(const char* args, bool newLine);
-
WorldSession* m_session; // != NULL for chat command call and NULL for CLI command
// common global flag
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index d26f937c43d..c02df6198f8 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -19,6 +19,8 @@
#include "SpellMgr.h"
#include "ObjectMgr.h"
#include "SpellInfo.h"
+#include "DBCStores.h"
+#include "AchievementMgr.h"
// Supported shift-links (client generated and server side)
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -74,7 +76,7 @@ inline bool CheckDelimiter(std::istringstream& iss, char delimiter, const char*
char c = iss.peek();
if (c != delimiter)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c);
return false;
}
iss.ignore(1);
@@ -108,20 +110,20 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
uint32 itemEntry = 0;
if (!ReadUInt32(iss, itemEntry))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str());
return false;
}
// Validate item
_item = sObjectMgr->GetItemTemplate(itemEntry);
if (!_item)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry);
return false;
}
// Validate item's color
if (_color != ItemQualityColors[_item->Quality])
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color);
return false;
}
// Number of various item properties after item entry
@@ -135,7 +137,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
int32 id = 0;
if (!ReadInt32(iss, id))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index);
return false;
}
if (id && (index == randomPropertyPosition))
@@ -146,7 +148,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
_property = sItemRandomPropertiesStore.LookupEntry(id);
if (!_property)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id);
return false;
}
}
@@ -155,7 +157,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
_suffix = sItemRandomSuffixStore.LookupEntry(-id);
if (!_suffix)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id);
return false;
}
}
@@ -197,7 +199,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
}
}
if (!res)
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId);
return res;
}
@@ -209,14 +211,14 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
uint32 questId = 0;
if (!ReadUInt32(iss, questId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str());
return false;
}
// Validate quest
_quest = sObjectMgr->GetQuestTemplate(questId);
if (!_quest)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId);
return false;
}
// Check delimiter
@@ -225,13 +227,13 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
// Read quest level
if (!ReadInt32(iss, _questLevel))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str());
return false;
}
// Validate quest level
if (_questLevel >= STRONG_MAX_LEVEL)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel);
return false;
}
return true;
@@ -251,7 +253,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context)
break;
}
if (!res)
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId());
return res;
}
@@ -265,14 +267,14 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0;
if (!ReadUInt32(iss, spellId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str());
return false;
}
// Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
return false;
}
return true;
@@ -288,19 +290,19 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(_spell->Id);
if (bounds.first == bounds.second)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id);
return false;
}
SkillLineAbilityEntry const* skillInfo = bounds.first->second;
if (!skillInfo)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id);
return false;
}
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId);
if (!skillLine)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId);
return false;
}
@@ -317,17 +319,12 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
}
}
- bool res = false;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
if (*_spell->SpellName[i] && strcmp(_spell->SpellName[i], buffer) == 0)
- {
- res = true;
- break;
- }
+ return true;
- if (!res)
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
- return res;
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
+ return false;
}
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -340,14 +337,14 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
uint32 achievementId = 0;
if (!ReadUInt32(iss, achievementId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
return false;
}
// Validate achievement
- _achievement = sAchievementStore.LookupEntry(achievementId);
+ _achievement = sAchievementMgr->GetAchievement(achievementId);
if (!_achievement)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId);
return false;
}
// Check delimiter
@@ -356,7 +353,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
// Read HEX
if (!ReadHex(iss, _guid, 0))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str());
return false;
}
// Skip progress
@@ -368,7 +365,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, _data[index]))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index);
return false;
}
}
@@ -379,17 +376,12 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context)
{
ChatLink::ValidateName(buffer, context);
- bool res = false;
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
if (*_achievement->name[i] && strcmp(_achievement->name[i], buffer) == 0)
- {
- res = true;
- break;
- }
+ return true;
- if (!res)
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
- return res;
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
+ return false;
}
// |color|Htrade:spell_id:cur_value:max_value:player_guid:base64_data|h[name]|h|r
@@ -402,14 +394,14 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0;
if (!ReadUInt32(iss, spellId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
return false;
}
// Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
return false;
}
// Check delimiter
@@ -418,7 +410,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Minimum talent level
if (!ReadInt32(iss, _minSkillLevel))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str());
return false;
}
// Check delimiter
@@ -427,7 +419,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Maximum talent level
if (!ReadInt32(iss, _maxSkillLevel))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str());
return false;
}
// Check delimiter
@@ -436,7 +428,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
// Something hexadecimal
if (!ReadHex(iss, _guid, 0))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str());
return false;
}
// Skip base64 encoded stuff
@@ -453,21 +445,21 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
// Read talent entry
if (!ReadUInt32(iss, _talentId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str());
return false;
}
// Validate talent
TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId);
if (!talentInfo)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId);
return false;
}
// Validate talent's spell
_spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]);
if (!_spell)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
return false;
}
// Delimiter
@@ -476,7 +468,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
// Rank
if (!ReadInt32(iss, _rankId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str());
return false;
}
return true;
@@ -492,14 +484,14 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
uint32 spellId = 0;
if (!ReadUInt32(iss, spellId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str());
return false;
}
// Validate spell
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
return false;
}
return true;
@@ -514,7 +506,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
// Slot
if (!ReadUInt32(iss, _slotId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str());
return false;
}
// Check delimiter
@@ -524,21 +516,21 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
uint32 glyphId = 0;
if (!ReadUInt32(iss, glyphId))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str());
return false;
}
// Validate glyph
_glyph = sGlyphPropertiesStore.LookupEntry(glyphId);
if (!_glyph)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId);
return false;
}
// Validate glyph's spell
_spell = sSpellMgr->GetSpellInfo(_glyph->SpellId);
if (!_spell)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
return false;
}
return true;
@@ -576,14 +568,14 @@ bool LinkExtractor::IsValidMessage()
}
else if (_iss.get() != PIPE_CHAR)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str());
return false;
}
// pipe has always to be followed by at least one char
if (_iss.peek() == '\0')
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str());
return false;
}
@@ -606,14 +598,14 @@ bool LinkExtractor::IsValidMessage()
}
else
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar);
return false;
}
}
else if (validSequence != validSequenceIterator)
{
// no escaped pipes in sequences
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str());
return false;
}
@@ -622,7 +614,7 @@ bool LinkExtractor::IsValidMessage()
case 'c':
if (!ReadHex(_iss, color, 8))
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str());
return false;
}
break;
@@ -631,7 +623,7 @@ bool LinkExtractor::IsValidMessage()
_iss.getline(buffer, 256, DELIMITER);
if (_iss.eof())
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
return false;
}
@@ -653,7 +645,7 @@ bool LinkExtractor::IsValidMessage()
link = new GlyphChatLink();
else
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer);
return false;
}
_links.push_back(link);
@@ -668,13 +660,13 @@ bool LinkExtractor::IsValidMessage()
// links start with '['
if (_iss.get() != '[')
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str());
return false;
}
_iss.getline(buffer, 256, ']');
if (_iss.eof())
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
return false;
}
@@ -692,7 +684,7 @@ bool LinkExtractor::IsValidMessage()
// no further payload
break;
default:
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar);
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar);
return false;
}
}
@@ -700,7 +692,7 @@ bool LinkExtractor::IsValidMessage()
// check if every opened sequence was also closed properly
if (validSequence != validSequenceIterator)
{
- sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str());
+ sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str());
return false;
}
diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp
deleted file mode 100755
index b05ba9b4194..00000000000
--- a/src/server/game/Chat/Commands/Level0.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "World.h"
-#include "Player.h"
-#include "Chat.h"
-#include "ObjectAccessor.h"
-#include "Language.h"
-#include "AccountMgr.h"
-#include "SystemConfig.h"
-#include "revision.h"
-#include "Util.h"
-
-bool ChatHandler::HandleHelpCommand(const char* args)
-{
- char* cmd = strtok((char*)args, " ");
- if (!cmd)
- {
- ShowHelpForCommand(getCommandTable(), "help");
- ShowHelpForCommand(getCommandTable(), "");
- }
- else
- {
- if (!ShowHelpForCommand(getCommandTable(), cmd))
- SendSysMessage(LANG_NO_HELP_CMD);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
-{
- ShowHelpForCommand(getCommandTable(), "");
- return true;
-}
-
-bool ChatHandler::HandleStartCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- if (player->isInFlight())
- {
- SendSysMessage(LANG_YOU_IN_FLIGHT);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isInCombat())
- {
- SendSysMessage(LANG_YOU_IN_COMBAT);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
- {
- // if player is dead and stuck, send ghost to graveyard
- player->RepopAtGraveyard();
- return true;
- }
-
- // cast spell Stuck
- player->CastSpell(player, 7355, false);
- return true;
-}
-
-bool ChatHandler::HandleDismountCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- //If player is not mounted, so go out :)
- if (!player->IsMounted())
- {
- SendSysMessage(LANG_CHAR_NON_MOUNTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->isInFlight())
- {
- SendSysMessage(LANG_YOU_IN_FLIGHT);
- SetSentErrorMessage(true);
- return false;
- }
-
- player->Dismount();
- player->RemoveAurasByType(SPELL_AURA_MOUNTED);
- return true;
-}
-
-bool ChatHandler::HandleSaveCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- // save GM account without delay and output message
- if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()))
- {
- if (Player* target = getSelectedPlayer())
- target->SaveToDB();
- else
- player->SaveToDB();
- SendSysMessage(LANG_PLAYER_SAVED);
- return true;
- }
-
- // save if the player has last been saved over 20 seconds ago
- uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
- if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
- player->SaveToDB();
-
- return true;
-}
-
diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp
deleted file mode 100755
index 1cf3d5c9b4e..00000000000
--- a/src/server/game/Chat/Commands/Level1.cpp
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "TicketMgr.h"
-#include "Player.h"
-#include "AccountMgr.h"
-#include "Opcodes.h"
-#include "Chat.h"
-#include "Log.h"
-#include "MapManager.h"
-#include "ObjectAccessor.h"
-#include "Language.h"
-#include "CellImpl.h"
-#include "InstanceSaveMgr.h"
-#include "Util.h"
-#include "Group.h"
-
-#ifdef _DEBUG_VMAPS
-#include "VMapFactory.h"
-#endif
-
-bool ChatHandler::HandleNameAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string name("Console");
- if (WorldSession* session = GetSession())
- name = session->GetPlayer()->GetName();
-
- sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args);
- return true;
-}
-
-bool ChatHandler::HandleGMNameAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string name("Console");
- if (WorldSession* session = GetSession())
- name = session->GetPlayer()->GetName();
-
- sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args);
- return true;
-}
-
-// global announce
-bool ChatHandler::HandleAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char buff[2048];
- sprintf(buff, GetTrinityString(LANG_SYSTEMMESSAGE), args);
- sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
- return true;
-}
-
-// announce to logged in GMs
-bool ChatHandler::HandleGMAnnounceCommand(const char* args)
-{
- if (!*args)
- return false;
-
- sWorld->SendGMText(LANG_GM_BROADCAST, args);
- return true;
-}
-
-//notification player at the screen
-bool ChatHandler::HandleNotifyCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string str = GetTrinityString(LANG_GLOBAL_NOTIFY);
- str += args;
-
- WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
- data << str;
- sWorld->SendGlobalMessage(&data);
-
- return true;
-}
-
-//notification GM at the screen
-bool ChatHandler::HandleGMNotifyCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string str = GetTrinityString(LANG_GM_NOTIFY);
- str += args;
-
- WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
- data << str;
- sWorld->SendGlobalGMMessage(&data);
-
- return true;
-}
-
-//Summon Player
-bool ChatHandler::HandleSummonCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- Player* _player = m_session->GetPlayer();
- if (target == _player || target_guid == _player->GetGUID())
- {
- PSendSysMessage(LANG_CANT_TELEPORT_SELF);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- std::string nameLink = playerLink(target_name);
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- if (target->IsBeingTeleported())
- {
- PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- Map* map = m_session->GetPlayer()->GetMap();
-
- if (map->IsBattlegroundOrArena())
- {
- // only allow if gm mode is on
- if (!_player->isGameMaster())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- // if both players are in different bgs
- else if (target->GetBattlegroundId() && m_session->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
- target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
-
- // all's well, set bg id
- // when porting out from the bg, it will be reset to 0
- target->SetBattlegroundId(m_session->GetPlayer()->GetBattlegroundId(), m_session->GetPlayer()->GetBattlegroundTypeId());
- // remember current position as entry point for return at bg end teleportation
- if (!target->GetMap()->IsBattlegroundOrArena())
- target->SetBattlegroundEntryPoint();
- }
- else if (map->IsDungeon())
- {
- Map* cMap = target->GetMap();
-
- if (cMap->Instanceable() && cMap->GetInstanceId() != map->GetInstanceId())
- target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
-
- // we are in instance, and can summon only player in our group with us as lead
- if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() ||
- (target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
- (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))
- // the last check is a bit excessive, but let it be, just in case
- {
- PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
- if (needReportToTarget(target))
- ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, playerLink(_player->GetName()).c_str());
-
- // stop flight if need
- if (target->isInFlight())
- {
- target->GetMotionMaster()->MovementExpired();
- target->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- target->SaveRecallPosition();
-
- // before GM
- float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
- target->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
- target->SetPhaseMask(m_session->GetPlayer()->GetPhaseMask(), true);
- }
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, target_guid))
- return false;
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), GetTrinityString(LANG_OFFLINE));
-
- // in point where GM stay
- Player::SavePositionInDB(m_session->GetPlayer()->GetMapId(),
- m_session->GetPlayer()->GetPositionX(),
- m_session->GetPlayer()->GetPositionY(),
- m_session->GetPlayer()->GetPositionZ(),
- m_session->GetPlayer()->GetOrientation(),
- m_session->GetPlayer()->GetZoneId(),
- target_guid);
- }
-
- return true;
-}
-
-//Teleport to Player
-bool ChatHandler::HandleAppearCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- Player* _player = m_session->GetPlayer();
- if (target == _player || target_guid == _player->GetGUID())
- {
- SendSysMessage(LANG_CANT_TELEPORT_SELF);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target)
- {
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- std::string chrNameLink = playerLink(target_name);
-
- Map* cMap = target->GetMap();
- if (cMap->IsBattlegroundOrArena())
- {
- // only allow if gm mode is on
- if (!_player->isGameMaster())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- // if both players are in different bgs
- else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
- _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
-
- // all's well, set bg id
- // when porting out from the bg, it will be reset to 0
- _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
- // remember current position as entry point for return at bg end teleportation
- if (!_player->GetMap()->IsBattlegroundOrArena())
- _player->SetBattlegroundEntryPoint();
- }
- else if (cMap->IsDungeon())
- {
- // we have to go to instance, and can go to player only if:
- // 1) we are in his group (either as leader or as member)
- // 2) we are not bound to any group and have GM mode on
- if (_player->GetGroup())
- {
- // we are in group, we can go only if we are in the player group
- if (_player->GetGroup() != target->GetGroup())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- // we are not in group, let's verify our GM mode
- if (!_player->isGameMaster())
- {
- PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- // if the player or the player's group is bound to another instance
- // the player will not be bound to another one
- InstancePlayerBind* pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid()));
- if (!pBind)
- {
- Group* group = _player->GetGroup();
- // if no bind exists, create a solo bind
- InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
- if (!gBind)
- if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
- _player->BindToInstance(save, !save->CanReset());
- }
-
- if (cMap->IsRaid())
- _player->SetRaidDifficulty(target->GetRaidDifficulty());
- else
- _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
- }
-
- PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
-
- // stop flight if need
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- // to point to see at target with same orientation
- float x, y, z;
- target->GetContactPoint(_player, x, y, z);
-
- _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
- _player->SetPhaseMask(target->GetPhaseMask(), true);
- }
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, target_guid))
- return false;
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
-
- // to point where player stay (if loaded)
- float x, y, z, o;
- uint32 map;
- bool in_flight;
- if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, target_guid))
- return false;
-
- // stop flight if need
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- _player->SaveRecallPosition();
-
- _player->TeleportTo(map, x, y, z, _player->GetOrientation());
- }
-
- return true;
-}
-
-// Teleport player to last position
-bool ChatHandler::HandleRecallCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- if (target->IsBeingTeleported())
- {
- PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(target).c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- // stop flight if need
- if (target->isInFlight())
- {
- target->GetMotionMaster()->MovementExpired();
- target->CleanupAfterTaxiFlight();
- }
-
- target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
- return true;
-}
-
-//Enable On\OFF all taxi paths
-bool ChatHandler::HandleTaxiCheatCommand(const char* args)
-{
- if (!*args)
- {
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string argstr = (char*)args;
-
- Player* chr = getSelectedPlayer();
-
- if (!chr)
- chr = m_session->GetPlayer();
- else if (HasLowerSecurity(chr, 0)) // check online security
- return false;
-
- if (argstr == "on")
- {
- chr->SetTaxiCheater(true);
- PSendSysMessage(LANG_YOU_GIVE_TAXIS, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetNameLink().c_str());
- return true;
- }
-
- if (argstr == "off")
- {
- chr->SetTaxiCheater(false);
- PSendSysMessage(LANG_YOU_REMOVE_TAXIS, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetNameLink().c_str());
-
- return true;
- }
-
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
-}
-
-//Enable\Dissable accept whispers (for GM)
-bool ChatHandler::HandleWhispersCommand(const char* args)
-{
- if (!*args)
- {
- PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, m_session->GetPlayer()->isAcceptWhispers() ? GetTrinityString(LANG_ON) : GetTrinityString(LANG_OFF));
- return true;
- }
-
- std::string argstr = (char*)args;
- // whisper on
- if (argstr == "on")
- {
- m_session->GetPlayer()->SetAcceptWhispers(true);
- SendSysMessage(LANG_COMMAND_WHISPERON);
- return true;
- }
-
- // whisper off
- if (argstr == "off")
- {
- // Remove all players from the Gamemaster's whisper whitelist
- m_session->GetPlayer()->ClearWhisperWhiteList();
- m_session->GetPlayer()->SetAcceptWhispers(false);
- SendSysMessage(LANG_COMMAND_WHISPEROFF);
- return true;
- }
-
- SendSysMessage(LANG_USE_BOL);
- SetSentErrorMessage(true);
- return false;
-}
-
-//Save all players in the world
-bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
-{
- sObjectAccessor->SaveAllPlayers();
- SendSysMessage(LANG_PLAYERS_SAVED);
- return true;
-}
-
-//Send mail by command
-bool ChatHandler::HandleSendMailCommand(const char* args)
-{
- // format: name "subject text" "mail text"
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- //- TODO: Fix poor design
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
- MailDraft(subject, text)
- .SendMailTo(trans, MailReceiver(target, GUID_LOPART(target_guid)), sender);
-
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = playerLink(target_name);
- PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
-}
-
-//Summon group of player
-bool ChatHandler::HandleGroupSummonCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- Group* grp = target->GetGroup();
-
- std::string nameLink = GetNameLink(target);
-
- if (!grp)
- {
- PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- Map* gmMap = m_session->GetPlayer()->GetMap();
- bool to_instance = gmMap->Instanceable();
-
- // we are in instance, and can summon only player in our group with us as lead
- if (to_instance && (
- !m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
- (m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID())))
- // the last check is a bit excessive, but let it be, just in case
- {
- SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
- SetSentErrorMessage(true);
- return false;
- }
-
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* player = itr->getSource();
-
- if (!player || player == m_session->GetPlayer() || !player->GetSession())
- continue;
-
- // check online security
- if (HasLowerSecurity(player, 0))
- return false;
-
- std::string plNameLink = GetNameLink(player);
-
- if (player->IsBeingTeleported() == true)
- {
- PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- if (to_instance)
- {
- Map* plMap = player->GetMap();
-
- if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
- {
- // cannot summon from instance to instance
- PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
- if (needReportToTarget(player))
- ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
-
- // stop flight if need
- if (player->isInFlight())
- {
- player->GetMotionMaster()->MovementExpired();
- player->CleanupAfterTaxiFlight();
- }
- // save only in non-flight case
- else
- player->SaveRecallPosition();
-
- // before GM
- float x, y, z;
- m_session->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
- player->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
- }
-
- return true;
-}
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
deleted file mode 100755
index a44ee515c02..00000000000
--- a/src/server/game/Chat/Commands/Level2.cpp
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "DBCStores.h"
-#include "ObjectMgr.h"
-#include "Player.h"
-#include "Item.h"
-#include "GameObject.h"
-#include "Opcodes.h"
-#include "Chat.h"
-#include "MapManager.h"
-#include "Language.h"
-#include "World.h"
-#include "GameEventMgr.h"
-#include "SpellMgr.h"
-#include "PoolMgr.h"
-#include "AccountMgr.h"
-#include "WaypointManager.h"
-#include "Util.h"
-#include <cctype>
-#include <iostream>
-#include <fstream>
-#include <map>
-#include "OutdoorPvPMgr.h"
-#include "Transport.h"
-#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
-#include "CreatureGroups.h"
-#include "ace/INET_Addr.h"
-
-//mute player for some times
-bool ChatHandler::HandleMuteCommand(const char* args)
-{
- char* nameStr;
- char* delayStr;
- extractOptFirstArg((char*)args, &nameStr, &delayStr);
- if (!delayStr)
- return false;
-
- char *mutereason = strtok(NULL, "\r");
- std::string mutereasonstr = "No reason";
- if (mutereason != NULL)
- mutereasonstr = mutereason;
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid);
-
- // find only player from same account if any
- if (!target)
- if (WorldSession* session = sWorld->FindSession(accountId))
- target = session->GetPlayer();
-
- uint32 notspeaktime = (uint32) atoi(delayStr);
-
- // must have strong lesser security level
- if (HasLowerSecurity (target, target_guid, true))
- return false;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
-
- if (target)
- {
- // Target is online, mute will be in effect right away.
- int64 muteTime = time(NULL) + notspeaktime * MINUTE;
- target->GetSession()->m_muteTime = muteTime;
-
- stmt->setInt64(0, muteTime);
-
- ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime, mutereasonstr.c_str());
- }
- else
- {
- // Target is offline, mute will be in effect starting from the next login.
- int32 muteTime = -int32(notspeaktime * MINUTE);
-
- stmt->setInt64(0, muteTime);
- }
-
- stmt->setUInt32(1, accountId);
-
- LoginDatabase.Execute(stmt);
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notspeaktime, mutereasonstr.c_str());
-
- return true;
-}
-
-//unmute player
-bool ChatHandler::HandleUnmuteCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(target_guid);
-
- // find only player from same account if any
- if (!target)
- if (WorldSession* session = sWorld->FindSession(accountId))
- target = session->GetPlayer();
-
- // must have strong lesser security level
- if (HasLowerSecurity (target, target_guid, true))
- return false;
-
- if (target)
- {
- if (target->CanSpeak())
- {
- SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
- SetSentErrorMessage(true);
- return false;
- }
-
- target->GetSession()->m_muteTime = 0;
- }
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
-
- stmt->setInt64(0, 0);
- stmt->setUInt32(1, accountId);
-
- LoginDatabase.Execute(stmt);
-
- if (target)
- ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
- return true;
-}
-
-bool ChatHandler::HandleGUIDCommand(const char* /*args*/)
-{
- uint64 guid = m_session->GetPlayer()->GetSelection();
-
- if (guid == 0)
- {
- SendSysMessage(LANG_NO_SELECTION);
- SetSentErrorMessage(true);
- return false;
- }
-
- PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
- return true;
-}
-
- //move item to other slot
-bool ChatHandler::HandleItemMoveCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char* pParam1 = strtok((char*)args, " ");
- if (!pParam1)
- return false;
-
- char* pParam2 = strtok(NULL, " ");
- if (!pParam2)
- return false;
-
- uint8 srcslot = (uint8)atoi(pParam1);
- uint8 dstslot = (uint8)atoi(pParam2);
-
- if (srcslot == dstslot)
- return true;
-
- if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcslot, true))
- return false;
-
- if (!m_session->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstslot, false))
- return false;
-
- uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcslot);
- uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstslot);
-
- m_session->GetPlayer()->SwapItem(src, dst);
-
- return true;
-}
-
-//kick player
-bool ChatHandler::HandleKickPlayerCommand(const char *args)
-{
- Player* target = NULL;
- std::string playerName;
- if (!extractPlayerTarget((char*)args, &target, NULL, &playerName))
- return false;
-
- if (m_session && target == m_session->GetPlayer())
- {
- SendSysMessage(LANG_COMMAND_KICKSELF);
- SetSentErrorMessage(true);
- return false;
- }
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
- sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
- else
- PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
-
- target->GetSession()->KickPlayer();
- return true;
-}
-
-//show info of player
-bool ChatHandler::HandlePInfoCommand(const char* args)
-{
- Player* target;
- uint64 target_guid;
- std::string target_name;
-
- uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
-
- if (sObjectMgr->GetPlayerNameByGUID(parseGUID, target_name))
- {
- target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
- target_guid = parseGUID;
- }
- else if (!extractPlayerTarget((char*)args, &target, &target_guid, &target_name))
- return false;
-
- uint32 accId = 0;
- uint32 money = 0;
- uint32 total_player_time = 0;
- uint8 level = 0;
- uint32 latency = 0;
- uint8 race;
- uint8 Class;
- int64 muteTime = 0;
- int64 banTime = -1;
- uint32 mapId;
- uint32 areaId;
- uint32 phase = 0;
-
- // get additional information from Player object
- if (target)
- {
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- accId = target->GetSession()->GetAccountId();
- money = target->GetMoney();
- total_player_time = target->GetTotalPlayedTime();
- level = target->getLevel();
- latency = target->GetSession()->GetLatency();
- race = target->getRace();
- Class = target->getClass();
- muteTime = target->GetSession()->m_muteTime;
- mapId = target->GetMapId();
- areaId = target->GetAreaId();
- phase = target->GetPhaseMask();
- }
- // get additional information from DB
- else
- {
- // check offline security
- if (HasLowerSecurity(NULL, target_guid))
- return false;
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
- stmt->setUInt32(0, GUID_LOPART(target_guid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- return false;
-
- Field* fields = result->Fetch();
- total_player_time = fields[0].GetUInt32();
- level = fields[1].GetUInt8();
- money = fields[2].GetUInt32();
- accId = fields[3].GetUInt32();
- race = fields[4].GetUInt8();
- Class = fields[5].GetUInt8();
- mapId = fields[6].GetUInt16();
- areaId = fields[7].GetUInt16();
- }
-
- std::string username = GetTrinityString(LANG_ERROR);
- std::string email = GetTrinityString(LANG_ERROR);
- std::string last_ip = GetTrinityString(LANG_ERROR);
- uint32 security = 0;
- std::string last_login = GetTrinityString(LANG_ERROR);
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
- stmt->setInt32(0, int32(realmID));
- stmt->setUInt32(1, accId);
- PreparedQueryResult result = LoginDatabase.Query(stmt);
-
- if (result)
- {
- Field* fields = result->Fetch();
- username = fields[0].GetString();
- security = fields[1].GetUInt8();
- email = fields[2].GetString();
- muteTime = fields[5].GetUInt64();
-
- if (email.empty())
- email = "-";
-
- if (!m_session || m_session->GetSecurity() >= AccountTypes(security))
- {
- last_ip = fields[3].GetString();
- last_login = fields[4].GetString();
-
- uint32 ip = inet_addr(last_ip.c_str());
-#if TRINITY_ENDIAN == BIGENDIAN
- EndianConvertReverse(ip);
-#endif
-
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
-
- stmt->setUInt32(0, ip);
-
- PreparedQueryResult result2 = WorldDatabase.Query(stmt);
-
- if (result2)
- {
- Field* fields2 = result2->Fetch();
- last_ip.append(" (");
- last_ip.append(fields2[0].GetString());
- last_ip.append(")");
- }
- }
- else
- {
- last_ip = "-";
- last_login = "-";
- }
- }
-
- std::string nameLink = playerLink(target_name);
-
- PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, email.c_str(), security, last_ip.c_str(), last_login.c_str(), latency);
-
- std::string bannedby = "unknown";
- std::string banreason = "";
-
- stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
- stmt->setUInt32(0, accId);
- PreparedQueryResult result2 = LoginDatabase.Query(stmt);
- if (!result2)
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
- stmt->setUInt32(0, GUID_LOPART(target_guid));
- result2 = CharacterDatabase.Query(stmt);
- }
-
- if (result2)
- {
- Field* fields = result2->Fetch();
- banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
- bannedby = fields[2].GetString();
- banreason = fields[3].GetString();
- }
-
- if (muteTime > 0)
- PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str());
-
- if (banTime >= 0)
- PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str());
-
- std::string race_s, Class_s;
- switch (race)
- {
- case RACE_HUMAN: race_s = "Human"; break;
- case RACE_ORC: race_s = "Orc"; break;
- case RACE_DWARF: race_s = "Dwarf"; break;
- case RACE_NIGHTELF: race_s = "Night Elf"; break;
- case RACE_UNDEAD_PLAYER: race_s = "Undead"; break;
- case RACE_TAUREN: race_s = "Tauren"; break;
- case RACE_GNOME: race_s = "Gnome"; break;
- case RACE_TROLL: race_s = "Troll"; break;
- case RACE_BLOODELF: race_s = "Blood Elf"; break;
- case RACE_DRAENEI: race_s = "Draenei"; break;
- }
- switch (Class)
- {
- case CLASS_WARRIOR: Class_s = "Warrior"; break;
- case CLASS_PALADIN: Class_s = "Paladin"; break;
- case CLASS_HUNTER: Class_s = "Hunter"; break;
- case CLASS_ROGUE: Class_s = "Rogue"; break;
- case CLASS_PRIEST: Class_s = "Priest"; break;
- case CLASS_DEATH_KNIGHT: Class_s = "Death Knight"; break;
- case CLASS_SHAMAN: Class_s = "Shaman"; break;
- case CLASS_MAGE: Class_s = "Mage"; break;
- case CLASS_WARLOCK: Class_s = "Warlock"; break;
- case CLASS_DRUID: Class_s = "Druid"; break;
- }
-
- std::string timeStr = secsToTimeString(total_player_time, true, true);
- uint32 gold = money /GOLD;
- uint32 silv = (money % GOLD) / SILVER;
- uint32 copp = (money % GOLD) % SILVER;
- PSendSysMessage(LANG_PINFO_LEVEL, race_s.c_str(), Class_s.c_str(), timeStr.c_str(), level, gold, silv, copp);
-
- // Add map, zone, subzone and phase to output
- int locale = GetSessionDbcLocale();
- std::string areaName = "<unknown>";
- std::string zoneName = "";
-
- MapEntry const* map = sMapStore.LookupEntry(mapId);
-
- AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
- if (area)
- {
- areaName = area->area_name[locale];
-
- AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
-
- if (zone)
- zoneName = zone->area_name[locale];
- }
-
- if (target)
- {
- if (!zoneName.empty())
- PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
- else
- PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
- }
- else
- PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
-
- return true;
-}
-
-bool ChatHandler::HandleCombatStopCommand(const char* args)
-{
- Player* target = NULL;
-
- if (args && strlen(args) > 0)
- {
- target = sObjectAccessor->FindPlayerByName(args);
- if (!target)
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- if (!target)
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- target->CombatStop();
- target->getHostileRefManager().deleteReferences();
- return true;
-}
-
-
-bool ChatHandler::HandleRepairitemsCommand(const char* args)
-{
- Player* target;
- if (!extractPlayerTarget((char*)args, &target))
- return false;
-
- // check online security
- if (HasLowerSecurity(target, 0))
- return false;
-
- // Repair items
- target->DurabilityRepairAll(false, 0, false);
-
- PSendSysMessage(LANG_YOU_REPAIR_ITEMS, GetNameLink(target).c_str());
- if (needReportToTarget(target))
- ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetNameLink().c_str());
- return true;
-}
-
-bool ChatHandler::HandleWaterwalkCommand(const char* args)
-{
- if (!*args)
- return false;
-
- Player* player = getSelectedPlayer();
-
- if (!player)
- {
- PSendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- // check online security
- if (HasLowerSecurity(player, 0))
- return false;
-
- if (strncmp(args, "on", 3) == 0)
- player->SetMovement(MOVE_WATER_WALK); // ON
- else if (strncmp(args, "off", 4) == 0)
- player->SetMovement(MOVE_LAND_WALK); // OFF
- else
- {
- SendSysMessage(LANG_USE_BOL);
- return false;
- }
-
- PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
- if (needReportToTarget(player))
- ChatHandler(player).PSendSysMessage(LANG_YOUR_WATERWALK_SET, args, GetNameLink().c_str());
- return true;
-}
-
-bool ChatHandler::HandleCreatePetCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
- Creature* creatureTarget = getSelectedCreature();
-
- if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
- {
- PSendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
- // Creatures with family 0 crashes the server
- if (cInfo->family == 0)
- {
- PSendSysMessage("This creature cannot be tamed. (family id: 0).");
- SetSentErrorMessage(true);
- return false;
- }
-
- if (player->GetPetGUID())
- {
- PSendSysMessage("You already have a pet");
- SetSentErrorMessage(true);
- return false;
- }
-
- // Everything looks OK, create new pet
- Pet* pet = new Pet(player, HUNTER_PET);
- if (!pet->CreateBaseAtCreature(creatureTarget))
- {
- delete pet;
- PSendSysMessage("Error 1");
- return false;
- }
-
- creatureTarget->setDeathState(JUST_DIED);
- creatureTarget->RemoveCorpse();
- creatureTarget->SetHealth(0); // just for nice GM-mode view
-
- pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
- pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
-
- if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
- {
- sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
- PSendSysMessage("Error 2");
- delete pet;
- return false;
- }
-
- // prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
-
- pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
- // this enables pet details window (Shift+P)
- pet->InitPetCreateSpells();
- pet->SetFullHealth();
-
- pet->GetMap()->AddToMap(pet->ToCreature());
-
- // visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
-
- player->SetMinion(pet, true);
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- player->PetSpellInitialize();
-
- return true;
-}
-
-bool ChatHandler::HandlePetLearnCommand(const char* args)
-{
- if (!*args)
- return false;
-
- Player* player = m_session->GetPlayer();
- Pet* pet = player->GetPet();
-
- if (!pet)
- {
- PSendSysMessage("You have no pet");
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 spellId = extractSpellIdFromLink((char*)args);
-
- if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
- return false;
-
- // Check if pet already has it
- if (pet->HasSpell(spellId))
- {
- PSendSysMessage("Pet already has spell: %u", spellId);
- SetSentErrorMessage(true);
- return false;
- }
-
- // Check if spell is valid
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
- if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
- {
- PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
- SetSentErrorMessage(true);
- return false;
- }
-
- pet->learnSpell(spellId);
-
- PSendSysMessage("Pet has learned spell %u", spellId);
- return true;
-}
-
-bool ChatHandler::HandlePetUnlearnCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* player = m_session->GetPlayer();
- Pet* pet = player->GetPet();
-
- if (!pet)
- {
- PSendSysMessage("You have no pet");
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 spellId = extractSpellIdFromLink((char*)args);
-
- if (pet->HasSpell(spellId))
- pet->removeSpell(spellId, false);
- else
- PSendSysMessage("Pet doesn't have that spell");
-
- return true;
-}
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
deleted file mode 100755
index 5b93b899898..00000000000
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ /dev/null
@@ -1,1763 +0,0 @@
-/*
- * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "GuildMgr.h"
-#include "AuctionHouseMgr.h"
-#include "AccountMgr.h"
-#include "PlayerDump.h"
-#include "SpellMgr.h"
-#include "Player.h"
-#include "Opcodes.h"
-#include "GameObject.h"
-#include "Chat.h"
-#include "Log.h"
-#include "Guild.h"
-#include "ObjectAccessor.h"
-#include "MapManager.h"
-#include "Language.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "Weather.h"
-#include "PointMovementGenerator.h"
-#include "TargetedMovementGenerator.h"
-#include "SkillDiscovery.h"
-#include "SkillExtraItems.h"
-#include "SystemConfig.h"
-#include "Config.h"
-#include "Util.h"
-#include "ItemEnchantmentMgr.h"
-#include "BattlegroundMgr.h"
-#include "InstanceSaveMgr.h"
-#include "InstanceScript.h"
-#include "CreatureEventAIMgr.h"
-#include "SpellAuraEffects.h"
-#include "DBCEnums.h"
-#include "ConditionMgr.h"
-#include "DisableMgr.h"
-#include "Transport.h"
-#include "WeatherMgr.h"
-#include "ScriptMgr.h"
-#include "CreatureTextMgr.h"
-#include "SmartAI.h"
-#include "Group.h"
-#include "ChannelMgr.h"
-
-bool ChatHandler::HandleMaxSkillCommand(const char* /*args*/)
-{
- Player* SelectedPlayer = getSelectedPlayer();
- if (!SelectedPlayer)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- // each skills that have max skill value dependent from level seted to current level max skill value
- SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
- return true;
-}
-
-bool ChatHandler::HandleSetSkillCommand(const char *args)
-{
- // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
- char* skill_p = extractKeyFromLink((char*)args, "Hskill");
- if (!skill_p)
- return false;
-
- char *level_p = strtok (NULL, " ");
- if (!level_p)
- return false;
-
- char *max_p = strtok (NULL, " ");
-
- int32 skill = atoi(skill_p);
- if (skill <= 0)
- {
- PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
- SetSentErrorMessage(true);
- return false;
- }
-
- int32 level = atol(level_p);
-
- Player* target = getSelectedPlayer();
- if (!target)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- SkillLineEntry const* sl = sSkillLineStore.LookupEntry(skill);
- if (!sl)
- {
- PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string tNameLink = GetNameLink(target);
-
- if (!target->GetSkillValue(skill))
- {
- PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, sl->name[GetSessionDbcLocale()]);
- SetSentErrorMessage(true);
- return false;
- }
-
- int32 max = max_p ? atol (max_p) : target->GetPureMaxSkillValue(skill);
-
- if (level <= 0 || level > max || max <= 0)
- return false;
-
- target->SetSkill(skill, target->GetSkillStep(skill), level, max);
- PSendSysMessage(LANG_SET_SKILL, skill, sl->name[GetSessionDbcLocale()], tNameLink.c_str(), level, max);
-
- return true;
-}
-
-bool ChatHandler::HandleUnLearnCommand(const char *args)
-{
- if (!*args)
- return false;
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
- uint32 spell_id = extractSpellIdFromLink((char*)args);
- if (!spell_id)
- return false;
-
- char const* allStr = strtok(NULL, " ");
- bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
-
- Player* target = getSelectedPlayer();
- if (!target)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (allRanks)
- spell_id = sSpellMgr->GetFirstSpellInChain (spell_id);
-
- if (target->HasSpell(spell_id))
- target->removeSpell(spell_id, false, !allRanks);
- else
- SendSysMessage(LANG_FORGET_SPELL);
-
- if (GetTalentSpellCost(spell_id))
- target->SendTalentsInfoData(false);
-
- return true;
-}
-
-bool ChatHandler::HandleCooldownCommand(const char *args)
-{
- Player* target = getSelectedPlayer();
- if (!target)
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string tNameLink = GetNameLink(target);
-
- if (!*args)
- {
- target->RemoveAllSpellCooldown();
- PSendSysMessage(LANG_REMOVEALL_COOLDOWN, tNameLink.c_str());
- }
- else
- {
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spell_id = extractSpellIdFromLink((char*)args);
- if (!spell_id)
- return false;
-
- if (!sSpellMgr->GetSpellInfo(spell_id))
- {
- PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- target->RemoveSpellCooldown(spell_id, true);
- PSendSysMessage(LANG_REMOVE_COOLDOWN, spell_id, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
- }
- return true;
-}
-
-bool ChatHandler::HandleAddItemCommand(const char *args)
-{
- if (!*args)
- return false;
-
- uint32 itemId = 0;
-
- if (args[0] == '[') // [name] manual form
- {
- char* citemName = strtok((char*)args, "]");
-
- if (citemName && citemName[0])
- {
- std::string itemName = citemName+1;
- WorldDatabase.EscapeString(itemName);
-
- PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
- stmt->setString(0, itemName);
- PreparedQueryResult result = WorldDatabase.Query(stmt);
-
- if (!result)
- {
- PSendSysMessage(LANG_COMMAND_COULDNOTFIND, citemName+1);
- SetSentErrorMessage(true);
- return false;
- }
- itemId = result->Fetch()->GetUInt16();
- }
- else
- return false;
- }
- else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
- {
- char* cId = extractKeyFromLink((char*)args, "Hitem");
- if (!cId)
- return false;
- itemId = atol(cId);
- }
-
- char* ccount = strtok(NULL, " ");
-
- int32 count = 1;
-
- if (ccount)
- count = strtol(ccount, NULL, 10);
-
- if (count == 0)
- count = 1;
-
- Player* player = m_session->GetPlayer();
- Player* plTarget = getSelectedPlayer();
- if (!plTarget)
- plTarget = player;
-
- sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
-
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemId);
- if (!pProto)
- {
- PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
- SetSentErrorMessage(true);
- return false;
- }
-
- //Subtract
- if (count < 0)
- {
- plTarget->DestroyItemCount(itemId, -count, true, false);
- PSendSysMessage(LANG_REMOVEITEM, itemId, -count, GetNameLink(plTarget).c_str());
- return true;
- }
-
- //Adding items
- uint32 noSpaceForCount = 0;
-
- // check space and find places
- ItemPosCountVec dest;
- InventoryResult msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
- if (msg != EQUIP_ERR_OK) // convert to possible store amount
- count -= noSpaceForCount;
-
- if (count == 0 || dest.empty()) // can't add any
- {
- PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
- SetSentErrorMessage(true);
- return false;
- }
-
- Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
-
- // remove binding (let GM give it to another player later)
- if (player == plTarget)
- for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
- if (Item* item1 = player->GetItemByPos(itr->pos))
- item1->SetBinding(false);
-
- if (count > 0 && item)
- {
- player->SendNewItem(item, count, false, true);
- if (player != plTarget)
- plTarget->SendNewItem(item, count, true, false);
- }
-
- if (noSpaceForCount > 0)
- PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
-
- return true;
-}
-
-bool ChatHandler::HandleAddItemSetCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* cId = extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
- if (!cId)
- return false;
-
- uint32 itemsetId = atol(cId);
-
- // prevent generation all items with itemset field value '0'
- if (itemsetId == 0)
- {
- PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemsetId);
- SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = m_session->GetPlayer();
- Player* playerTarget = getSelectedPlayer();
- if (!playerTarget)
- playerTarget = player;
-
- sLog->outDetail(GetTrinityString(LANG_ADDITEMSET), itemsetId);
-
- bool found = false;
- ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
- for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
- {
- if (itr->second.ItemSet == itemsetId)
- {
- found = true;
- ItemPosCountVec dest;
- InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
- if (msg == EQUIP_ERR_OK)
- {
- Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
-
- // remove binding (let GM give it to another player later)
- if (player == playerTarget)
- item->SetBinding(false);
-
- player->SendNewItem(item, 1, false, true);
- if (player != playerTarget)
- playerTarget->SendNewItem(item, 1, true, false);
- }
- else
- {
- player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
- PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
- }
- }
- }
-
- if (!found)
- {
- PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemsetId);
-
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleGetDistanceCommand(const char *args)
-{
- WorldObject* obj = NULL;
-
- if (*args)
- {
- uint64 guid = extractGuidFromLink((char*)args);
- if (guid)
- obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
-
- if (!obj)
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- obj = getSelectedUnit();
-
- if (!obj)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- PSendSysMessage(LANG_DISTANCE, m_session->GetPlayer()->GetDistance(obj), m_session->GetPlayer()->GetDistance2d(obj), m_session->GetPlayer()->GetExactDist(obj), m_session->GetPlayer()->GetExactDist2d(obj));
- return true;
-}
-
-bool ChatHandler::HandleDieCommand(const char* /*args*/)
-{
- Unit* target = getSelectedUnit();
-
- if (!target || !m_session->GetPlayer()->GetSelection())
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target->GetTypeId() == TYPEID_PLAYER)
- {
- if (HasLowerSecurity((Player*)target, 0, false))
- return false;
- }
-
- if (target->isAlive())
- {
- if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
- m_session->GetPlayer()->Kill(target);
- else
- m_session->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleDamageCommand(const char * args)
-{
- if (!*args)
- return false;
-
- Unit* target = getSelectedUnit();
-
- if (!target || !m_session->GetPlayer()->GetSelection())
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target->GetTypeId() == TYPEID_PLAYER)
- {
- if (HasLowerSecurity((Player*)target, 0, false))
- return false;
- }
-
- if (!target->isAlive())
- return true;
-
- char* damageStr = strtok((char*)args, " ");
- if (!damageStr)
- return false;
-
- int32 damage_int = atoi((char*)damageStr);
- if (damage_int <= 0)
- return true;
-
- uint32 damage = damage_int;
-
- char* schoolStr = strtok((char*)NULL, " ");
-
- // flat melee damage without resistence/etc reduction
- if (!schoolStr)
- {
- m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- if (target != m_session->GetPlayer())
- m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
- return true;
- }
-
- uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
- if (school >= MAX_SPELL_SCHOOL)
- return false;
-
- SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
-
- if (Unit::IsDamageReducedByArmor(schoolmask))
- damage = m_session->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
-
- char* spellStr = strtok((char*)NULL, " ");
-
- // melee damage by specific school
- if (!spellStr)
- {
- uint32 absorb = 0;
- uint32 resist = 0;
-
- m_session->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
-
- if (damage <= absorb + resist)
- return true;
-
- damage -= absorb + resist;
-
- m_session->GetPlayer()->DealDamageMods(target, damage, &absorb);
- m_session->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
- m_session->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
- return true;
- }
-
- // non-melee damage
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellid = extractSpellIdFromLink((char*)args);
- if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
- return false;
-
- m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
- return true;
-}
-
-bool ChatHandler::HandleReviveCommand(const char *args)
-{
- Player* target;
- uint64 target_guid;
- if (!extractPlayerTarget((char*)args, &target, &target_guid))
- return false;
-
- if (target)
- {
- target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
- target->SpawnCorpseBones();
- target->SaveToDB();
- }
- else
- // will resurrected at login without corpse
- sObjectAccessor->ConvertCorpseForPlayer(target_guid);
-
- return true;
-}
-
-bool ChatHandler::HandleAuraCommand(const char *args)
-{
- Unit* target = getSelectedUnit();
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellID = extractSpellIdFromLink((char*)args);
-
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID))
- Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
-
- return true;
-}
-
-bool ChatHandler::HandleUnAuraCommand(const char *args)
-{
- Unit* target = getSelectedUnit();
- if (!target)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- std::string argstr = args;
- if (argstr == "all")
- {
- target->RemoveAllAuras();
- return true;
- }
-
- // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
- uint32 spellID = extractSpellIdFromLink((char*)args);
- if (!spellID)
- return false;
-
- target->RemoveAurasDueToSpell(spellID);
-
- return true;
-}
-
-bool ChatHandler::HandleLinkGraveCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* px = strtok((char*)args, " ");
- if (!px)
- return false;
-
- uint32 g_id = (uint32)atoi(px);
-
- uint32 g_team;
-
- char* px2 = strtok(NULL, " ");
-
- if (!px2)
- g_team = 0;
- else if (strncmp(px2, "horde", 6) == 0)
- g_team = HORDE;
- else if (strncmp(px2, "alliance", 9) == 0)
- g_team = ALLIANCE;
- else
- return false;
-
- WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(g_id);
-
- if (!graveyard)
- {
- PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, g_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = m_session->GetPlayer();
-
- uint32 zoneId = player->GetZoneId();
-
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
- if (!areaEntry || areaEntry->zone !=0)
- {
- PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id, zoneId);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (sObjectMgr->AddGraveYardLink(g_id, zoneId, g_team))
- PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, g_id, zoneId);
- else
- PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, g_id, zoneId);
-
- return true;
-}
-
-bool ChatHandler::HandleNearGraveCommand(const char *args)
-{
- uint32 g_team;
-
- size_t argslen = strlen(args);
-
- if (!*args)
- g_team = 0;
- else if (strncmp((char*)args, "horde", argslen) == 0)
- g_team = HORDE;
- else if (strncmp((char*)args, "alliance", argslen) == 0)
- g_team = ALLIANCE;
- else
- return false;
-
- Player* player = m_session->GetPlayer();
- uint32 zone_id = player->GetZoneId();
-
- WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), g_team);
-
- if (graveyard)
- {
- uint32 g_id = graveyard->ID;
-
- GraveYardData const* data = sObjectMgr->FindGraveYardData(g_id, zone_id);
- if (!data)
- {
- PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, g_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- g_team = data->team;
-
- std::string team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
-
- if (g_team == 0)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (g_team == HORDE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if (g_team == ALLIANCE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
-
- PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, g_id, team_name.c_str(), zone_id);
- }
- else
- {
- std::string team_name;
-
- if (g_team == 0)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
- else if (g_team == HORDE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
- else if (g_team == ALLIANCE)
- team_name = GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
-
- if (g_team == ~uint32(0))
- PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
- else
- PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
- }
-
- return true;
-}
-
-bool ChatHandler::HandleExploreCheatCommand(const char *args)
-{
- if (!*args)
- return false;
-
- int flag = atoi((char*)args);
-
- Player* chr = getSelectedPlayer();
- if (chr == NULL)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (flag != 0)
- {
- PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, GetNameLink().c_str());
- }
- else
- {
- PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, GetNameLink(chr).c_str());
- if (needReportToTarget(chr))
- ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, GetNameLink().c_str());
- }
-
- for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
- {
- if (flag != 0)
- m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
- else
- m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
- }
-
- return true;
-}
-
-void ChatHandler::HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel)
-{
- if (player)
- {
- player->GiveLevel(newLevel);
- player->InitTalentForLevel();
- player->SetUInt32Value(PLAYER_XP, 0);
-
- if (needReportToTarget(player))
- {
- if (oldLevel == newLevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, GetNameLink().c_str());
- else if (oldLevel < newLevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_UP, GetNameLink().c_str(), newLevel);
- else // if (oldlevel > newlevel)
- ChatHandler(player).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, GetNameLink().c_str(), newLevel);
- }
- }
- else
- {
- // Update level and reset XP, everything else will be updated at login
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
-
- stmt->setUInt8(0, uint8(newLevel));
- stmt->setUInt32(1, GUID_LOPART(playerGuid));
-
- CharacterDatabase.Execute(stmt);
- }
-}
-
-bool ChatHandler::HandleLevelUpCommand(const char *args)
-{
- char* nameStr;
- char* levelStr;
- extractOptFirstArg((char*)args, &nameStr, &levelStr);
-
- // exception opt second arg: .character level $name
- if (levelStr && isalpha(levelStr[0]))
- {
- nameStr = levelStr;
- levelStr = NULL; // current level will used
- }
-
- Player* target;
- uint64 target_guid;
- std::string target_name;
- if (!extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
- return false;
-
- int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(target_guid);
- int32 addlevel = levelStr ? atoi(levelStr) : 1;
- int32 newlevel = oldlevel + addlevel;
-
- if (newlevel < 1)
- newlevel = 1;
-
- if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
- newlevel = STRONG_MAX_LEVEL;
-
- HandleCharacterLevel(target, target_guid, oldlevel, newlevel);
-
- if (!m_session || m_session->GetPlayer() != target) // including chr == NULL
- {
- std::string nameLink = playerLink(target_name);
- PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleShowAreaCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* chr = getSelectedPlayer();
- if (chr == NULL)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- int area = GetAreaFlagByAreaID(atoi((char*)args));
- int offset = area / 32;
- uint32 val = (uint32)(1 << (area % 32));
-
- if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
- {
- SendSysMessage(LANG_BAD_VALUE);
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val));
-
- SendSysMessage(LANG_EXPLORE_AREA);
- return true;
-}
-
-bool ChatHandler::HandleHideAreaCommand(const char *args)
-{
- if (!*args)
- return false;
-
- Player* chr = getSelectedPlayer();
- if (chr == NULL)
- {
- SendSysMessage(LANG_NO_CHAR_SELECTED);
- SetSentErrorMessage(true);
- return false;
- }
-
- int area = GetAreaFlagByAreaID(atoi((char*)args));
- int offset = area / 32;
- uint32 val = (uint32)(1 << (area % 32));
-
- if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
- {
- SendSysMessage(LANG_BAD_VALUE);
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 currFields = chr->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
- chr->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields ^ val));
-
- SendSysMessage(LANG_UNEXPLORE_AREA);
- return true;
-}
-
-bool ChatHandler::HandleBankCommand(const char* /*args*/)
-{
- m_session->SendShowBank(m_session->GetPlayer()->GetGUID());
-
- return true;
-}
-
-bool ChatHandler::HandleChangeWeather(const char *args)
-{
- if (!*args)
- return false;
-
- //Weather is OFF
- if (!sWorld->getBoolConfig(CONFIG_WEATHER))
- {
- SendSysMessage(LANG_WEATHER_DISABLED);
- SetSentErrorMessage(true);
- return false;
- }
-
- // *Change the weather of a cell
- char* px = strtok((char*)args, " ");
- char* py = strtok(NULL, " ");
-
- if (!px || !py)
- return false;
-
- uint32 type = (uint32)atoi(px); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
- float grade = (float)atof(py); //0 to 1, sending -1 is instand good weather
-
- Player* player = m_session->GetPlayer();
- uint32 zoneid = player->GetZoneId();
-
- Weather* wth = WeatherMgr::FindWeather(zoneid);
-
- if (!wth)
- wth = WeatherMgr::AddWeather(zoneid);
- if (!wth)
- {
- SendSysMessage(LANG_NO_WEATHER);
- SetSentErrorMessage(true);
- return false;
- }
-
- wth->SetWeather(WeatherType(type), grade);
-
- return true;
-}
-
-bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- // accept only explicitly selected target (not implicitly self targeting case)
- Unit* target = getSelectedUnit();
- if (player->GetSelection() && target)
- {
- if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
- {
- SendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (target->isDead())
- target->ToCreature()->Respawn();
- return true;
- }
-
- CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
- Cell cell(p);
- cell.SetNoCreate();
-
- Trinity::RespawnDo u_do;
- Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
-
- TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
- cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
-
- return true;
-}
-
-bool ChatHandler::HandlePDumpLoadCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char * file = strtok((char*)args, " ");
- if (!file)
- return false;
-
- char * account = strtok(NULL, " ");
- if (!account)
- return false;
-
- std::string account_name = account;
- if (!AccountMgr::normalizeString(account_name))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 account_id = AccountMgr::GetId(account_name);
- if (!account_id)
- {
- account_id = atoi(account); // use original string
- if (!account_id)
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- if (!AccountMgr::GetName(account_id, account_name))
- {
- PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str());
- SetSentErrorMessage(true);
- return false;
- }
-
- char* guid_str = NULL;
- char* name_str = strtok(NULL, " ");
-
- std::string name;
- if (name_str)
- {
- name = name_str;
- // normalize the name if specified and check if it exists
- if (!normalizePlayerName(name))
- {
- PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS)
- {
- PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
- SetSentErrorMessage(true);
- return false;
- }
-
- guid_str = strtok(NULL, " ");
- }
-
- uint32 guid = 0;
-
- if (guid_str)
- {
- guid = atoi(guid_str);
- if (!guid)
- {
- PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
- SetSentErrorMessage(true);
- return false;
- }
-
- if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
- {
- PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- switch (PlayerDumpReader().LoadDump(file, account_id, name, guid))
- {
- case DUMP_SUCCESS:
- PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
- break;
- case DUMP_FILE_OPEN_ERROR:
- PSendSysMessage(LANG_FILE_OPEN_FAIL, file);
- SetSentErrorMessage(true);
- return false;
- case DUMP_FILE_BROKEN:
- PSendSysMessage(LANG_DUMP_BROKEN, file);
- SetSentErrorMessage(true);
- return false;
- case DUMP_TOO_MANY_CHARS:
- PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account_name.c_str(), account_id);
- SetSentErrorMessage(true);
- return false;
- default:
- PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandlePDumpWriteCommand(const char *args)
-{
- if (!*args)
- return false;
-
- char* file = strtok((char*)args, " ");
- char* p2 = strtok(NULL, " ");
-
- if (!file || !p2)
- return false;
-
- uint64 guid;
- // character name can't start from number
- if (isNumeric(p2))
- guid = MAKE_NEW_GUID(atoi(p2), 0, HIGHGUID_PLAYER);
- else
- {
- std::string name = extractPlayerNameFromLink(p2);
- if (name.empty())
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- guid = sObjectMgr->GetPlayerGUIDByName(name);
- }
-
- if (!sObjectMgr->GetPlayerAccountIdByGUID(guid))
- {
- PSendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- switch (PlayerDumpWriter().WriteDump(file, uint32(guid)))
- {
- case DUMP_SUCCESS:
- PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
- break;
- case DUMP_FILE_OPEN_ERROR:
- PSendSysMessage(LANG_FILE_OPEN_FAIL, file);
- SetSentErrorMessage(true);
- return false;
- case DUMP_CHARACTER_DELETED:
- PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
- SetSentErrorMessage(true);
- return false;
- default:
- PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
- SetSentErrorMessage(true);
- return false;
- }
-
- return true;
-}
-
-bool ChatHandler::HandleMovegensCommand(const char* /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- {
- SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
-
- MotionMaster* mm = unit->GetMotionMaster();
- float x,y,z;
- mm->GetDestination(x,y,z);
-
- for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
- {
- MovementGenerator* mg = mm->GetMotionSlot(i);
- if (!mg)
- {
- SendSysMessage("Empty");
- continue;
- }
- switch (mg->GetMovementGeneratorType())
- {
- case IDLE_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_IDLE); break;
- case RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_RANDOM); break;
- case WAYPOINT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_WAYPOINT); break;
- case ANIMAL_RANDOM_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM); break;
- case CONFUSED_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_CONFUSED); break;
- case CHASE_MOTION_TYPE:
- {
- Unit* target = NULL;
- if (unit->GetTypeId() == TYPEID_PLAYER)
- target = static_cast<ChaseMovementGenerator<Player> const*>(mg)->GetTarget();
- else
- target = static_cast<ChaseMovementGenerator<Creature> const*>(mg)->GetTarget();
-
- if (!target)
- SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
- else if (target->GetTypeId() == TYPEID_PLAYER)
- PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow());
- else
- PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow());
- break;
- }
- case FOLLOW_MOTION_TYPE:
- {
- Unit* target = NULL;
- if (unit->GetTypeId() == TYPEID_PLAYER)
- target = static_cast<FollowMovementGenerator<Player> const*>(mg)->GetTarget();
- else
- target = static_cast<FollowMovementGenerator<Creature> const*>(mg)->GetTarget();
-
- if (!target)
- SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
- else if (target->GetTypeId() == TYPEID_PLAYER)
- PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow());
- else
- PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow());
- break;
- }
- case HOME_MOTION_TYPE:
- {
- if (unit->GetTypeId() == TYPEID_UNIT)
- PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
- else
- SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
- break;
- }
- case FLIGHT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FLIGHT); break;
- case POINT_MOTION_TYPE:
- {
- PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
- break;
- }
- case FLEEING_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_FEAR); break;
- case DISTRACT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_DISTRACT); break;
- case EFFECT_MOTION_TYPE: SendSysMessage(LANG_MOVEGENS_EFFECT); break;
- default:
- PSendSysMessage(LANG_MOVEGENS_UNKNOWN, mg->GetMovementGeneratorType());
- break;
- }
- }
- return true;
-}
-
-/*
-ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
-Without this function 3rd party scripting library will get linking errors (unresolved external)
-when attempting to use the PointMovementGenerator
-*/
-bool ChatHandler::HandleComeToMeCommand(const char *args)
-{
- char* newFlagStr = strtok((char*)args, " ");
-
- if (!newFlagStr)
- return false;
-
- Creature* caster = getSelectedCreature();
- if (!caster)
- {
- SendSysMessage(LANG_SELECT_CREATURE);
- SetSentErrorMessage(true);
- return false;
- }
-
- Player* player = m_session->GetPlayer();
-
- caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
- return true;
-}
-
-//Send items by mail
-bool ChatHandler::HandleSendItemsCommand(const char *args)
-{
- // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
- Player* receiver;
- uint64 receiver_guid;
- std::string receiver_name;
- if (!extractPlayerTarget((char*)args, &receiver, &receiver_guid, &receiver_name))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // extract items
- typedef std::pair<uint32, uint32> ItemPair;
- typedef std::list< ItemPair > ItemPairs;
- ItemPairs items;
-
- // get all tail string
- char* tail = strtok(NULL, "");
-
- // get from tail next item str
- while (char* itemStr = strtok(tail, " "))
- {
- // and get new tail
- tail = strtok(NULL, "");
-
- // parse item str
- char* itemIdStr = strtok(itemStr, ":");
- char* itemCountStr = strtok(NULL, " ");
-
- uint32 item_id = atoi(itemIdStr);
- if (!item_id)
- return false;
-
- ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(item_id);
- if (!item_proto)
- {
- PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1;
- if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount)))
- {
- PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count, item_id);
- SetSentErrorMessage(true);
- return false;
- }
-
- while (item_count > item_proto->GetMaxStackSize())
- {
- items.push_back(ItemPair(item_id, item_proto->GetMaxStackSize()));
- item_count -= item_proto->GetMaxStackSize();
- }
-
- items.push_back(ItemPair(item_id, item_count));
-
- if (items.size() > MAX_MAIL_ITEMS)
- {
- PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
- SetSentErrorMessage(true);
- return false;
- }
- }
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- // fill mail
- MailDraft draft(subject, text);
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
- {
- if (Item* item = Item::CreateItem(itr->first, itr->second, m_session ? m_session->GetPlayer() : 0))
- {
- item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
- draft.AddItem(item);
- }
- }
-
- draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender);
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = playerLink(receiver_name);
- PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
-}
-
-///Send money by mail
-bool ChatHandler::HandleSendMoneyCommand(const char *args)
-{
- /// format: name "subject text" "mail text" money
-
- Player* receiver;
- uint64 receiver_guid;
- std::string receiver_name;
- if (!extractPlayerTarget((char*)args, &receiver, &receiver_guid, &receiver_name))
- return false;
-
- char* tail1 = strtok(NULL, "");
- if (!tail1)
- return false;
-
- char* msgSubject = extractQuotedArg(tail1);
- if (!msgSubject)
- return false;
-
- char* tail2 = strtok(NULL, "");
- if (!tail2)
- return false;
-
- char* msgText = extractQuotedArg(tail2);
- if (!msgText)
- return false;
-
- char* money_str = strtok(NULL, "");
- int32 money = money_str ? atoi(money_str) : 0;
- if (money <= 0)
- return false;
-
- // msgSubject, msgText isn't NUL after prev. check
- std::string subject = msgSubject;
- std::string text = msgText;
-
- // from console show not existed sender
- MailSender sender(MAIL_NORMAL, m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
-
- SQLTransaction trans = CharacterDatabase.BeginTransaction();
-
- MailDraft(subject, text)
- .AddMoney(money)
- .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiver_guid)), sender);
-
- CharacterDatabase.CommitTransaction(trans);
-
- std::string nameLink = playerLink(receiver_name);
- PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
- return true;
-}
-
-/// Send a message to a player in game
-bool ChatHandler::HandleSendMessageCommand(const char *args)
-{
- ///- Find the player
- Player* rPlayer;
- if (!extractPlayerTarget((char*)args, &rPlayer))
- return false;
-
- char* msg_str = strtok(NULL, "");
- if (!msg_str)
- return false;
-
- ///- Check that he is not logging out.
- if (rPlayer->GetSession()->isLogingOut())
- {
- SendSysMessage(LANG_PLAYER_NOT_FOUND);
- SetSentErrorMessage(true);
- return false;
- }
-
- ///- Send the message
- //Use SendAreaTriggerMessage for fastest delivery.
- rPlayer->GetSession()->SendAreaTriggerMessage("%s", msg_str);
- rPlayer->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
-
- //Confirmation message
- std::string nameLink = GetNameLink(rPlayer);
- PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msg_str);
- return true;
-}
-
-bool ChatHandler::HandleFlushArenaPointsCommand(const char * /*args*/)
-{
- sArenaTeamMgr->DistributeArenaPoints();
- return true;
-}
-
-bool ChatHandler::HandleChannelSetOwnership(const char *args)
-{
- if (!*args)
- return false;
- char *channel = strtok((char*)args, " ");
- char *argstr = strtok(NULL, "");
-
- if (!channel || !argstr)
- return false;
-
- Player* player = m_session->GetPlayer();
- Channel* chn = NULL;
-
- if (ChannelMgr* cMgr = channelMgr(player->GetTeam()))
- chn = cMgr->GetChannel(channel, player);
-
- if (strcmp(argstr, "on") == 0)
- {
- if (chn)
- chn->SetOwnership(true);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
- stmt->setUInt8 (0, 1);
- stmt->setString(1, channel);
- CharacterDatabase.Execute(stmt);
- PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channel);
- }
- else if (strcmp(argstr, "off") == 0)
- {
- if (chn)
- chn->SetOwnership(false);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
- stmt->setUInt8 (0, 0);
- stmt->setString(1, channel);
- CharacterDatabase.Execute(stmt);
- PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channel);
- }
- else
- return false;
-
- return true;
-}
-
-bool ChatHandler::HandlePlayAllCommand(const char *args)
-{
- if (!*args)
- return false;
-
- uint32 soundId = atoi((char*)args);
-
- if (!sSoundEntriesStore.LookupEntry(soundId))
- {
- PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
- SetSentErrorMessage(true);
- return false;
- }
-
- WorldPacket data(SMSG_PLAY_SOUND, 4);
- data << uint32(soundId) << m_session->GetPlayer()->GetGUID();
- sWorld->SendGlobalMessage(&data);
-
- PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
- return true;
-}
-
-bool ChatHandler::HandleFreezeCommand(const char *args)
-{
- std::string name;
- Player* player;
- char *TargetName = strtok((char*)args, " "); //get entered name
- if (!TargetName) //if no name entered use target
- {
- player = getSelectedPlayer();
- if (player) //prevent crash with creature as target
- {
- name = player->GetName();
- normalizePlayerName(name);
- }
- }
- else // if name entered
- {
- name = TargetName;
- normalizePlayerName(name);
- player = sObjectAccessor->FindPlayerByName(name.c_str());
- }
-
- if (!player)
- {
- SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
-
- if (player == m_session->GetPlayer())
- {
- SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
- return true;
- }
-
- //effect
- if (player && player != m_session->GetPlayer())
- {
- PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
-
- //stop combat + make player unattackable + duel stop + stop some spells
- player->setFaction(35);
- player->CombatStop();
- if (player->IsNonMeleeSpellCasted(true))
- player->InterruptNonMeleeSpells(true);
- player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
-
- //if player class = hunter || warlock remove pet if alive
- if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
- {
- if (Pet* pet = player->GetPet())
- {
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- // not let dismiss dead pet
- if (pet && pet->isAlive())
- player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
- }
- }
-
- //m_session->GetPlayer()->CastSpell(player, spellID, false);
- if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
- Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
-
- //save player
- player->SaveToDB();
- }
- return true;
-}
-
-bool ChatHandler::HandleUnFreezeCommand(const char *args)
-{
- std::string name;
- Player* player;
- char* targetName = strtok((char*)args, " "); // Get entered name
-
- if (targetName)
- {
- name = targetName;
- normalizePlayerName(name);
- player = sObjectAccessor->FindPlayerByName(name.c_str());
- }
- else // If no name was entered - use target
- {
- player = getSelectedPlayer();
- if (player)
- name = player->GetName();
- }
-
- if (player)
- {
- PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
-
- // Reset player faction + allow combat + allow duels
- player->setFactionForRace(player->getRace());
- player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
-
- // Remove Freeze spell (allowing movement and spells)
- player->RemoveAurasDueToSpell(9454);
-
- // Save player
- player->SaveToDB();
- }
- else
- {
- if (targetName)
- {
- // Check for offline players
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
- stmt->setString(0, name);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- {
- SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
-
- // If player found: delete his freeze aura
- Field* fields = result->Fetch();
- uint32 lowGuid = fields[0].GetUInt32();
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
- stmt->setUInt32(0, lowGuid);
- CharacterDatabase.Execute(stmt);
-
- PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
- return true;
- }
- else
- {
- SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
- return true;
- }
- }
-
- return true;
-}
-
-bool ChatHandler::HandleListFreezeCommand(const char * /*args*/)
-{
- // Get names from DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
-
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (!result)
- {
- SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
- return true;
- }
- //Header of the names
- PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
-
- //Output of the results
- do
- {
- Field* fields = result->Fetch();
- std::string fplayers = fields[0].GetString();
- PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, fplayers.c_str());
- } while (result->NextRow());
-
- return true;
-}
-
-bool ChatHandler::HandleGroupLeaderCommand(const char *args)
-{
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* cname = strtok((char*)args, " ");
-
- if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
- if (group && group->GetLeaderGUID() != guid)
- {
- group->ChangeLeader(guid);
- group->SendUpdate();
- }
-
- return true;
-}
-
-bool ChatHandler::HandleGroupDisbandCommand(const char *args)
-{
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* cname = strtok((char*)args, " ");
-
- if (GetPlayerGroupAndGUIDByName(cname, player, group, guid))
- if (group)
- group->Disband();
-
- return true;
-}
-
-bool ChatHandler::HandleGroupRemoveCommand(const char *args)
-{
- Player* player = NULL;
- Group* group = NULL;
- uint64 guid = 0;
- char* cname = strtok((char*)args, " ");
-
- if (GetPlayerGroupAndGUIDByName(cname, player, group, guid, true))
- if (group)
- group->RemoveMember(guid);
-
- return true;
-}
-
-bool ChatHandler::HandlePossessCommand(const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- return false;
-
- m_session->GetPlayer()->CastSpell(unit, 530, true);
- return true;
-}
-
-bool ChatHandler::HandleUnPossessCommand(const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- unit = m_session->GetPlayer();
-
- unit->RemoveCharmAuras();
-
- return true;
-}
-
-bool ChatHandler::HandleBindSightCommand(const char * /*args*/)
-{
- Unit* unit = getSelectedUnit();
- if (!unit)
- return false;
-
- m_session->GetPlayer()->CastSpell(unit, 6277, true);
- return true;
-}
-
-bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/)
-{
- Player* player = m_session->GetPlayer();
-
- if (player->isPossessing())
- return false;
-
- player->StopCastingBindSight();
- return true;
-}
diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp
deleted file mode 100755
index 177899efbf0..00000000000
--- a/src/server/game/Chat/Commands/TicketCommands.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * Copyright (C) 2008-2012 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 "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "ObjectMgr.h"
-#include "TicketMgr.h"
-#include "AccountMgr.h"
-#include "Chat.h"
-#include "Player.h"
-
-bool ChatHandler::HandleGMTicketListCommand(const char* /*args*/)
-{
- sTicketMgr->ShowList(*this, false);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketListOnlineCommand(const char* /*args*/)
-{
- sTicketMgr->ShowList(*this, true);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketListClosedCommand(const char* /*args*/)
-{
- sTicketMgr->ShowClosedList(*this);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketListEscalatedCommand(const char* /*args*/)
-{
- sTicketMgr->ShowEscalatedList(*this);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketGetByIdCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket *ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetViewed();
- ticket->SaveToDB(trans);
-
- SendSysMessage(ticket->FormatMessageString(*this, true).c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketGetByNameCommand(const char* args)
-{
- if (!*args)
- return false;
-
- std::string name(args);
- if (!normalizePlayerName(name))
- return false;
-
- // Detect target's GUID
- uint64 guid = 0;
- if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
- guid = player->GetGUID();
- else
- guid = sObjectMgr->GetPlayerGUIDByName(name);
-
- // Target must exist
- if (!guid)
- {
- SendSysMessage(LANG_NO_PLAYERS_FOUND);
- return true;
- }
-
- // Ticket must exist
- GmTicket *ticket = sTicketMgr->GetTicketByPlayer(guid);
- if (!ticket)
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetViewed();
- ticket->SaveToDB(trans);
-
- SendSysMessage(ticket->FormatMessageString(*this, true).c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketCloseByIdCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Ticket should be assigned to the player who tries to close it.
- // Console can override though
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
- return true;
- }
-
- sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, player ? player->GetName() : "Console", NULL, NULL, NULL);
- SendGlobalGMSysMessage(msg.c_str());
-
- // Inform player, who submitted this ticket, that it is closed
- if (Player* submitter = ticket->GetPlayer())
- {
- if (submitter->IsInWorld())
- {
- WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
- data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
- submitter->GetSession()->SendPacket(&data);
- }
- }
- return true;
-}
-
-bool ChatHandler::HandleGMTicketAssignToCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char* sTicketId = strtok((char*)args, " ");
- uint32 ticketId = atoi(sTicketId);
-
- char* sTarget = strtok(NULL, " ");
- if (!sTarget)
- return false;
-
- std::string target(sTarget);
- if (!normalizePlayerName(target))
- return false;
-
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Get target information
- uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
- uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
- uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccId, realmID);
-
- // Target must exist and have administrative rights
- if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
- {
- SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
- return true;
- }
-
- // If already assigned, leave
- if (ticket->IsAssignedTo(targetGuid))
- {
- PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
- return true;
- }
-
- // If assigned to different player other than current, leave
- //! Console can override though
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
- return true;
- }
-
- // Assign ticket
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
- ticket->SaveToDB(trans);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, NULL, target.c_str(), NULL, NULL);
- SendGlobalGMSysMessage(msg.c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket *ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
- // Ticket must be assigned
- if (!ticket->IsAssigned())
- {
- PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId());
- return true;
- }
-
- // Get security level of player, whom this ticket is assigned to
- uint32 security = SEC_PLAYER;
- Player* assignedPlayer = ticket->GetAssignedPlayer();
- if (assignedPlayer && assignedPlayer->IsInWorld())
- security = assignedPlayer->GetSession()->GetSecurity();
- else
- {
- uint64 guid = ticket->GetAssignedToGUID();
- uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
- security = AccountMgr::GetSecurity(accountId, realmID);
- }
-
- // Check security
- //! If no m_session present it means we're issuing this command from the console
- uint32 mySecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;
- if (security > mySecurity)
- {
- SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetUnassigned();
- ticket->SaveToDB(trans);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(),
- m_session ? m_session->GetPlayer()->GetName() : "Console", NULL);
- SendGlobalGMSysMessage(msg.c_str());
- return true;
-}
-
-bool ChatHandler::HandleGMTicketCommentCommand(const char* args)
-{
- if (!*args)
- return false;
-
- char* tguid = strtok((char*)args, " ");
- uint32 ticketId = atoi(tguid);
-
- char* comment = strtok(NULL, "\n");
- if (!comment)
- return false;
-
- GmTicket *ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || ticket->IsClosed())
- {
- PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Cannot comment ticket assigned to someone else
- //! Console excluded
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->SetComment(comment);
- ticket->SaveToDB(trans);
- sTicketMgr->UpdateLastChange();
-
- std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL);
- msg += PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment);
- SendGlobalGMSysMessage(msg.c_str());
-
- return true;
-}
-
-bool ChatHandler::HandleGMTicketDeleteByIdCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket)
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- if (!ticket->IsClosed())
- {
- SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
- return true;
- }
-
- std::string msg = ticket->FormatMessageString(*this, NULL, NULL, NULL, m_session ? m_session->GetPlayer()->GetName() : "Console");
- SendGlobalGMSysMessage(msg.c_str());
-
- sTicketMgr->RemoveTicket(ticket->GetId());
- sTicketMgr->UpdateLastChange();
-
- if (Player* player = ticket->GetPlayer())
- {
- if (player->IsInWorld())
- {
- // Force abandon ticket
- WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
- data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
- player->GetSession()->SendPacket(&data);
- }
- }
- return true;
-}
-
-bool ChatHandler::HandleGMTicketResetCommand(const char* /* args */)
-{
- if (sTicketMgr->GetOpenTicketCount() > 0)
- {
- SendSysMessage(LANG_COMMAND_TICKETPENDING);
- return true;
- }
- else
- {
- sTicketMgr->ResetTickets();
- SendSysMessage(LANG_COMMAND_TICKETRESET);
- }
-
- return true;
-}
-
-bool ChatHandler::HandleToggleGMTicketSystem(const char* /* args */)
-{
- bool status = !sTicketMgr->GetStatus();
- sTicketMgr->SetStatus(status);
- PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS);
- return true;
-}
-
-bool ChatHandler::HandleGMTicketEscalateCommand(const char *args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || !ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED)
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE);
-
- if (Player* player = ticket->GetPlayer())
- if (player->IsInWorld())
- sTicketMgr->SendTicket(player->GetSession(), ticket);
-
- sTicketMgr->UpdateLastChange();
- return true;
-}
-
-bool ChatHandler::HandleGMTicketCompleteCommand(const char* args)
-{
- if (!*args)
- return false;
-
- uint32 ticketId = atoi(args);
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || !ticket->IsClosed() || ticket->IsCompleted())
- {
- SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- if (Player* player = ticket->GetPlayer())
- if (player->IsInWorld())
- ticket->SendResponse(player->GetSession());
-
- sTicketMgr->UpdateLastChange();
- return true;
-}
-
-inline bool ChatHandler::_HandleGMTicketResponseAppendCommand(const char* args, bool newLine)
-{
- if (!*args)
- return false;
-
- char* sTicketId = strtok((char*)args, " ");
- uint32 ticketId = atoi(sTicketId);
-
- char* response = strtok(NULL, "\n");
- if (!response)
- return false;
-
- GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
- if (!ticket || !ticket->IsClosed())
- {
- PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
- return true;
- }
-
- // Cannot add response to ticket, assigned to someone else
- //! Console excluded
- Player* player = m_session ? m_session->GetPlayer() : NULL;
- if (player && ticket->IsAssignedNotTo(player->GetGUID()))
- {
- PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
- return true;
- }
-
- SQLTransaction trans = SQLTransaction(NULL);
- ticket->AppendResponse(response);
- if (newLine)
- ticket->AppendResponse("\n");
- ticket->SaveToDB(trans);
-
- return true;
-}
-
-bool ChatHandler::HandleGMTicketResponseAppendCommand(const char* args)
-{
- return _HandleGMTicketResponseAppendCommand(args, false);
-}
-
-bool ChatHandler::HandleGMTicketResponseAppendLnCommand(const char* args)
-{
- return _HandleGMTicketResponseAppendCommand(args, true);
-}
diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp
index 05b4fa171c7..05b4fa171c7 100755..100644
--- a/src/server/game/Combat/HostileRefManager.cpp
+++ b/src/server/game/Combat/HostileRefManager.cpp
diff --git a/src/server/game/Combat/HostileRefManager.h b/src/server/game/Combat/HostileRefManager.h
index 8a49d230161..b8991d8faf8 100755..100644
--- a/src/server/game/Combat/HostileRefManager.h
+++ b/src/server/game/Combat/HostileRefManager.h
@@ -71,4 +71,3 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
};
//=================================================
#endif
-
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 0c43c9ece0e..2c45067d95a 100755..100644
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -158,7 +158,7 @@ void HostileReference::addThreat(float modThreat)
void HostileReference::addThreatPercent(int32 percent)
{
float tmpThreat = iThreat;
- AddPctN(tmpThreat, percent);
+ AddPct(tmpThreat, percent);
addThreat(tmpThreat - iThreat);
}
@@ -194,7 +194,6 @@ void HostileReference::updateOnlineStatus()
}
else
accessible = true;
-
}
setAccessibleState(accessible);
setOnlineOfflineState(online);
@@ -254,25 +253,29 @@ Unit* HostileReference::getSourceUnit()
void ThreatContainer::clearReferences()
{
- for (std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
+ for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
{
(*i)->unlink();
delete (*i);
}
+
iThreatList.clear();
}
//============================================================
// Return the HostileReference of NULL, if not found
-HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim)
+HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const
{
if (!victim)
return NULL;
- uint64 guid = victim->GetGUID();
- for (std::list<HostileReference*>::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
- if ((*i) && (*i)->getUnitGuid() == guid)
- return (*i);
+ uint64 const guid = victim->GetGUID();
+ for (ThreatContainer::StorageType::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i)
+ {
+ HostileReference *ref = (*i);
+ if (ref && ref->getUnitGuid() == guid)
+ return ref;
+ }
return NULL;
}
@@ -311,16 +314,16 @@ void ThreatContainer::update()
// return the next best victim
// could be the current victim
-HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileReference* currentVictim)
+HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileReference* currentVictim) const
{
HostileReference* currentRef = NULL;
bool found = false;
bool noPriorityTargetFound = false;
- std::list<HostileReference*>::const_iterator lastRef = iThreatList.end();
+ ThreatContainer::StorageType::const_iterator lastRef = iThreatList.end();
--lastRef;
- for (std::list<HostileReference*>::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
+ for (ThreatContainer::StorageType::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
{
currentRef = (*iter);
@@ -578,17 +581,15 @@ bool ThreatManager::isNeedUpdateToClient(uint32 time)
return false;
}
-// Reset all aggro without modifying the threadlist.
+// Reset all aggro without modifying the threatlist.
void ThreatManager::resetAllAggro()
{
- std::list<HostileReference*> &threatList = getThreatList();
+ ThreatContainer::StorageType &threatList = iThreatContainer.iThreatList;
if (threatList.empty())
return;
- for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
- {
+ for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
(*itr)->setThreat(0);
- }
setDirty(true);
}
diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h
index e5badcd24ce..665acd6d751 100755..100644
--- a/src/server/game/Combat/ThreatManager.h
+++ b/src/server/game/Combat/ThreatManager.h
@@ -142,39 +142,57 @@ class ThreatManager;
class ThreatContainer
{
- private:
- std::list<HostileReference*> iThreatList;
- bool iDirty;
- protected:
friend class ThreatManager;
- void remove(HostileReference* hostileRef) { iThreatList.remove(hostileRef); }
- void addReference(HostileReference* hostileRef) { iThreatList.push_back(hostileRef); }
- void clearReferences();
-
- // Sort the list if necessary
- void update();
public:
- ThreatContainer() { iDirty = false; }
+ typedef std::list<HostileReference*> StorageType;
+
+ ThreatContainer(): iDirty(false) { }
+
~ThreatContainer() { clearReferences(); }
HostileReference* addThreat(Unit* victim, float threat);
void modifyThreatPercent(Unit* victim, int32 percent);
- HostileReference* selectNextVictim(Creature* attacker, HostileReference* currentVictim);
+ HostileReference* selectNextVictim(Creature* attacker, HostileReference* currentVictim) const;
void setDirty(bool isDirty) { iDirty = isDirty; }
bool isDirty() const { return iDirty; }
- bool empty() const { return iThreatList.empty(); }
+ bool empty() const
+ {
+ return iThreatList.empty();
+ }
- HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }
+ HostileReference* getMostHated() const
+ {
+ return iThreatList.empty() ? NULL : iThreatList.front();
+ }
+
+ HostileReference* getReferenceByTarget(Unit* victim) const;
- HostileReference* getReferenceByTarget(Unit* victim);
+ StorageType const & getThreatList() const { return iThreatList; }
- std::list<HostileReference*>& getThreatList() { return iThreatList; }
+ private:
+ void remove(HostileReference* hostileRef)
+ {
+ iThreatList.remove(hostileRef);
+ }
+
+ void addReference(HostileReference* hostileRef)
+ {
+ iThreatList.push_back(hostileRef);
+ }
+
+ void clearReferences();
+
+ // Sort the list if necessary
+ void update();
+
+ StorageType iThreatList;
+ bool iDirty;
};
//=================================================
@@ -198,15 +216,15 @@ class ThreatManager
float getThreat(Unit* victim, bool alsoSearchOfflineList = false);
- bool isThreatListEmpty() { return iThreatContainer.empty(); }
+ bool isThreatListEmpty() const { return iThreatContainer.empty(); }
void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent);
bool isNeedUpdateToClient(uint32 time);
- HostileReference* getCurrentVictim() { return iCurrentVictim; }
+ HostileReference* getCurrentVictim() const { return iCurrentVictim; }
- Unit* getOwner() { return iOwner; }
+ Unit* getOwner() const { return iOwner; }
Unit* getHostilTarget();
@@ -223,11 +241,11 @@ class ThreatManager
// Reset all aggro of unit in threadlist satisfying the predicate.
template<class PREDICATE> void resetAggro(PREDICATE predicate)
{
- std::list<HostileReference*> &threatList = getThreatList();
+ ThreatContainer::StorageType &threatList = iThreatContainer.iThreatList;
if (threatList.empty())
return;
- for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+ for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
HostileReference* ref = (*itr);
@@ -241,8 +259,8 @@ class ThreatManager
// methods to access the lists from the outside to do some dirty manipulation (scriping and such)
// I hope they are used as little as possible.
- std::list<HostileReference*>& getThreatList() { return iThreatContainer.getThreatList(); }
- std::list<HostileReference*>& getOfflineThreatList() { return iThreatOfflineContainer.getThreatList(); }
+ ThreatContainer::StorageType const & getThreatList() const { return iThreatContainer.getThreatList(); }
+ ThreatContainer::StorageType const & getOfflineThreatList() const { return iThreatOfflineContainer.getThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; }
private:
@@ -273,4 +291,3 @@ namespace Trinity
};
}
#endif
-
diff --git a/src/server/game/Combat/UnitEvents.h b/src/server/game/Combat/UnitEvents.h
index 39c79b8273a..8d57ef6c59c 100755..100644
--- a/src/server/game/Combat/UnitEvents.h
+++ b/src/server/game/Combat/UnitEvents.h
@@ -49,7 +49,7 @@ enum UNIT_EVENT_TYPE
UEV_THREAT_SET_NEXT_TARGET = 1<<5,
// A new victim (target) was set. Could be NULL
- UEV_THREAT_VICTIM_CHANGED = 1<<6,
+ UEV_THREAT_VICTIM_CHANGED = 1<<6
// Future use
//UEV_UNIT_KILLED = 1<<7,
@@ -77,7 +77,6 @@ class UnitBaseEvent
bool matchesTypeMask(uint32 pMask) const { return iType & pMask; }
void setType(uint32 pType) { iType = pType; }
-
};
//==============================================================
@@ -124,8 +123,8 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
private:
ThreatContainer* iThreatContainer;
public:
- ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {}
- ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {}
+ ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(NULL) {}
+ ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(NULL) {}
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
@@ -134,4 +133,3 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
//==============================================================
#endif
-
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 9f534ab697d..37835618183 100755..100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -16,16 +16,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-#include "Player.h"
-#include "SpellAuras.h"
-#include "SpellMgr.h"
+#include "ConditionMgr.h"
+#include "AchievementMgr.h"
#include "GameEventMgr.h"
-#include "ObjectMgr.h"
#include "InstanceScript.h"
-#include "ConditionMgr.h"
-#include "ScriptMgr.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ReputationMgr.h"
#include "ScriptedCreature.h"
+#include "ScriptMgr.h"
+#include "SpellAuras.h"
+#include "SpellMgr.h"
#include "Spell.h"
// Checks if object meets the condition
@@ -84,7 +85,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case CONDITION_ACHIEVEMENT:
{
if (Player* player = object->ToPlayer())
- condMeets = player->GetAchievementMgr().HasAchieved(ConditionValue1);
+ condMeets = player->HasAchieved(ConditionValue1);
break;
}
case CONDITION_TEAM:
@@ -105,6 +106,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = unit->getRaceMask() & ConditionValue1;
break;
}
+ case CONDITION_GENDER:
+ {
+ if (Player* player = object->ToPlayer())
+ condMeets = player->getGender() == ConditionValue1;
+ break;
+ }
case CONDITION_SKILL:
{
if (Player* player = object->ToPlayer())
@@ -224,6 +231,9 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case RELATION_PASSENGER_OF:
condMeets = unit->IsOnVehicle(toUnit);
break;
+ case RELATION_CREATED_BY:
+ condMeets = unit->GetCreatorGUID() == toUnit->GetGUID();
+ break;
}
}
}
@@ -280,6 +290,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = player->HasTitle(ConditionValue1);
break;
}
+ case CONDITION_SPAWNMASK:
+ {
+ condMeets = ((1 << object->GetMap()->GetSpawnMode()) & ConditionValue1);
+ break;
+ }
default:
condMeets = false;
break;
@@ -431,6 +446,12 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_TITLE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
+ case CONDITION_SPAWNMASK:
+ mask |= GRID_MAP_TYPE_MASK_ALL;
+ break;
+ case CONDITION_GENDER:
+ mask |= GRID_MAP_TYPE_MASK_PLAYER;
+ break;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
@@ -451,6 +472,7 @@ uint32 Condition::GetMaxAvailableConditionTargets()
case CONDITION_SOURCE_TYPE_GOSSIP_MENU:
case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION:
case CONDITION_SOURCE_TYPE_SMART_EVENT:
+ case CONDITION_SOURCE_TYPE_NPC_VENDOR:
return 2;
default:
return 1;
@@ -601,7 +623,8 @@ bool ConditionMgr::CanHaveSourceGroupSet(ConditionSourceType sourceType) const
sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT ||
- sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
+ sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT ||
+ sourceType == CONDITION_SOURCE_TYPE_NPC_VENDOR);
}
bool ConditionMgr::CanHaveSourceIdSet(ConditionSourceType sourceType) const
@@ -628,7 +651,6 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
return spellCond;
}
-
ConditionList ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId)
{
ConditionList cond;
@@ -651,7 +673,7 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint
CreatureSpellConditionContainer::const_iterator itr = VehicleSpellConditionStore.find(creatureId);
if (itr != VehicleSpellConditionStore.end())
{
- ConditionTypeContainer::const_iterator i = (*itr).second.find(spellId);
+ ConditionTypeContainer::const_iterator i = (*itr).second.find(spellId);
if (i != (*itr).second.end())
{
cond = (*i).second;
@@ -677,6 +699,22 @@ ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32
return cond;
}
+ConditionList ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId)
+{
+ ConditionList cond;
+ NpcVendorConditionContainer::const_iterator itr = NpcVendorConditionContainerStore.find(creatureId);
+ if (itr != NpcVendorConditionContainerStore.end())
+ {
+ ConditionTypeContainer::const_iterator i = (*itr).second.find(itemId);
+ if (i != (*itr).second.end())
+ {
+ cond = (*i).second;
+ sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForNpcVendorEvent: found conditions for creature entry %u item %u", creatureId, itemId);
+ }
+ }
+ return cond;
+}
+
void ConditionMgr::LoadConditions(bool isReload)
{
uint32 oldMSTime = getMSTime();
@@ -686,7 +724,7 @@ void ConditionMgr::LoadConditions(bool isReload)
//must clear all custom handled cases (groupped types) before reload
if (isReload)
{
- sLog->outString("Reseting Loot Conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reseting Loot Conditions...");
LootTemplates_Creature.ResetConditions();
LootTemplates_Fishing.ResetConditions();
LootTemplates_Gameobject.ResetConditions();
@@ -700,21 +738,20 @@ void ConditionMgr::LoadConditions(bool isReload)
LootTemplates_Prospecting.ResetConditions();
LootTemplates_Spell.ResetConditions();
- sLog->outString("Re-Loading `gossip_menu` Table for Conditions!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table for Conditions!");
sObjectMgr->LoadGossipMenu();
- sLog->outString("Re-Loading `gossip_menu_option` Table for Conditions!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table for Conditions!");
sObjectMgr->LoadGossipMenuItems();
sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists();
}
QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, "
- " ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorTextId, ScriptName FROM conditions");
+ " ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ErrorTextId, ScriptName FROM conditions");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 conditions. DB table `conditions` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!");
return;
}
@@ -722,23 +759,23 @@ void ConditionMgr::LoadConditions(bool isReload)
do
{
-
Field* fields = result->Fetch();
Condition* cond = new Condition();
- int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
+ int32 iSourceTypeOrReferenceId = fields[0].GetInt32();
cond->SourceGroup = fields[1].GetUInt32();
- cond->SourceEntry = fields[2].GetUInt32();
+ cond->SourceEntry = fields[2].GetInt32();
cond->SourceId = fields[3].GetInt32();
cond->ElseGroup = fields[4].GetUInt32();
- int32 iConditionTypeOrReference = fields[5].GetInt32();
+ int32 iConditionTypeOrReference = fields[5].GetInt32();
cond->ConditionTarget = fields[6].GetUInt8();
cond->ConditionValue1 = fields[7].GetUInt32();
cond->ConditionValue2 = fields[8].GetUInt32();
cond->ConditionValue3 = fields[9].GetUInt32();
cond->NegativeCondition = fields[10].GetUInt8();
- cond->ErrorTextId = fields[11].GetUInt32();
- cond->ScriptId = sObjectMgr->GetScriptId(fields[12].GetCString());
+ cond->ErrorType = fields[11].GetUInt32();
+ cond->ErrorTextId = fields[12].GetUInt32();
+ cond->ScriptId = sObjectMgr->GetScriptId(fields[13].GetCString());
if (iConditionTypeOrReference >= 0)
cond->ConditionType = ConditionTypes(iConditionTypeOrReference);
@@ -750,7 +787,7 @@ void ConditionMgr::LoadConditions(bool isReload)
{
if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip
{
- sLog->outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId);
+ sLog->outError(LOG_FILTER_SQL, "Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId);
delete cond;
continue;
}
@@ -761,19 +798,19 @@ void ConditionMgr::LoadConditions(bool isReload)
rowType = "reference";
//check for useless data
if (cond->ConditionTarget)
- sLog->outErrorDb("Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget);
if (cond->ConditionValue1)
- sLog->outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1);
if (cond->ConditionValue2)
- sLog->outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3);
if (cond->NegativeCondition)
- sLog->outErrorDb("Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition);
if (cond->SourceGroup && iSourceTypeOrReferenceId < 0)
- sLog->outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup);
if (cond->SourceEntry && iSourceTypeOrReferenceId < 0)
- sLog->outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry);
}
else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType
{
@@ -804,17 +841,29 @@ void ConditionMgr::LoadConditions(bool isReload)
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType))
{
- sLog->outErrorDb("Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup);
delete cond;
continue;
}
if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType))
{
- sLog->outErrorDb("Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId);
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId);
delete cond;
continue;
}
+ if (cond->ErrorType && cond->SourceType != CONDITION_SOURCE_TYPE_SPELL)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType);
+ cond->ErrorType = 0;
+ }
+
+ if (cond->ErrorTextId && !cond->ErrorType)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId);
+ cond->ErrorTextId = 0;
+ }
+
if (cond->SourceGroup)
{
bool valid = false;
@@ -869,7 +918,6 @@ void ConditionMgr::LoadConditions(bool isReload)
valid = true;
++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting
- break;
}
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
valid = addToSpellImplicitTargetConditions(cond);
@@ -890,13 +938,20 @@ void ConditionMgr::LoadConditions(bool isReload)
++count;
continue;
}
+ case CONDITION_SOURCE_TYPE_NPC_VENDOR:
+ {
+ NpcVendorConditionContainerStore[cond->SourceGroup][cond->SourceEntry].push_back(cond);
+ valid = true;
+ ++count;
+ continue;
+ }
default:
break;
}
if (!valid)
{
- sLog->outErrorDb("Not handled grouped condition, SourceGroup %u", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "Not handled grouped condition, SourceGroup %u", cond->SourceGroup);
delete cond;
}
else
@@ -928,22 +983,22 @@ void ConditionMgr::LoadConditions(bool isReload)
}
while (result->NextRow());
- sLog->outString(">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot)
{
if (!loot)
{
- sLog->outErrorDb("ConditionMgr: LootTemplate %u not found", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "ConditionMgr: LootTemplate %u not found", cond->SourceGroup);
return false;
}
if (loot->addConditionItem(cond))
return true;
- sLog->outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -963,7 +1018,7 @@ bool ConditionMgr::addToGossipMenus(Condition* cond)
}
}
- sLog->outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "addToGossipMenus: GossipMenu %u not found", cond->SourceGroup);
return false;
}
@@ -982,7 +1037,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
}
}
- sLog->outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry);
return false;
}
@@ -1037,7 +1092,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
// we have overlapping masks in db
if (conditionEffMask != *itr)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - "
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - "
"effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -1062,7 +1117,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX)
{
- sLog->outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType));
+ sLog->outError(LOG_FILTER_SQL, "Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType));
return false;
}
@@ -1072,7 +1127,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1080,7 +1135,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1089,7 +1144,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Disenchant.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1097,7 +1152,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1106,7 +1161,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Fishing.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1114,7 +1169,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1123,7 +1178,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Gameobject.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1131,7 +1186,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1140,7 +1195,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Item.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1148,7 +1203,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1157,7 +1212,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Mail.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1165,7 +1220,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1174,7 +1229,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Milling.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1182,7 +1237,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1191,7 +1246,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Pickpocketing.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1199,7 +1254,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1208,7 +1263,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Prospecting.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1216,7 +1271,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1225,7 +1280,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Reference.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1233,7 +1288,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1242,7 +1297,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Skinning.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1250,7 +1305,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1259,7 +1314,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!LootTemplates_Spell.HaveLootFor(cond->SourceGroup))
{
- sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup);
return false;
}
@@ -1267,7 +1322,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry);
if (!pItemProto && !loot->isReference(cond->SourceEntry))
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry);
return false;
}
break;
@@ -1277,13 +1332,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry);
if (!spellInfo)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -1314,7 +1369,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
break;
}
- sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
cond->SourceGroup &= ~(1<<i);
}
// all effects were removed, no need to add the condition at all
@@ -1326,7 +1381,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (!sObjectMgr->GetCreatureTemplate(cond->SourceEntry))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry);
return false;
}
break;
@@ -1336,7 +1391,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry);
if (!spellProto)
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
break;
@@ -1344,43 +1399,58 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
case CONDITION_SOURCE_TYPE_QUEST_ACCEPT:
if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry))
{
- sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry);
return false;
}
break;
case CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK:
if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry))
{
- sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry);
return false;
}
break;
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL:
if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
return false;
}
if (!sSpellMgr->GetSpellInfo(cond->SourceEntry))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
break;
case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT:
if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
return false;
}
if (!sSpellMgr->GetSpellInfo(cond->SourceEntry))
{
- sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
break;
+ case CONDITION_SOURCE_TYPE_NPC_VENDOR:
+ {
+ if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
+ {
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup);
+ return false;
+ }
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(cond->SourceEntry);
+ if (!itemTemplate)
+ {
+ sLog->outError(LOG_FILTER_SQL, "SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceEntry);
+ return false;
+ }
+ break;
+ }
case CONDITION_SOURCE_TYPE_GOSSIP_MENU:
case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION:
case CONDITION_SOURCE_TYPE_SMART_EVENT:
@@ -1391,17 +1461,18 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
return true;
}
+
bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX)
{
- sLog->outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry);
return false;
}
if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry);
+ sLog->outError(LOG_FILTER_SQL, "SourceType %u, SourceEntry %u, SourceGroup %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry, cond->SourceGroup);
return false;
}
@@ -1411,17 +1482,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1))
{
- sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 > EFFECT_2)
{
- sLog->outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Aura condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Aura condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ITEM:
@@ -1429,13 +1500,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1);
if (!proto)
{
- sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Item condition has non existing item (%u), skipped", cond->ConditionValue1);
return false;
}
if (!cond->ConditionValue2)
{
- sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2);
return false;
}
break;
@@ -1445,14 +1516,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1);
if (!proto)
{
- sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ZONEID:
@@ -1460,20 +1531,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->ConditionValue1);
if (!areaEntry)
{
- sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1);
return false;
}
if (areaEntry->zone != 0)
{
- sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_REPUTATION_RANK:
@@ -1481,25 +1552,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->ConditionValue1);
if (!factionEntry)
{
- sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TEAM:
{
if (cond->ConditionValue1 != ALLIANCE && cond->ConditionValue1 != HORDE)
{
- sLog->outErrorDb("Team condition specifies unknown team (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Team condition specifies unknown team (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Team condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Team condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_SKILL:
@@ -1507,17 +1578,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->ConditionValue1);
if (!pSkill)
{
- sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 < 1 || cond->ConditionValue2 > sWorld->GetConfigMaxSkillValue())
{
- sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Skill condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_QUESTREWARDED:
@@ -1527,14 +1598,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1))
{
- sLog->outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 > 1)
- sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Quest condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Quest condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ACTIVE_EVENT:
@@ -1542,57 +1613,71 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
if (cond->ConditionValue1 >=events.size() || !events[cond->ConditionValue1].isValid())
{
- sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_ACHIEVEMENT:
{
- AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1);
+ AchievementEntry const* achievement = sAchievementMgr->GetAchievement(cond->ConditionValue1);
if (!achievement)
{
- sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_CLASS:
{
if (!(cond->ConditionValue1 & CLASSMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE);
+ sLog->outError(LOG_FILTER_SQL, "Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Class condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Class condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_RACE:
{
if (!(cond->ConditionValue1 & RACEMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE);
+ sLog->outError(LOG_FILTER_SQL, "Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ break;
+ }
+ case CONDITION_GENDER:
+ {
+ if (!Player::IsValidGender(uint8(cond->ConditionValue1)))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has invalid gender (%u), skipped", cond->ConditionValue1);
+ return false;
+ }
+
+ if (cond->ConditionValue2)
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ if (cond->ConditionValue3)
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_MAPID:
@@ -1600,77 +1685,77 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1);
if (!me)
{
- sLog->outErrorDb("Map condition has non existing map (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Map condition has non existing map (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Map condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Map condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_SPELL:
{
if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1))
{
- sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_LEVEL:
{
if (cond->ConditionValue2 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Level condition has invalid option (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Level condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_DRUNKENSTATE:
{
if (cond->ConditionValue1 > DRUNKEN_SMASHED)
{
- sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2)
{
- sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_NEAR_CREATURE:
{
if (!sObjectMgr->GetCreatureTemplate(cond->ConditionValue1))
{
- sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_NEAR_GAMEOBJECT:
{
if (!sObjectMgr->GetGameObjectTemplate(cond->ConditionValue1))
{
- sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_OBJECT_ENTRY:
@@ -1680,79 +1765,79 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
case TYPEID_UNIT:
if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2))
{
- sLog->outErrorDb("ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2);
return false;
}
break;
case TYPEID_GAMEOBJECT:
if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2))
{
- sLog->outErrorDb("ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2);
return false;
}
break;
case TYPEID_PLAYER:
case TYPEID_CORPSE:
if (cond->ConditionValue2)
- sLog->outErrorDb("ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2);
break;
default:
- sLog->outErrorDb("ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TYPE_MASK:
{
if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE)))
{
- sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue2)
- sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_RELATION_TO:
{
if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue1 == cond->ConditionTarget)
{
- sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 >= RELATION_MAX)
{
- sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_REACTION_TO:
{
if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue1 == cond->ConditionTarget)
{
- sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
return false;
}
if (!cond->ConditionValue2)
{
- sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2);
return false;
}
break;
@@ -1761,17 +1846,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets())
{
- sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue1 == cond->ConditionTarget)
{
- sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3);
return false;
}
break;
@@ -1779,38 +1864,38 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
case CONDITION_ALIVE:
{
if (cond->ConditionValue1)
- sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value1 (%u)!", cond->ConditionValue1);
if (cond->ConditionValue2)
- sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Alive condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_HP_VAL:
{
if (cond->ConditionValue2 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_HP_PCT:
{
if (cond->ConditionValue1 > 100)
{
- sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue2 >= COMP_TYPE_MAX)
{
- sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_AREAID:
@@ -1820,19 +1905,19 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
if (!sWorld->getWorldState(cond->ConditionValue1))
{
- sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1);
return false;
}
if (cond->ConditionValue3)
- sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "World state condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_PHASEMASK:
{
if (cond->ConditionValue2)
- sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ sLog->outError(LOG_FILTER_SQL, "Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2);
if (cond->ConditionValue3)
- sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ sLog->outError(LOG_FILTER_SQL, "Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_TITLE:
@@ -1840,22 +1925,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1);
if (!titleEntry)
{
- sLog->outErrorDb("Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1);
+ sLog->outError(LOG_FILTER_SQL, "Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1);
+ return false;
+ }
+ break;
+ }
+ case CONDITION_SPAWNMASK:
+ {
+ if (cond->ConditionValue1 > SPAWNMASK_RAID_ALL)
+ {
+ sLog->outError(LOG_FILTER_SQL, "SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1);
return false;
}
break;
}
- case CONDITION_UNUSED_19:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring");
- return false;
- case CONDITION_UNUSED_20:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_20 in `conditions` table - ignoring");
- return false;
case CONDITION_UNUSED_21:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring");
+ sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_21 in `conditions` table - ignoring");
return false;
case CONDITION_UNUSED_24:
- sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring");
+ sLog->outError(LOG_FILTER_SQL, "Found ConditionTypeOrReference = CONDITION_UNUSED_24 in `conditions` table - ignoring");
return false;
default:
break;
@@ -1926,6 +2014,19 @@ void ConditionMgr::Clean()
SpellClickEventConditionStore.clear();
+ for (NpcVendorConditionContainer::iterator itr = NpcVendorConditionContainerStore.begin(); itr != NpcVendorConditionContainerStore.end(); ++itr)
+ {
+ for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
+ {
+ for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
+ delete *i;
+ it->second.clear();
+ }
+ itr->second.clear();
+ }
+
+ NpcVendorConditionContainerStore.clear();
+
// this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;)
for (std::list<Condition*>::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr)
delete *itr;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 130a23a0cb0..807b75c4ee6 100755..100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -19,8 +19,11 @@
#ifndef TRINITY_CONDITIONMGR_H
#define TRINITY_CONDITIONMGR_H
-#include "LootMgr.h"
+#include "Define.h"
+#include "Errors.h"
#include <ace/Singleton.h>
+#include <list>
+#include <map>
class Player;
class Unit;
@@ -49,8 +52,8 @@ enum ConditionTypes
CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete
CONDITION_TITLE = 18, // title id 0 0 true if player has title
- CONDITION_UNUSED_19 = 19, //
- CONDITION_UNUSED_20 = 20, //
+ CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask
+ CONDITION_GENDER = 20, // gender 0 0 true if player's gender is equal to gender
CONDITION_UNUSED_21 = 21, //
CONDITION_MAPID = 22, // map_id 0 0 true if in map_id
CONDITION_AREAID = 23, // area_id 0 0 true if in area_id
@@ -124,7 +127,8 @@ enum ConditionSourceType
CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK = 20,
CONDITION_SOURCE_TYPE_VEHICLE_SPELL = 21,
CONDITION_SOURCE_TYPE_SMART_EVENT = 22,
- CONDITION_SOURCE_TYPE_MAX = 23 //MAX
+ CONDITION_SOURCE_TYPE_NPC_VENDOR = 23,
+ CONDITION_SOURCE_TYPE_MAX = 24 // MAX
};
enum ComparisionType
@@ -144,12 +148,13 @@ enum RelationType
RELATION_IN_RAID_OR_PARTY,
RELATION_OWNED_BY,
RELATION_PASSENGER_OF,
+ RELATION_CREATED_BY,
RELATION_MAX
};
enum
{
- MAX_CONDITION_TARGETS = 3,
+ MAX_CONDITION_TARGETS = 3
};
struct ConditionSourceInfo
@@ -176,6 +181,7 @@ struct Condition
uint32 ConditionValue1;
uint32 ConditionValue2;
uint32 ConditionValue3;
+ uint32 ErrorType;
uint32 ErrorTextId;
uint32 ReferenceId;
uint32 ScriptId;
@@ -194,6 +200,7 @@ struct Condition
ConditionValue2 = 0;
ConditionValue3 = 0;
ReferenceId = 0;
+ ErrorType = 0;
ErrorTextId = 0;
ScriptId = 0;
NegativeCondition = false;
@@ -209,6 +216,7 @@ typedef std::list<Condition*> ConditionList;
typedef std::map<uint32, ConditionList> ConditionTypeContainer;
typedef std::map<ConditionSourceType, ConditionTypeContainer> ConditionContainer;
typedef std::map<uint32, ConditionTypeContainer> CreatureSpellConditionContainer;
+typedef std::map<uint32, ConditionTypeContainer> NpcVendorConditionContainer;
typedef std::map<std::pair<int32, uint32 /*SAI source_type*/>, ConditionTypeContainer> SmartEventConditionContainer;
typedef std::map<uint32, ConditionList> ConditionReferenceContainer;//only used for references
@@ -236,6 +244,7 @@ class ConditionMgr
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
+ ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
private:
bool isSourceTypeValid(Condition* cond);
@@ -252,6 +261,7 @@ class ConditionMgr
ConditionReferenceContainer ConditionReferenceStore;
CreatureSpellConditionContainer VehicleSpellConditionStore;
CreatureSpellConditionContainer SpellClickEventConditionStore;
+ NpcVendorConditionContainer NpcVendorConditionContainerStore;
SmartEventConditionContainer SmartEventConditionStore;
};
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index d7a769d3f5c..b544e966084 100755..100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -17,10 +17,12 @@
*/
#include "DisableMgr.h"
+#include "AchievementMgr.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "SpellMgr.h"
#include "VMapManager2.h"
+#include "Player.h"
namespace DisableMgr
{
@@ -59,8 +61,7 @@ void LoadDisables()
if (!result)
{
- sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!");
return;
}
@@ -71,7 +72,7 @@ void LoadDisables()
DisableType type = DisableType(fields[0].GetUInt32());
if (type >= MAX_DISABLE_TYPES)
{
- sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type);
+ sLog->outError(LOG_FILTER_SQL, "Invalid type %u specified in `disables` table, skipped.", type);
continue;
}
@@ -88,26 +89,26 @@ void LoadDisables()
case DISABLE_TYPE_SPELL:
if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
{
- sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
{
- sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags for spell %u are invalid, skipped.", entry);
continue;
}
if (flags & SPELL_DISABLE_MAP)
{
- Tokens tokens(params_0, ',');
+ Tokenizer tokens(params_0, ',');
for (uint8 i = 0; i < tokens.size(); )
data.params[0].insert(atoi(tokens[i++]));
}
if (flags & SPELL_DISABLE_AREA)
{
- Tokens tokens(params_1, ',');
+ Tokenizer tokens(params_1, ',');
for (uint8 i = 0; i < tokens.size(); )
data.params[1].insert(atoi(tokens[i++]));
}
@@ -121,7 +122,7 @@ void LoadDisables()
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
{
- sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
bool isFlagInvalid = false;
@@ -134,20 +135,22 @@ void LoadDisables()
case MAP_INSTANCE:
case MAP_RAID:
if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC))
- isFlagInvalid = true;
- else if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC))
- isFlagInvalid = true;
- else if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC))
+ flags -= DUNGEON_STATUSFLAG_HEROIC;
+ if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC))
+ flags -= RAID_STATUSFLAG_10MAN_HEROIC;
+ if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC))
+ flags -= RAID_STATUSFLAG_25MAN_HEROIC;
+ if (!flags)
isFlagInvalid = true;
break;
case MAP_BATTLEGROUND:
case MAP_ARENA:
- sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Battleground map %u specified to be disabled in map case, skipped.", entry);
continue;
}
if (isFlagInvalid)
{
- sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags for map %u are invalid, skipped.", entry);
continue;
}
break;
@@ -155,64 +158,64 @@ void LoadDisables()
case DISABLE_TYPE_BATTLEGROUND:
if (!sBattlemasterListStore.LookupEntry(entry))
{
- sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
- sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for battleground %u, useless data.", entry);
break;
case DISABLE_TYPE_OUTDOORPVP:
if (entry > MAX_OUTDOORPVP_TYPES)
{
- sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
continue;
}
if (flags)
- sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for outdoor PvP %u, useless data.", entry);
break;
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
- if (!sAchievementCriteriaStore.LookupEntry(entry))
+ if (!sAchievementMgr->GetAchievementCriteria(entry))
{
- sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
- sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for Achievement Criteria %u, useless data.", entry);
break;
case DISABLE_TYPE_VMAP:
{
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
{
- sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
switch (mapEntry->map_type)
{
case MAP_COMMON:
if (flags & VMAP_DISABLE_AREAFLAG)
- sLog->outString("Areaflag disabled for world map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Areaflag disabled for world map %u.", entry);
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
- sLog->outString("Liquid status disabled for world map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Liquid status disabled for world map %u.", entry);
break;
case MAP_INSTANCE:
case MAP_RAID:
if (flags & VMAP_DISABLE_HEIGHT)
- sLog->outString("Height disabled for instance map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for instance map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
- sLog->outString("LoS disabled for instance map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for instance map %u.", entry);
break;
case MAP_BATTLEGROUND:
if (flags & VMAP_DISABLE_HEIGHT)
- sLog->outString("Height disabled for battleground map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for battleground map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
- sLog->outString("LoS disabled for battleground map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for battleground map %u.", entry);
break;
case MAP_ARENA:
if (flags & VMAP_DISABLE_HEIGHT)
- sLog->outString("Height disabled for arena map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for arena map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
- sLog->outString("LoS disabled for arena map %u.", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for arena map %u.", entry);
break;
default:
break;
@@ -228,8 +231,7 @@ void LoadDisables()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
}
void CheckQuestDisables()
@@ -239,8 +241,7 @@ void CheckQuestDisables()
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
if (!count)
{
- sLog->outString(">> Checked 0 quest disables.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables.");
return;
}
@@ -250,17 +251,16 @@ void CheckQuestDisables()
const uint32 entry = itr->first;
if (!sObjectMgr->GetQuestTemplate(entry))
{
- sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Quest entry %u from `disables` doesn't exist, skipped.", entry);
m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++);
continue;
}
if (itr->second.flags)
- sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Disable flags specified for quest %u, useless data.", entry);
++itr;
}
- sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)
diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h
index 0f9310ace3b..b1bb43315bd 100755..100644
--- a/src/server/game/Conditions/DisableMgr.h
+++ b/src/server/game/Conditions/DisableMgr.h
@@ -31,7 +31,7 @@ enum DisableType
DISABLE_TYPE_BATTLEGROUND = 3,
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4,
DISABLE_TYPE_OUTDOORPVP = 5,
- DISABLE_TYPE_VMAP = 6,
+ DISABLE_TYPE_VMAP = 6
};
enum SpellDisableTypes
@@ -43,7 +43,7 @@ enum SpellDisableTypes
SPELL_DISABLE_MAP = 0x10,
SPELL_DISABLE_AREA = 0x20,
MAX_SPELL_DISABLE_TYPE = ( SPELL_DISABLE_PLAYER | SPELL_DISABLE_CREATURE | SPELL_DISABLE_PET |
- SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA),
+ SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA)
};
enum VmapDisableTypes
@@ -51,7 +51,7 @@ enum VmapDisableTypes
VMAP_DISABLE_AREAFLAG = 0x1,
VMAP_DISABLE_HEIGHT = 0x2,
VMAP_DISABLE_LOS = 0x4,
- VMAP_DISABLE_LIQUIDSTATUS = 0x8,
+ VMAP_DISABLE_LIQUIDSTATUS = 0x8
};
namespace DisableMgr
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index e73480cb4de..fa6b5f0695f 100755..100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -19,18 +19,21 @@
#ifndef DBCENUMS_H
#define DBCENUMS_H
-// Client expected level limitation, like as used in DBC item max levels for "until max player level"
-// use as default max player level, must be fit max level for used client
-// also see MAX_LEVEL and STRONG_MAX_LEVEL define
-#define DEFAULT_MAX_LEVEL 80
-
-// client supported max level for player/pets/etc. Avoid overflow or client stability affected.
-// also see GT_MAX_LEVEL define
-#define MAX_LEVEL 100
-
-// Server side limitation. Base at used code requirements.
-// also see MAX_LEVEL and GT_MAX_LEVEL define
-#define STRONG_MAX_LEVEL 255
+enum LevelLimit
+{
+ // Client expected level limitation, like as used in DBC item max levels for "until max player level"
+ // use as default max player level, must be fit max level for used client
+ // also see MAX_LEVEL and STRONG_MAX_LEVEL define
+ DEFAULT_MAX_LEVEL = 80,
+
+ // client supported max level for player/pets/etc. Avoid overflow or client stability affected.
+ // also see GT_MAX_LEVEL define
+ MAX_LEVEL = 100,
+
+ // Server side limitation. Base at used code requirements.
+ // also see MAX_LEVEL and GT_MAX_LEVEL define
+ STRONG_MAX_LEVEL = 255,
+};
enum BattlegroundBracketId // bracketId for level ranges
{
@@ -53,21 +56,21 @@ enum AchievementFaction
{
ACHIEVEMENT_FACTION_HORDE = 0,
ACHIEVEMENT_FACTION_ALLIANCE = 1,
- ACHIEVEMENT_FACTION_ANY = -1,
+ ACHIEVEMENT_FACTION_ANY = -1
};
enum AchievementFlags
{
- ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // Just count statistic (never stop and complete)
- ACHIEVEMENT_FLAG_HIDDEN = 0x00000002, // Not sent to client - internal use only
- ACHIEVEMENT_FLAG_STORE_MAX_VALUE = 0x00000004, // Store only max value? used only in "Reach level xx"
- ACHIEVEMENT_FLAG_SUMM = 0x00000008, // Use summ criteria value from all reqirements (and calculate max value)
- ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // Show max criteria (and calculate max value ??)
- ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // Use not zero req count (and calculate max value)
- ACHIEVEMENT_FLAG_AVERAGE = 0x00000040, // Show as average value (value / time_in_days) depend from other flag (by def use last criteria value)
- ACHIEVEMENT_FLAG_BAR = 0x00000080, // Show as progress bar (value / max vale) depend from other flag (by def use last criteria value)
- ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, //
- ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200, //
+ ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // Just count statistic (never stop and complete)
+ ACHIEVEMENT_FLAG_HIDDEN = 0x00000002, // Not sent to client - internal use only
+ ACHIEVEMENT_FLAG_STORE_MAX_VALUE = 0x00000004, // Store only max value? used only in "Reach level xx"
+ ACHIEVEMENT_FLAG_SUMM = 0x00000008, // Use summ criteria value from all requirements (and calculate max value)
+ ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // Show max criteria (and calculate max value ??)
+ ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // Use not zero req count (and calculate max value)
+ ACHIEVEMENT_FLAG_AVERAGE = 0x00000040, // Show as average value (value / time_in_days) depend from other flag (by def use last criteria value)
+ ACHIEVEMENT_FLAG_BAR = 0x00000080, // Show as progress bar (value / max vale) depend from other flag (by def use last criteria value)
+ ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, //
+ ACHIEVEMENT_FLAG_REALM_FIRST_KILL = 0x00000200 //
};
#define MAX_CRITERIA_REQUIREMENTS 2
@@ -76,12 +79,12 @@ enum AchievementCriteriaCondition
{
ACHIEVEMENT_CRITERIA_CONDITION_NONE = 0,
ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH = 1, // reset progress on death
- ACHIEVEMENT_CRITERIA_CONDITION_UNK1 = 2, // only used in "Complete a daily quest every day for five consecutive days"
+ ACHIEVEMENT_CRITERIA_CONDITION_UNK2 = 2, // only used in "Complete a daily quest every day for five consecutive days"
ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP = 3, // requires you to be on specific map, reset at change
ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE = 4, // only used in "Win 10 arenas without losing"
ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT = 9, // requires the player not to be hit by specific spell
ACHIEVEMENT_CRITERIA_CONDITION_NOT_IN_GROUP = 10, // requires the player not to be in group
- ACHIEVEMENT_CRITERIA_CONDITION_UNK3 = 13, // unk
+ ACHIEVEMENT_CRITERIA_CONDITION_UNK13 = 13 // unk
};
enum AchievementCriteriaFlags
@@ -91,7 +94,7 @@ enum AchievementCriteriaFlags
ACHIEVEMENT_CRITERIA_FLAG_UNK3 = 0x00000004, // BG related??
ACHIEVEMENT_CRITERIA_FLAG_UNK4 = 0x00000008, //
ACHIEVEMENT_CRITERIA_FLAG_UNK5 = 0x00000010, // not used
- ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020, // Displays counter as money
+ ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER = 0x00000020 // Displays counter as money
};
enum AchievementCriteriaTimedTypes
@@ -103,132 +106,120 @@ enum AchievementCriteriaTimedTypes
ACHIEVEMENT_TIMED_TYPE_CREATURE = 7, // Timer is started by killing creature with entry in timerStartEvent
ACHIEVEMENT_TIMED_TYPE_ITEM = 9, // Timer is started by using item with entry in timerStartEvent
- ACHIEVEMENT_TIMED_TYPE_MAX,
+ ACHIEVEMENT_TIMED_TYPE_MAX
};
enum AchievementCriteriaTypes
{
- ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0,
- ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1,
- ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5,
- ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9,
- // you have to complete a daily quest x times in a row
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11,
- ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE = 13,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND= 15,
- ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP= 16,
- ACHIEVEMENT_CRITERIA_TYPE_DEATH= 17,
- ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON = 18,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19,
- ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20,
- ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER = 23,
- ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24,
- ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM = 26,
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27,
- ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28,
- ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL= 29,
- ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE = 30,
- ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31,
- ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32,
- ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33,
- ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34,
- ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL = 35,
- ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36,
- // TODO: the archievements 1162 and 1163 requires a special rating which can't be found in the dbc
- ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING = 39,
- ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40,
- ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41,
- ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM= 42,
- ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43,
- ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK= 44,
- ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT= 45,
- ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION= 46,
- ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION= 47,
- // noted: rewarded as soon as the player payed, not at taking place at the seat
- ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP= 48,
- ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49,
- // TODO: itemlevel is mentioned in text but not present in dbc
- ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50,
- ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT= 51,
- ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52,
- ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53,
- ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54,
- ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE = 55,
- // TODO: in some cases map not present, and in some cases need do without die
- ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS = 56,
- ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57,
- ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS = 59,
- ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS = 60,
- ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS = 61,
- ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD = 62,
- ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING = 63,
- ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER = 65,
- ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL = 66,
- ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67,
- ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68,
- ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2= 69,
- ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL= 70,
- ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72,
- // TODO: title id is not mentioned in dbc
- ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE = 74,
- ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS= 75,
- ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76,
- ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL = 77,
- // TODO: creature type (demon, undead etc.) is not stored in dbc
- ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE = 78,
- ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS= 80,
- ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION= 82,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID= 83,
- ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS= 84,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD = 85,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED = 86,
- ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION = 87,
- ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION = 88,
- ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS = 89,
- ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM = 90,
- ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM = 91,
- ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED = 93,
- ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED = 94,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH = 95,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR = 99,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT = 101,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED = 102,
- ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED = 103,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED = 104,
- ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED = 105,
- ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED = 106,
- ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED = 107,
- ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN = 108,
- ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109,
- // TODO: target entry is missing
- ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110,
- ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE= 112,
- ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113,
- ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114,
- // 0..115 => 116 criteria types total
- ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115,
+ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE = 0,
+ ACHIEVEMENT_CRITERIA_TYPE_WIN_BG = 1,
+ ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL = 5,
+ ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL = 7,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT = 8,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT = 9,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY = 10, // you have to complete a daily quest x times in a row
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE = 11,
+ ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE = 13,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST = 14,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND = 15,
+ ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP = 16,
+ ACHIEVEMENT_CRITERIA_TYPE_DEATH = 17,
+ ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON = 18,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_RAID = 19,
+ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE = 20,
+ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER = 23,
+ ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING = 24,
+ ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM = 26,
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST = 27,
+ ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET = 28,
+ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL = 29,
+ ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE = 30,
+ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA = 31,
+ ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32,
+ ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33,
+ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL = 34,
+ ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL = 35,
+ ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM = 36,
+ ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA = 37,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_TEAM_RATING = 38,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_PERSONAL_RATING = 39,
+ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL = 40,
+ ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM = 41,
+ ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM = 42,
+ ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA = 43,
+ ACHIEVEMENT_CRITERIA_TYPE_OWN_RANK = 44,
+ ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT = 45,
+ ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION = 46,
+ ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION = 47,
+ ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP = 48,
+ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM = 49,
+ ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT = 50, // TODO: itemlevel is mentioned in text but not present in dbc
+ ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT = 51,
+ ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS = 52,
+ ACHIEVEMENT_CRITERIA_TYPE_HK_RACE = 53,
+ ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE = 54,
+ ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE = 55,
+ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS = 56, // TODO: in some cases map not present, and in some cases need do without die
+ ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM = 57,
+ ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS = 59,
+ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS = 60,
+ ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS = 61,
+ ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD = 62,
+ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING = 63,
+ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER = 65,
+ ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL = 66,
+ ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY = 67,
+ ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT = 68,
+ ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2 = 69,
+ ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL = 70,
+ ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT = 72,
+ // TODO 73: Achievements 1515, 1241, 1103 (Name: Mal'Ganis)
+ ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE = 74, // TODO: title id is not mentioned in dbc
+ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS = 75,
+ ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL = 76,
+ ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL = 77,
+ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE = 78,
+ ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS = 80,
+ ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION = 82,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID = 83,
+ ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS = 84,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD = 85,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_GOLD_VALUE_OWNED = 86,
+ ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION = 87,
+ ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION = 88,
+ ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS = 89,
+ ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM = 90,
+ ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM = 91,
+ ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED = 93,
+ ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED = 94,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH = 95,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_POWER = 96,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_STAT = 97,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER = 98,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR = 99,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_RATING = 100,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT = 101,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED = 102,
+ ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED = 103,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED = 104,
+ ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED = 105,
+ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED = 106,
+ ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED = 107,
+ ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN = 108,
+ ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE = 109,
+ ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2 = 110, // TODO: target entry is missing
+ ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE = 112,
+ ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL = 113,
+ ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS = 114,
+ ACHIEVEMENT_CRITERIA_TYPE_EARN_ACHIEVEMENT_POINTS = 115,
ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS = 119,
- // 120
- // 121
- // 122
- // 123
- // 0..123 => 124 criteria types total
- ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124,
};
+#define ACHIEVEMENT_CRITERIA_TYPE_TOTAL 120
+
enum AchievementCategory
{
- CATEGORY_CHILDRENS_WEEK = 163,
+ CATEGORY_CHILDRENS_WEEK = 163
};
enum AreaFlags
@@ -275,7 +266,7 @@ enum Difficulty
RAID_DIFFICULTY_10MAN_NORMAL = 0,
RAID_DIFFICULTY_25MAN_NORMAL = 1,
RAID_DIFFICULTY_10MAN_HEROIC = 2,
- RAID_DIFFICULTY_25MAN_HEROIC = 3,
+ RAID_DIFFICULTY_25MAN_HEROIC = 3
};
#define RAID_DIFFICULTY_MASK_25MAN 1 // since 25man difficulties are 1 and 3, we can check them like that
@@ -286,7 +277,7 @@ enum Difficulty
enum SpawnMask
{
- SPAWNMASK_CONTINENT = (1 << REGULAR_DIFFICULTY), // any any maps without spawn modes
+ SPAWNMASK_CONTINENT = (1 << REGULAR_DIFFICULTY), // any maps without spawn modes
SPAWNMASK_DUNGEON_NORMAL = (1 << DUNGEON_DIFFICULTY_NORMAL),
SPAWNMASK_DUNGEON_HEROIC = (1 << DUNGEON_DIFFICULTY_HEROIC),
@@ -300,14 +291,14 @@ enum SpawnMask
SPAWNMASK_RAID_25MAN_HEROIC = (1 << RAID_DIFFICULTY_25MAN_HEROIC),
SPAWNMASK_RAID_HEROIC_ALL = (SPAWNMASK_RAID_10MAN_HEROIC | SPAWNMASK_RAID_25MAN_HEROIC),
- SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL),
+ SPAWNMASK_RAID_ALL = (SPAWNMASK_RAID_NORMAL_ALL | SPAWNMASK_RAID_HEROIC_ALL)
};
enum FactionTemplateFlags
{
FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP
FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats
- FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000,
+ FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000
};
enum FactionMasks
@@ -349,19 +340,19 @@ enum ItemEnchantmentType
enum ItemLimitCategoryMode
{
- ITEM_LIMIT_CATEGORY_MODE_HAVE = 0, // limit applied to amount items in inventory/bank
- ITEM_LIMIT_CATEGORY_MODE_EQUIP = 1, // limit applied to amount equipped items (including used gems)
+ ITEM_LIMIT_CATEGORY_MODE_HAVE = 0, // limit applied to amount items in inventory/bank
+ ITEM_LIMIT_CATEGORY_MODE_EQUIP = 1 // limit applied to amount equipped items (including used gems)
};
enum TotemCategoryType
{
- TOTEM_CATEGORY_TYPE_KNIFE = 1,
- TOTEM_CATEGORY_TYPE_TOTEM = 2,
- TOTEM_CATEGORY_TYPE_ROD = 3,
- TOTEM_CATEGORY_TYPE_PICK = 21,
- TOTEM_CATEGORY_TYPE_STONE = 22,
- TOTEM_CATEGORY_TYPE_HAMMER = 23,
- TOTEM_CATEGORY_TYPE_SPANNER = 24
+ TOTEM_CATEGORY_TYPE_KNIFE = 1,
+ TOTEM_CATEGORY_TYPE_TOTEM = 2,
+ TOTEM_CATEGORY_TYPE_ROD = 3,
+ TOTEM_CATEGORY_TYPE_PICK = 21,
+ TOTEM_CATEGORY_TYPE_STONE = 22,
+ TOTEM_CATEGORY_TYPE_HAMMER = 23,
+ TOTEM_CATEGORY_TYPE_SPANNER = 24
};
// SummonProperties.dbc, col 1
@@ -411,7 +402,7 @@ enum SummonPropFlags
SUMMON_PROP_FLAG_UNK13 = 0x00001000, // Lightwell, Jeeves, Gnomish Alarm-o-bot, Build vehicles(wintergrasp)
SUMMON_PROP_FLAG_UNK14 = 0x00002000, // Guides, player follows
SUMMON_PROP_FLAG_UNK15 = 0x00004000, // Force of Nature, Shadowfiend, Feral Spirit, Summon Water Elemental
- SUMMON_PROP_FLAG_UNK16 = 0x00008000, // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
+ SUMMON_PROP_FLAG_UNK16 = 0x00008000 // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
};
enum VehicleSeatFlags
@@ -436,7 +427,7 @@ enum VehicleSeatFlags
VEHICLE_SEAT_FLAG_HAS_START_WARITING_FOR_VEH_TRANSITION_ANIM_EXIT = 0x10000000,
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
VEHICLE_SEAT_FLAG_UNK2 = 0x40000000, // checked in conjunction with 0x800 in CastSpell2
- VEHICLE_SEAT_FLAG_ALLOWS_INTERACTION = 0x80000000,
+ VEHICLE_SEAT_FLAG_ALLOWS_INTERACTION = 0x80000000
};
enum VehicleSeatFlagsB
@@ -449,7 +440,7 @@ enum VehicleSeatFlagsB
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_4 = 0x02000000,
VEHICLE_SEAT_FLAG_B_CAN_SWITCH = 0x04000000,
- VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
+ VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000 // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
#endif
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 4be6c33db79..b74c8a4d1f5 100755..100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -17,11 +17,9 @@
*/
#include "DBCStores.h"
-
#include "Log.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
-
#include "DBCfmt.h"
#include <map>
@@ -200,7 +198,7 @@ uint32 DBCFileCount = 0;
static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename)
{
- sLog->outError("Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
+ sLog->outError(LOG_FILTER_GENERAL, "Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
// ASSERT must fail after function call
return false;
@@ -457,7 +455,7 @@ void LoadDBCStores(const std::string& dataPath)
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
{
if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
- sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
+ sLog->outError(LOG_FILTER_SQL, "spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0
}
else
@@ -610,7 +608,7 @@ void LoadDBCStores(const std::string& dataPath)
// error checks
if (bad_dbc_files.size() >= DBCFileCount)
{
- sLog->outError("Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
exit(1);
}
else if (!bad_dbc_files.empty())
@@ -619,7 +617,7 @@ void LoadDBCStores(const std::string& dataPath)
for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
str += *i + "\n";
- sLog->outError("Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
exit(1);
}
@@ -632,12 +630,12 @@ void LoadDBCStores(const std::string& dataPath)
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
- sLog->outError("You have _outdated_ DBC files. Please extract correct versions from current using client.");
+ sLog->outError(LOG_FILTER_GENERAL, "You have _outdated_ DBC files. Please extract correct versions from current using client.");
exit(1);
}
- sLog->outString(">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
+
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index cd30ed587f8..cd30ed587f8 100755..100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 15792fd57da..f57724fe58b 100755..100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -221,7 +221,8 @@ struct AchievementCriteriaEntry
// ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA = 32
struct
{
- uint32 mapID; // 3 Reference to Map.dbc
+ uint32 mapID; // 3 Reference to Map.dbc
+ uint32 count; // 4 Number of times that the arena must be won.
} win_arena;
// ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA = 33
@@ -1052,7 +1053,7 @@ struct GtRegenMPPerSptEntry
/* no used
struct HolidayDescriptionsEntry
{
- uint32 ID; // 0, this is NOT holiday id
+ uint32 ID; // 0, m_holidayDescriptionID
//char* name[16] // 1-16 m_name_lang
// 17 name flags
};
@@ -1061,7 +1062,7 @@ struct HolidayDescriptionsEntry
/* no used
struct HolidayNamesEntry
{
- uint32 ID; // 0, this is NOT holiday id
+ uint32 ID; // 0, m_holidayNameID
//char* name[16] // 1-16 m_name_lang
// 17 name flags
};
@@ -1092,7 +1093,7 @@ struct ItemEntry
uint32 ID; // 0
uint32 Class; // 1
uint32 SubClass; // 2 some items have strange subclasses
- int32 Unk0; // 3
+ int32 SoundOverrideSubclass; // 3
int32 Material; // 4
uint32 DisplayId; // 5
uint32 InventoryType; // 6
@@ -1195,7 +1196,7 @@ struct ItemSetEntry
struct LFGDungeonEntry
{
uint32 ID; // 0
- //char* name[16]; // 1-17 Name lang
+ char* name[16]; // 1-17 Name lang
uint32 minlevel; // 18
uint32 maxlevel; // 19
uint32 reclevel; // 20
@@ -1203,7 +1204,7 @@ struct LFGDungeonEntry
uint32 recmaxlevel; // 22
int32 map; // 23
uint32 difficulty; // 24
- //uint32 flags; // 25
+ uint32 flags; // 25
uint32 type; // 26
//uint32 unk; // 27
//char* iconname; // 28
@@ -1676,9 +1677,9 @@ struct SpellFocusObjectEntry
struct SpellRadiusEntry
{
uint32 ID;
- float radiusMin;
- //uint32 Unk //always 0
- float radiusMax;
+ float RadiusMin;
+ float RadiusPerLevel;
+ float RadiusMax;
};
struct SpellRangeEntry
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 39d031e96f9..bb671d4dd72 100755..100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -19,111 +19,111 @@
#ifndef TRINITY_DBCSFRM_H
#define TRINITY_DBCSFRM_H
-const char Achievementfmt[]="niixssssssssssssssssxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxii";
+char const Achievementfmt[]="niixssssssssssssssssxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxxxxxxxxii";
const std::string CustomAchievementfmt="pppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaapapaaaaaaaaaaaaaaaaaapp";
const std::string CustomAchievementIndex = "ID";
-const char AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiiiix";
-const char AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxiiiiixxx";
-const char AreaGroupEntryfmt[]="niiiiiii";
-const char AreaPOIEntryfmt[]="niiiiiiiiiiifffixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
-const char AreaTriggerEntryfmt[]="niffffffff";
-const char AuctionHouseEntryfmt[]="niiixxxxxxxxxxxxxxxxx";
-const char BankBagSlotPricesEntryfmt[]="ni";
-const char BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
-const char BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxiixx";
-const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-const char CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
-const char ChatChannelsEntryfmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxx";
+char const AchievementCriteriafmt[]="niiiiiiiixxxxxxxxxxxxxxxxxiiiix";
+char const AreaTableEntryfmt[]="iiinixxxxxissssssssssssssssxiiiiixxx";
+char const AreaGroupEntryfmt[]="niiiiiii";
+char const AreaPOIEntryfmt[]="niiiiiiiiiiifffixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
+char const AreaTriggerEntryfmt[]="niffffffff";
+char const AuctionHouseEntryfmt[]="niiixxxxxxxxxxxxxxxxx";
+char const BankBagSlotPricesEntryfmt[]="ni";
+char const BarberShopStyleEntryfmt[]="nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii";
+char const BattlemasterListEntryfmt[]="niiiiiiiiixssssssssssssssssxiixx";
+char const CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+char const CharTitlesEntryfmt[]="nxssssssssssssssssxxxxxxxxxxxxxxxxxxi";
+char const ChatChannelsEntryfmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxx";
// ChatChannelsEntryfmt, index not used (more compact store)
-const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
-const char ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
-const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";
-const char CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx";
-const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
-const char CreatureModelDatafmt[]="nxxxfxxxxxxxxxxffxxxxxxxxxxx";
-const char CreatureSpellDatafmt[]="niiiixxxx";
-const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
-const char CurrencyTypesfmt[]="xnxi";
-const char DestructibleModelDatafmt[]="nxxixxxixxxixxxixxx";
-const char DungeonEncounterfmt[]="niixissssssssssssssssxx";
-const char DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
-const char DurabilityQualityfmt[]="nf";
-const char EmotesEntryfmt[]="nxxiiix";
-const char EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx";
-const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiiffixssssssssssssssssxxxxxxxxxxxxxxxxxx";
-const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii";
-const char GameObjectDisplayInfofmt[]="nsxxxxxxxxxxffffffx";
-const char GemPropertiesEntryfmt[]="nixxi";
-const char GlyphPropertiesfmt[]="niii";
-const char GlyphSlotfmt[]="nii";
-const char GtBarberShopCostBasefmt[]="f";
-const char GtCombatRatingsfmt[]="f";
-const char GtChanceToMeleeCritBasefmt[]="f";
-const char GtChanceToMeleeCritfmt[]="f";
-const char GtChanceToSpellCritBasefmt[]="f";
-const char GtChanceToSpellCritfmt[]="f";
-const char GtOCTClassCombatRatingScalarfmt[]="df";
-const char GtOCTRegenHPfmt[]="f";
-//const char GtOCTRegenMPfmt[]="f";
-const char GtRegenHPPerSptfmt[]="f";
-const char GtRegenMPPerSptfmt[]="f";
-const char Holidaysfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix";
-const char Itemfmt[]="niiiiiii";
-const char ItemBagFamilyfmt[]="nxxxxxxxxxxxxxxxxx";
-//const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx";
-//const char ItemCondExtCostsEntryfmt[]="xiii";
-const char ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiix";
-const char ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
-const char ItemRandomPropertiesfmt[]="nxiiixxssssssssssssssssx";
-const char ItemRandomSuffixfmt[]="nssssssssssssssssxxiiixxiiixx";
-const char ItemSetEntryfmt[]="dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
-const char LFGDungeonEntryfmt[]="nxxxxxxxxxxxxxxxxxiiiiiiixixxixixxxxxxxxxxxxxxxxx";
-const char LiquidTypefmt[]="nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
-const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxssssssssssssssssx";
-const char MapEntryfmt[]="nxixxssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiix";
-const char MapDifficultyEntryfmt[]="diisxxxxxxxxxxxxxxxxiix";
-const char MovieEntryfmt[]="nxx";
-const char OverrideSpellDatafmt[]="niiiiiiiiiix";
-const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx";
-const char QuestXPfmt[]="niiiiiiiiii";
-const char QuestFactionRewardfmt[]="niiiiiiiiii";
-const char PvPDifficultyfmt[]="diiiii";
-const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii";
-const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii";
-const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiiiiiiii";
-const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi";
-const char SkillLineAbilityfmt[]="niiiixxiiiiixx";
-const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-const char SpellCastTimefmt[]="nixx";
-const char SpellDifficultyfmt[]="niiii";
+char const ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
+char const ChrRacesEntryfmt[]="nxixiixixxxxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
+char const CinematicSequencesEntryfmt[]="nxxxxxxxxx";
+char const CreatureDisplayInfofmt[]="nixxfxxxxxxxxxxx";
+char const CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
+char const CreatureModelDatafmt[]="nxxxfxxxxxxxxxxffxxxxxxxxxxx";
+char const CreatureSpellDatafmt[]="niiiixxxx";
+char const CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
+char const CurrencyTypesfmt[]="xnxi";
+char const DestructibleModelDatafmt[]="nxxixxxixxxixxxixxx";
+char const DungeonEncounterfmt[]="niixissssssssssssssssxx";
+char const DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
+char const DurabilityQualityfmt[]="nf";
+char const EmotesEntryfmt[]="nxxiiix";
+char const EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx";
+char const FactionEntryfmt[]="niiiiiiiiiiiiiiiiiiffixssssssssssssssssxxxxxxxxxxxxxxxxxx";
+char const FactionTemplateEntryfmt[]="niiiiiiiiiiiii";
+char const GameObjectDisplayInfofmt[]="nsxxxxxxxxxxffffffx";
+char const GemPropertiesEntryfmt[]="nixxi";
+char const GlyphPropertiesfmt[]="niii";
+char const GlyphSlotfmt[]="nii";
+char const GtBarberShopCostBasefmt[]="f";
+char const GtCombatRatingsfmt[]="f";
+char const GtChanceToMeleeCritBasefmt[]="f";
+char const GtChanceToMeleeCritfmt[]="f";
+char const GtChanceToSpellCritBasefmt[]="f";
+char const GtChanceToSpellCritfmt[]="f";
+char const GtOCTClassCombatRatingScalarfmt[]="df";
+char const GtOCTRegenHPfmt[]="f";
+//char const GtOCTRegenMPfmt[]="f";
+char const GtRegenHPPerSptfmt[]="f";
+char const GtRegenMPPerSptfmt[]="f";
+char const Holidaysfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix";
+char const Itemfmt[]="niiiiiii";
+char const ItemBagFamilyfmt[]="nxxxxxxxxxxxxxxxxx";
+//char const ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx";
+//char const ItemCondExtCostsEntryfmt[]="xiii";
+char const ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiix";
+char const ItemLimitCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
+char const ItemRandomPropertiesfmt[]="nxiiixxssssssssssssssssx";
+char const ItemRandomSuffixfmt[]="nssssssssssssssssxxiiixxiiixx";
+char const ItemSetEntryfmt[]="dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
+char const LFGDungeonEntryfmt[]="nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx";
+char const LiquidTypefmt[]="nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+char const LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx";
+char const MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxssssssssssssssssx";
+char const MapEntryfmt[]="nxixxssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiix";
+char const MapDifficultyEntryfmt[]="diisxxxxxxxxxxxxxxxxiix";
+char const MovieEntryfmt[]="nxx";
+char const OverrideSpellDatafmt[]="niiiiiiiiiix";
+char const QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx";
+char const QuestXPfmt[]="niiiiiiiiii";
+char const QuestFactionRewardfmt[]="niiiiiiiiii";
+char const PvPDifficultyfmt[]="diiiii";
+char const RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii";
+char const ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii";
+char const ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiiiiiiii";
+char const SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi";
+char const SkillLineAbilityfmt[]="niiiixxiiiiixx";
+char const SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+char const SpellCastTimefmt[]="nixx";
+char const SpellDifficultyfmt[]="niiii";
const std::string CustomSpellDifficultyfmt="ppppp";
const std::string CustomSpellDifficultyIndex="id";
-const char SpellDurationfmt[]="niii";
-const char SpellEntryfmt[]="niiiiiiiiiiiixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxfffxx";
+char const SpellDurationfmt[]="niii";
+char const SpellEntryfmt[]="niiiiiiiiiiiixixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiixxfffxx";
const std::string CustomSpellEntryfmt="papppppppppppapapaaaaaaaaaaapaaapapppppppaaaaapaapaaaaaaaaaaaaaaaaaappppppppppppppppppppppppppppppppppppaaaaaapppppppppaaapppppppppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppppppapppaaaaappaaaaaaa";
const std::string CustomSpellEntryIndex = "Id";
-const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
-const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiii";
-const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
-const char SpellRadiusfmt[]="nfxf";
-const char SpellRangefmt[]="nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
-const char SpellRuneCostfmt[]="niiii";
-const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
-const char StableSlotPricesfmt[] = "ni";
-const char SummonPropertiesfmt[] = "niiiii";
-const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
-const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
-const char TaxiNodesEntryfmt[]="nifffssssssssssssssssxii";
-const char TaxiPathEntryfmt[]="niii";
-const char TaxiPathNodeEntryfmt[]="diiifffiiii";
-const char TeamContributionPointsfmt[]="df";
-const char TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
-const char VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
-const char VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
-const char WMOAreaTableEntryfmt[]="niiixxxxxiixxxxxxxxxxxxxxxxx";
-const char WorldMapAreaEntryfmt[]="xinxffffixx";
-const char WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
-const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
+char const SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
+char const SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiii";
+char const SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
+char const SpellRadiusfmt[]="nfff";
+char const SpellRangefmt[]="nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+char const SpellRuneCostfmt[]="niiii";
+char const SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
+char const StableSlotPricesfmt[] = "ni";
+char const SummonPropertiesfmt[] = "niiiii";
+char const TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
+char const TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
+char const TaxiNodesEntryfmt[]="nifffssssssssssssssssxii";
+char const TaxiPathEntryfmt[]="niii";
+char const TaxiPathNodeEntryfmt[]="diiifffiiii";
+char const TeamContributionPointsfmt[]="df";
+char const TotemCategoryEntryfmt[]="nxxxxxxxxxxxxxxxxxii";
+char const VehicleEntryfmt[]="niffffiiiiiiiifffffffffffffffssssfifiixx";
+char const VehicleSeatEntryfmt[]="niiffffffffffiiiiiifffffffiiifffiiiiiiiffiiiiixxxxxxxxxxxx";
+char const WMOAreaTableEntryfmt[]="niiixxxxxiixxxxxxxxxxxxxxxxx";
+char const WorldMapAreaEntryfmt[]="xinxffffixx";
+char const WorldMapOverlayEntryfmt[]="nxiiiixxxxxxxxxxx";
+char const WorldSafeLocsEntryfmt[]="nifffxxxxxxxxxxxxxxxxx";
#endif
diff --git a/src/server/game/DungeonFinding/LFG.h b/src/server/game/DungeonFinding/LFG.h
index 28498749af8..8477002279c 100755..100644
--- a/src/server/game/DungeonFinding/LFG.h
+++ b/src/server/game/DungeonFinding/LFG.h
@@ -20,21 +20,28 @@
#include "Common.h"
+enum LFGEnum
+{
+ LFG_TANKS_NEEDED = 1,
+ LFG_HEALERS_NEEDED = 1,
+ LFG_DPS_NEEDED = 3
+};
+
enum LfgRoles
{
- ROLE_NONE = 0x00,
- ROLE_LEADER = 0x01,
- ROLE_TANK = 0x02,
- ROLE_HEALER = 0x04,
- ROLE_DAMAGE = 0x08
+ PLAYER_ROLE_NONE = 0x00,
+ PLAYER_ROLE_LEADER = 0x01,
+ PLAYER_ROLE_TANK = 0x02,
+ PLAYER_ROLE_HEALER = 0x04,
+ PLAYER_ROLE_DAMAGE = 0x08
};
enum LfgUpdateType
{
LFG_UPDATETYPE_DEFAULT = 0, // Internal Use
- LFG_UPDATETYPE_LEADER = 1,
+ LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave
LFG_UPDATETYPE_ROLECHECK_ABORTED = 4,
- LFG_UPDATETYPE_JOIN_PROPOSAL = 5,
+ LFG_UPDATETYPE_JOIN_QUEUE = 5,
LFG_UPDATETYPE_ROLECHECK_FAILED = 6,
LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7,
LFG_UPDATETYPE_PROPOSAL_FAILED = 8,
@@ -42,9 +49,9 @@ enum LfgUpdateType
LFG_UPDATETYPE_GROUP_FOUND = 10,
LFG_UPDATETYPE_ADDED_TO_QUEUE = 12,
LFG_UPDATETYPE_PROPOSAL_BEGIN = 13,
- LFG_UPDATETYPE_CLEAR_LOCK_LIST = 14,
+ LFG_UPDATETYPE_UPDATE_STATUS = 14,
LFG_UPDATETYPE_GROUP_MEMBER_OFFLINE = 15,
- LFG_UPDATETYPE_GROUP_DISBAND = 16
+ LFG_UPDATETYPE_GROUP_DISBAND_UNK16 = 16, // FIXME: Sometimes at group disband
};
enum LfgState
@@ -62,7 +69,6 @@ enum LfgState
/// Instance lock types
enum LfgLockStatusType
{
- LFG_LOCKSTATUS_OK = 0, // Internal use only
LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION = 1,
LFG_LOCKSTATUS_TOO_LOW_LEVEL = 2,
LFG_LOCKSTATUS_TOO_HIGH_LEVEL = 3,
@@ -73,18 +79,24 @@ enum LfgLockStatusType
LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL = 1002,
LFG_LOCKSTATUS_QUEST_NOT_COMPLETED = 1022,
LFG_LOCKSTATUS_MISSING_ITEM = 1025,
- LFG_LOCKSTATUS_NOT_IN_SEASON = 1031
+ LFG_LOCKSTATUS_NOT_IN_SEASON = 1031,
+ LFG_LOCKSTATUS_MISSING_ACHIEVEMENT = 1034
};
-/// Dungeon and reason why player can't join
-struct LfgLockStatus
+/// Answer state (Also used to check compatibilites)
+enum LfgAnswer
{
- uint32 dungeon; ///< Dungeon Id
- LfgLockStatusType lockstatus; ///< Lock type
+ LFG_ANSWER_PENDING = -1,
+ LFG_ANSWER_DENY = 0,
+ LFG_ANSWER_AGREE = 1
};
typedef std::set<uint32> LfgDungeonSet;
-typedef std::map<uint32, LfgLockStatusType> LfgLockMap;
+typedef std::map<uint32, uint32> LfgLockMap;
typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
+typedef std::set<uint64> LfgGuidSet;
+typedef std::list<uint64> LfgGuidList;
+typedef std::map<uint64, uint8> LfgRolesMap;
+typedef std::map<uint64, uint64> LfgGroupsMap;
#endif
diff --git a/src/server/game/DungeonFinding/LFGGroupData.cpp b/src/server/game/DungeonFinding/LFGGroupData.cpp
index 607389c5dbf..68e7ab82c32 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.cpp
+++ b/src/server/game/DungeonFinding/LFGGroupData.cpp
@@ -18,14 +18,16 @@
#include "LFG.h"
#include "LFGGroupData.h"
-LfgGroupData::LfgGroupData():
-m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), m_Dungeon(0),
-m_VotesNeeded(LFG_GROUP_KICK_VOTES_NEEDED), m_KicksLeft(LFG_GROUP_MAX_KICKS)
-{
-}
+LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
+ m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
+{ }
LfgGroupData::~LfgGroupData()
+{ }
+
+bool LfgGroupData::IsLfgGroup()
{
+ return m_OldState != LFG_STATE_NONE;
}
void LfgGroupData::SetState(LfgState state)
@@ -33,10 +35,12 @@ void LfgGroupData::SetState(LfgState state)
switch (state)
{
case LFG_STATE_NONE:
- case LFG_STATE_DUNGEON:
+ m_Dungeon = 0;
+ m_KicksLeft = LFG_GROUP_MAX_KICKS;
case LFG_STATE_FINISHED_DUNGEON:
+ case LFG_STATE_DUNGEON:
m_OldState = state;
- // No break on purpose
+ // No break on purpose
default:
m_State = state;
}
@@ -47,6 +51,29 @@ void LfgGroupData::RestoreState()
m_State = m_OldState;
}
+void LfgGroupData::AddPlayer(uint64 guid)
+{
+ m_Players.insert(guid);
+}
+
+uint8 LfgGroupData::RemovePlayer(uint64 guid)
+{
+ LfgGuidSet::iterator it = m_Players.find(guid);
+ if (it != m_Players.end())
+ m_Players.erase(it);
+ return uint8(m_Players.size());
+}
+
+void LfgGroupData::RemoveAllPlayers()
+{
+ m_Players.clear();
+}
+
+void LfgGroupData::SetLeader(uint64 guid)
+{
+ m_Leader = guid;
+}
+
void LfgGroupData::SetDungeon(uint32 dungeon)
{
m_Dungeon = dungeon;
@@ -63,6 +90,26 @@ LfgState LfgGroupData::GetState() const
return m_State;
}
+LfgState LfgGroupData::GetOldState() const
+{
+ return m_OldState;
+}
+
+LfgGuidSet const& LfgGroupData::GetPlayers() const
+{
+ return m_Players;
+}
+
+uint8 LfgGroupData::GetPlayerCount() const
+{
+ return m_Players.size();
+}
+
+uint64 LfgGroupData::GetLeader() const
+{
+ return m_Leader;
+}
+
uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
{
if (asId)
@@ -71,11 +118,6 @@ uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
return m_Dungeon;
}
-uint8 LfgGroupData::GetVotesNeeded() const
-{
- return m_VotesNeeded;
-}
-
uint8 LfgGroupData::GetKicksLeft() const
{
return m_KicksLeft;
diff --git a/src/server/game/DungeonFinding/LFGGroupData.h b/src/server/game/DungeonFinding/LFGGroupData.h
index 74570817698..2054e776282 100644
--- a/src/server/game/DungeonFinding/LFGGroupData.h
+++ b/src/server/game/DungeonFinding/LFGGroupData.h
@@ -23,7 +23,6 @@
enum LfgGroupEnum
{
LFG_GROUP_MAX_KICKS = 3,
- LFG_GROUP_KICK_VOTES_NEEDED = 3
};
/**
@@ -35,31 +34,44 @@ class LfgGroupData
LfgGroupData();
~LfgGroupData();
+ bool IsLfgGroup();
+
// General
void SetState(LfgState state);
void RestoreState();
+ void AddPlayer(uint64 guid);
+ uint8 RemovePlayer(uint64 guid);
+ void RemoveAllPlayers();
+ void SetLeader(uint64 guid);
+
// Dungeon
void SetDungeon(uint32 dungeon);
+
// VoteKick
- void SetVotesNeeded(uint8 votes);
void DecreaseKicksLeft();
// General
LfgState GetState() const;
+ LfgState GetOldState() const;
+ LfgGuidSet const& GetPlayers() const;
+ uint8 GetPlayerCount() const;
+ uint64 GetLeader() const;
+
// Dungeon
uint32 GetDungeon(bool asId = true) const;
+
// VoteKick
- uint8 GetVotesNeeded() const;
uint8 GetKicksLeft() const;
private:
// General
LfgState m_State; ///< State if group in LFG
LfgState m_OldState; ///< Old State
+ uint64 m_Leader; ///< Leader GUID
+ LfgGuidSet m_Players; ///< Players in group
// Dungeon
uint32 m_Dungeon; ///< Dungeon entry
// Vote Kick
- uint8 m_VotesNeeded; ///< Votes need to kick success
uint8 m_KicksLeft; ///< Number of kicks left
};
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 91f9104b0b1..668b1622738 100755..100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -18,59 +18,32 @@
#include "Common.h"
#include "SharedDefines.h"
#include "DBCStores.h"
-
#include "DisableMgr.h"
#include "ObjectMgr.h"
#include "SocialMgr.h"
+#include "Language.h"
#include "LFGMgr.h"
-#include "GroupMgr.h"
#include "LFGScripts.h"
#include "LFGGroupData.h"
#include "LFGPlayerData.h"
-
+#include "LFGQueue.h"
#include "Group.h"
#include "Player.h"
+#include "GroupMgr.h"
+#include "GameEventMgr.h"
+#include "WorldSession.h"
-LFGMgr::LFGMgr(): m_update(true), m_QueueTimer(0), m_lfgProposalId(1),
-m_WaitTimeAvg(-1), m_WaitTimeTank(-1), m_WaitTimeHealer(-1), m_WaitTimeDps(-1),
-m_NumWaitTimeAvg(0), m_NumWaitTimeTank(0), m_NumWaitTimeHealer(0), m_NumWaitTimeDps(0)
+LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1),
+ m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK))
{
- m_update = sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE);
- if (m_update)
- {
- new LFGPlayerScript();
- new LFGGroupScript();
-
- // Initialize dungeon cache
- for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
- {
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
- if (dungeon && dungeon->type != LFG_TYPE_ZONE)
- {
- if (dungeon->type != LFG_TYPE_RANDOM)
- m_CachedDungeonMap[dungeon->grouptype].insert(dungeon->ID);
- m_CachedDungeonMap[0].insert(dungeon->ID);
- }
- }
- }
+ new LFGPlayerScript();
+ new LFGGroupScript();
}
LFGMgr::~LFGMgr()
{
- for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr)
+ for (LfgRewardContainer::iterator itr = RewardMapStore.begin(); itr != RewardMapStore.end(); ++itr)
delete itr->second;
-
- for (LfgQueueInfoMap::iterator it = m_QueueInfoMap.begin(); it != m_QueueInfoMap.end(); ++it)
- delete it->second;
-
- for (LfgProposalMap::iterator it = m_Proposals.begin(); it != m_Proposals.end(); ++it)
- delete it->second;
-
- for (LfgPlayerBootMap::iterator it = m_Boots.begin(); it != m_Boots.end(); ++it)
- delete it->second;
-
- for (LfgRoleCheckMap::iterator it = m_RoleChecks.begin(); it != m_RoleChecks.end(); ++it)
- delete it->second;
}
void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
@@ -81,8 +54,9 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid)
if (!IS_GROUP(guid))
return;
- uint32 dungeon = fields[16].GetUInt32();
+ SetLeader(guid, MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER));
+ uint32 dungeon = fields[16].GetUInt32();
uint8 state = fields[17].GetUInt8();
if (!dungeon || !state)
@@ -121,22 +95,104 @@ 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()
{
uint32 oldMSTime = getMSTime();
- for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr)
+ for (LfgRewardContainer::iterator itr = RewardMapStore.begin(); itr != RewardMapStore.end(); ++itr)
delete itr->second;
- m_RewardMap.clear();
+ RewardMapStore.clear();
// ORDER BY is very important for GetRandomDungeonReward!
QueryResult result = WorldDatabase.Query("SELECT dungeonId, maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar FROM lfg_dungeon_rewards ORDER BY dungeonId, maxLevel ASC");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
return;
}
@@ -155,148 +211,234 @@ void LFGMgr::LoadRewards()
uint32 otherMoneyVar = fields[6].GetUInt32();
uint32 otherXPVar = fields[7].GetUInt32();
- if (!sLFGDungeonStore.LookupEntry(dungeonId))
+ if (!GetLFGDungeon(dungeonId))
{
- sLog->outErrorDb("Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
continue;
}
if (!maxLevel || maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- sLog->outErrorDb("Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
}
if (firstQuestId && !sObjectMgr->GetQuestTemplate(firstQuestId))
{
- sLog->outErrorDb("First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
firstQuestId = 0;
}
if (otherQuestId && !sObjectMgr->GetQuestTemplate(otherQuestId))
{
- sLog->outErrorDb("Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
+ sLog->outError(LOG_FILTER_SQL, "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
otherQuestId = 0;
}
- m_RewardMap.insert(LfgRewardMap::value_type(dungeonId, new LfgReward(maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar)));
+ RewardMapStore.insert(LfgRewardContainer::value_type(dungeonId, new LfgReward(maxLevel, firstQuestId, firstMoneyVar, firstXPVar, otherQuestId, otherMoneyVar, otherXPVar)));
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
+LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id)
+{
+ LFGDungeonContainer::const_iterator itr = LfgDungeonStore.find(id);
+ if (itr != LfgDungeonStore.end())
+ return &(itr->second);
+
+ return NULL;
+}
+
+LFGDungeonContainer & LFGMgr::GetLFGDungeonMap()
+{
+ return LfgDungeonStore;
+}
+
+void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
+{
+ uint32 oldMSTime = getMSTime();
+
+ LfgDungeonStore.clear();
+
+ // Initialize Dungeon map with data from dbcs
+ for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
+ {
+ LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
+ if (!dungeon)
+ continue;
+
+ switch (dungeon->type)
+ {
+ case LFG_TYPE_DUNGEON:
+ case LFG_TYPE_HEROIC:
+ case LFG_TYPE_RAID:
+ case LFG_TYPE_RANDOM:
+ LfgDungeonStore[dungeon->ID] = LFGDungeonData(dungeon);
+ break;
+ }
+ }
+
+ // Fill teleport locations from DB
+ QueryResult result = WorldDatabase.Query("SELECT dungeonId, position_x, position_y, position_z, orientation FROM lfg_entrances");
+
+ if (!result)
+ {
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg entrance positions. DB table `lfg_entrances` is empty!");
+ return;
+ }
+
+ uint32 count = 0;
+
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 dungeonId = fields[0].GetUInt32();
+ LFGDungeonContainer::iterator dungeonItr = LfgDungeonStore.find(dungeonId);
+ if (dungeonItr == LfgDungeonStore.end())
+ {
+ sLog->outError(LOG_FILTER_SQL, "table `lfg_entrances` contains coordinates for wrong dungeon %u", dungeonId);
+ continue;
+ }
+
+ LFGDungeonData& data = dungeonItr->second;
+ data.x = fields[1].GetFloat();
+ data.y = fields[2].GetFloat();
+ data.z = fields[3].GetFloat();
+ data.o = fields[4].GetFloat();
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
+ // Fill all other teleport coords from areatriggers
+ for (LFGDungeonContainer::iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr)
+ {
+ LFGDungeonData& dungeon = itr->second;
+
+ // No teleport coords in database, load from areatriggers
+ if (dungeon.type != LFG_TYPE_RANDOM && dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f)
+ {
+ AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map);
+ if (!at)
+ {
+ sLog->outError(LOG_FILTER_LFG, "LFGMgr::LoadLFGDungeons: Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map);
+ continue;
+ }
+
+ dungeon.map = at->target_mapId;
+ dungeon.x = at->target_X;
+ dungeon.y = at->target_Y;
+ dungeon.z = at->target_Z;
+ dungeon.o = at->target_Orientation;
+ }
+
+ if (dungeon.type != LFG_TYPE_RANDOM)
+ CachedDungeonMapStore[dungeon.group].insert(dungeon.id);
+ CachedDungeonMapStore[0].insert(dungeon.id);
+ }
+
+ if (reload)
+ {
+ CachedDungeonMapStore.clear();
+ // Recalculate locked dungeons
+ for (LfgPlayerDataContainer::const_iterator it = PlayersStore.begin(); it != PlayersStore.end(); ++it)
+ if (Player* player = ObjectAccessor::FindPlayer(it->first))
+ InitializeLockedDungeons(player);
+ }
}
void LFGMgr::Update(uint32 diff)
{
- if (!m_update)
+ if (!isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- m_update = false;
time_t currTime = time(NULL);
// Remove obsolete role checks
- for (LfgRoleCheckMap::iterator it = m_RoleChecks.begin(); it != m_RoleChecks.end();)
+ for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();)
{
- LfgRoleCheckMap::iterator itRoleCheck = it++;
- LfgRoleCheck* roleCheck = itRoleCheck->second;
- if (currTime < roleCheck->cancelTime)
+ LfgRoleCheckContainer::iterator itRoleCheck = it++;
+ LfgRoleCheck& roleCheck = itRoleCheck->second;
+ if (currTime < roleCheck.cancelTime)
continue;
- roleCheck->state = LFG_ROLECHECK_MISSING_ROLE;
+ roleCheck.state = LFG_ROLECHECK_MISSING_ROLE;
- for (LfgRolesMap::const_iterator itRoles = roleCheck->roles.begin(); itRoles != roleCheck->roles.end(); ++itRoles)
+ for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles)
{
uint64 guid = itRoles->first;
- ClearState(guid);
- if (Player* player = ObjectAccessor::FindPlayer(guid))
- {
- player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
-
- if (itRoles->first == roleCheck->leader)
- player->GetSession()->SendLfgJoinResult(LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
- }
+ RestoreState(guid, "Remove Obsolete RoleCheck");
+ SendLfgRoleCheckUpdate(guid, roleCheck);
+ if (guid == roleCheck.leader)
+ SendLfgJoinResult(guid, LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
}
- delete roleCheck;
- m_RoleChecks.erase(itRoleCheck);
+
+ RestoreState(itRoleCheck->first, "Remove Obsolete RoleCheck");
+ RoleChecksStore.erase(itRoleCheck);
}
// Remove obsolete proposals
- for (LfgProposalMap::iterator it = m_Proposals.begin(); it != m_Proposals.end();)
+ for (LfgProposalContainer::iterator it = ProposalsStore.begin(); it != ProposalsStore.end();)
{
- LfgProposalMap::iterator itRemove = it++;
- if (itRemove->second->cancelTime < currTime)
+ LfgProposalContainer::iterator itRemove = it++;
+ if (itRemove->second.cancelTime < currTime)
RemoveProposal(itRemove, LFG_UPDATETYPE_PROPOSAL_FAILED);
}
// Remove obsolete kicks
- for (LfgPlayerBootMap::iterator it = m_Boots.begin(); it != m_Boots.end();)
+ for (LfgPlayerBootContainer::iterator it = BootsStore.begin(); it != BootsStore.end();)
{
- LfgPlayerBootMap::iterator itBoot = it++;
- LfgPlayerBoot* pBoot = itBoot->second;
- if (pBoot->cancelTime < currTime)
+ LfgPlayerBootContainer::iterator itBoot = it++;
+ LfgPlayerBoot& boot = itBoot->second;
+ if (boot.cancelTime < currTime)
{
- pBoot->inProgress = false;
- for (LfgAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes)
- if (Player* plrg = ObjectAccessor::FindPlayer(itVotes->first))
- if (plrg->GetGUID() != pBoot->victim)
- plrg->GetSession()->SendLfgBootPlayer(pBoot);
- delete pBoot;
- m_Boots.erase(itBoot);
+ boot.inProgress = false;
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
+ {
+ uint64 pguid = itVotes->first;
+ if (pguid != boot.victim)
+ SendLfgBootProposalUpdate(pguid, boot);
+ SetState(pguid, LFG_STATE_DUNGEON);
+ }
+ SetState(itBoot->first, LFG_STATE_DUNGEON);
+ BootsStore.erase(itBoot);
}
}
+ uint32 lastProposalId = m_lfgProposalId;
// Check if a proposal can be formed with the new groups being added
- for (LfgGuidListMap::iterator it = m_newToQueue.begin(); it != m_newToQueue.end(); ++it)
+ for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it)
+ if (uint8 newProposals = it->second.FindGroups())
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Update: Found %u new groups in queue %u", newProposals, it->first);
+
+ if (lastProposalId != m_lfgProposalId)
{
- uint8 queueId = it->first;
- LfgGuidList& newToQueue = it->second;
- LfgGuidList& currentQueue = m_currentQueue[queueId];
- LfgGuidList firstNew;
- while (!newToQueue.empty())
+ // FIXME lastProposalId ? lastProposalId +1 ?
+ for (LfgProposalContainer::const_iterator itProposal = ProposalsStore.find(m_lfgProposalId); itProposal != ProposalsStore.end(); ++itProposal)
{
- uint64 frontguid = newToQueue.front();
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Update: QueueId %u: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", queueId, frontguid, uint32(newToQueue.size()), uint32(currentQueue.size()));
- firstNew.push_back(frontguid);
- newToQueue.pop_front();
+ uint32 proposalId = itProposal->first;
+ LfgProposal& proposal = ProposalsStore[proposalId];
- LfgGuidList temporalList = currentQueue;
- if (LfgProposal* pProposal = FindNewGroups(firstNew, temporalList)) // Group found!
+ uint64 guid = 0;
+ for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
{
- // Remove groups in the proposal from new and current queues (not from queue map)
- for (LfgGuidList::const_iterator itQueue = pProposal->queues.begin(); itQueue != pProposal->queues.end(); ++itQueue)
- {
- currentQueue.remove(*itQueue);
- newToQueue.remove(*itQueue);
- }
- m_Proposals[++m_lfgProposalId] = pProposal;
-
- uint64 guid = 0;
- for (LfgProposalPlayerMap::const_iterator itPlayers = pProposal->players.begin(); itPlayers != pProposal->players.end(); ++itPlayers)
+ guid = itPlayers->first;
+ SetState(guid, LFG_STATE_PROPOSAL);
+ if (uint64 gguid = GetGroup(guid))
{
- guid = itPlayers->first;
- SetState(guid, LFG_STATE_PROPOSAL);
- if (Player* player = ObjectAccessor::FindPlayer(itPlayers->first))
- {
- Group* grp = player->GetGroup();
- if (grp)
- {
- uint64 gguid = grp->GetGUID();
- SetState(gguid, LFG_STATE_PROPOSAL);
- player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
- }
- else
- player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
- player->GetSession()->SendLfgUpdateProposal(m_lfgProposalId, pProposal);
- }
+ SetState(gguid, LFG_STATE_PROPOSAL);
+ SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
}
-
- if (pProposal->state == LFG_PROPOSAL_SUCCESS)
- UpdateProposal(m_lfgProposalId, guid, true);
+ else
+ SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_PROPOSAL_BEGIN, GetSelectedDungeons(guid), GetComment(guid)));
+ SendLfgUpdateProposal(guid, m_lfgProposalId, proposal);
}
- else
- if (std::find(currentQueue.begin(), currentQueue.end(), frontguid) == currentQueue.end()) //already in queue?
- currentQueue.push_back(frontguid); // Lfg group not found, add this group to the queue.
- firstNew.clear();
+
+ if (proposal.state == LFG_PROPOSAL_SUCCESS)
+ UpdateProposal(proposalId, guid, true);
}
}
@@ -304,105 +446,12 @@ void LFGMgr::Update(uint32 diff)
if (m_QueueTimer > LFG_QUEUEUPDATE_INTERVAL)
{
m_QueueTimer = 0;
- currTime = time(NULL);
- for (LfgQueueInfoMap::const_iterator itQueue = m_QueueInfoMap.begin(); itQueue != m_QueueInfoMap.end(); ++itQueue)
- {
- LfgQueueInfo* queue = itQueue->second;
- if (!queue)
- {
- sLog->outError("LFGMgr::Update: [" UI64FMTD "] queued with null queue info!", itQueue->first);
- continue;
- }
- uint32 dungeonId = (*queue->dungeons.begin());
- uint32 queuedTime = uint32(currTime - queue->joinTime);
- uint8 role = ROLE_NONE;
- for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
- role |= itPlayer->second;
- role &= ~ROLE_LEADER;
-
- int32 waitTime = -1;
- switch (role)
- {
- case ROLE_NONE: // Should not happen - just in case
- waitTime = -1;
- break;
- case ROLE_TANK:
- waitTime = m_WaitTimeTank;
- break;
- case ROLE_HEALER:
- waitTime = m_WaitTimeHealer;
- break;
- case ROLE_DAMAGE:
- waitTime = m_WaitTimeDps;
- break;
- default:
- waitTime = m_WaitTimeAvg;
- break;
- }
-
- for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
- if (Player* player = ObjectAccessor::FindPlayer(itPlayer->first))
- player->GetSession()->SendLfgQueueStatus(dungeonId, waitTime, m_WaitTimeAvg, m_WaitTimeTank, m_WaitTimeHealer, m_WaitTimeDps, queuedTime, queue->tanks, queue->healers, queue->dps);
- }
+ time_t currTime = time(NULL);
+ for (LfgQueueContainer::iterator it = QueuesStore.begin(); it != QueuesStore.end(); ++it)
+ it->second.UpdateQueueTimers(currTime);
}
else
m_QueueTimer += diff;
- m_update = true;
-}
-
-/**
- Add a guid to the queue of guids to be added to main queue. It guid its already
- in queue does nothing. If this function is called guid is not in the main queue
- (No need to check it here)
-
- @param[in] guid Player or group guid to add to queue
- @param[in] queueId Queue Id to add player/group to
-*/
-void LFGMgr::AddToQueue(uint64 guid, uint8 queueId)
-{
- if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
- queueId = 0;
-
- LfgGuidList& list = m_newToQueue[queueId];
- if (std::find(list.begin(), list.end(), guid) != list.end())
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::AddToQueue: [" UI64FMTD "] already in new queue. ignoring", guid);
- else
- {
- list.push_back(guid);
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::AddToQueue: [" UI64FMTD "] added to m_newToQueue (size: %u)", guid, uint32(list.size()));
- }
-}
-
-/**
- Removes a guid from the main and new queues.
-
- @param[in] guid Player or group guid to add to queue
- @return true if guid was found in main queue.
-*/
-bool LFGMgr::RemoveFromQueue(uint64 guid)
-{
- for (LfgGuidListMap::iterator it = m_currentQueue.begin(); it != m_currentQueue.end(); ++it)
- it->second.remove(guid);
-
- for (LfgGuidListMap::iterator it = m_newToQueue.begin(); it != m_newToQueue.end(); ++it)
- it->second.remove(guid);
-
- RemoveFromCompatibles(guid);
-
- LfgQueueInfoMap::iterator it = m_QueueInfoMap.find(guid);
- if (it != m_QueueInfoMap.end())
- {
- delete it->second;
- m_QueueInfoMap.erase(it);
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveFromQueue: [" UI64FMTD "] removed", guid);
- return true;
- }
- else
- {
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveFromQueue: [" UI64FMTD "] not in queue", guid);
- return false;
- }
-
}
/**
@@ -410,63 +459,61 @@ bool LFGMgr::RemoveFromQueue(uint64 guid)
@param[in] player Player we need to initialize the lock status map
*/
-void LFGMgr::InitializeLockedDungeons(Player* player)
+void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
{
uint64 guid = player->GetGUID();
- uint8 level = player->getLevel();
+ if (!level)
+ level = player->getLevel();
uint8 expansion = player->GetSession()->Expansion();
- LfgDungeonSet dungeons = GetDungeonsByRandom(0);
+ LfgDungeonSet const& dungeons = GetDungeonsByRandom(0);
LfgLockMap lock;
for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*it);
+ LFGDungeonData const* dungeon = GetLFGDungeon(*it);
if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore
continue;
- AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty));
-
- LfgLockStatusType locktype = LFG_LOCKSTATUS_OK;
+ uint32 lockData = 0;
if (dungeon->expansion > expansion)
- locktype = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
+ lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
- locktype = LFG_LOCKSTATUS_RAID_LOCKED;
+ lockData = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && player->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty)))
- {
- //if (!player->GetGroup() || !player->GetGroup()->isLFGGroup() || GetDungeon(player->GetGroup()->GetGUID(), true) != dungeon->ID || GetState(player->GetGroup()->GetGUID()) != LFG_STATE_DUNGEON)
- locktype = LFG_LOCKSTATUS_RAID_LOCKED;
- }
+ lockData = LFG_LOCKSTATUS_RAID_LOCKED;
else if (dungeon->minlevel > level)
- locktype = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
+ lockData = LFG_LOCKSTATUS_TOO_LOW_LEVEL;
else if (dungeon->maxlevel < level)
- locktype = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
- else if (locktype == LFG_LOCKSTATUS_OK && ar)
+ lockData = LFG_LOCKSTATUS_TOO_HIGH_LEVEL;
+ else if (dungeon->seasonal && !IsSeasonActive(dungeon->id))
+ lockData = LFG_LOCKSTATUS_NOT_IN_SEASON;
+ else if (AccessRequirement const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty)))
{
- if (ar->achievement && !player->GetAchievementMgr().HasAchieved(ar->achievement))
- locktype = LFG_LOCKSTATUS_RAID_LOCKED; // FIXME: Check the correct lock value
+ if (ar->achievement && !player->HasAchieved(ar->achievement))
+ lockData = LFG_LOCKSTATUS_MISSING_ACHIEVEMENT;
else if (player->GetTeam() == ALLIANCE && ar->quest_A && !player->GetQuestRewardStatus(ar->quest_A))
- locktype = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
+ lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
else if (player->GetTeam() == HORDE && ar->quest_H && !player->GetQuestRewardStatus(ar->quest_H))
- locktype = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
+ lockData = LFG_LOCKSTATUS_QUEST_NOT_COMPLETED;
else
if (ar->item)
{
- if (!player->HasItemCount(ar->item, 1) && (!ar->item2 || !player->HasItemCount(ar->item2, 1)))
- locktype = LFG_LOCKSTATUS_MISSING_ITEM;
+ if (!player->HasItemCount(ar->item) && (!ar->item2 || !player->HasItemCount(ar->item2)))
+ lockData = LFG_LOCKSTATUS_MISSING_ITEM;
}
- else if (ar->item2 && !player->HasItemCount(ar->item2, 1))
- locktype = LFG_LOCKSTATUS_MISSING_ITEM;
+ else if (ar->item2 && !player->HasItemCount(ar->item2))
+ lockData = LFG_LOCKSTATUS_MISSING_ITEM;
}
+
/* TODO VoA closed if WG is not under team control (LFG_LOCKSTATUS_RAID_LOCKED)
- locktype = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE;
- locktype = LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE;
- locktype = LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL;
- locktype = LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL;
- locktype = LFG_LOCKSTATUS_NOT_IN_SEASON; // Need list of instances and needed season to open
+ lockData = LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE;
+ lockData = LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE;
+ lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL;
+ lockData = LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL;
*/
- if (locktype != LFG_LOCKSTATUS_OK)
- lock[dungeon->Entry()] = locktype;
+ if (lockData)
+ lock[dungeon->Entry()] = lockData;
}
SetLockedDungeons(guid, lock);
}
@@ -481,19 +528,18 @@ void LFGMgr::InitializeLockedDungeons(Player* player)
@param[in] dungeons Dungeons the player/group is applying for
@param[in] comment Player selected comment
*/
-void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment)
+void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const std::string& comment)
{
- if (!player || !player->GetSession() || selectedDungeons.empty())
- return;
+ if (!player || !player->GetSession() || dungeons.empty())
+ return;
Group* grp = player->GetGroup();
uint64 guid = player->GetGUID();
uint64 gguid = grp ? grp->GetGUID() : guid;
LfgJoinResultData joinData;
- PlayerSet players;
+ LfgGuidSet players;
uint32 rDungeonId = 0;
bool isContinue = grp && grp->isLFGGroup() && GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
- LfgDungeonSet dungeons = selectedDungeons;
// Do not allow to change dungeon in the middle of a current dungeon
if (isContinue)
@@ -503,24 +549,30 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
}
// Already in queue?
- LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(gguid);
- if (itQueue != m_QueueInfoMap.end())
+ LfgState state = GetState(gguid);
+ if (state == LFG_STATE_QUEUED)
{
- LfgDungeonSet playerDungeons = GetSelectedDungeons(guid);
+ LfgDungeonSet const& playerDungeons = GetSelectedDungeons(guid);
if (playerDungeons == dungeons) // Joining the same dungeons -- Send OK
{
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment);
player->GetSession()->SendLfgJoinResult(joinData); // Default value of joinData.result = LFG_JOIN_OK
if (grp)
{
+ LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, comment);
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
if (itr->getSource() && itr->getSource()->GetSession())
itr->getSource()->GetSession()->SendLfgUpdateParty(updateData);
}
+ else
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment));
+
return;
}
else // Remove from queue and rejoin
- RemoveFromQueue(gguid);
+ {
+ LFGQueue& queue = GetQueue(gguid);
+ queue.RemoveFromQueue(gguid);
+ }
}
// Check player or group member restrictions
@@ -550,15 +602,16 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue())
joinData.result = LFG_JOIN_USING_BG_SYSTEM;
++memberCount;
- players.insert(plrg);
+ players.insert(plrg->GetGUID());
}
}
- if (memberCount != grp->GetMembersCount())
+
+ if (joinData.result == LFG_JOIN_OK && memberCount != grp->GetMembersCount())
joinData.result = LFG_JOIN_DISCONNECTED;
}
}
else
- players.insert(player);
+ players.insert(player->GetGUID());
// Check if all dungeons are valid
bool isRaid = false;
@@ -616,25 +669,24 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
return;
}
- // FIXME - Raid browser not supported yet
+ SetComment(guid, comment);
+
if (isRaid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] trying to join raid browser and it's disabled.", guid);
return;
}
- SetComment(guid, comment);
-
+ std::string debugNames = "";
if (grp) // Begin rolecheck
{
// Create new rolecheck
- LfgRoleCheck* roleCheck = new LfgRoleCheck();
- roleCheck->cancelTime = time_t(time(NULL)) + LFG_TIME_ROLECHECK;
- roleCheck->state = LFG_ROLECHECK_INITIALITING;
- roleCheck->leader = guid;
- roleCheck->dungeons = dungeons;
- roleCheck->rDungeonId = rDungeonId;
- m_RoleChecks[gguid] = roleCheck;
+ LfgRoleCheck& roleCheck = RoleChecksStore[gguid];
+ roleCheck.cancelTime = time_t(time(NULL)) + LFG_TIME_ROLECHECK;
+ roleCheck.state = LFG_ROLECHECK_INITIALITING;
+ roleCheck.leader = guid;
+ roleCheck.dungeons = dungeons;
+ roleCheck.rDungeonId = rDungeonId;
if (rDungeonId)
{
@@ -644,7 +696,7 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
SetState(gguid, LFG_STATE_ROLECHECK);
// Send update to player
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment);
+ LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment);
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
if (Player* plrg = itr->getSource())
@@ -654,7 +706,10 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
SetState(pguid, LFG_STATE_ROLECHECK);
if (!isContinue)
SetSelectedDungeons(pguid, dungeons);
- roleCheck->roles[pguid] = 0;
+ roleCheck.roles[pguid] = 0;
+ if (!debugNames.empty())
+ debugNames.append(", ");
+ debugNames.append(plrg->GetName());
}
}
// Update leader role
@@ -662,24 +717,11 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
}
else // Add player to queue
{
- // Queue player
- LfgQueueInfo* pqInfo = new LfgQueueInfo();
- pqInfo->joinTime = time_t(time(NULL));
- pqInfo->roles[player->GetGUID()] = roles;
- pqInfo->dungeons = dungeons;
- if (roles & ROLE_TANK)
- --pqInfo->tanks;
- else if (roles & ROLE_HEALER)
- --pqInfo->healers;
- else
- --pqInfo->dps;
- m_QueueInfoMap[guid] = pqInfo;
+ LfgRolesMap rolesMap;
+ rolesMap[guid] = roles;
+ LFGQueue& queue = GetQueue(gguid);
+ queue.AddQueueData(guid, time_t(time(NULL)), dungeons, rolesMap);
- // Send update to player
- player->GetSession()->SendLfgJoinResult(joinData);
- player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_PROPOSAL, dungeons, comment));
- SetState(gguid, LFG_STATE_QUEUED);
- SetRoles(guid, roles);
if (!isContinue)
{
if (rDungeonId)
@@ -689,563 +731,199 @@ void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDung
}
SetSelectedDungeons(guid, dungeons);
}
- AddToQueue(guid, uint8(player->GetTeam()));
+ // Send update to player
+ player->GetSession()->SendLfgJoinResult(joinData);
+ player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_JOIN_QUEUE, dungeons, comment));
+ SetState(gguid, LFG_STATE_QUEUED);
+ SetRoles(guid, roles);
+ debugNames.append(player->GetName());
+ }
+
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::ostringstream o;
+ o << "LFGMgr::Join: [" << guid << "] joined (" << (grp ? "group" : "player") << ") Members: " << debugNames.c_str()
+ << ". Dungeons (" << uint32(dungeons.size()) << "): " << ConcatenateDungeons(dungeons);
+ sLog->outDebug(LOG_FILTER_LFG, "%s", o.str().c_str());
}
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joined with %u members. dungeons: %u", guid, grp ? grp->GetMembersCount() : 1, uint8(dungeons.size()));
}
/**
Leaves Dungeon System. Player/Group is removed from queue, rolechecks, proposals
or votekicks. Player or group needs to be not NULL and using Dungeon System
- @param[in] player Player trying to leave (can be NULL)
- @param[in] grp Group trying to leave (default NULL)
+ @param[in] guid Player or group guid
*/
-void LFGMgr::Leave(Player* player, Group* grp /* = NULL*/)
+void LFGMgr::LeaveLfg(uint64 guid)
{
- if (!player && !grp)
- return;
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::LeaveLfg: [" UI64FMTD "]", guid);
- uint64 guid = grp ? grp->GetGUID() : player->GetGUID();
+ uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid);
LfgState state = GetState(guid);
-
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
switch (state)
{
case LFG_STATE_QUEUED:
+ if (gguid)
{
- RemoveFromQueue(guid);
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
- if (grp)
- {
- RestoreState(guid);
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
- if (Player* plrg = itr->getSource())
- {
- plrg->GetSession()->SendLfgUpdateParty(updateData);
- uint64 pguid = plrg->GetGUID();
- ClearState(pguid);
- }
- }
- else
+ LFGQueue& queue = GetQueue(gguid);
+ queue.RemoveFromQueue(gguid);
+ SetState(gguid, LFG_STATE_NONE);
+ const LfgGuidSet& players = GetPlayers(gguid);
+ for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
- player->GetSession()->SendLfgUpdatePlayer(updateData);
- ClearState(guid);
+ SetState(*it, LFG_STATE_NONE);
+ SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
}
}
+ else
+ {
+ LFGQueue& queue = GetQueue(guid);
+ queue.RemoveFromQueue(guid);
+ SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
+ SetState(guid, LFG_STATE_NONE);
+ }
break;
case LFG_STATE_ROLECHECK:
- if (grp)
- UpdateRoleCheck(guid); // No player to update role = LFG_ROLECHECK_ABORTED
+ if (gguid)
+ UpdateRoleCheck(gguid); // No player to update role = LFG_ROLECHECK_ABORTED
break;
case LFG_STATE_PROPOSAL:
{
// Remove from Proposals
- LfgProposalMap::iterator it = m_Proposals.begin();
- while (it != m_Proposals.end())
+ LfgProposalContainer::iterator it = ProposalsStore.begin();
+ uint64 pguid = gguid == guid ? GetLeader(gguid) : guid;
+ while (it != ProposalsStore.end())
{
- LfgProposalPlayerMap::iterator itPlayer = it->second->players.find(player ? player->GetGUID() : grp->GetLeaderGUID());
- if (itPlayer != it->second->players.end())
+ LfgProposalPlayerContainer::iterator itPlayer = it->second.players.find(pguid);
+ if (itPlayer != it->second.players.end())
{
// Mark the player/leader of group who left as didn't accept the proposal
- itPlayer->second->accept = LFG_ANSWER_DENY;
+ itPlayer->second.accept = LFG_ANSWER_DENY;
break;
}
++it;
}
// Remove from queue - if proposal is found, RemoveProposal will call RemoveFromQueue
- if (it != m_Proposals.end())
+ if (it != ProposalsStore.end())
RemoveProposal(it, LFG_UPDATETYPE_PROPOSAL_DECLINED);
break;
}
- default:
+ case LFG_STATE_NONE:
+ case LFG_STATE_RAIDBROWSER:
+ break;
+ case LFG_STATE_DUNGEON:
+ case LFG_STATE_FINISHED_DUNGEON:
+ case LFG_STATE_BOOT:
+ if (guid != gguid) // Player
+ SetState(guid, LFG_STATE_NONE);
break;
}
}
/**
- Sends the leader of a group the offer to continue popup
-
- @param[in] grp Group to send offer to
-*/
-void LFGMgr::OfferContinue(Group* grp)
-{
- if (grp)
- {
- uint64 gguid = grp->GetGUID();
- if (Player* leader = ObjectAccessor::FindPlayer(grp->GetLeaderGUID()))
- leader->GetSession()->SendLfgOfferContinue(GetDungeon(gguid, false));
- }
-}
-
-/**
- Checks que main queue to try to form a Lfg group. Returns first match found (if any)
-
- @param[in] check List of guids trying to match with other groups
- @param[in] all List of all other guids in main queue to match against
- @return Pointer to proposal, if match is found
-*/
-LfgProposal* LFGMgr::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
-{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FindNewGroup: (%s) - all(%s)", ConcatenateGuids(check).c_str(), ConcatenateGuids(all).c_str());
-
- LfgProposal* pProposal = NULL;
- if (check.empty() || check.size() > MAXGROUPSIZE || !CheckCompatibility(check, pProposal))
- return NULL;
-
- // Try to match with queued groups
- while (!pProposal && !all.empty())
- {
- check.push_back(all.front());
- all.pop_front();
- pProposal = FindNewGroups(check, all);
- check.pop_back();
- }
- return pProposal;
-}
-
-/**
- Check compatibilities between groups
-
- @param[in] check List of guids to check compatibilities
- @param[out] pProposal Proposal found if groups are compatibles and Match
- @return true if group are compatibles
-*/
-bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
-{
- if (pProposal) // Do not check anything if we already have a proposal
- return false;
-
- std::string strGuids = ConcatenateGuids(check);
-
- if (check.size() > MAXGROUPSIZE || check.empty())
- {
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s): Size wrong - Not compatibles", strGuids.c_str());
- return false;
- }
-
- if (check.size() == 1 && IS_PLAYER_GUID(check.front())) // Player joining dungeon... compatible
- return true;
-
- // Previously cached?
- LfgAnswer answer = GetCompatibles(strGuids);
- if (answer != LFG_ANSWER_PENDING)
- {
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) compatibles (cached): %d", strGuids.c_str(), answer);
- return bool(answer);
- }
-
- // Check all but new compatiblitity
- if (check.size() > 2)
- {
- uint64 frontGuid = check.front();
- check.pop_front();
-
- // Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D)
- if (!CheckCompatibility(check, pProposal)) // Group not compatible
- {
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) not compatibles (%s not compatibles)", strGuids.c_str(), ConcatenateGuids(check).c_str());
- SetCompatibles(strGuids, false);
- return false;
- }
- check.push_front(frontGuid);
- // all-but-new compatibles, now check with new
- }
-
- uint8 numPlayers = 0;
- uint8 numLfgGroups = 0;
- uint32 groupLowGuid = 0;
- LfgQueueInfoMap pqInfoMap;
- for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
- {
- uint64 guid = (*it);
- LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid);
- if (itQueue == m_QueueInfoMap.end() || GetState(guid) != LFG_STATE_QUEUED)
- {
- sLog->outError("LFGMgr::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", (*it));
- RemoveFromQueue(guid);
- return false;
- }
- pqInfoMap[guid] = itQueue->second;
- numPlayers += itQueue->second->roles.size();
-
- if (IS_GROUP(guid))
- {
- uint32 lowGuid = GUID_LOPART(guid);
- if (Group* grp = sGroupMgr->GetGroupByGUID(lowGuid))
- if (grp->isLFGGroup())
- {
- if (!numLfgGroups)
- groupLowGuid = lowGuid;
- ++numLfgGroups;
- }
- }
- }
-
- if (check.size() == 1 && numPlayers != MAXGROUPSIZE) // Single group with less than MAXGROUPSIZE - Compatibles
- return true;
-
- // Do not match - groups already in a lfgDungeon or too much players
- if (numLfgGroups > 1 || numPlayers > MAXGROUPSIZE)
- {
- SetCompatibles(strGuids, false);
- if (numLfgGroups > 1)
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) More than one Lfggroup (%u)", strGuids.c_str(), numLfgGroups);
- else
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Too much players (%u)", strGuids.c_str(), numPlayers);
- return false;
- }
-
- // ----- Player checks -----
- LfgRolesMap rolesMap;
- uint64 leader = 0;
- for (LfgQueueInfoMap::const_iterator it = pqInfoMap.begin(); it != pqInfoMap.end(); ++it)
- {
- for (LfgRolesMap::const_iterator itRoles = it->second->roles.begin(); itRoles != it->second->roles.end(); ++itRoles)
- {
- // Assign new leader
- if (itRoles->second & ROLE_LEADER && (!leader || urand(0, 1)))
- leader = itRoles->first;
-
- rolesMap[itRoles->first] = itRoles->second;
- }
- }
-
- if (rolesMap.size() != numPlayers) // Player in multiples queues!
- return false;
-
- PlayerSet players;
- for (LfgRolesMap::const_iterator it = rolesMap.begin(); it != rolesMap.end(); ++it)
- {
- Player* player = ObjectAccessor::FindPlayer(it->first);
- if (!player)
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Warning! [" UI64FMTD "] offline! Marking as not compatibles!", strGuids.c_str(), it->first);
- else
- {
- for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && player; ++itPlayer)
- {
- // Do not form a group with ignoring candidates
- if (player->GetSocial()->HasIgnore((*itPlayer)->GetGUIDLow()) || (*itPlayer)->GetSocial()->HasIgnore(player->GetGUIDLow()))
- {
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Players [" UI64FMTD "] and [" UI64FMTD "] ignoring", strGuids.c_str(), (*itPlayer)->GetGUID(), player->GetGUID());
- player = NULL;
- }
- }
- if (player)
- players.insert(player);
- }
- }
-
- // if we dont have the same ammount of players then we have self ignoring candidates or different faction groups
- // otherwise check if roles are compatible
- if (players.size() != numPlayers || !CheckGroupRoles(rolesMap))
- {
- if (players.size() == numPlayers)
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Roles not compatible", strGuids.c_str());
- SetCompatibles(strGuids, false);
- return false;
- }
-
- // ----- Selected Dungeon checks -----
- // Check if there are any compatible dungeon from the selected dungeons
- LfgDungeonSet compatibleDungeons;
-
- LfgQueueInfoMap::const_iterator itFirst = pqInfoMap.begin();
- for (LfgDungeonSet::const_iterator itDungeon = itFirst->second->dungeons.begin(); itDungeon != itFirst->second->dungeons.end(); ++itDungeon)
- {
- LfgQueueInfoMap::const_iterator itOther = itFirst;
- ++itOther;
- while (itOther != pqInfoMap.end() && itOther->second->dungeons.find(*itDungeon) != itOther->second->dungeons.end())
- ++itOther;
-
- if (itOther == pqInfoMap.end())
- compatibleDungeons.insert(*itDungeon);
- }
- LfgLockPartyMap lockMap;
- GetCompatibleDungeons(compatibleDungeons, players, lockMap);
-
- if (compatibleDungeons.empty())
- {
- SetCompatibles(strGuids, false);
- return false;
- }
- SetCompatibles(strGuids, true);
-
- // ----- Group is compatible, if we have MAXGROUPSIZE members then match is found
- if (numPlayers != MAXGROUPSIZE)
- {
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) Compatibles but not match. Players(%u)", strGuids.c_str(), numPlayers);
- uint8 Tanks_Needed = LFG_TANKS_NEEDED;
- uint8 Healers_Needed = LFG_HEALERS_NEEDED;
- uint8 Dps_Needed = LFG_DPS_NEEDED;
- for (LfgQueueInfoMap::const_iterator itQueue = pqInfoMap.begin(); itQueue != pqInfoMap.end(); ++itQueue)
- {
- LfgQueueInfo* queue = itQueue->second;
- for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
- {
- uint8 roles = itPlayer->second;
- if ((roles & ROLE_TANK) && Tanks_Needed > 0)
- --Tanks_Needed;
- else if ((roles & ROLE_HEALER) && Healers_Needed > 0)
- --Healers_Needed;
- else if ((roles & ROLE_DAMAGE) && Dps_Needed > 0)
- --Dps_Needed;
- }
- }
- for (PlayerSet::const_iterator itPlayers = players.begin(); itPlayers != players.end(); ++itPlayers)
- {
- for (LfgQueueInfoMap::const_iterator itQueue = pqInfoMap.begin(); itQueue != pqInfoMap.end(); ++itQueue)
- {
- LfgQueueInfo* queue = itQueue->second;
- if (!queue)
- continue;
-
- for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer)
- {
- if (*itPlayers == ObjectAccessor::FindPlayer(itPlayer->first))
- {
- queue->tanks = Tanks_Needed;
- queue->healers = Healers_Needed;
- queue->dps = Dps_Needed;
- }
- }
- }
- }
- return true;
- }
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s) MATCH! Group formed", strGuids.c_str());
-
- // GROUP FORMED!
- // TODO - Improve algorithm to select proper group based on Item Level
- // Do not match bad tank and bad healer on same group
-
- // Select a random dungeon from the compatible list
- // TODO - Select the dungeon based on group item Level, not just random
- // Create a new proposal
- pProposal = new LfgProposal(Trinity::Containers::SelectRandomContainerElement(compatibleDungeons));
- pProposal->cancelTime = time_t(time(NULL)) + LFG_TIME_PROPOSAL;
- pProposal->state = LFG_PROPOSAL_INITIATING;
- pProposal->queues = check;
- pProposal->groupLowGuid = groupLowGuid;
-
- // Assign new roles to players and assign new leader
- PlayerSet::const_iterator itPlayers = players.begin();
- if (!leader)
- {
- uint8 pos = uint8(urand(0, players.size() - 1));
- for (uint8 i = 0; i < pos; ++i)
- ++itPlayers;
- leader = (*itPlayers)->GetGUID();
- }
- pProposal->leader = leader;
-
- uint8 numAccept = 0;
- for (itPlayers = players.begin(); itPlayers != players.end(); ++itPlayers)
- {
- uint64 guid = (*itPlayers)->GetGUID();
- LfgProposalPlayer* ppPlayer = new LfgProposalPlayer();
- if (Group* grp = (*itPlayers)->GetGroup())
- {
- ppPlayer->groupLowGuid = grp->GetLowGUID();
- if (grp->isLFGGroup()) // Player from existing group, autoaccept
- {
- ppPlayer->accept = LFG_ANSWER_AGREE;
- ++numAccept;
- }
- }
- ppPlayer->role = rolesMap[guid];
- pProposal->players[guid] = ppPlayer;
- }
- if (numAccept == MAXGROUPSIZE)
- pProposal->state = LFG_PROPOSAL_SUCCESS;
-
- return true;
-}
-
-/**
Update the Role check info with the player selected role.
@param[in] grp Group guid to update rolecheck
@param[in] guid Player guid (0 = rolecheck failed)
@param[in] roles Player selected roles
*/
-void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* = ROLE_NONE */)
+void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* = PLAYER_ROLE_NONE */)
{
if (!gguid)
return;
LfgRolesMap check_roles;
- LfgRoleCheckMap::iterator itRoleCheck = m_RoleChecks.find(gguid);
- if (itRoleCheck == m_RoleChecks.end())
+ LfgRoleCheckContainer::iterator itRoleCheck = RoleChecksStore.find(gguid);
+ if (itRoleCheck == RoleChecksStore.end())
return;
- LfgRoleCheck* roleCheck = itRoleCheck->second;
- bool sendRoleChosen = roleCheck->state != LFG_ROLECHECK_DEFAULT && guid;
+ LfgRoleCheck& roleCheck = itRoleCheck->second;
+ bool sendRoleChosen = roleCheck.state != LFG_ROLECHECK_DEFAULT && guid;
if (!guid)
- roleCheck->state = LFG_ROLECHECK_ABORTED;
- else if (roles < ROLE_TANK) // Player selected no role.
- roleCheck->state = LFG_ROLECHECK_NO_ROLE;
+ roleCheck.state = LFG_ROLECHECK_ABORTED;
+ else if (roles < PLAYER_ROLE_TANK) // Player selected no role.
+ roleCheck.state = LFG_ROLECHECK_NO_ROLE;
else
{
- roleCheck->roles[guid] = roles;
+ roleCheck.roles[guid] = roles;
// Check if all players have selected a role
- LfgRolesMap::const_iterator itRoles = roleCheck->roles.begin();
- while (itRoles != roleCheck->roles.end() && itRoles->second != ROLE_NONE)
+ LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin();
+ while (itRoles != roleCheck.roles.end() && itRoles->second != PLAYER_ROLE_NONE)
++itRoles;
- if (itRoles == roleCheck->roles.end())
+ if (itRoles == roleCheck.roles.end())
{
// use temporal var to check roles, CheckGroupRoles modifies the roles
- check_roles = roleCheck->roles;
- roleCheck->state = CheckGroupRoles(check_roles) ? LFG_ROLECHECK_FINISHED : LFG_ROLECHECK_WRONG_ROLES;
+ check_roles = roleCheck.roles;
+ roleCheck.state = CheckGroupRoles(check_roles) ? LFG_ROLECHECK_FINISHED : LFG_ROLECHECK_WRONG_ROLES;
}
}
- uint8 team = 0;
LfgDungeonSet dungeons;
- if (roleCheck->rDungeonId)
- dungeons.insert(roleCheck->rDungeonId);
+ if (roleCheck.rDungeonId)
+ dungeons.insert(roleCheck.rDungeonId);
else
- dungeons = roleCheck->dungeons;
+ dungeons = roleCheck.dungeons;
- LfgJoinResultData joinData = LfgJoinResultData(LFG_JOIN_FAILED, roleCheck->state);
- for (LfgRolesMap::const_iterator it = roleCheck->roles.begin(); it != roleCheck->roles.end(); ++it)
+ LfgJoinResultData joinData = LfgJoinResultData(LFG_JOIN_FAILED, roleCheck.state);
+ for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{
uint64 pguid = it->first;
- Player* plrg = ObjectAccessor::FindPlayer(pguid);
- if (!plrg)
- {
- if (roleCheck->state == LFG_ROLECHECK_FINISHED)
- SetState(pguid, LFG_STATE_QUEUED);
- else if (roleCheck->state != LFG_ROLECHECK_INITIALITING)
- ClearState(pguid);
- continue;
- }
- team = uint8(plrg->GetTeam());
if (!sendRoleChosen)
- plrg->GetSession()->SendLfgRoleChosen(guid, roles);
- plrg->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
- switch (roleCheck->state)
+ SendLfgRoleChosen(pguid, guid, roles);
+
+ SendLfgRoleCheckUpdate(pguid, roleCheck);
+ switch (roleCheck.state)
{
case LFG_ROLECHECK_INITIALITING:
continue;
case LFG_ROLECHECK_FINISHED:
SetState(pguid, LFG_STATE_QUEUED);
- plrg->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, GetComment(pguid)));
+ SetRoles(pguid, it->second);
+ SendLfgUpdateParty(pguid, LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, dungeons, GetComment(pguid)));
break;
default:
- if (roleCheck->leader == pguid)
- plrg->GetSession()->SendLfgJoinResult(joinData);
- plrg->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ROLECHECK_FAILED));
- ClearState(pguid);
+ if (roleCheck.leader == pguid)
+ SendLfgJoinResult(pguid, joinData);
+ SendLfgUpdateParty(pguid, LfgUpdateData(LFG_UPDATETYPE_ROLECHECK_FAILED));
+ RestoreState(pguid, "Rolecheck Failed");
break;
}
}
- if (roleCheck->state == LFG_ROLECHECK_FINISHED)
+ if (roleCheck.state == LFG_ROLECHECK_FINISHED)
{
SetState(gguid, LFG_STATE_QUEUED);
- LfgQueueInfo* pqInfo = new LfgQueueInfo();
- pqInfo->joinTime = time_t(time(NULL));
- pqInfo->roles = roleCheck->roles;
- pqInfo->dungeons = roleCheck->dungeons;
-
- // Set queue roles needed - As we are using check_roles will not have more that 1 tank, 1 healer, 3 dps
- for (LfgRolesMap::const_iterator it = check_roles.begin(); it != check_roles.end(); ++it)
- {
- uint8 roles2 = it->second;
- if (roles2 & ROLE_TANK)
- --pqInfo->tanks;
- else if (roles2 & ROLE_HEALER)
- --pqInfo->healers;
- else
- --pqInfo->dps;
- }
-
- m_QueueInfoMap[gguid] = pqInfo;
- if (GetState(gguid) != LFG_STATE_NONE)
- {
- LfgGuidList& currentQueue = m_currentQueue[team];
- currentQueue.push_front(gguid);
- }
- AddToQueue(gguid, team);
+ LFGQueue& queue = GetQueue(gguid);
+ queue.AddQueueData(gguid, time_t(time(NULL)), roleCheck.dungeons, roleCheck.roles);
+ RoleChecksStore.erase(itRoleCheck);
}
-
- if (roleCheck->state != LFG_ROLECHECK_INITIALITING)
- {
- if (roleCheck->state != LFG_ROLECHECK_FINISHED)
- RestoreState(gguid);
- delete roleCheck;
- m_RoleChecks.erase(itRoleCheck);
- }
-}
-
-/**
- Remove from cached compatible dungeons any entry that contains the given guid
-
- @param[in] guid Guid to remove from compatible cache
-*/
-void LFGMgr::RemoveFromCompatibles(uint64 guid)
-{
- std::stringstream out;
- out << guid;
- std::string strGuid = out.str();
-
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveFromCompatibles: Removing [" UI64FMTD "]", guid);
- for (LfgCompatibleMap::iterator itNext = m_CompatibleMap.begin(); itNext != m_CompatibleMap.end();)
+ else if (roleCheck.state != LFG_ROLECHECK_INITIALITING)
{
- LfgCompatibleMap::iterator it = itNext++;
- if (it->first.find(strGuid) != std::string::npos) // Found, remove it
- m_CompatibleMap.erase(it);
+ RestoreState(gguid, "Rolecheck Failed");
+ RoleChecksStore.erase(itRoleCheck);
}
}
/**
- Stores the compatibility of a list of guids
-
- @param[in] key String concatenation of guids (| used as separator)
- @param[in] compatibles Compatibles or not
-*/
-void LFGMgr::SetCompatibles(std::string key, bool compatibles)
-{
- m_CompatibleMap[key] = LfgAnswer(compatibles);
-}
-
-/**
- Get the compatibility of a group of guids
-
- @param[in] key String concatenation of guids (| used as separator)
- @return 1 (Compatibles), 0 (Not compatibles), -1 (Not set)
-*/
-LfgAnswer LFGMgr::GetCompatibles(std::string key)
-{
- LfgAnswer answer = LFG_ANSWER_PENDING;
- LfgCompatibleMap::iterator it = m_CompatibleMap.find(key);
- if (it != m_CompatibleMap.end())
- answer = it->second;
-
- return answer;
-}
-
-/**
Given a list of dungeons remove the dungeons players have restrictions.
@param[in, out] dungeons Dungeons to check restrictions
@param[in] players Set of players to check their dungeon restrictions
@param[out] lockMap Map of players Lock status info of given dungeons (Empty if dungeons is not empty)
*/
-void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap)
+void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const LfgGuidSet& players, LfgLockPartyMap& lockMap)
{
lockMap.clear();
- for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it)
+ for (LfgGuidSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{
- uint64 guid = (*it)->GetGUID();
- LfgLockMap cachedLockMap = GetLockedDungeons(guid);
- for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2)
+ uint64 guid = (*it);
+ LfgLockMap const& cachedLockMap = GetLockedDungeons(guid);
+ for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
@@ -1278,36 +956,36 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
if (removeLeaderFlag)
for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
- it->second &= ~ROLE_LEADER;
+ it->second &= ~PLAYER_ROLE_LEADER;
for (LfgRolesMap::iterator it = groles.begin(); it != groles.end(); ++it)
{
- if (it->second == ROLE_NONE)
+ if (it->second == PLAYER_ROLE_NONE)
return false;
- if (it->second & ROLE_TANK)
+ if (it->second & PLAYER_ROLE_DAMAGE)
{
- if (it->second != ROLE_TANK)
+ if (it->second != PLAYER_ROLE_DAMAGE)
{
- it->second -= ROLE_TANK;
+ it->second -= PLAYER_ROLE_DAMAGE;
if (CheckGroupRoles(groles, false))
return true;
- it->second += ROLE_TANK;
+ it->second += PLAYER_ROLE_DAMAGE;
}
- else if (tank == LFG_TANKS_NEEDED)
+ else if (damage == LFG_DPS_NEEDED)
return false;
else
- tank++;
+ damage++;
}
- if (it->second & ROLE_HEALER)
+ if (it->second & PLAYER_ROLE_HEALER)
{
- if (it->second != ROLE_HEALER)
+ if (it->second != PLAYER_ROLE_HEALER)
{
- it->second -= ROLE_HEALER;
+ it->second -= PLAYER_ROLE_HEALER;
if (CheckGroupRoles(groles, false))
return true;
- it->second += ROLE_HEALER;
+ it->second += PLAYER_ROLE_HEALER;
}
else if (healer == LFG_HEALERS_NEEDED)
return false;
@@ -1315,25 +993,103 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
healer++;
}
- if (it->second & ROLE_DAMAGE)
+ if (it->second & PLAYER_ROLE_TANK)
{
- if (it->second != ROLE_DAMAGE)
+ if (it->second != PLAYER_ROLE_TANK)
{
- it->second -= ROLE_DAMAGE;
+ it->second -= PLAYER_ROLE_TANK;
if (CheckGroupRoles(groles, false))
return true;
- it->second += ROLE_DAMAGE;
+ it->second += PLAYER_ROLE_TANK;
}
- else if (damage == LFG_DPS_NEEDED)
+ else if (tank == LFG_TANKS_NEEDED)
return false;
else
- damage++;
+ tank++;
}
}
return (tank + healer + damage) == uint8(groles.size());
}
/**
+ Makes a new group given a proposal
+ @param[in] proposal Proposal to get info from
+*/
+void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
+{
+ LfgGuidList players;
+ LfgGuidList playersToTeleport;
+
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ {
+ uint64 guid = it->first;
+ if (guid == proposal.leader)
+ players.push_front(guid);
+ else
+ players.push_back(guid);
+
+ if (proposal.isNew || GetGroup(guid) != proposal.group)
+ playersToTeleport.push_back(guid);
+ }
+
+ // Set the dungeon difficulty
+ LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId);
+ ASSERT(dungeon);
+
+ Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL;
+ for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it)
+ {
+ uint64 pguid = (*it);
+ Player* player = ObjectAccessor::FindPlayer(pguid);
+ if (!player)
+ continue;
+
+ Group* group = player->GetGroup();
+ if (group && group != grp)
+ group->RemoveMember(player->GetGUID());
+
+ if (!grp)
+ {
+ grp = new Group();
+ grp->ConvertToLFG();
+ grp->Create(player);
+ uint64 gguid = grp->GetGUID();
+ SetState(gguid, LFG_STATE_PROPOSAL);
+ sGroupMgr->AddGroup(grp);
+ }
+ else if (group != grp)
+ grp->AddMember(player);
+
+ grp->SetLfgRoles(pguid, proposal.players.find(pguid)->second.role);
+
+ // Add the cooldown spell if queued for a random dungeon
+ if (dungeon->type == LFG_TYPE_RANDOM)
+ player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
+ }
+
+ grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
+ uint64 gguid = grp->GetGUID();
+ SetDungeon(gguid, dungeon->Entry());
+ SetState(gguid, LFG_STATE_DUNGEON);
+
+ _SaveToDB(gguid, grp->GetDbStoreId());
+
+ // Teleport Player
+ for (LfgGuidList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
+ if (Player* player = ObjectAccessor::FindPlayer(*it))
+ TeleportPlayer(player, false);
+
+ // Update group info
+ grp->SendUpdate();
+}
+
+uint32 LFGMgr::AddProposal(LfgProposal const& proposal)
+{
+ ProposalsStore[++m_lfgProposalId] = proposal;
+ return m_lfgProposalId;
+}
+
+/**
Update Proposal info with player answer
@param[in] proposalId Proposal id to be updated
@@ -1343,18 +1099,20 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
{
// Check if the proposal exists
- LfgProposalMap::iterator itProposal = m_Proposals.find(proposalId);
- if (itProposal == m_Proposals.end())
+ LfgProposalContainer::iterator itProposal = ProposalsStore.find(proposalId);
+ if (itProposal == ProposalsStore.end())
return;
- LfgProposal* pProposal = itProposal->second;
+
+ LfgProposal& proposal = itProposal->second;
// Check if proposal have the current player
- LfgProposalPlayerMap::iterator itProposalPlayer = pProposal->players.find(guid);
- if (itProposalPlayer == pProposal->players.end())
+ LfgProposalPlayerContainer::iterator itProposalPlayer = proposal.players.find(guid);
+ if (itProposalPlayer == proposal.players.end())
return;
- LfgProposalPlayer* ppPlayer = itProposalPlayer->second;
- ppPlayer->accept = LfgAnswer(accept);
+ LfgProposalPlayer& player = itProposalPlayer->second;
+ player.accept = LfgAnswer(accept);
+
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: Player [" UI64FMTD "] of proposal %u selected: %u", guid, proposalId, accept);
if (!accept)
{
@@ -1362,157 +1120,80 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
return;
}
- LfgPlayerList players;
- LfgPlayerList playersToTeleport;
-
// check if all have answered and reorder players (leader first)
bool allAnswered = true;
- for (LfgProposalPlayerMap::const_iterator itPlayers = pProposal->players.begin(); itPlayers != pProposal->players.end(); ++itPlayers)
- {
- if (Player* player = ObjectAccessor::FindPlayer(itPlayers->first))
- {
- if (itPlayers->first == pProposal->leader)
- players.push_front(player);
- else
- players.push_back(player);
-
- // Only teleport new players
- Group* grp = player->GetGroup();
- uint64 gguid = grp ? grp->GetGUID() : 0;
- if (!gguid || !grp->isLFGGroup() || GetState(gguid) == LFG_STATE_FINISHED_DUNGEON)
- playersToTeleport.push_back(player);
- }
-
- if (itPlayers->second->accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
+ for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
+ if (itPlayers->second.accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
allAnswered = false;
- }
if (!allAnswered)
{
- for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
- (*it)->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
- }
- else
- {
- bool sendUpdate = pProposal->state != LFG_PROPOSAL_SUCCESS;
- pProposal->state = LFG_PROPOSAL_SUCCESS;
- time_t joinTime = time_t(time(NULL));
- std::map<uint64, int32> waitTimesMap;
- // Save wait times before redoing groups
- for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- LfgProposalPlayer* player = pProposal->players[(*it)->GetGUID()];
- uint32 lowgroupguid = (*it)->GetGroup() ? (*it)->GetGroup()->GetLowGUID() : 0;
- if (player->groupLowGuid != lowgroupguid)
- sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid);
-
- uint64 guid2 = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID();
- LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid2);
- if (itQueue == m_QueueInfoMap.end())
- {
- sLog->outError("LFGMgr::UpdateProposal: Queue info for guid [" UI64FMTD "] not found!", guid);
- waitTimesMap[(*it)->GetGUID()] = -1;
- }
- else
- waitTimesMap[(*it)->GetGUID()] = int32(joinTime - itQueue->second->joinTime);
+ uint64 guid = it->first;
+ SendLfgUpdateProposal(guid, proposalId, proposal);
}
+ return;
+ }
- // Set the dungeon difficulty
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(pProposal->dungeonId);
- ASSERT(dungeon);
-
- // Create a new group (if needed)
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
- Group* grp = pProposal->groupLowGuid ? sGroupMgr->GetGroupByGUID(pProposal->groupLowGuid) : NULL;
- for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
- {
- Player* player = (*it);
- uint64 pguid = player->GetGUID();
- Group* group = player->GetGroup();
- if (sendUpdate)
- player->GetSession()->SendLfgUpdateProposal(proposalId, pProposal);
-
- if (group)
- {
- player->GetSession()->SendLfgUpdateParty(updateData);
- if (group != grp)
- player->RemoveFromGroup();
- }
- else
- player->GetSession()->SendLfgUpdatePlayer(updateData);
-
- if (!grp)
- {
- grp = new Group();
- grp->Create(player);
- grp->ConvertToLFG();
- uint64 gguid = grp->GetGUID();
- SetState(gguid, LFG_STATE_PROPOSAL);
- sGroupMgr->AddGroup(grp);
- }
- else if (group != grp)
- grp->AddMember(player);
-
- // Update timers
- uint8 role = GetRoles(pguid);
- role &= ~ROLE_LEADER;
- switch (role)
- {
- case ROLE_DAMAGE:
- {
- uint32 old_number = m_NumWaitTimeDps++;
- m_WaitTimeDps = int32((m_WaitTimeDps * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeDps);
- break;
- }
- case ROLE_HEALER:
- {
- uint32 old_number = m_NumWaitTimeHealer++;
- m_WaitTimeHealer = int32((m_WaitTimeHealer * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeHealer);
- break;
- }
- case ROLE_TANK:
- {
- uint32 old_number = m_NumWaitTimeTank++;
- m_WaitTimeTank = int32((m_WaitTimeTank * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeTank);
- break;
- }
- default:
- {
- uint32 old_number = m_NumWaitTimeAvg++;
- m_WaitTimeAvg = int32((m_WaitTimeAvg * old_number + waitTimesMap[player->GetGUID()]) / m_NumWaitTimeAvg);
- break;
- }
- }
+ bool sendUpdate = proposal.state != LFG_PROPOSAL_SUCCESS;
+ proposal.state = LFG_PROPOSAL_SUCCESS;
+ time_t joinTime = time_t(time(NULL));
- m_teleport.push_back(pguid);
- grp->SetLfgRoles(pguid, pProposal->players[pguid]->role);
- SetState(pguid, LFG_STATE_DUNGEON);
+ LFGQueue& queue = GetQueue(guid);
+ LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ {
+ uint64 pguid = it->first;
+ uint64 gguid = it->second.group;
+ uint32 dungeonId = (*GetSelectedDungeons(pguid).begin());
+ int32 waitTime = -1;
+ if (sendUpdate)
+ SendLfgUpdateProposal(pguid, proposalId, proposal);
- // Add the cooldown spell if queued for a random dungeon
- if (dungeon->type == LFG_TYPE_RANDOM)
- player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);
+ if (gguid)
+ {
+ waitTime = int32((joinTime - queue.GetJoinTime(gguid)) / IN_MILLISECONDS);
+ SendLfgUpdateParty(pguid, updateData);
+ }
+ else
+ {
+ waitTime = int32((joinTime - queue.GetJoinTime(pguid)) / IN_MILLISECONDS);
+ SendLfgUpdatePlayer(pguid, updateData);
+ }
+ updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
+ SendLfgUpdatePlayer(pguid, updateData);
+ SendLfgUpdateParty(pguid, updateData);
+
+ // Update timers
+ uint8 role = GetRoles(pguid);
+ role &= ~PLAYER_ROLE_LEADER;
+ switch (role)
+ {
+ case PLAYER_ROLE_DAMAGE:
+ queue.UpdateWaitTimeDps(waitTime, dungeonId);
+ break;
+ case PLAYER_ROLE_HEALER:
+ queue.UpdateWaitTimeHealer(waitTime, dungeonId);
+ break;
+ case PLAYER_ROLE_TANK:
+ queue.UpdateWaitTimeTank(waitTime, dungeonId);
+ break;
+ default:
+ queue.UpdateWaitTimeAvg(waitTime, dungeonId);
+ break;
}
- grp->SetDungeonDifficulty(Difficulty(dungeon->difficulty));
- uint64 gguid = grp->GetGUID();
- SetDungeon(gguid, dungeon->Entry());
- SetState(gguid, LFG_STATE_DUNGEON);
- _SaveToDB(gguid, grp->GetDbStoreId());
-
- // Remove players/groups from Queue
- for (LfgGuidList::const_iterator it = pProposal->queues.begin(); it != pProposal->queues.end(); ++it)
- RemoveFromQueue(*it);
-
- // Teleport Player
- for (LfgPlayerList::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
- TeleportPlayer(*it, false);
+ teleportStore.push_back(pguid);
+ SetState(pguid, LFG_STATE_DUNGEON);
+ }
- // Update group info
- grp->SendUpdate();
+ // Remove players/groups from Queue
+ for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
+ queue.RemoveFromQueue(*it);
- delete pProposal;
- m_Proposals.erase(itProposal);
- }
+ MakeNewGroup(proposal);
+ ProposalsStore.erase(itProposal);
}
/**
@@ -1521,53 +1202,46 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
@param[in] itProposal Iterator to the proposal to remove
@param[in] type Type of removal (LFG_UPDATETYPE_PROPOSAL_FAILED, LFG_UPDATETYPE_PROPOSAL_DECLINED)
*/
-void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type)
+void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type)
{
- LfgProposal* pProposal = itProposal->second;
- pProposal->state = LFG_PROPOSAL_FAILED;
+ LfgProposal& proposal = itProposal->second;
+ proposal.state = LFG_PROPOSAL_FAILED;
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Proposal %u, state FAILED, UpdateType %u", itProposal->first, type);
// Mark all people that didn't answered as no accept
if (type == LFG_UPDATETYPE_PROPOSAL_FAILED)
- for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it)
- if (it->second->accept == LFG_ANSWER_PENDING)
- it->second->accept = LFG_ANSWER_DENY;
+ for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
+ if (it->second.accept == LFG_ANSWER_PENDING)
+ it->second.accept = LFG_ANSWER_DENY;
// Mark players/groups to be removed
LfgGuidSet toRemove;
- for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it)
+ for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- if (it->second->accept == LFG_ANSWER_AGREE)
+ if (it->second.accept == LFG_ANSWER_AGREE)
continue;
- uint64 guid = it->second->groupLowGuid ? MAKE_NEW_GUID(it->second->groupLowGuid, 0, HIGHGUID_GROUP) : it->first;
+ uint64 guid = it->second.group ? it->second.group : it->first;
// Player didn't accept or still pending when no secs left
- if (it->second->accept == LFG_ANSWER_DENY || type == LFG_UPDATETYPE_PROPOSAL_FAILED)
+ if (it->second.accept == LFG_ANSWER_DENY || type == LFG_UPDATETYPE_PROPOSAL_FAILED)
{
- it->second->accept = LFG_ANSWER_DENY;
+ it->second.accept = LFG_ANSWER_DENY;
toRemove.insert(guid);
}
}
- uint8 team = 0;
// Notify players
- for (LfgProposalPlayerMap::const_iterator it = pProposal->players.begin(); it != pProposal->players.end(); ++it)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- Player* player = ObjectAccessor::FindPlayer(it->first);
- if (!player)
- continue;
-
- team = uint8(player->GetTeam());
- player->GetSession()->SendLfgUpdateProposal(itProposal->first, pProposal);
+ uint64 guid = it->first;
+ uint64 gguid = it->second.group ? it->second.group : guid;
- Group* grp = player->GetGroup();
- uint64 guid = player->GetGUID();
- uint64 gguid = it->second->groupLowGuid ? MAKE_NEW_GUID(it->second->groupLowGuid, 0, HIGHGUID_GROUP) : guid;
+ SendLfgUpdateProposal(guid, itProposal->first, proposal);
if (toRemove.find(gguid) != toRemove.end()) // Didn't accept or in same group that someone that didn't accept
{
LfgUpdateData updateData;
- if (it->second->accept == LFG_ANSWER_DENY)
+ if (it->second.accept == LFG_ANSWER_DENY)
{
updateData.updateType = type;
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] didn't accept. Removing from queue and compatible cache", guid);
@@ -1577,126 +1251,111 @@ void LFGMgr::RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType t
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid);
}
- ClearState(guid);
- if (grp)
+
+ RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
+ if (gguid != guid)
{
- RestoreState(gguid);
- player->GetSession()->SendLfgUpdateParty(updateData);
+ RestoreState(it->second.group, "Proposal Fail (someone in group didn't accepted)");
+ SendLfgUpdateParty(guid, updateData);
}
else
- player->GetSession()->SendLfgUpdatePlayer(updateData);
+ SendLfgUpdatePlayer(guid, updateData);
}
else
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Readding [" UI64FMTD "] to queue.", guid);
SetState(guid, LFG_STATE_QUEUED);
- if (grp)
+ if (gguid != guid)
{
SetState(gguid, LFG_STATE_QUEUED);
- player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
+ SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
}
else
- player->GetSession()->SendLfgUpdatePlayer(LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
+ SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_ADDED_TO_QUEUE, GetSelectedDungeons(guid), GetComment(guid)));
}
}
+ LFGQueue& queue = GetQueue(proposal.players.begin()->first);
// Remove players/groups from queue
for (LfgGuidSet::const_iterator it = toRemove.begin(); it != toRemove.end(); ++it)
{
uint64 guid = *it;
- RemoveFromQueue(guid);
- pProposal->queues.remove(guid);
+ queue.RemoveFromQueue(guid);
+ proposal.queues.remove(guid);
}
// Readd to queue
- for (LfgGuidList::const_iterator it = pProposal->queues.begin(); it != pProposal->queues.end(); ++it)
+ for (LfgGuidList::const_iterator it = proposal.queues.begin(); it != proposal.queues.end(); ++it)
{
uint64 guid = *it;
- LfgGuidList& currentQueue = m_currentQueue[team];
- currentQueue.push_front(guid); //Add GUID for high priority
- AddToQueue(guid, team); //We have to add each GUID in newQueue to check for a new groups
+ queue.AddToQueue(guid);
}
- delete pProposal;
- m_Proposals.erase(itProposal);
+ ProposalsStore.erase(itProposal);
}
/**
Initialize a boot kick vote
- @param[in] grp Group the vote kicks belongs to
+ @param[in] gguid Group the vote kicks belongs to
@param[in] kicker Kicker guid
@param[in] victim Victim guid
@param[in] reason Kick reason
*/
-void LFGMgr::InitBoot(Group* grp, uint64 kicker, uint64 victim, std::string reason)
+void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason)
{
- if (!grp)
- return;
-
- uint64 gguid = grp->GetGUID();
SetState(gguid, LFG_STATE_BOOT);
- LfgPlayerBoot* pBoot = new LfgPlayerBoot();
- pBoot->inProgress = true;
- pBoot->cancelTime = time_t(time(NULL)) + LFG_TIME_BOOT;
- pBoot->reason = reason;
- pBoot->victim = victim;
- pBoot->votedNeeded = GetVotesNeeded(gguid);
+ LfgPlayerBoot& boot = BootsStore[gguid];
+ boot.inProgress = true;
+ boot.cancelTime = time_t(time(NULL)) + LFG_TIME_BOOT;
+ boot.reason = reason;
+ boot.victim = victim;
+
+ LfgGuidSet const& players = GetPlayers(gguid);
// Set votes
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
+ for (LfgGuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
- if (Player* plrg = itr->getSource())
- {
- uint64 guid = plrg->GetGUID();
- SetState(guid, LFG_STATE_BOOT);
- if (guid == victim)
- pBoot->votes[victim] = LFG_ANSWER_DENY; // Victim auto vote NO
- else if (guid == kicker)
- pBoot->votes[kicker] = LFG_ANSWER_AGREE; // Kicker auto vote YES
- else
- {
- pBoot->votes[guid] = LFG_ANSWER_PENDING; // Other members need to vote
- plrg->GetSession()->SendLfgBootPlayer(pBoot);
- }
- }
+ uint64 guid = (*itr);
+ SetState(guid, LFG_STATE_BOOT);
+ boot.votes[guid] = LFG_ANSWER_PENDING;
}
- m_Boots[grp->GetLowGUID()] = pBoot;
+ boot.votes[victim] = LFG_ANSWER_DENY; // Victim auto vote NO
+ boot.votes[kicker] = LFG_ANSWER_AGREE; // Kicker auto vote YES
+
+ // Notify players
+ for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
+ SendLfgBootProposalUpdate(*it, boot);
}
/**
Update Boot info with player answer
- @param[in] player Player who has answered
- @param[in] accept player answer
+ @param[in] guid Player who has answered
+ @param[in] player answer
*/
-void LFGMgr::UpdateBoot(Player* player, bool accept)
+void LFGMgr::UpdateBoot(uint64 guid, bool accept)
{
- Group* grp = player ? player->GetGroup() : NULL;
- if (!grp)
+ uint64 gguid = GetGroup(guid);
+ if (!gguid)
return;
- uint32 bootId = grp->GetLowGUID();
- uint64 guid = player->GetGUID();
-
- LfgPlayerBootMap::iterator itBoot = m_Boots.find(bootId);
- if (itBoot == m_Boots.end())
+ LfgPlayerBootContainer::iterator itBoot = BootsStore.find(gguid);
+ if (itBoot == BootsStore.end())
return;
- LfgPlayerBoot* pBoot = itBoot->second;
- if (!pBoot)
- return;
+ LfgPlayerBoot& boot = itBoot->second;
- if (pBoot->votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
+ if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
return;
- pBoot->votes[guid] = LfgAnswer(accept);
+ boot.votes[guid] = LfgAnswer(accept);
uint8 votesNum = 0;
uint8 agreeNum = 0;
- for (LfgAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes)
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
if (itVotes->second != LFG_ANSWER_PENDING)
{
@@ -1706,39 +1365,30 @@ void LFGMgr::UpdateBoot(Player* player, bool accept)
}
}
- if (agreeNum == pBoot->votedNeeded || // Vote passed
- votesNum == pBoot->votes.size() || // All voted but not passed
- (pBoot->votes.size() - votesNum + agreeNum) < pBoot->votedNeeded) // Vote didnt passed
+ // if we don't have enough votes (agree or deny) do nothing
+ if (agreeNum < LFG_GROUP_KICK_VOTES_NEEDED && (votesNum - agreeNum) < LFG_GROUP_KICK_VOTES_NEEDED)
+ return;
+
+ // Send update info to all players
+ boot.inProgress = false;
+ for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
{
- // Send update info to all players
- pBoot->inProgress = false;
- for (LfgAnswerMap::const_iterator itVotes = pBoot->votes.begin(); itVotes != pBoot->votes.end(); ++itVotes)
+ uint64 pguid = itVotes->first;
+ if (pguid != boot.victim)
{
- uint64 pguid = itVotes->first;
- if (pguid != pBoot->victim)
- {
- SetState(pguid, LFG_STATE_DUNGEON);
- if (Player* plrg = ObjectAccessor::FindPlayer(pguid))
- plrg->GetSession()->SendLfgBootPlayer(pBoot);
- }
+ SetState(pguid, LFG_STATE_DUNGEON);
+ SendLfgBootProposalUpdate(pguid, boot);
}
+ }
- uint64 gguid = grp->GetGUID();
- SetState(gguid, LFG_STATE_DUNGEON);
- if (agreeNum == pBoot->votedNeeded) // Vote passed - Kick player
- {
- Player::RemoveFromGroup(grp, pBoot->victim);
- if (Player* victim = ObjectAccessor::FindPlayer(pBoot->victim))
- {
- TeleportPlayer(victim, true, false);
- SetState(pBoot->victim, LFG_STATE_NONE);
- }
- OfferContinue(grp);
- DecreaseKicksLeft(gguid);
- }
- delete pBoot;
- m_Boots.erase(itBoot);
+ SetState(gguid, LFG_STATE_DUNGEON);
+ if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player
+ {
+ if (Group* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(gguid)))
+ Player::RemoveFromGroup(group, boot.victim, GROUP_REMOVEMETHOD_KICK_LFG);
+ DecreaseKicksLeft(gguid);
}
+ BootsStore.erase(itBoot);
}
/**
@@ -1750,107 +1400,95 @@ void LFGMgr::UpdateBoot(Player* player, bool accept)
*/
void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in");
+ LFGDungeonData const* dungeon = NULL;
+ Group* group = player->GetGroup();
+
+ if (group && group->isLFGGroup())
+ dungeon = GetLFGDungeon(GetDungeon(group->GetGUID()));
+
+ if (!dungeon)
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s not in group/lfggroup or dungeon not found!",
+ player->GetName().c_str());
+ player->GetSession()->SendLfgTeleportError(uint8(LFG_TELEPORTERROR_INVALID_LOCATION));
+ return;
+ }
+
+ if (out)
+ {
+ 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;
+ }
LfgTeleportError error = LFG_TELEPORTERROR_OK;
- Group* grp = player->GetGroup();
- if (!grp || !grp->isLFGGroup()) // should never happen, but just in case...
- error = LFG_TELEPORTERROR_INVALID_LOCATION;
- else if (!player->isAlive())
+ if (!player->isAlive())
error = LFG_TELEPORTERROR_PLAYER_DEAD;
else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING))
error = LFG_TELEPORTERROR_FALLING;
else if (player->IsMirrorTimerActive(FATIGUE_TIMER))
error = LFG_TELEPORTERROR_FATIGUE;
- else
+ else if (player->GetVehicle())
+ error = LFG_TELEPORTERROR_IN_VEHICLE;
+ else if (player->GetCharmGUID())
+ error = LFG_TELEPORTERROR_CHARMING;
+ else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance
{
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(GetDungeon(grp->GetGUID()));
+ uint32 mapid = dungeon->map;
+ float x = dungeon->x;
+ float y = dungeon->y;
+ float z = dungeon->z;
+ float orientation = dungeon->o;
- if (out)
+ if (!fromOpcode)
{
- // Player needs to be inside the LFG dungeon to be able to teleport out
- if (dungeon && player->GetMapId() == uint32(dungeon->map))
+ // Select a player inside to be teleported to
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL && !mapid; itr = itr->next())
{
- player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
- player->TeleportToBGEntryPoint();
+ Player* plrg = itr->getSource();
+ if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map))
+ {
+ mapid = plrg->GetMapId();
+ x = plrg->GetPositionX();
+ y = plrg->GetPositionY();
+ z = plrg->GetPositionZ();
+ orientation = plrg->GetOrientation();
+ break;
+ }
}
- else
- player->GetSession()->SendLfgTeleportError(LFG_TELEPORTERROR_DONT_REPORT); // Not sure which error message to send
-
- return;
}
- if (!dungeon)
- error = LFG_TELEPORTERROR_INVALID_LOCATION;
- else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance
+ if (error == LFG_TELEPORTERROR_OK)
{
- uint32 mapid = 0;
- float x = 0;
- float y = 0;
- float z = 0;
- float orientation = 0;
-
- if (!fromOpcode)
- {
- // Select a player inside to be teleported to
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && !mapid; itr = itr->next())
- {
- Player* plrg = itr->getSource();
- if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map))
- {
- mapid = plrg->GetMapId();
- x = plrg->GetPositionX();
- y = plrg->GetPositionY();
- z = plrg->GetPositionZ();
- orientation = plrg->GetOrientation();
- }
- }
- }
+ if (!player->GetMap()->IsDungeon())
+ player->SetBattlegroundEntryPoint();
- if (!mapid)
+ if (player->isInFlight())
{
- AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon->map);
- if (!at)
- {
- sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "]: No areatrigger found for map: %u difficulty: %u", player->GetGUID(), dungeon->map, dungeon->difficulty);
- error = LFG_TELEPORTERROR_INVALID_LOCATION;
- }
- else
- {
- mapid = at->target_mapId;
- x = at->target_X;
- y = at->target_Y;
- z = at->target_Z;
- orientation = at->target_Orientation;
- }
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
}
- if (error == LFG_TELEPORTERROR_OK)
+ if (!player->TeleportTo(mapid, x, y, z, orientation))
{
- if (!player->GetMap()->IsDungeon())
- player->SetBattlegroundEntryPoint();
-
- if (player->isInFlight())
- {
- player->GetMotionMaster()->MovementExpired();
- player->CleanupAfterTaxiFlight();
- }
-
- if (player->TeleportTo(mapid, x, y, z, orientation))
- // FIXME - HACK - this should be done by teleport, when teleporting far
- player->RemoveAurasByType(SPELL_AURA_MOUNTED);
- else
- {
- error = LFG_TELEPORTERROR_INVALID_LOCATION;
- sLog->outError("LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid);
- }
+ error = LFG_TELEPORTERROR_INVALID_LOCATION;
+ sLog->outError(LOG_FILTER_LFG, "TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u (x: %f, y: %f, z: %f)", player->GetGUID(), mapid, x, y, z);
}
}
}
if (error != LFG_TELEPORTERROR_OK)
player->GetSession()->SendLfgTeleportError(uint8(error));
+
+ sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported in. Result: %u",
+ player->GetName().c_str(), error);
}
/**
@@ -1888,20 +1526,19 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player)
// Clear player related lfg stuff
uint32 rDungeonId = (*GetSelectedDungeons(guid).begin());
- ClearState(guid);
SetState(guid, LFG_STATE_FINISHED_DUNGEON);
- // Give rewards only if its a random dungeon
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(rDungeonId);
- if (!dungeon || dungeon->type != LFG_TYPE_RANDOM)
+ // Give rewards only if its a random or seasonal dungeon
+ LFGDungeonData const* dungeon = GetLFGDungeon(rDungeonId);
+ if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal))
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RewardDungeonDoneFor: [" UI64FMTD "] dungeon %u is not random", guid, rDungeonId);
+ sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RewardDungeonDoneFor: [" UI64FMTD "] dungeon %u is not random nor seasonal", guid, rDungeonId);
return;
}
// Update achievements
if (dungeon->difficulty == DUNGEON_DIFFICULTY_HEROIC)
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, 1);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS, 1);
LfgReward const* reward = GetRandomDungeonReward(rDungeonId, player->getLevel());
if (!reward)
@@ -1942,9 +1579,9 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player)
*/
const LfgDungeonSet& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
{
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(randomdungeon);
- uint32 groupType = dungeon ? dungeon->grouptype : 0;
- return m_CachedDungeonMap[groupType];
+ LFGDungeonData const* dungeon = GetLFGDungeon(randomdungeon);
+ uint32 group = dungeon ? dungeon->group : 0;
+ return CachedDungeonMapStore[group];
}
/**
@@ -1957,8 +1594,8 @@ const LfgDungeonSet& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level)
{
LfgReward const* rew = NULL;
- LfgRewardMapBounds bounds = m_RewardMap.equal_range(dungeon & 0x00FFFFFF);
- for (LfgRewardMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
+ LfgRewardContainerBounds bounds = RewardMapStore.equal_range(dungeon & 0x00FFFFFF);
+ for (LfgRewardContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{
rew = itr->second;
// ordered properly at loading
@@ -1977,64 +1614,62 @@ LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level)
*/
LfgType LFGMgr::GetDungeonType(uint32 dungeonId)
{
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId);
+ LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId);
if (!dungeon)
return LFG_TYPE_NONE;
return LfgType(dungeon->type);
}
-/**
- Given a list of guids returns the concatenation using | as delimiter
-
- @param[in] check list of guids
- @returns Concatenated string
-*/
-std::string LFGMgr::ConcatenateGuids(LfgGuidList check)
+LfgState LFGMgr::GetState(uint64 guid)
{
- if (check.empty())
- return "";
+ LfgState state;
+ if (IS_GROUP(guid))
+ state = GroupsStore[guid].GetState();
+ else
+ state = PlayersStore[guid].GetState();
- std::ostringstream o;
- LfgGuidList::const_iterator it = check.begin();
- o << (*it);
- for (++it; it != check.end(); ++it)
- o << '|' << (*it);
- return o.str();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
+ return state;
}
-LfgState LFGMgr::GetState(uint64 guid)
+uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "]", guid);
- if (IS_GROUP(guid))
- return m_Groups[guid].GetState();
- else
- return m_Players[guid].GetState();
+ uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
+ return dungeon;
}
-uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true*/)
+uint32 LFGMgr::GetDungeonMapId(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u", guid, asId);
- return m_Groups[guid].GetDungeon(asId);
+ uint32 dungeonId = GroupsStore[guid].GetDungeon(true);
+ uint32 mapId = 0;
+ if (dungeonId)
+ if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
+ mapId = dungeon->map;
+
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
+ return mapId;
}
uint8 LFGMgr::GetRoles(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "]", guid);
- return m_Players[guid].GetRoles();
+ uint8 roles = PlayersStore[guid].GetRoles();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
+ return roles;
}
const std::string& LFGMgr::GetComment(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "]", guid);
- return m_Players[guid].GetComment();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
+ return PlayersStore[guid].GetComment();
}
bool LFGMgr::IsTeleported(uint64 pguid)
{
- if (std::find(m_teleport.begin(), m_teleport.end(), pguid) != m_teleport.end())
+ if (std::find(teleportStore.begin(), teleportStore.end(), pguid) != teleportStore.end())
{
- m_teleport.remove(pguid);
+ teleportStore.remove(pguid);
return true;
}
return false;
@@ -2042,97 +1677,355 @@ bool LFGMgr::IsTeleported(uint64 pguid)
const LfgDungeonSet& LFGMgr::GetSelectedDungeons(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
- return m_Players[guid].GetSelectedDungeons();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
+ return PlayersStore[guid].GetSelectedDungeons();
}
const LfgLockMap& LFGMgr::GetLockedDungeons(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
- return m_Players[guid].GetLockedDungeons();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
+ return PlayersStore[guid].GetLockedDungeons();
}
uint8 LFGMgr::GetKicksLeft(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "]", guid);
- return m_Groups[guid].GetKicksLeft();
-}
-
-uint8 LFGMgr::GetVotesNeeded(uint64 guid)
-{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetVotesNeeded: [" UI64FMTD "]", guid);
- return m_Groups[guid].GetVotesNeeded();
+ uint8 kicks = GroupsStore[guid].GetKicksLeft();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
+ return kicks;
}
-void LFGMgr::RestoreState(uint64 guid)
+void LFGMgr::RestoreState(uint64 guid, char const *debugMsg)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RestoreState: [" UI64FMTD "]", guid);
- m_Groups[guid].RestoreState();
-}
+ if (IS_GROUP(guid))
+ {
+ LfgGroupData& data = GroupsStore[guid];
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::string const& ps = GetStateString(data.GetState());
+ std::string const& os = GetStateString(data.GetOldState());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
+ guid, debugMsg, ps.c_str(), os.c_str());
+ }
-void LFGMgr::ClearState(uint64 guid)
-{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::ClearState: [" UI64FMTD "]", guid);
- m_Players[guid].ClearState();
+ data.RestoreState();
+ }
+ else
+ {
+ LfgPlayerData& data = PlayersStore[guid];
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::string const& ps = GetStateString(data.GetState());
+ std::string const& os = GetStateString(data.GetOldState());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
+ guid, debugMsg, ps.c_str(), os.c_str());
+ }
+ data.RestoreState();
+ }
}
void LFGMgr::SetState(uint64 guid, LfgState state)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: [" UI64FMTD "] state %u", guid, state);
if (IS_GROUP(guid))
- m_Groups[guid].SetState(state);
+ {
+ LfgGroupData& data = GroupsStore[guid];
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::string const& ns = GetStateString(state);
+ std::string const& ps = GetStateString(data.GetState());
+ std::string const& os = GetStateString(data.GetOldState());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
+ guid, ns.c_str(), ps.c_str(), os.c_str());
+ }
+ data.SetState(state);
+ }
else
- m_Players[guid].SetState(state);
+ {
+ LfgPlayerData& data = PlayersStore[guid];
+ if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
+ {
+ std::string const& ns = GetStateString(state);
+ std::string const& ps = GetStateString(data.GetState());
+ std::string const& os = GetStateString(data.GetOldState());
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
+ guid, ns.c_str(), ps.c_str(), os.c_str());
+ }
+ data.SetState(state);
+ }
}
void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
- m_Groups[guid].SetDungeon(dungeon);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
+ GroupsStore[guid].SetDungeon(dungeon);
}
void LFGMgr::SetRoles(uint64 guid, uint8 roles)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
- m_Players[guid].SetRoles(roles);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
+ PlayersStore[guid].SetRoles(roles);
}
void LFGMgr::SetComment(uint64 guid, const std::string& comment)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
- m_Players[guid].SetComment(comment);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
+ PlayersStore[guid].SetComment(comment);
}
void LFGMgr::SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
- m_Players[guid].SetSelectedDungeons(dungeons);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
+ PlayersStore[guid].SetSelectedDungeons(dungeons);
}
void LFGMgr::SetLockedDungeons(uint64 guid, const LfgLockMap& lock)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
- m_Players[guid].SetLockedDungeons(lock);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
+ PlayersStore[guid].SetLockedDungeons(lock);
}
void LFGMgr::DecreaseKicksLeft(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
- m_Groups[guid].DecreaseKicksLeft();
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
+ GroupsStore[guid].DecreaseKicksLeft();
}
void LFGMgr::RemovePlayerData(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
- LfgPlayerDataMap::iterator it = m_Players.find(guid);
- if (it != m_Players.end())
- m_Players.erase(it);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
+ LfgPlayerDataContainer::iterator it = PlayersStore.find(guid);
+ if (it != PlayersStore.end())
+ PlayersStore.erase(it);
}
void LFGMgr::RemoveGroupData(uint64 guid)
{
- sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
- LfgGroupDataMap::iterator it = m_Groups.find(guid);
- if (it != m_Groups.end())
- m_Groups.erase(it);
+ sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
+ LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
+ if (it == GroupsStore.end())
+ return;
+
+ LfgState state = GetState(guid);
+ // If group is being formed after proposal success do nothing more
+ LfgGuidSet const& players = it->second.GetPlayers();
+ for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
+ {
+ uint64 guid = (*it);
+ SetGroup(*it, 0);
+ if (state != LFG_STATE_PROPOSAL)
+ {
+ SetState(*it, LFG_STATE_NONE);
+ SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
+ }
+ }
+ GroupsStore.erase(it);
+}
+
+uint8 LFGMgr::GetTeam(uint64 guid)
+{
+ return PlayersStore[guid].GetTeam();
+}
+
+uint8 LFGMgr::RemovePlayerFromGroup(uint64 gguid, uint64 guid)
+{
+ return GroupsStore[gguid].RemovePlayer(guid);
+}
+
+void LFGMgr::AddPlayerToGroup(uint64 gguid, uint64 guid)
+{
+ GroupsStore[gguid].AddPlayer(guid);
+}
+
+void LFGMgr::SetLeader(uint64 gguid, uint64 leader)
+{
+ GroupsStore[gguid].SetLeader(leader);
+}
+
+void LFGMgr::SetTeam(uint64 guid, uint8 team)
+{
+ if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
+ team = 0;
+
+ PlayersStore[guid].SetTeam(team);
+}
+
+uint64 LFGMgr::GetGroup(uint64 guid)
+{
+ return PlayersStore[guid].GetGroup();
+}
+
+void LFGMgr::SetGroup(uint64 guid, uint64 group)
+{
+ PlayersStore[guid].SetGroup(group);
+}
+
+LfgGuidSet const& LFGMgr::GetPlayers(uint64 guid)
+{
+ return GroupsStore[guid].GetPlayers();
+}
+
+uint8 LFGMgr::GetPlayerCount(uint64 guid)
+{
+ return GroupsStore[guid].GetPlayerCount();
+}
+
+uint64 LFGMgr::GetLeader(uint64 guid)
+{
+ return GroupsStore[guid].GetLeader();
+}
+
+bool LFGMgr::HasIgnore(uint64 guid1, uint64 guid2)
+{
+ Player* plr1 = ObjectAccessor::FindPlayer(guid1);
+ Player* plr2 = ObjectAccessor::FindPlayer(guid2);
+ uint32 low1 = GUID_LOPART(guid1);
+ uint32 low2 = GUID_LOPART(guid2);
+ return plr1 && plr2 && (plr1->GetSocial()->HasIgnore(low2) || plr2->GetSocial()->HasIgnore(low1));
+}
+
+void LFGMgr::SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgRoleChosen(pguid, roles);
+}
+
+void LFGMgr::SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgRoleCheckUpdate(roleCheck);
+}
+
+void LFGMgr::SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgUpdatePlayer(data);
+}
+
+void LFGMgr::SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgUpdateParty(data);
+}
+
+void LFGMgr::SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgJoinResult(data);
+}
+
+void LFGMgr::SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgBootProposalUpdate(boot);
+}
+
+void LFGMgr::SendLfgUpdateProposal(uint64 guid, uint32 proposalId, LfgProposal const& proposal)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgUpdateProposal(proposalId, proposal);
+}
+
+void LFGMgr::SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data)
+{
+ if (Player* player = ObjectAccessor::FindPlayer(guid))
+ player->GetSession()->SendLfgQueueStatus(data);
+}
+
+bool LFGMgr::IsLfgGroup(uint64 guid)
+{
+ return guid && IS_GROUP(guid) && GroupsStore[guid].IsLfgGroup();
+}
+
+LFGQueue& LFGMgr::GetQueue(uint64 guid)
+{
+ uint8 queueId = 0;
+ if (IS_GROUP(guid))
+ {
+ const LfgGuidSet& players = GetPlayers(guid);
+ uint64 pguid = players.empty() ? 0 : (*players.begin());
+ if (pguid)
+ queueId = GetTeam(pguid);
+ }
+ else
+ queueId = GetTeam(guid);
+ return QueuesStore[queueId];
+}
+
+bool LFGMgr::AllQueued(LfgGuidList const& check)
+{
+ if (check.empty())
+ return false;
+
+ for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
+ if (GetState(*it) != LFG_STATE_QUEUED)
+ return false;
+ return true;
+}
+
+// Only for debugging purposes
+void LFGMgr::Clean()
+{
+ QueuesStore.clear();
+}
+
+bool LFGMgr::isOptionEnabled(uint32 option)
+{
+ return m_options & option;
+}
+
+uint32 LFGMgr::GetOptions()
+{
+ return m_options;
+}
+
+void LFGMgr::SetOptions(uint32 options)
+{
+ m_options = options;
+}
+
+LfgUpdateData LFGMgr::GetLfgStatus(uint64 guid)
+{
+ LfgPlayerData& playerData = PlayersStore[guid];
+ return LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS, playerData.GetState(), playerData.GetSelectedDungeons());
+}
+
+bool LFGMgr::IsSeasonActive(uint32 dungeonId)
+{
+ switch (dungeonId)
+ {
+ case 285: // The Headless Horseman
+ return IsHolidayActive(HOLIDAY_HALLOWS_END);
+ case 286: // The Frost Lord Ahune
+ return IsHolidayActive(HOLIDAY_FIRE_FESTIVAL);
+ case 287: // Coren Direbrew
+ return IsHolidayActive(HOLIDAY_BREWFEST);
+ case 288: // The Crown Chemical Co.
+ return IsHolidayActive(HOLIDAY_LOVE_IS_IN_THE_AIR);
+ }
+ return false;
+}
+
+std::string LFGMgr::DumpQueueInfo(bool full)
+{
+ uint32 size = uint32(QueuesStore.size());
+ std::ostringstream o;
+
+ o << "Number of Queues: " << size << "\n";
+ for (LfgQueueContainer::const_iterator itr = QueuesStore.begin(); itr != QueuesStore.end(); ++itr)
+ {
+ std::string const& queued = itr->second.DumpQueueInfo();
+ std::string const& compatibles = itr->second.DumpCompatibleInfo(full);
+ o << queued << compatibles;
+ }
+
+ return o.str();
+}
+
+void LFGMgr::SetupGroupMember(uint64 guid, uint64 gguid)
+{
+ LfgDungeonSet dungeons;
+ dungeons.insert(GetDungeon(gguid));
+ SetSelectedDungeons(guid, dungeons);
+ SetState(guid, GetState(gguid));
+ SetGroup(guid, gguid);
+ AddPlayerToGroup(gguid, guid);
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index f21818deb64..14bc0becb02 100755..100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -18,37 +18,49 @@
#ifndef _LFGMGR_H
#define _LFGMGR_H
-#include "Common.h"
#include <ace/Singleton.h>
+#include "DBCStructure.h"
+#include "Field.h"
#include "LFG.h"
+#include "LFGQueue.h"
+#include "LFGGroupData.h"
+#include "LFGPlayerData.h"
-class LfgGroupData;
-class LfgPlayerData;
class Group;
class Player;
-enum LFGenum
+enum LfgOptions
{
- LFG_TIME_ROLECHECK = 2*MINUTE,
- LFG_TIME_BOOT = 2*MINUTE,
- LFG_TIME_PROPOSAL = 2*MINUTE,
- LFG_TANKS_NEEDED = 1,
- LFG_HEALERS_NEEDED = 1,
- LFG_DPS_NEEDED = 3,
- LFG_QUEUEUPDATE_INTERVAL = 15*IN_MILLISECONDS,
+ LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
+ LFG_OPTION_ENABLE_RAID_BROWSER = 0x02,
+};
+
+enum LFGMgrEnum
+{
+ LFG_TIME_ROLECHECK = 40 * IN_MILLISECONDS,
+ LFG_TIME_BOOT = 120,
+ LFG_TIME_PROPOSAL = 120,
+ LFG_QUEUEUPDATE_INTERVAL = 15 * IN_MILLISECONDS,
LFG_SPELL_DUNGEON_COOLDOWN = 71328,
LFG_SPELL_DUNGEON_DESERTER = 71041,
- LFG_SPELL_LUCK_OF_THE_DRAW = 72221
+ LFG_SPELL_LUCK_OF_THE_DRAW = 72221,
+ LFG_GROUP_KICK_VOTES_NEEDED = 3
+};
+
+enum LfgFlags
+{
+ LFG_FLAG_UNK1 = 0x1,
+ LFG_FLAG_UNK2 = 0x2,
+ LFG_FLAG_SEASONAL = 0x4,
+ LFG_FLAG_UNK3 = 0x8
};
/// Determines the type of instance
enum LfgType
{
- LFG_TYPE_NONE = 0, // Internal use only
+ LFG_TYPE_NONE = 0,
LFG_TYPE_DUNGEON = 1,
LFG_TYPE_RAID = 2,
- LFG_TYPE_QUEST = 3,
- LFG_TYPE_ZONE = 4,
LFG_TYPE_HEROIC = 5,
LFG_TYPE_RANDOM = 6
};
@@ -64,13 +76,14 @@ enum LfgProposalState
/// Teleport errors
enum LfgTeleportError
{
- // 3, 7, 8 = "You can't do that right now" | 5 = No client reaction
+ // 7 = "You can't do that right now" | 5 = No client reaction
LFG_TELEPORTERROR_OK = 0, // Internal use
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
LFG_TELEPORTERROR_FALLING = 2,
- LFG_TELEPORTERROR_DONT_REPORT = 3,
+ LFG_TELEPORTERROR_IN_VEHICLE = 3,
LFG_TELEPORTERROR_FATIGUE = 4,
- LFG_TELEPORTERROR_INVALID_LOCATION = 6
+ LFG_TELEPORTERROR_INVALID_LOCATION = 6,
+ LFG_TELEPORTERROR_CHARMING = 8 // FIXME - It can be 7 or 8 (Need proper data)
};
/// Queue join results
@@ -108,41 +121,27 @@ enum LfgRoleCheckState
LFG_ROLECHECK_NO_ROLE = 6 // Someone selected no role
};
-/// Answer state (Also used to check compatibilites)
-enum LfgAnswer
-{
- LFG_ANSWER_PENDING = -1,
- LFG_ANSWER_DENY = 0,
- LFG_ANSWER_AGREE = 1
-};
-
// Forward declaration (just to have all typedef together)
+struct LFGDungeonData;
struct LfgReward;
-struct LfgLockStatus;
struct LfgQueueInfo;
struct LfgRoleCheck;
struct LfgProposal;
struct LfgProposalPlayer;
struct LfgPlayerBoot;
-typedef std::set<uint64> LfgGuidSet;
-typedef std::list<uint64> LfgGuidList;
-typedef std::map<uint8, LfgGuidList> LfgGuidListMap;
-typedef std::set<Player*> PlayerSet;
-typedef std::list<Player*> LfgPlayerList;
-typedef std::multimap<uint32, LfgReward const*> LfgRewardMap;
-typedef std::pair<LfgRewardMap::const_iterator, LfgRewardMap::const_iterator> LfgRewardMapBounds;
-typedef std::map<std::string, LfgAnswer> LfgCompatibleMap;
-typedef std::map<uint64, LfgDungeonSet> LfgDungeonMap;
-typedef std::map<uint64, uint8> LfgRolesMap;
-typedef std::map<uint64, LfgAnswer> LfgAnswerMap;
-typedef std::map<uint64, LfgRoleCheck*> LfgRoleCheckMap;
-typedef std::map<uint64, LfgQueueInfo*> LfgQueueInfoMap;
-typedef std::map<uint32, LfgProposal*> LfgProposalMap;
-typedef std::map<uint64, LfgProposalPlayer*> LfgProposalPlayerMap;
-typedef std::map<uint32, LfgPlayerBoot*> LfgPlayerBootMap;
-typedef std::map<uint64, LfgGroupData> LfgGroupDataMap;
-typedef std::map<uint64, LfgPlayerData> LfgPlayerDataMap;
+typedef std::map<uint8, LFGQueue> LfgQueueContainer;
+typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
+typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
+typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
+typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
+typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
+typedef std::map<uint32, LfgProposal> LfgProposalContainer;
+typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
+typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
+typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
+typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
+typedef UNORDERED_MAP<uint32, LFGDungeonData> LFGDungeonContainer;
// Data needed by SMSG_LFG_JOIN_RESULT
struct LfgJoinResultData
@@ -157,15 +156,38 @@ struct LfgJoinResultData
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
struct LfgUpdateData
{
- LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") {}
- LfgUpdateData(LfgUpdateType _type, const LfgDungeonSet& _dungeons, std::string _comment):
- updateType(_type), dungeons(_dungeons), comment(_comment) {}
+ LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
+ LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
+ updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
+ LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
+ updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
LfgUpdateType updateType;
+ LfgState state;
LfgDungeonSet dungeons;
std::string comment;
};
+// Data needed by SMSG_LFG_QUEUE_STATUS
+struct LfgQueueStatusData
+{
+ LfgQueueStatusData(uint32 _dungeonId = 0, int32 _waitTime = -1, int32 _waitTimeAvg = -1, int32 _waitTimeTank = -1, int32 _waitTimeHealer = -1,
+ int32 _waitTimeDps = -1, uint32 _queuedTime = 0, uint8 _tanks = 0, uint8 _healers = 0, uint8 _dps = 0) :
+ dungeonId(_dungeonId), waitTime(_waitTime), waitTimeAvg(_waitTimeAvg), waitTimeTank(_waitTimeTank), waitTimeHealer(_waitTimeHealer),
+ waitTimeDps(_waitTimeDps), queuedTime(_queuedTime), tanks(_tanks), healers(_healers), dps(_dps) {}
+
+ uint32 dungeonId;
+ int32 waitTime;
+ int32 waitTimeAvg;
+ int32 waitTimeTank;
+ int32 waitTimeHealer;
+ int32 waitTimeDps;
+ uint32 queuedTime;
+ uint8 tanks;
+ uint8 healers;
+ uint8 dps;
+};
+
/// Reward info
struct LfgReward
{
@@ -189,45 +211,31 @@ struct LfgReward
}
};
-/// Stores player or group queue info
-struct LfgQueueInfo
-{
- LfgQueueInfo(): joinTime(0), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED) {};
- time_t joinTime; ///< Player queue join time (to calculate wait times)
- uint8 tanks; ///< Tanks needed
- uint8 healers; ///< Healers needed
- uint8 dps; ///< Dps needed
- LfgDungeonSet dungeons; ///< Selected Player/Group Dungeon/s
- LfgRolesMap roles; ///< Selected Player Role/s
-};
-
/// Stores player data related to proposal to join
struct LfgProposalPlayer
{
- LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), groupLowGuid(0) {};
+ LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
uint8 role; ///< Proposed role
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
- uint32 groupLowGuid; ///< Original group guid (Low guid) 0 if no original group
+ uint64 group; ///< Original group guid. 0 if no original group
};
/// Stores group data related to proposal to join
struct LfgProposal
{
- LfgProposal(uint32 dungeon = 0): dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), groupLowGuid(0), leader(0), cancelTime(0) {}
+ LfgProposal(uint32 dungeon = 0): dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
+ group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
+ { }
- ~LfgProposal()
- {
- for (LfgProposalPlayerMap::iterator it = players.begin(); it != players.end(); ++it)
- delete it->second;
- };
uint32 dungeonId; ///< Dungeon to join
LfgProposalState state; ///< State of the proposal
- uint32 groupLowGuid; ///< Proposal group (0 if new)
+ uint64 group; ///< Proposal group (0 if new)
uint64 leader; ///< Leader guid.
time_t cancelTime; ///< Time when we will cancel this proposal
+ uint32 encounters; ///< Dungeon Encounters
+ bool isNew; ///< Determines if it's new group or not
LfgGuidList queues; ///< Queue Ids to remove/readd
- LfgProposalPlayerMap players; ///< Players data
-
+ LfgProposalPlayerContainer players; ///< Players data
};
/// Stores all rolecheck info of a group that wants to join
@@ -246,12 +254,38 @@ struct LfgPlayerBoot
{
time_t cancelTime; ///< Time left to vote
bool inProgress; ///< Vote in progress
- LfgAnswerMap votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
+ LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
uint64 victim; ///< Player guid to be kicked (can't vote)
- uint8 votedNeeded; ///< Votes needed to kick the player
std::string reason; ///< kick reason
};
+struct LFGDungeonData
+{
+ LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
+ maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
+ { }
+ LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
+ type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
+ minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)),
+ seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
+ { }
+
+ uint32 id;
+ std::string name;
+ uint16 map;
+ uint8 type;
+ uint8 expansion;
+ uint8 group;
+ uint8 minlevel;
+ uint8 maxlevel;
+ Difficulty difficulty;
+ bool seasonal;
+ float x, y, z, o;
+
+ // Helpers
+ uint32 Entry() const { return id + (type << 24); }
+};
+
class LFGMgr
{
friend class ACE_Singleton<LFGMgr, ACE_Null_Mutex>;
@@ -265,104 +299,129 @@ class LFGMgr
// Reward
void LoadRewards();
- void RewardDungeonDoneFor(const uint32 dungeonId, Player* player);
+ void RewardDungeonDoneFor(uint32 const dungeonId, Player* player);
LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
// Queue
- void Join(Player* player, uint8 roles, const LfgDungeonSet& dungeons, const std::string& comment);
- void Leave(Player* player, Group* grp = NULL);
+ 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 = ROLE_NONE);
+ 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 const& proposal);
void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
// Teleportation
void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
// Vote kick
- void InitBoot(Group* grp, uint64 kguid, uint64 vguid, std::string reason);
- void UpdateBoot(Player* player, bool accept);
- void OfferContinue(Group* grp);
+ void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
+ void UpdateBoot(uint64 guid, bool accept);
+
+ void InitializeLockedDungeons(Player* player, uint8 level = 0);
- void InitializeLockedDungeons(Player* player);
+ void SetRoles(uint64 guid, uint8 roles);
+ void SetComment(uint64 guid, std::string const& comment);
+ void SetTeam(uint64 guid, uint8 team);
+ void SetGroup(uint64 guid, uint64 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 SetComment(uint64 guid, const std::string& comment);
- const LfgLockMap& GetLockedDungeons(uint64 guid);
- LfgState GetState(uint64 guid);
- const LfgDungeonSet& GetSelectedDungeons(uint64 guid);
- uint32 GetDungeon(uint64 guid, bool asId = true);
- void SetState(uint64 guid, LfgState state);
- void ClearState(uint64 guid);
void RemovePlayerData(uint64 guid);
void RemoveGroupData(uint64 guid);
+ uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
+ void AddPlayerToGroup(uint64 gguid, uint64 guid);
+
+ 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);
uint8 GetKicksLeft(uint64 gguid);
- uint8 GetVotesNeeded(uint64 gguid);
- bool IsTeleported(uint64 pguid);
- void SetRoles(uint64 guid, uint8 roles);
- void SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons);
+ uint64 GetLeader(uint64 guid);
+ bool IsLfgGroup(uint64 guid);
+ uint8 GetRoles(uint64 guid);
+ std::string const& GetComment(uint64 gguid);
+ LfgGuidSet const& GetPlayers(uint64 guid);
+ uint8 GetPlayerCount(uint64 guid);
- private:
+ bool IsTeleported(uint64 guid);
- uint8 GetRoles(uint64 guid);
- const std::string& GetComment(uint64 gguid);
- void RestoreState(uint64 guid);
+ bool AllQueued(LfgGuidList const& check);
+ void Clean();
+
+ static bool HasIgnore(uint64 guid1, uint64 guid2);
+ 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);
+ void ClearState(uint64 guid, char const *debugMsg);
void SetDungeon(uint64 guid, uint32 dungeon);
- void SetLockedDungeons(uint64 guid, const LfgLockMap& lock);
+ void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
+ void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
void DecreaseKicksLeft(uint64 guid);
- // Queue
- void AddToQueue(uint64 guid, uint8 queueId);
- bool RemoveFromQueue(uint64 guid);
-
// Proposals
- void RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type);
-
- // Group Matching
- LfgProposal* FindNewGroups(LfgGuidList& check, LfgGuidList& all);
- bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
- bool CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal);
- void GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap);
- void SetCompatibles(std::string concatenatedGuids, bool compatibles);
- LfgAnswer GetCompatibles(std::string concatenatedGuids);
- void RemoveFromCompatibles(uint64 guid);
+ void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type);
+ void MakeNewGroup(LfgProposal const& proposal);
// Generic
- const LfgDungeonSet& GetDungeonsByRandom(uint32 randomdungeon);
+ LFGQueue &GetQueue(uint64 guid);
+ LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
LfgType GetDungeonType(uint32 dungeon);
- std::string ConcatenateGuids(LfgGuidList check);
+
+ void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot);
+ void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data);
+ void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles);
+ void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck);
+ void SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data);
+ void SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data);
+ void SendLfgUpdateProposal(uint64 guid, uint32 proposalId, LfgProposal const& proposal);
// General variables
- bool m_update; ///< Doing an update?
uint32 m_QueueTimer; ///< used to check interval of update
uint32 m_lfgProposalId; ///< used as internal counter for proposals
- int32 m_WaitTimeAvg; ///< Average wait time to find a group queuing as multiple roles
- int32 m_WaitTimeTank; ///< Average wait time to find a group queuing as tank
- int32 m_WaitTimeHealer; ///< Average wait time to find a group queuing as healer
- int32 m_WaitTimeDps; ///< Average wait time to find a group queuing as dps
- uint32 m_NumWaitTimeAvg; ///< Num of players used to calc avs wait time
- uint32 m_NumWaitTimeTank; ///< Num of players used to calc tank wait time
- uint32 m_NumWaitTimeHealer; ///< Num of players used to calc healers wait time
- uint32 m_NumWaitTimeDps; ///< Num of players used to calc dps wait time
- LfgDungeonMap m_CachedDungeonMap; ///< Stores all dungeons by groupType
+ uint32 m_options; ///< Stores config options
+
+ LfgQueueContainer QueuesStore; ///< Queues
+ LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType
// Reward System
- LfgRewardMap m_RewardMap; ///< Stores rewards for random dungeons
- // Queue
- LfgQueueInfoMap m_QueueInfoMap; ///< Queued groups
- LfgGuidListMap m_currentQueue; ///< Ordered list. Used to find groups
- LfgGuidListMap m_newToQueue; ///< New groups to add to queue
- LfgCompatibleMap m_CompatibleMap; ///< Compatible dungeons
- LfgGuidList m_teleport; ///< Players being teleported
+ LfgRewardContainer RewardMapStore; ///< Stores rewards for random dungeons
+ LFGDungeonContainer LfgDungeonStore;
// Rolecheck - Proposal - Vote Kicks
- LfgRoleCheckMap m_RoleChecks; ///< Current Role checks
- LfgProposalMap m_Proposals; ///< Current Proposals
- LfgPlayerBootMap m_Boots; ///< Current player kicks
- LfgPlayerDataMap m_Players; ///< Player data
- LfgGroupDataMap m_Groups; ///< Group data
+ LfgRoleCheckContainer RoleChecksStore; ///< Current Role checks
+ LfgProposalContainer ProposalsStore; ///< Current Proposals
+ 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()
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.cpp b/src/server/game/DungeonFinding/LFGPlayerData.cpp
index 4a6e86ab966..deee0ddae3c 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.cpp
+++ b/src/server/game/DungeonFinding/LFGPlayerData.cpp
@@ -17,8 +17,8 @@
#include "LFGPlayerData.h"
-LfgPlayerData::LfgPlayerData():
-m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), m_Roles(0), m_Comment("")
+LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
+ m_Team(0), m_Group(0), m_Roles(0), m_Comment("")
{}
LfgPlayerData::~LfgPlayerData()
@@ -30,57 +30,84 @@ void LfgPlayerData::SetState(LfgState state)
switch (state)
{
case LFG_STATE_NONE:
- case LFG_STATE_DUNGEON:
case LFG_STATE_FINISHED_DUNGEON:
+ m_Roles = 0;
+ m_SelectedDungeons.clear();
+ m_Comment = "";
+ // No break on purpose
+ case LFG_STATE_DUNGEON:
m_OldState = state;
- // No break on purpose
+ // No break on purpose
default:
m_State = state;
}
}
-void LfgPlayerData::ClearState()
+void LfgPlayerData::RestoreState()
{
- m_SelectedDungeons.clear();
- m_Roles = 0;
+ if (m_OldState == LFG_STATE_NONE)
+ {
+ m_SelectedDungeons.clear();
+ m_Roles = 0;
+ }
m_State = m_OldState;
}
-void LfgPlayerData::SetLockedDungeons(const LfgLockMap& lockStatus)
+void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
{
m_LockedDungeons = lockStatus;
}
+void LfgPlayerData::SetTeam(uint8 team)
+{
+ m_Team = team;
+}
+
+void LfgPlayerData::SetGroup(uint64 group)
+{
+ m_Group = group;
+}
+
void LfgPlayerData::SetRoles(uint8 roles)
{
m_Roles = roles;
}
-void LfgPlayerData::SetComment(const std::string& comment)
+void LfgPlayerData::SetComment(std::string const& comment)
{
m_Comment = comment;
}
-void LfgPlayerData::SetSelectedDungeons(const LfgDungeonSet& dungeons)
+void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
{
m_SelectedDungeons = dungeons;
}
-void LfgPlayerData::ClearSelectedDungeons()
+LfgState LfgPlayerData::GetState() const
{
- m_SelectedDungeons.clear();
+ return m_State;
}
-LfgState LfgPlayerData::GetState() const
+LfgState LfgPlayerData::GetOldState() const
{
- return m_State;
+ return m_OldState;
}
-const LfgLockMap & LfgPlayerData::GetLockedDungeons() const
+const LfgLockMap& LfgPlayerData::GetLockedDungeons() const
{
return m_LockedDungeons;
}
+uint8 LfgPlayerData::GetTeam() const
+{
+ return m_Team;
+}
+
+uint64 LfgPlayerData::GetGroup() const
+{
+ return m_Group;
+}
+
uint8 LfgPlayerData::GetRoles() const
{
return m_Roles;
diff --git a/src/server/game/DungeonFinding/LFGPlayerData.h b/src/server/game/DungeonFinding/LFGPlayerData.h
index e8bae1c5a0f..589404cf65c 100644
--- a/src/server/game/DungeonFinding/LFGPlayerData.h
+++ b/src/server/game/DungeonFinding/LFGPlayerData.h
@@ -18,7 +18,6 @@
#ifndef _LFGPLAYERDATA_H
#define _LFGPLAYERDATA_H
-#include "Common.h"
#include "LFG.h"
/**
@@ -32,28 +31,37 @@ class LfgPlayerData
// General
void SetState(LfgState state);
- void ClearState();
- void SetLockedDungeons(const LfgLockMap& lock);
+ void RestoreState();
+ void SetLockedDungeons(LfgLockMap const& lock);
+ void SetTeam(uint8 team);
+ void SetGroup(uint64 group);
+
// Queue
void SetRoles(uint8 roles);
- void SetComment(const std::string& comment);
+ void SetComment(std::string const& comment);
void SetSelectedDungeons(const LfgDungeonSet& dungeons);
- void ClearSelectedDungeons();
// General
LfgState GetState() const;
- const LfgLockMap& GetLockedDungeons() const;
+ LfgState GetOldState() const;
+ LfgLockMap const& GetLockedDungeons() const;
+ uint8 GetTeam() const;
+ uint64 GetGroup() const;
+
// Queue
uint8 GetRoles() const;
- const std::string& GetComment() const;
- const LfgDungeonSet& GetSelectedDungeons() const;
+ std::string const& GetComment() const;
+ LfgDungeonSet const& GetSelectedDungeons() const;
private:
// General
LfgState m_State; ///< State if group in LFG
- LfgState m_OldState; ///< Old State
+ LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
// Player
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
+ uint8 m_Team; ///< Player team - determines the queue to join
+ uint64 m_Group; ///< Original group of player when joined LFG
+
// Queue
uint8 m_Roles; ///< Roles the player selected when joined LFG
std::string m_Comment; ///< Player comment used when joined LFG
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
new file mode 100644
index 00000000000..bfcf17dc270
--- /dev/null
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -0,0 +1,673 @@
+/*
+ * Copyright (C) 2008-2012 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 "ObjectDefines.h"
+#include "Containers.h"
+#include "DBCStructure.h"
+#include "DBCStores.h"
+#include "Group.h"
+#include "LFGQueue.h"
+#include "LFGMgr.h"
+#include "Log.h"
+#include "ObjectMgr.h"
+#include "World.h"
+#include "GroupMgr.h"
+
+/**
+ Given a list of guids returns the concatenation using | as delimiter
+
+ @param[in] check list of guids
+ @returns Concatenated string
+*/
+std::string ConcatenateGuids(LfgGuidList const& check)
+{
+ if (check.empty())
+ return "";
+
+ // need the guids in order to avoid duplicates
+ LfgGuidSet guids(check.begin(), check.end());
+
+ std::ostringstream o;
+
+ LfgGuidSet::const_iterator it = guids.begin();
+ o << (*it);
+ for (++it; it != guids.end(); ++it)
+ o << '|' << (*it);
+
+ return o.str();
+}
+
+char const* GetCompatibleString(LfgCompatibility compatibles)
+{
+ switch (compatibles)
+ {
+ case LFG_COMPATIBILITY_PENDING:
+ return "Pending";
+ case LFG_COMPATIBLES_BAD_STATES:
+ return "Compatibles (Bad States)";
+ case LFG_COMPATIBLES_MATCH:
+ return "Match";
+ case LFG_COMPATIBLES_WITH_LESS_PLAYERS:
+ return "Compatibles (Not enough players)";
+ case LFG_INCOMPATIBLES_HAS_IGNORES:
+ return "Has ignores";
+ case LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS:
+ return "Multiple Lfg Groups";
+ case LFG_INCOMPATIBLES_NO_DUNGEONS:
+ return "Incompatible dungeons";
+ case LFG_INCOMPATIBLES_NO_ROLES:
+ return "Incompatible roles";
+ case LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS:
+ return "Too much players";
+ case LFG_INCOMPATIBLES_WRONG_GROUP_SIZE:
+ return "Wrong group size";
+ default:
+ return "Unknown";
+ }
+}
+
+void LFGQueue::AddToQueue(uint64 guid)
+{
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
+ if (itQueue == QueueDataStore.end())
+ {
+ sLog->outError(LOG_FILTER_LFG, "LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
+ return;
+ }
+
+ AddToNewQueue(guid);
+}
+
+void LFGQueue::RemoveFromQueue(uint64 guid)
+{
+ RemoveFromNewQueue(guid);
+ RemoveFromCurrentQueue(guid);
+ RemoveFromCompatibles(guid);
+
+ std::ostringstream o;
+ o << guid;
+ std::string sguid = o.str();
+
+ LfgQueueDataContainer::iterator itDelete = QueueDataStore.end();
+ for (LfgQueueDataContainer::iterator itr = QueueDataStore.begin(); itr != QueueDataStore.end(); ++itr)
+ if (itr->first != guid)
+ {
+ if (std::string::npos != itr->second.bestCompatible.find(sguid))
+ {
+ itr->second.bestCompatible.clear();
+ FindBestCompatibleInQueue(itr);
+ }
+ }
+ else
+ itDelete = itr;
+
+ if (itDelete != QueueDataStore.end())
+ QueueDataStore.erase(itDelete);
+}
+
+void LFGQueue::AddToNewQueue(uint64 guid)
+{
+ newToQueueStore.push_back(guid);
+}
+
+void LFGQueue::RemoveFromNewQueue(uint64 guid)
+{
+ newToQueueStore.remove(guid);
+}
+
+void LFGQueue::AddToCurrentQueue(uint64 guid)
+{
+ currentQueueStore.push_back(guid);
+}
+
+void LFGQueue::RemoveFromCurrentQueue(uint64 guid)
+{
+ currentQueueStore.remove(guid);
+}
+
+void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, const LfgDungeonSet &dungeons, const LfgRolesMap &rolesMap)
+{
+ QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
+ AddToQueue(guid);
+}
+
+void LFGQueue::RemoveQueueData(uint64 guid)
+{
+ LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
+ if (it != QueueDataStore.end())
+ QueueDataStore.erase(it);
+}
+
+void LFGQueue::UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId)
+{
+ LfgWaitTime &wt = waitTimesAvgStore[dungeonId];
+ uint32 old_number = wt.number++;
+ wt.time = int32((wt.time * old_number + waitTime) / wt.number);
+}
+
+void LFGQueue::UpdateWaitTimeTank(int32 waitTime, uint32 dungeonId)
+{
+ LfgWaitTime &wt = waitTimesTankStore[dungeonId];
+ uint32 old_number = wt.number++;
+ wt.time = int32((wt.time * old_number + waitTime) / wt.number);
+}
+
+void LFGQueue::UpdateWaitTimeHealer(int32 waitTime, uint32 dungeonId)
+{
+ LfgWaitTime &wt = waitTimesHealerStore[dungeonId];
+ uint32 old_number = wt.number++;
+ wt.time = int32((wt.time * old_number + waitTime) / wt.number);
+}
+
+void LFGQueue::UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId)
+{
+ LfgWaitTime &wt = waitTimesDpsStore[dungeonId];
+ uint32 old_number = wt.number++;
+ wt.time = int32((wt.time * old_number + waitTime) / wt.number);
+}
+
+/**
+ Remove from cached compatible dungeons any entry that contains the given guid
+
+ @param[in] guid Guid to remove from compatible cache
+*/
+void LFGQueue::RemoveFromCompatibles(uint64 guid)
+{
+ std::stringstream out;
+ out << guid;
+ std::string strGuid = out.str();
+
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::RemoveFromCompatibles: Removing [" UI64FMTD "]", guid);
+ for (LfgCompatibleContainer::iterator itNext = CompatibleMapStore.begin(); itNext != CompatibleMapStore.end();)
+ {
+ LfgCompatibleContainer::iterator it = itNext++;
+ if (std::string::npos != it->first.find(strGuid))
+ CompatibleMapStore.erase(it);
+ }
+}
+
+/**
+ Stores the compatibility of a list of guids
+
+ @param[in] key String concatenation of guids (| used as separator)
+ @param[in] compatibles type of compatibility
+*/
+void LFGQueue::SetCompatibles(std::string const& key, LfgCompatibility compatibles)
+{
+ LfgCompatibilityData& data = CompatibleMapStore[key];
+ data.compatibility = compatibles;
+}
+
+void LFGQueue::SetCompatibilityData(std::string const& key, LfgCompatibilityData const& data)
+{
+ CompatibleMapStore[key] = data;
+}
+
+
+/**
+ Get the compatibility of a group of guids
+
+ @param[in] key String concatenation of guids (| used as separator)
+ @return LfgCompatibility type of compatibility
+*/
+LfgCompatibility LFGQueue::GetCompatibles(std::string const& key)
+{
+ LfgCompatibleContainer::iterator itr = CompatibleMapStore.find(key);
+ if (itr != CompatibleMapStore.end())
+ return itr->second.compatibility;
+
+ return LFG_COMPATIBILITY_PENDING;
+}
+
+LfgCompatibilityData* LFGQueue::GetCompatibilityData(std::string const& key)
+{
+ LfgCompatibleContainer::iterator itr = CompatibleMapStore.find(key);
+ if (itr != CompatibleMapStore.end())
+ return &(itr->second);
+
+ return NULL;
+}
+
+uint8 LFGQueue::FindGroups()
+{
+ uint8 proposals = 0;
+ LfgGuidList firstNew;
+ while (!newToQueueStore.empty())
+ {
+ uint64 frontguid = newToQueueStore.front();
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindGroups: checking [" UI64FMTD "] newToQueue(%u), currentQueue(%u)", frontguid, uint32(newToQueueStore.size()), uint32(currentQueueStore.size()));
+ firstNew.clear();
+ firstNew.push_back(frontguid);
+ RemoveFromNewQueue(frontguid);
+
+ LfgGuidList temporalList = currentQueueStore;
+ LfgCompatibility compatibles = FindNewGroups(firstNew, temporalList);
+
+ if (compatibles == LFG_COMPATIBLES_MATCH)
+ ++proposals;
+ else
+ AddToCurrentQueue(frontguid); // Lfg group not found, add this group to the queue.
+ }
+ return proposals;
+}
+
+/**
+ Checks que main queue to try to form a Lfg group. Returns first match found (if any)
+
+ @param[in] check List of guids trying to match with other groups
+ @param[in] all List of all other guids in main queue to match against
+ @return LfgCompatibility type of compatibility between groups
+*/
+LfgCompatibility LFGQueue::FindNewGroups(LfgGuidList& check, LfgGuidList& all)
+{
+ std::string strGuids = ConcatenateGuids(check);
+ LfgCompatibility compatibles = GetCompatibles(strGuids);
+
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindNewGroup: (%s): %s - all(%s)", strGuids.c_str(), GetCompatibleString(compatibles), ConcatenateGuids(all).c_str());
+ if (compatibles == LFG_COMPATIBILITY_PENDING) // Not previously cached, calculate
+ compatibles = CheckCompatibility(check);
+
+ if (compatibles == LFG_COMPATIBLES_BAD_STATES && sLFGMgr->AllQueued(check))
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindNewGroup: (%s) compatibles (cached) changed from bad states to match", strGuids.c_str());
+ SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH);
+ return LFG_COMPATIBLES_MATCH;
+ }
+
+ if (compatibles != LFG_COMPATIBLES_WITH_LESS_PLAYERS)
+ return compatibles;
+
+ // Try to match with queued groups
+ while (!all.empty())
+ {
+ check.push_back(all.front());
+ all.pop_front();
+ LfgCompatibility subcompatibility = FindNewGroups(check, all);
+ if (subcompatibility == LFG_COMPATIBLES_MATCH)
+ return LFG_COMPATIBLES_MATCH;
+ check.pop_back();
+ }
+ return compatibles;
+}
+
+/**
+ Check compatibilities between groups. If group is Matched proposal will be created
+
+ @param[in] check List of guids to check compatibilities
+ @return LfgCompatibility type of compatibility
+*/
+LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
+{
+ std::string strGuids = ConcatenateGuids(check);
+ LfgProposal proposal;
+ LfgDungeonSet proposalDungeons;
+ LfgGroupsMap proposalGroups;
+ LfgRolesMap proposalRoles;
+
+ // Check for correct size
+ if (check.size() > MAXGROUPSIZE || check.empty())
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s): Size wrong - Not compatibles", strGuids.c_str());
+ return LFG_INCOMPATIBLES_WRONG_GROUP_SIZE;
+ }
+
+ // Check all-but-new compatiblitity
+ if (check.size() > 2)
+ {
+ uint64 frontGuid = check.front();
+ check.pop_front();
+
+ // Check all-but-new compatibilities (New, A, B, C, D) --> check(A, B, C, D)
+ LfgCompatibility child_compatibles = CheckCompatibility(check);
+ if (child_compatibles < LFG_COMPATIBLES_WITH_LESS_PLAYERS) // Group not compatible
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) child %s not compatibles", strGuids.c_str(), ConcatenateGuids(check).c_str());
+ SetCompatibles(strGuids, child_compatibles);
+ return child_compatibles;
+ }
+ check.push_front(frontGuid);
+ }
+
+ // Check if more than one LFG group and number of players joining
+ uint8 numPlayers = 0;
+ uint8 numLfgGroups = 0;
+ for (LfgGuidList::const_iterator it = check.begin(); it != check.end() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++it)
+ {
+ uint64 guid = (*it);
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
+ if (itQueue == QueueDataStore.end())
+ {
+ sLog->outError(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid);
+ RemoveFromQueue(guid);
+ return LFG_COMPATIBILITY_PENDING;
+ }
+
+ // Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group)
+ for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
+ proposalGroups[it2->first] = IS_GROUP(itQueue->first) ? itQueue->first : 0;
+
+ numPlayers += itQueue->second.roles.size();
+
+ if (sLFGMgr->IsLfgGroup(guid))
+ {
+ if (!numLfgGroups)
+ proposal.group = guid;
+ ++numLfgGroups;
+ }
+ }
+
+ // Group with less that MAXGROUPSIZE members always compatible
+ if (check.size() == 1 && numPlayers != MAXGROUPSIZE)
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) sigle group. Compatibles", strGuids.c_str());
+ LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
+
+ LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
+ data.roles = itQueue->second.roles;
+ LFGMgr::CheckGroupRoles(data.roles);
+
+ UpdateBestCompatibleInQueue(itQueue, strGuids, data.roles);
+ SetCompatibilityData(strGuids, data);
+ return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
+ }
+
+ if (numLfgGroups > 1)
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) More than one Lfggroup (%u)", strGuids.c_str(), numLfgGroups);
+ SetCompatibles(strGuids, LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS);
+ return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
+ }
+
+ if (numPlayers > MAXGROUPSIZE)
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Too much players (%u)", strGuids.c_str(), numPlayers);
+ SetCompatibles(strGuids, LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS);
+ return LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS;
+ }
+
+ // If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
+ if (check.size() > 1)
+ {
+ for (LfgGuidList::const_iterator it = check.begin(); it != check.end(); ++it)
+ {
+ const LfgRolesMap &roles = QueueDataStore[(*it)].roles;
+ for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
+ {
+ LfgRolesMap::const_iterator itPlayer;
+ for (itPlayer = proposalRoles.begin(); itPlayer != proposalRoles.end(); ++itPlayer)
+ {
+ if (itRoles->first == itPlayer->first)
+ sLog->outError(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
+ else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
+ break;
+ }
+ if (itPlayer == proposalRoles.end())
+ proposalRoles[itRoles->first] = itRoles->second;
+ }
+ }
+
+ if (uint8 playersize = numPlayers - proposalRoles.size())
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) not compatible, %u players are ignoring each other", strGuids.c_str(), playersize);
+ SetCompatibles(strGuids, LFG_INCOMPATIBLES_HAS_IGNORES);
+ return LFG_INCOMPATIBLES_HAS_IGNORES;
+ }
+
+ LfgRolesMap debugRoles = proposalRoles;
+ if (!LFGMgr::CheckGroupRoles(proposalRoles))
+ {
+ std::ostringstream o;
+ for (LfgRolesMap::const_iterator it = debugRoles.begin(); it != debugRoles.end(); ++it)
+ o << ", " << it->first << ": " << sLFGMgr->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);
+ return LFG_INCOMPATIBLES_NO_ROLES;
+ }
+
+ LfgGuidList::iterator itguid = check.begin();
+ proposalDungeons = QueueDataStore[*itguid].dungeons;
+ std::ostringstream o;
+ o << ", " << *itguid << ": (" << sLFGMgr->ConcatenateDungeons(proposalDungeons) << ")";
+ for (++itguid; itguid != check.end(); ++itguid)
+ {
+ LfgDungeonSet temporal;
+ LfgDungeonSet &dungeons = QueueDataStore[*itguid].dungeons;
+ o << ", " << *itguid << ": (" << sLFGMgr->ConcatenateDungeons(dungeons) << ")";
+ std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
+ proposalDungeons = temporal;
+ }
+
+ if (proposalDungeons.empty())
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) No compatible dungeons%s", strGuids.c_str(), o.str().c_str());
+ SetCompatibles(strGuids, LFG_INCOMPATIBLES_NO_DUNGEONS);
+ return LFG_INCOMPATIBLES_NO_DUNGEONS;
+ }
+ }
+ else
+ {
+ uint64 gguid = *check.begin();
+ const LfgQueueData &queue = QueueDataStore[gguid];
+ proposalDungeons = queue.dungeons;
+ proposalRoles = queue.roles;
+ LFGMgr::CheckGroupRoles(proposalRoles); // assing new roles
+ }
+
+ // Enough players?
+ if (numPlayers != MAXGROUPSIZE)
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Compatibles but not enough players(%u)", strGuids.c_str(), numPlayers);
+ LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
+ data.roles = proposalRoles;
+
+ for (LfgGuidList::const_iterator itr = check.begin(); itr != check.end(); ++itr)
+ UpdateBestCompatibleInQueue(QueueDataStore.find(*itr), strGuids, data.roles);
+
+ SetCompatibilityData(strGuids, data);
+ return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
+ }
+
+ proposal.queues = check;
+ proposal.isNew = numLfgGroups != 1;
+
+ if (!sLFGMgr->AllQueued(check))
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) Group MATCH but can't create proposal!", strGuids.c_str());
+ SetCompatibles(strGuids, LFG_COMPATIBLES_BAD_STATES);
+ return LFG_COMPATIBLES_BAD_STATES;
+ }
+
+ // Create a new proposal
+ proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL;
+ proposal.state = LFG_PROPOSAL_INITIATING;
+ proposal.leader = 0;
+ proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons);
+
+ bool leader = false;
+ for (LfgRolesMap::const_iterator itRoles = proposalRoles.begin(); itRoles != proposalRoles.end(); ++itRoles)
+ {
+ // Assing new leader
+ if (itRoles->second & PLAYER_ROLE_LEADER)
+ {
+ if (!leader || !proposal.leader || urand(0, 1))
+ proposal.leader = itRoles->first;
+ leader = true;
+ }
+ else if (!leader && (!proposal.leader || urand(0, 1)))
+ proposal.leader = itRoles->first;
+
+ // Assing player data and roles
+ LfgProposalPlayer &data = proposal.players[itRoles->first];
+ data.role = itRoles->second;
+ data.group = proposalGroups.find(itRoles->first)->second;
+ if (!proposal.isNew && data.group && data.group == proposal.group) // Player from existing group, autoaccept
+ data.accept = LFG_ANSWER_AGREE;
+ }
+
+ // Mark proposal members as not queued (but not remove queue data)
+ for (LfgGuidList::const_iterator itQueue = proposal.queues.begin(); itQueue != proposal.queues.end(); ++itQueue)
+ {
+ uint64 guid = (*itQueue);
+ RemoveFromNewQueue(guid);
+ RemoveFromCurrentQueue(guid);
+ }
+
+ sLFGMgr->AddProposal(proposal);
+
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::CheckCompatibility: (%s) MATCH! Group formed", strGuids.c_str());
+ SetCompatibles(strGuids, LFG_COMPATIBLES_MATCH);
+ return LFG_COMPATIBLES_MATCH;
+}
+
+void LFGQueue::UpdateQueueTimers(time_t currTime)
+{
+ sLog->outTrace(LOG_FILTER_LFG, "Updating queue timers...");
+ for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ++itQueue)
+ {
+ LfgQueueData& queueinfo = itQueue->second;
+ uint32 dungeonId = (*queueinfo.dungeons.begin());
+ uint32 queuedTime = uint32(currTime - queueinfo.joinTime);
+ uint8 role = PLAYER_ROLE_NONE;
+ int32 waitTime = -1;
+ int32 wtTank = waitTimesTankStore[dungeonId].time;
+ int32 wtHealer = waitTimesHealerStore[dungeonId].time;
+ int32 wtDps = waitTimesDpsStore[dungeonId].time;
+ int32 wtAvg = waitTimesAvgStore[dungeonId].time;
+
+ for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
+ role |= itPlayer->second;
+ role &= ~PLAYER_ROLE_LEADER;
+
+ switch (role)
+ {
+ case PLAYER_ROLE_NONE: // Should not happen - just in case
+ waitTime = -1;
+ break;
+ case PLAYER_ROLE_TANK:
+ waitTime = wtTank;
+ break;
+ case PLAYER_ROLE_HEALER:
+ waitTime = wtHealer;
+ break;
+ case PLAYER_ROLE_DAMAGE:
+ waitTime = wtDps;
+ break;
+ default:
+ waitTime = wtAvg;
+ break;
+ }
+
+ if (queueinfo.bestCompatible.empty())
+ FindBestCompatibleInQueue(itQueue);
+
+ LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
+ for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
+ {
+ uint64 pguid = itPlayer->first;
+ LFGMgr::SendLfgQueueStatus(pguid, queueData);
+ }
+ }
+}
+
+time_t LFGQueue::GetJoinTime(uint64 guid)
+{
+ return QueueDataStore[guid].joinTime;
+}
+
+std::string LFGQueue::DumpQueueInfo() const
+{
+ uint32 players = 0;
+ uint32 groups = 0;
+ uint32 playersInGroup = 0;
+
+ for (uint8 i = 0; i < 2; ++i)
+ {
+ LfgGuidList const& queue = i ? newToQueueStore : currentQueueStore;
+ for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it)
+ {
+ uint64 guid = *it;
+ if (IS_GROUP(guid))
+ {
+ groups++;
+ playersInGroup += sLFGMgr->GetPlayerCount(guid);
+ }
+ else
+ players++;
+ }
+ }
+ std::ostringstream o;
+ o << "Queued Players: " << players << " (in group: " << playersInGroup << ") Groups: " << groups << "\n";
+ return o.str();
+}
+
+std::string LFGQueue::DumpCompatibleInfo(bool full /* = false */) const
+{
+ std::ostringstream o;
+ o << "Compatible Map size: " << CompatibleMapStore.size() << "\n";
+ if (full)
+ for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
+ o << "(" << itr->first << "): " << GetCompatibleString(itr->second.compatibility) << "\n";
+
+ return o.str();
+}
+
+void LFGQueue::FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue)
+{
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::FindBestCompatibleInQueue: " UI64FMTD, itrQueue->first);
+ std::ostringstream o;
+ o << itrQueue->first;
+ std::string sguid = o.str();
+
+ for (LfgCompatibleContainer::const_iterator itr = CompatibleMapStore.begin(); itr != CompatibleMapStore.end(); ++itr)
+ if (itr->second.compatibility == LFG_COMPATIBLES_WITH_LESS_PLAYERS &&
+ std::string::npos != itr->first.find(sguid))
+ {
+ UpdateBestCompatibleInQueue(itrQueue, itr->first, itr->second.roles);
+ }
+}
+
+void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles)
+{
+ LfgQueueData& queueData = itrQueue->second;
+
+ uint8 storedSize = queueData.bestCompatible.empty() ? 0 :
+ std::count(queueData.bestCompatible.begin(), queueData.bestCompatible.end(), '|') + 1;
+
+ uint8 size = std::count(key.begin(), key.end(), '|') + 1;
+
+ if (size <= storedSize)
+ return;
+
+ sLog->outDebug(LOG_FILTER_LFG, "LFGQueue::UpdateBestCompatibleInQueue: Changed (%s) to (%s) as best compatible group for " UI64FMTD,
+ queueData.bestCompatible.c_str(), key.c_str(), itrQueue->first);
+
+ queueData.bestCompatible = key;
+ queueData.tanks = LFG_TANKS_NEEDED;
+ queueData.healers = LFG_HEALERS_NEEDED;
+ queueData.dps = LFG_DPS_NEEDED;
+ for (LfgRolesMap::const_iterator it = roles.begin(); it != roles.end(); ++it)
+ {
+ uint8 role = it->second;
+ if (role & PLAYER_ROLE_TANK)
+ --queueData.tanks;
+ else if (role & PLAYER_ROLE_HEALER)
+ --queueData.healers;
+ else
+ --queueData.dps;
+ }
+}
diff --git a/src/server/game/DungeonFinding/LFGQueue.h b/src/server/game/DungeonFinding/LFGQueue.h
new file mode 100644
index 00000000000..e6ba038a9e6
--- /dev/null
+++ b/src/server/game/DungeonFinding/LFGQueue.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef _LFGQUEUE_H
+#define _LFGQUEUE_H
+
+#include "LFG.h"
+
+enum LfgCompatibility
+{
+ LFG_COMPATIBILITY_PENDING,
+ LFG_INCOMPATIBLES_WRONG_GROUP_SIZE,
+ LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS,
+ LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS,
+ LFG_INCOMPATIBLES_HAS_IGNORES,
+ LFG_INCOMPATIBLES_NO_ROLES,
+ LFG_INCOMPATIBLES_NO_DUNGEONS,
+ LFG_COMPATIBLES_WITH_LESS_PLAYERS, // Values under this = not compatible (do not modify order)
+ LFG_COMPATIBLES_BAD_STATES,
+ LFG_COMPATIBLES_MATCH // Must be the last one
+};
+
+struct LfgCompatibilityData
+{
+ LfgCompatibilityData(): compatibility(LFG_COMPATIBILITY_PENDING) { }
+ LfgCompatibilityData(LfgCompatibility _compatibility): compatibility(_compatibility) { }
+ LfgCompatibilityData(LfgCompatibility _compatibility, LfgRolesMap const& _roles):
+ compatibility(_compatibility), roles(_roles) { }
+
+ LfgCompatibility compatibility;
+ LfgRolesMap roles;
+};
+
+/// Stores player or group queue info
+struct LfgQueueData
+{
+ LfgQueueData(): joinTime(time_t(time(NULL))), tanks(LFG_TANKS_NEEDED),
+ healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
+ { }
+
+ LfgQueueData(time_t _joinTime, const LfgDungeonSet &_dungeons, LfgRolesMap const& _roles):
+ joinTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
+ dps(LFG_DPS_NEEDED), dungeons(_dungeons), roles(_roles)
+ { }
+
+ time_t joinTime; ///< Player queue join time (to calculate wait times)
+ uint8 tanks; ///< Tanks needed
+ uint8 healers; ///< Healers needed
+ uint8 dps; ///< Dps needed
+ LfgDungeonSet dungeons; ///< Selected Player/Group Dungeon/s
+ LfgRolesMap roles; ///< Selected Player Role/s
+ std::string bestCompatible; ///< Best compatible combination of people queued
+};
+
+struct LfgWaitTime
+{
+ LfgWaitTime(): time(-1), number(0) {}
+ int32 time; ///< Wait time
+ uint32 number; ///< Number of people used to get that wait time
+};
+
+typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
+typedef std::map<std::string, LfgCompatibilityData> LfgCompatibleContainer;
+typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
+
+/**
+ Stores all data related to queue
+*/
+class LFGQueue
+{
+ public:
+
+ // Add/Remove from queue
+ void AddToQueue(uint64 guid);
+ void RemoveFromQueue(uint64 guid);
+ void AddQueueData(uint64 guid, time_t joinTime, const LfgDungeonSet &dungeons, const LfgRolesMap &rolesMap);
+ void RemoveQueueData(uint64 guid);
+
+ // Update Timers (when proposal success)
+ void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId);
+ void UpdateWaitTimeTank(int32 waitTime, uint32 dungeonId);
+ void UpdateWaitTimeHealer(int32 waitTime, uint32 dungeonId);
+ void UpdateWaitTimeDps(int32 waitTime, uint32 dungeonId);
+
+ // Update Queue timers
+ void UpdateQueueTimers(time_t currTime);
+ time_t GetJoinTime(uint64 guid);
+
+ // Find new group
+ uint8 FindGroups();
+
+ // Just for debugging purposes
+ std::string DumpQueueInfo() const;
+ std::string DumpCompatibleInfo(bool full = false) const;
+
+ private:
+ void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles);
+ LfgRolesMap const& RemoveFromQueueUpdateData(uint64 guid);
+
+ void AddToNewQueue(uint64 guid);
+ void AddToCurrentQueue(uint64 guid);
+ void RemoveFromNewQueue(uint64 guid);
+ void RemoveFromCurrentQueue(uint64 guid);
+
+ void SetCompatibles(std::string const& key, LfgCompatibility compatibles);
+ LfgCompatibility GetCompatibles(std::string const& key);
+ void RemoveFromCompatibles(uint64 guid);
+
+ void SetCompatibilityData(std::string const& key, LfgCompatibilityData const& compatibles);
+ LfgCompatibilityData* GetCompatibilityData(std::string const& key);
+ void FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
+ void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, std::string const& key, LfgRolesMap const& roles);
+
+ LfgCompatibility FindNewGroups(LfgGuidList& check, LfgGuidList& all);
+ LfgCompatibility CheckCompatibility(LfgGuidList check);
+
+ // Queue
+ LfgQueueDataContainer QueueDataStore; ///< Queued groups
+ LfgCompatibleContainer CompatibleMapStore; ///< Compatible dungeons
+
+ LfgWaitTimesContainer waitTimesAvgStore; ///< Average wait time to find a group queuing as multiple roles
+ LfgWaitTimesContainer waitTimesTankStore; ///< Average wait time to find a group queuing as tank
+ LfgWaitTimesContainer waitTimesHealerStore; ///< Average wait time to find a group queuing as healer
+ LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps
+ LfgGuidList currentQueueStore; ///< Ordered list. Used to find groups
+ LfgGuidList newToQueueStore; ///< New groups to add to queue
+};
+
+#endif
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 1fa7fe0ca9f..32dc8319215 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -23,9 +23,11 @@
#include "SharedDefines.h"
#include "Player.h"
#include "Group.h"
-#include "ScriptPCH.h"
#include "LFGScripts.h"
#include "LFGMgr.h"
+#include "ScriptMgr.h"
+#include "ObjectAccessor.h"
+#include "WorldSession.h"
LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
{
@@ -33,24 +35,46 @@ LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/)
{
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
+ return;
+
sLFGMgr->InitializeLockedDungeons(player);
}
void LFGPlayerScript::OnLogout(Player* player)
{
- sLFGMgr->Leave(player);
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
- player->GetSession()->SendLfgUpdateParty(updateData);
- player->GetSession()->SendLfgUpdatePlayer(updateData);
- player->GetSession()->SendLfgUpdateSearch(false);
- uint64 guid = player->GetGUID();
- // TODO - Do not remove, add timer before deleting
- sLFGMgr->RemovePlayerData(guid);
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
+ return;
+
+ if (!player->GetGroup())
+ {
+ player->GetSession()->SendLfgLfrList(false);
+ sLFGMgr->LeaveLfg(player->GetGUID());
+ }
}
void LFGPlayerScript::OnLogin(Player* player)
{
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
+ return;
+
+ // Temporal: Trying to determine when group data and LFG data gets desynched
+ uint64 guid = player->GetGUID();
+ uint64 gguid = sLFGMgr->GetGroup(guid);
+
+ if (Group const* group = player->GetGroup())
+ {
+ uint64 gguid2 = group->GetGUID();
+ if (gguid != gguid2)
+ {
+ sLog->outError(LOG_FILTER_LFG, "%s on group %u but LFG has group %u saved... Fixing.",
+ player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
+ sLFGMgr->SetupGroupMember(guid, group->GetGUID());
+ }
+ }
+
sLFGMgr->InitializeLockedDungeons(player);
+ sLFGMgr->SetTeam(player->GetGUID(), player->GetTeam());
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group
}
@@ -67,80 +91,102 @@ LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
{
- uint64 gguid = group->GetGUID();
- if (!gguid)
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "]", gguid, guid);
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_CLEAR_LOCK_LIST);
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ uint64 gguid = group->GetGUID();
+ uint64 leader = group->GetLeaderGUID();
+
+ if (leader == guid)
+ {
+ sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
+ sLFGMgr->SetLeader(gguid, guid);
+ }
+ else
{
- if (Player* plrg = itr->getSource())
+ LfgState gstate = sLFGMgr->GetState(gguid);
+ LfgState state = sLFGMgr->GetState(guid);
+ sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
+ LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_UPDATE_STATUS);
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
- plrg->GetSession()->SendLfgUpdatePlayer(updateData);
- plrg->GetSession()->SendLfgUpdateParty(updateData);
+ if (Player* plrg = itr->getSource())
+ {
+ plrg->GetSession()->SendLfgUpdatePlayer(updateData);
+ plrg->GetSession()->SendLfgUpdateParty(updateData);
+ }
}
- }
- // TODO - if group is queued and new player is added convert to rolecheck without notify the current players queued
- if (sLFGMgr->GetState(gguid) == LFG_STATE_QUEUED)
- sLFGMgr->Leave(NULL, group);
+ if (state == LFG_STATE_QUEUED)
+ sLFGMgr->LeaveLfg(guid);
+
+ // TODO - if group is queued and new player is added convert to rolecheck without notify the current players queued
+ if (gstate == LFG_STATE_QUEUED)
+ sLFGMgr->LeaveLfg(gguid);
+ }
- if (sLFGMgr->GetState(guid) == LFG_STATE_QUEUED)
- if (Player* player = ObjectAccessor::FindPlayer(guid))
- sLFGMgr->Leave(player);
+ sLFGMgr->SetGroup(guid, gguid);
+ sLFGMgr->AddPlayerToGroup(gguid, guid);
}
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
{
- uint64 gguid = group->GetGUID();
- if (!gguid || method == GROUP_REMOVEMETHOD_DEFAULT)
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
+ uint64 gguid = group->GetGUID();
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
- if (sLFGMgr->GetState(gguid) == LFG_STATE_QUEUED)
- {
- // TODO - Do not remove, just remove the one leaving and rejoin queue with all other data
- sLFGMgr->Leave(NULL, group);
- }
- if (!group->isLFGGroup())
- return;
+ bool isLFG = group->isLFGGroup();
- if (method == GROUP_REMOVEMETHOD_KICK) // Player have been kicked
+ if (isLFG && method == GROUP_REMOVEMETHOD_KICK) // Player have been kicked
{
// TODO - Update internal kick cooldown of kicker
std::string str_reason = "";
if (reason)
str_reason = std::string(reason);
- sLFGMgr->InitBoot(group, kicker, guid, str_reason);
+ sLFGMgr->InitBoot(gguid, kicker, guid, str_reason);
return;
}
- uint32 state = sLFGMgr->GetState(gguid);
- sLFGMgr->ClearState(guid);
- sLFGMgr->SetState(guid, LFG_STATE_NONE);
+ LfgState state = sLFGMgr->GetState(gguid);
+
+ // If group is being formed after proposal success do nothing more
+ if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
+ {
+ // LfgData: Remove player from group
+ sLFGMgr->SetGroup(guid, 0);
+ sLFGMgr->RemovePlayerFromGroup(gguid, guid);
+ return;
+ }
+
+ sLFGMgr->LeaveLfg(guid);
+ sLFGMgr->SetGroup(guid, 0);
+ uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
+
if (Player* player = ObjectAccessor::FindPlayer(guid))
{
- if (method == GROUP_REMOVEMETHOD_LEAVE && state != LFG_STATE_FINISHED_DUNGEON && player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN))
- player->CastSpell(player, LFG_SPELL_DUNGEON_DESERTER, false);
- /*
- else if (group->isLfgKickActive())
+ if (method == GROUP_REMOVEMETHOD_LEAVE && state == LFG_STATE_DUNGEON &&
+ players >= LFG_GROUP_KICK_VOTES_NEEDED)
+ player->CastSpell(player, LFG_SPELL_DUNGEON_DESERTER, true);
+ //else if (state == LFG_STATE_BOOT)
// Update internal kick cooldown of kicked
- */
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
- player->GetSession()->SendLfgUpdateParty(updateData);
- if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon
+ player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_LEADER_UNK1));
+ if (isLFG && player->GetMap()->IsDungeon()) // Teleport player out the dungeon
sLFGMgr->TeleportPlayer(player, true);
}
- if (state != LFG_STATE_FINISHED_DUNGEON)// Need more players to finish the dungeon
- sLFGMgr->OfferContinue(group);
+ if (isLFG && state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon
+ if (Player* leader = ObjectAccessor::FindPlayer(sLFGMgr->GetLeader(gguid)))
+ leader->GetSession()->SendLfgOfferContinue(sLFGMgr->GetDungeon(gguid, false));
}
void LFGGroupScript::OnDisband(Group* group)
{
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
+ return;
+
uint64 gguid = group->GetGUID();
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
@@ -149,31 +195,26 @@ void LFGGroupScript::OnDisband(Group* group)
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
{
- uint64 gguid = group->GetGUID();
- if (!gguid)
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
- Player* player = ObjectAccessor::FindPlayer(newLeaderGuid);
-
- LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER);
- if (player)
- player->GetSession()->SendLfgUpdateParty(updateData);
+ uint64 gguid = group->GetGUID();
- player = ObjectAccessor::FindPlayer(oldLeaderGuid);
- if (player)
- {
- updateData.updateType = LFG_UPDATETYPE_GROUP_DISBAND;
- player->GetSession()->SendLfgUpdateParty(updateData);
- }
+ sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
+ sLFGMgr->SetLeader(gguid, newLeaderGuid);
}
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
{
- uint64 gguid = group->GetGUID();
- if (!gguid)
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
- sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, group->GetLeaderGUID());
- sLFGMgr->Leave(NULL, group);
+ uint64 gguid = group->GetGUID();
+ uint64 leader = group->GetLeaderGUID();
+ sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
+ // No gguid == new group being formed
+ // No leader == after group creation first invite is new leader
+ // leader and no gguid == first invite after leader is added to new group (this is the real invite)
+ if (leader && !gguid)
+ sLFGMgr->LeaveLfg(leader);
}
diff --git a/src/server/game/DungeonFinding/LFGScripts.h b/src/server/game/DungeonFinding/LFGScripts.h
index 4b332c7d731..ac1f66abbda 100644
--- a/src/server/game/DungeonFinding/LFGScripts.h
+++ b/src/server/game/DungeonFinding/LFGScripts.h
@@ -21,7 +21,7 @@
#include "Common.h"
#include "SharedDefines.h"
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
class Player;
class Group;
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 4613a3554db..9f3b416d0f6 100755..100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -26,8 +26,7 @@
#include "GossipDef.h"
#include "World.h"
-Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
-, m_type(type)
+Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
{
m_objectType |= TYPEMASK_CORPSE;
m_objectTypeId = TYPEID_CORPSE;
@@ -39,6 +38,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
m_time = time(NULL);
lootForBody = false;
+ lootRecipient = NULL;
}
Corpse::~Corpse()
@@ -78,8 +78,8 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
if (!IsPositionValid())
{
- sLog->outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
- guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
+ sLog->outError(LOG_FILTER_PLAYER, "Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
+ guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY());
return false;
}
@@ -103,25 +103,26 @@ void Corpse::SaveToDB()
SQLTransaction trans = CharacterDatabase.BeginTransaction();
DeleteFromDB(trans);
+ uint16 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE);
- stmt->setUInt32(0, GetGUIDLow()); // corpseGuid
- stmt->setUInt32(1, GUID_LOPART(GetOwnerGUID())); // guid
- stmt->setFloat (2, GetPositionX()); // posX
- stmt->setFloat (3, GetPositionY()); // posY
- stmt->setFloat (4, GetPositionZ()); // posZ
- stmt->setFloat (5, GetOrientation()); // orientation
- stmt->setUInt16(6, GetMapId()); // mapId
- stmt->setUInt32(7, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
- stmt->setString(8, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
- stmt->setUInt32(9, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
- stmt->setUInt32(10, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
- stmt->setUInt32(11, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
- stmt->setUInt8 (12, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
- stmt->setUInt8 (13, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
- stmt->setUInt32(14, uint32(m_time)); // time
- stmt->setUInt8 (15, GetType()); // corpseType
- stmt->setUInt32(16, GetInstanceId()); // instanceId
- stmt->setUInt16(17, GetPhaseMask()); // phaseMask
+ stmt->setUInt32(index++, GetGUIDLow()); // corpseGuid
+ stmt->setUInt32(index++, GUID_LOPART(GetOwnerGUID())); // guid
+ stmt->setFloat (index++, GetPositionX()); // posX
+ stmt->setFloat (index++, GetPositionY()); // posY
+ stmt->setFloat (index++, GetPositionZ()); // posZ
+ stmt->setFloat (index++, GetOrientation()); // orientation
+ stmt->setUInt16(index++, GetMapId()); // mapId
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
+ stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
+ stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
+ stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
+ stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
+ stmt->setUInt32(index++, uint32(m_time)); // time
+ stmt->setUInt8 (index++, GetType()); // corpseType
+ stmt->setUInt32(index++, GetInstanceId()); // instanceId
+ stmt->setUInt16(index++, GetPhaseMask()); // phaseMask
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
@@ -134,7 +135,7 @@ void Corpse::DeleteBonesFromWorld()
if (!corpse)
{
- sLog->outError("Bones %u not found in world.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Bones %u not found in world.", GetGUIDLow());
return;
}
@@ -161,9 +162,10 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
{
- uint32 ownerGuid = fields[17].GetUInt32();
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, corpseGuid, guid FROM corpse WHERE corpseType <> 0
+
+ uint32 ownerGuid = fields[17].GetUInt32();
float posX = fields[0].GetFloat();
float posY = fields[1].GetFloat();
float posZ = fields[2].GetFloat();
@@ -194,7 +196,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
if (!IsPositionValid())
{
- sLog->outError("Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
+ sLog->outError(LOG_FILTER_PLAYER, "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
return false;
}
diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h
index afac900df32..afac900df32 100755..100644
--- a/src/server/game/Entities/Corpse/Corpse.h
+++ b/src/server/game/Entities/Corpse/Corpse.h
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 4d54d1599a8..b28295d47ef 100755..100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -16,40 +16,42 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "BattlegroundMgr.h"
+#include "CellImpl.h"
#include "Common.h"
-#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "GroupMgr.h"
-#include "SpellMgr.h"
-#include "Creature.h"
-#include "QuestDef.h"
-#include "GossipDef.h"
-#include "Player.h"
-#include "PoolMgr.h"
-#include "Opcodes.h"
-#include "Log.h"
-#include "LootMgr.h"
-#include "MapManager.h"
#include "CreatureAI.h"
#include "CreatureAISelector.h"
+#include "CreatureGroups.h"
+#include "Creature.h"
+#include "DatabaseEnv.h"
#include "Formulas.h"
-#include "WaypointMovementGenerator.h"
-#include "InstanceScript.h"
-#include "BattlegroundMgr.h"
-#include "Util.h"
+#include "GameEventMgr.h"
+#include "GossipDef.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "OutdoorPvPMgr.h"
-#include "GameEventMgr.h"
-#include "CreatureGroups.h"
-#include "Vehicle.h"
-#include "SpellAuraEffects.h"
#include "Group.h"
-#include "MoveSplineInit.h"
+#include "GroupMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "LootMgr.h"
+#include "MapManager.h"
#include "MoveSpline.h"
+#include "MoveSplineInit.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "OutdoorPvPMgr.h"
+#include "Player.h"
+#include "PoolMgr.h"
+#include "QuestDef.h"
+#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
+#include "Util.h"
+#include "Vehicle.h"
+#include "WaypointMovementGenerator.h"
+#include "World.h"
+#include "WorldPacket.h"
+
// apply implementation of the singletons
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
@@ -173,7 +175,7 @@ Creature::~Creature()
i_AI = NULL;
//if (m_uint32Values)
- // sLog->outError("Deconstruct Creature Entry = %u", GetEntry());
+ // sLog->outError(LOG_FILTER_UNITS, "Deconstruct Creature Entry = %u", GetEntry());
}
void Creature::AddToWorld()
@@ -261,7 +263,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!normalInfo)
{
- sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature::InitEntry creature entry %u does not exist.", Entry);
return false;
}
@@ -299,7 +301,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
// Cancel load if no model defined
if (!(cinfo->GetFirstValidModelId()))
{
- sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
return false;
}
@@ -307,7 +309,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (!minfo) // Cancel load if no model defined
{
- sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
return false;
}
@@ -380,6 +382,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
SetAttackTime(RANGED_ATTACK, cInfo->rangeattacktime);
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
+ SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
@@ -408,6 +411,16 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
SetPvP(false);
}
+ // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template
+ if (IsVehicle())
+ {
+ if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player
+ {
+ setFaction(owner->getFaction()); // vehicles should have same as owner faction
+ owner->VehicleSpellInitialize();
+ }
+ }
+
// trigger creature is always not selectable and can not be attacked
if (isTrigger())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -470,11 +483,11 @@ void Creature::Update(uint32 diff)
{
case JUST_RESPAWNED:
// Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
- sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
break;
case JUST_DIED:
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
- sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
break;
case DEAD:
{
@@ -523,7 +536,7 @@ void Creature::Update(uint32 diff)
else if (m_corpseRemoveTime <= time(NULL))
{
RemoveCorpse(false);
- sLog->outStaticDebug("Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
+ sLog->outDebug(LOG_FILTER_UNITS, "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
}
break;
}
@@ -629,7 +642,7 @@ void Creature::RegenerateMana()
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetMiscValue() == POWER_MANA)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
@@ -666,7 +679,7 @@ void Creature::RegenerateHealth()
// Apply modifiers (if any).
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILLISECONDS);
@@ -755,7 +768,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
- sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
return false;
}
@@ -769,7 +782,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
if (!IsPositionValid())
{
- sLog->outError("Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang);
+ sLog->outError(LOG_FILTER_UNITS, "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang);
return false;
}
@@ -836,7 +849,7 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const
if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS)
{
- sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
+ sLog->outError(LOG_FILTER_SQL, "Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
GetGUIDLow(), GetEntry());
return false;
}
@@ -952,30 +965,6 @@ bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const
&& player->getClass() == GetCreatureTemplate()->trainer_class;
}
-void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 /*MovementFlags*/, uint8 /*type*/)
-{
- /* uint32 timeElap = getMSTime();
- if ((timeElap - m_startMove) < m_moveTime)
- {
- oX = (dX - oX) * ((timeElap - m_startMove) / m_moveTime);
- oY = (dY - oY) * ((timeElap - m_startMove) / m_moveTime);
- }
- else
- {
- oX = dX;
- oY = dY;
- }
-
- dX = x;
- dY = y;
- m_orientation = atan2((oY - dY), (oX - dX));
-
- m_startMove = getMSTime();
- m_moveTime = time;*/
- float speed = GetDistance(x, y, z) / ((float)time * 0.001f);
- MonsterMoveWithSpeed(x, y, z, speed);
-}
-
Player* Creature::GetLootRecipient() const
{
if (!m_lootRecipient)
@@ -1038,7 +1027,7 @@ void Creature::SaveToDB()
CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid);
if (!data)
{
- sLog->outError("Creature::SaveToDB failed, cannot get creature data!");
+ sLog->outError(LOG_FILTER_UNITS, "Creature::SaveToDB failed, cannot get creature data!");
return;
}
@@ -1252,7 +1241,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
- sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
return false;
}
@@ -1278,7 +1267,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
if (!data)
{
- sLog->outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
return false;
}
@@ -1394,7 +1383,7 @@ void Creature::DeleteFromDB()
{
if (!m_DBTableGuid)
{
- sLog->outError("Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
return;
}
@@ -1600,7 +1589,8 @@ void Creature::Respawn(bool force)
if (m_DBTableGuid)
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
- sLog->outStaticDebug("Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName(), GetGUIDLow(), GetGUID(), GetEntry());
+ sLog->outDebug(LOG_FILTER_UNITS, "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)",
+ GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
m_respawnTime = 0;
lootForPickPocketed = false;
lootForBody = false;
@@ -1714,7 +1704,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
+ sLog->outError(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]);
continue;
}
@@ -1762,7 +1752,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
+ sLog->outError(LOG_FILTER_UNITS, "WORLD: unknown spell id %i", m_spells[i]);
continue;
}
@@ -1834,7 +1824,7 @@ Unit* Creature::SelectNearestTargetInAttackDistance(float dist) const
if (dist > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (GUID: %u Entry: %u) SelectNearestTargetInAttackDistance called with dist > MAX_VISIBILITY_DISTANCE. Distance set to ATTACK_DISTANCE.", GetGUIDLow(), GetEntry());
dist = ATTACK_DISTANCE;
}
@@ -2118,7 +2108,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
if (!AdditionalSpellInfo)
{
- sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
continue;
}
@@ -2126,7 +2116,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
if (HasAura(*itr))
{
if (!reload)
- sLog->outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
continue;
}
@@ -2153,7 +2143,7 @@ void Creature::SetInCombatWithZone()
{
if (!CanHaveThreatList())
{
- sLog->outError("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
return;
}
@@ -2161,7 +2151,7 @@ void Creature::SetInCombatWithZone()
if (!map->IsDungeon())
{
- sLog->outError("Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
+ sLog->outError(LOG_FILTER_UNITS, "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
return;
}
@@ -2230,6 +2220,38 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id);
}
+void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
+{
+ time_t curTime = time(NULL);
+ for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
+ {
+ if (m_spells[i] == 0)
+ continue;
+
+ uint32 unSpellId = m_spells[i];
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
+ if (!spellInfo)
+ {
+ ASSERT(spellInfo);
+ continue;
+ }
+
+ // Not send cooldown for this spells
+ if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ continue;
+
+ if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
+ continue;
+
+ if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs)
+ {
+ _AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS);
+ if (UnitAI* ai = GetAI())
+ ai->SpellInterrupted(unSpellId, unTimeMs);
+ }
+ }
+}
+
bool Creature::HasSpell(uint32 spellID) const
{
uint8 i;
@@ -2410,7 +2432,7 @@ TrainerSpellData const* Creature::GetTrainerSpells() const
}
// overwrite WorldObject function for proper name localization
-const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
+std::string const & Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
{
if (loc_idx != DEFAULT_LOCALE)
{
@@ -2419,7 +2441,7 @@ const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const
if (cl)
{
if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
- return cl->Name[uloc_idx].c_str();
+ return cl->Name[uloc_idx];
}
}
@@ -2447,7 +2469,7 @@ void Creature::SetPosition(float x, float y, float z, float o)
GetMap()->CreatureRelocation(ToCreature(), x, y, z, o);
if (IsVehicle())
- GetVehicleKit()->RelocatePassengers(x, y, z, o);
+ GetVehicleKit()->RelocatePassengers();
}
bool Creature::IsDungeonBoss() const
@@ -2503,3 +2525,69 @@ bool Creature::SetHover(bool enable)
SendMessageToSet(&data, false);
return true;
}
+
+float Creature::GetAggroRange(Unit const* target) const
+{
+ // Determines the aggro range for creatures (usually pets), used mainly for aggressive pet target selection.
+ // Based on data from wowwiki due to lack of 3.3.5a data
+
+ if (target && this->isPet())
+ {
+ uint32 targetLevel = 0;
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ targetLevel = target->getLevelForTarget(this);
+ else if (target->GetTypeId() == TYPEID_UNIT)
+ targetLevel = target->ToCreature()->getLevelForTarget(this);
+
+ uint32 myLevel = getLevelForTarget(target);
+ int32 levelDiff = int32(targetLevel) - int32(myLevel);
+
+ // The maximum Aggro Radius is capped at 45 yards (25 level difference)
+ if (levelDiff < -25)
+ levelDiff = -25;
+
+ // The base aggro radius for mob of same level
+ float aggroRadius = 20;
+
+ // Aggro Radius varies with level difference at a rate of roughly 1 yard/level
+ aggroRadius -= (float)levelDiff;
+
+ // detect range auras
+ aggroRadius += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
+
+ // detected range auras
+ aggroRadius += target->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
+
+ // Just in case, we don't want pets running all over the map
+ if (aggroRadius > MAX_AGGRO_RADIUS)
+ aggroRadius = MAX_AGGRO_RADIUS;
+
+ // Minimum Aggro Radius for a mob seems to be combat range (5 yards)
+ // hunter pets seem to ignore minimum aggro radius so we'll default it a little higher
+ if (aggroRadius < 10)
+ aggroRadius = 10;
+
+ return (aggroRadius);
+ }
+
+ // Default
+ return 0.0f;
+}
+
+Unit* Creature::SelectNearestHostileUnitInAggroRange(bool useLOS) const
+{
+ // Selects nearest hostile target within creature's aggro range. Used primarily by
+ // pets set to aggressive. Will not return neutral or friendly targets.
+
+ Unit* target = NULL;
+
+ {
+ Trinity::NearestHostileUnitInAggroRangeCheck u_check(this, useLOS);
+ Trinity::UnitSearcher<Trinity::NearestHostileUnitInAggroRangeCheck> searcher(this, target, u_check);
+
+ VisitNearbyGridObject(MAX_AGGRO_RADIUS, searcher);
+ }
+
+ return target;
+}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index c8ebf1aa13b..8a697dd0ef0 100755..100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -54,7 +54,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills
CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre
CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // Creature is subject to all diminishing returns as player are
- CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
+ CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000 // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
};
#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \
@@ -111,6 +111,7 @@ struct CreatureTemplate
uint32 rangeattacktime;
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
uint32 unit_flags; // enum UnitFlags mask values
+ uint32 unit_flags2; // enum UnitFlags2 mask values
uint32 dynamicflags;
uint32 family; // enum CreatureFamily values (optional)
uint32 trainer_type;
@@ -322,7 +323,7 @@ struct VendorItem
: item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {}
uint32 item;
- uint32 maxcount; // 0 for infinity item amount
+ uint32 maxcount; // 0 for infinity item amount
uint32 incrtime; // time for restore items amount if maxcount != 0
uint32 ExtendedCost;
@@ -411,15 +412,15 @@ typedef std::map<uint32, time_t> CreatureSpellCooldowns;
enum CreatureCellMoveState
{
- CREATURE_CELL_MOVE_NONE, //not in move list
- CREATURE_CELL_MOVE_ACTIVE, //in move list
- CREATURE_CELL_MOVE_INACTIVE, //in move list but should not move
+ CREATURE_CELL_MOVE_NONE, // not in move list
+ CREATURE_CELL_MOVE_ACTIVE, // in move list
+ CREATURE_CELL_MOVE_INACTIVE // in move list but should not move
};
class MapCreature
{
- friend class Map; //map for moving creatures
- friend class ObjectGridLoader; //grid loader for loading creatures
+ friend class Map; // map for moving creatures
+ friend class ObjectGridLoader; // grid loader for loading creatures
protected:
MapCreature() : _moveState(CREATURE_CELL_MOVE_NONE) {}
@@ -519,7 +520,6 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool AIM_Initialize(CreatureAI* ai = NULL);
void Motion_Initialize();
- void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type);
CreatureAI* AI() const { return (CreatureAI*)i_AI; }
bool SetWalk(bool enable);
@@ -539,6 +539,13 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void AddCreatureSpellCooldown(uint32 spellid);
bool HasSpellCooldown(uint32 spell_id) const;
bool HasCategoryCooldown(uint32 spell_id) const;
+ uint32 GetCreatureSpellCooldownDelay(uint32 spellId) const
+ {
+ CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spellId);
+ time_t t = time(NULL);
+ return uint32(itr != m_CreatureSpellCooldowns.end() && itr->second > t ? itr->second - t : 0);
+ }
+ virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
bool HasSpell(uint32 spellID) const;
@@ -576,7 +583,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId, language, TargetGuid); }
// override WorldObject function for proper name localization
- const char* GetNameForLocaleIdx(LocaleConstant locale_idx) const;
+ std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void setDeathState(DeathState s); // override virtual Unit::setDeathState
@@ -614,12 +621,14 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool canStartAttack(Unit const* u, bool force) const;
float GetAttackDistance(Unit const* player) const;
+ float GetAggroRange(Unit const* target) const;
void SendAIReaction(AiReaction reactionType);
Unit* SelectNearestTarget(float dist = 0) const;
Unit* SelectNearestTargetInAttackDistance(float dist = 0) const;
Player* SelectNearestPlayer(float distance = 0) const;
+ Unit* SelectNearestHostileUnitInAggroRange(bool useLOS = false) const;
void DoFleeToGetAssistance();
void CallForHelp(float fRadius);
@@ -660,6 +669,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool hasInvolvedQuest(uint32 quest_id) const;
bool isRegeneratingHealth() { return m_regenHealth; }
+ void setRegeneratingHealth(bool regenHealth) { m_regenHealth = regenHealth; }
virtual uint8 GetPetAutoSpellSize() const { return MAX_SPELL_CHARM; }
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
{
@@ -674,8 +684,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void SetHomePosition(float x, float y, float z, float o) { m_homePosition.Relocate(x, y, z, o); }
void SetHomePosition(const Position &pos) { m_homePosition.Relocate(pos); }
- void GetHomePosition(float &x, float &y, float &z, float &ori) { m_homePosition.GetPosition(x, y, z, ori); }
- Position GetHomePosition() { return m_homePosition; }
+ void GetHomePosition(float &x, float &y, float &z, float &ori) const { m_homePosition.GetPosition(x, y, z, ori); }
+ Position GetHomePosition() const { return m_homePosition; }
void SetTransportHomePosition(float x, float y, float z, float o) { m_transportHomePosition.Relocate(x, y, z, o); }
void SetTransportHomePosition(const Position &pos) { m_transportHomePosition.Relocate(pos); }
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 54953ef5420..c9d1944af09 100755..100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -84,8 +84,7 @@ void FormationMgr::LoadCreatureFormations()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
return;
}
@@ -118,14 +117,14 @@ void FormationMgr::LoadCreatureFormations()
{
if (!sObjectMgr->GetCreatureData(group_member->leaderGUID))
{
- sLog->outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
+ sLog->outError(LOG_FILTER_SQL, "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
delete group_member;
continue;
}
if (!sObjectMgr->GetCreatureData(memberGUID))
{
- sLog->outErrorDb("creature_formations table member guid %u incorrect (not exist)", memberGUID);
+ sLog->outError(LOG_FILTER_SQL, "creature_formations table member guid %u incorrect (not exist)", memberGUID);
delete group_member;
continue;
}
@@ -136,8 +135,7 @@ void FormationMgr::LoadCreatureFormations()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void CreatureGroup::AddMember(Creature* member)
@@ -227,8 +225,8 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
float angle = itr->second->follow_angle;
float dist = itr->second->follow_dist;
- float dx = x + cos(angle + pathangle) * dist;
- float dy = y + sin(angle + pathangle) * dist;
+ float dx = x + std::cos(angle + pathangle) * dist;
+ float dy = y + std::sin(angle + pathangle) * dist;
float dz = z;
Trinity::NormalizeMapCoord(dx);
diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h
index e5b8771ee40..e5b8771ee40 100755..100644
--- a/src/server/game/Entities/Creature/CreatureGroups.h
+++ b/src/server/game/Entities/Creature/CreatureGroups.h
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 836fbe8c7bf..17a8711379a 100755..100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -142,9 +142,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20
- for (uint32 iI = 0; iI < _questMenu.GetMenuItemCount(); ++iI)
+ for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
- QuestMenuItem const& item = _questMenu.GetItem(iI);
+ QuestMenuItem const& item = _questMenu.GetItem(i);
uint32 questID = item.QuestId;
Quest const* quest = sObjectMgr->GetQuestTemplate(questID);
@@ -155,7 +155,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
std::string title = quest->GetTitle();
- int locale = _session->GetSessionDbLocaleIndex();
+ int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
@@ -177,7 +177,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const
PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId);
if (!poi)
{
- sLog->outErrorDb("Request to send non-existing POI (Id: %u), ignored.", poiId);
+ sLog->outError(LOG_FILTER_SQL, "Request to send non-existing POI (Id: %u), ignored.", poiId);
return;
}
@@ -262,10 +262,10 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
{
std::string title = quest->GetTitle();
- int loc_idx = _session->GetSessionDbLocaleIndex();
- if (loc_idx >= 0)
- if (QuestLocale const* ql = sObjectMgr->GetQuestLocale(questID))
- ObjectMgr::GetLocaleString(ql->Title, loc_idx, title);
+ int32 locale = _session->GetSessionDbLocaleIndex();
+ if (locale >= 0)
+ if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
+ ObjectMgr::GetLocaleString(localeData->Title, locale, title);
data << uint32(questID);
data << uint32(qmi.QuestIcon);
@@ -367,8 +367,8 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
}
// rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0.0f); // new 3.3.0, honor multiplier?
+ data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
+ data << float(0.0f); // unk, honor multiplier?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell
data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -405,7 +405,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
std::string questCompletedText = quest->GetCompletedText();
std::string questObjectiveText[QUEST_OBJECTIVES_COUNT];
- for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
questObjectiveText[i] = quest->ObjectiveText[i];
int32 locale = _session->GetSessionDbLocaleIndex();
@@ -419,7 +419,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
ObjectMgr::GetLocaleString(localeData->EndText, locale, questEndText);
ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText);
- for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]);
}
}
@@ -454,8 +454,8 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
data << int32(quest->GetRewSpellCast()); // casted spell
// rewarded honor points
- data << Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0); // new reward honor (multipled by ~62 at client side)
+ data << uint32(quest->GetRewHonorAddition());
+ data << float(quest->GetRewHonorMultiplier());
data << uint32(quest->GetSrcItemId()); // source item id
data << uint32(quest->GetFlags() & 0xFFFF); // quest flags
data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
@@ -466,46 +466,46 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
{
- for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
data << uint32(0) << uint32(0);
- for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
data << uint32(0) << uint32(0);
}
else
{
- for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << uint32(quest->RewardItemId[i]);
data << uint32(quest->RewardItemIdCount[i]);
}
- for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << uint32(quest->RewardChoiceItemId[i]);
data << uint32(quest->RewardChoiceItemCount[i]);
}
}
- for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
data << uint32(quest->RewardFactionId[i]);
- for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc?
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc?
data << int32(quest->RewardFactionValueId[i]);
- for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0)
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0)
data << int32(quest->RewardFactionValueIdOverride[i]);
- data << quest->GetPointMapId();
- data << quest->GetPointX();
- data << quest->GetPointY();
- data << quest->GetPointOpt();
+ data << uint32(quest->GetPointMapId());
+ data << float(quest->GetPointX());
+ data << float(quest->GetPointY());
+ data << uint32(quest->GetPointOpt());
data << questTitle;
data << questObjectives;
data << questDetails;
data << questEndText;
- data << questCompletedText; // display in quest objectives window once all objectives are completed
+ data << questCompletedText; // display in quest objectives window once all objectives are completed
- for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
if (quest->RequiredNpcOrGo[i] < 0)
data << uint32((quest->RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000)
@@ -517,13 +517,13 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
data << uint32(0); // req source count?
}
- for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
data << uint32(quest->RequiredItemId[i]);
data << uint32(quest->RequiredItemCount[i]);
}
- for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
data << questObjectiveText[i];
_session->SendPacket(&data);
@@ -535,7 +535,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
std::string questTitle = quest->GetTitle();
std::string questOfferRewardText = quest->GetOfferRewardText();
- int locale = _session->GetSessionDbLocaleIndex();
+ int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
{
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
@@ -556,7 +556,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum
uint32 emoteCount = 0;
- for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
+ for (uint8 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
if (quest->OfferRewardEmote[i] <= 0)
break;
@@ -564,7 +564,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
}
data << emoteCount; // Emote Count
- for (uint32 i = 0; i < emoteCount; ++i)
+ for (uint8 i = 0; i < emoteCount; ++i)
{
data << uint32(quest->OfferRewardEmoteDelay[i]); // Delay Emote
data << uint32(quest->OfferRewardEmote[i]);
@@ -598,8 +598,8 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
// rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0); // unk, honor multiplier?
+ data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
+ data << float(0.0f); // unk, honor multiplier?
data << uint32(0x08); // unused by client?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell
@@ -651,7 +651,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
data << questTitle;
data << requestItemsText;
- data << uint32(0x00); // unknown
+ data << uint32(0); // unknown
if (canComplete)
data << quest->GetCompleteEmote();
@@ -659,10 +659,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
data << quest->GetIncompleteEmote();
// Close Window after cancel
- if (closeOnCancel)
- data << uint32(0x01);
- else
- data << uint32(0x00);
+ data << uint32(closeOnCancel);
data << uint32(quest->GetFlags()); // 3.3.3 questFlags
data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum
diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h
index 15766bbcd59..15766bbcd59 100755..100644
--- a/src/server/game/Entities/Creature/GossipDef.h
+++ b/src/server/game/Entities/Creature/GossipDef.h
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index 2af6b4c04fd..a6b51a4d395 100755..100644
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
@@ -21,6 +21,8 @@
#include "CreatureAI.h"
#include "ObjectMgr.h"
#include "TemporarySummon.h"
+#include "Pet.h"
+#include "Player.h"
TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) :
Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
@@ -159,7 +161,7 @@ void TempSummon::Update(uint32 diff)
}
default:
UnSummon();
- sLog->outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
+ sLog->outError(LOG_FILTER_UNITS, "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
break;
}
}
@@ -267,7 +269,7 @@ void TempSummon::RemoveFromWorld()
owner->m_SummonSlot[slot] = 0;
//if (GetOwnerGUID())
- // sLog->outError("Unit %u has owner guid when removed from world", GetEntry());
+ // sLog->outError(LOG_FILTER_UNITS, "Unit %u has owner guid when removed from world", GetEntry());
Creature::RemoveFromWorld();
}
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 537bbd9c099..b60197ff613 100755..100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -29,12 +29,12 @@ class TempSummon : public Creature
void Update(uint32 time);
virtual void InitStats(uint32 lifetime);
virtual void InitSummon();
- void UnSummon(uint32 msTime = 0);
+ virtual void UnSummon(uint32 msTime = 0);
void RemoveFromWorld();
void SetTempSummonType(TempSummonType type);
void SaveToDB(uint32 /*mapid*/, uint8 /*spawnMask*/, uint32 /*phaseMask*/) {}
Unit* GetSummoner() const;
- uint64 GetSummonerGUID() { return m_summonerGUID; }
+ uint64 GetSummonerGUID() const { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
uint32 GetTimer() { return m_timer; }
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 76d4cb6624b..cd4a9443867 100755..100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -85,7 +85,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
Relocate(pos);
if (!IsPositionValid())
{
- sLog->outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
+ sLog->outError(LOG_FILTER_GENERAL, "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY());
return false;
}
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index 7e68f6acd38..68da99ac668 100755..100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -29,7 +29,7 @@ enum DynamicObjectType
{
DYNAMIC_OBJECT_PORTAL = 0x0, // unused
DYNAMIC_OBJECT_AREA_SPELL = 0x1,
- DYNAMIC_OBJECT_FARSIGHT_FOCUS = 0x2,
+ DYNAMIC_OBJECT_FARSIGHT_FOCUS = 0x2
};
class DynamicObject : public WorldObject, public GridObject<DynamicObject>
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 1d9958a6524..f72e36e2d30 100755..100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -33,7 +33,7 @@
#include "GameObjectModel.h"
#include "DynamicTree.h"
-GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new GameObjectValue), m_AI(NULL)
+GameObject::GameObject(): WorldObject(false), m_model(NULL), m_goValue(), m_AI(NULL)
{
m_objectType |= TYPEMASK_GAMEOBJECT;
m_objectTypeId = TYPEID_GAMEOBJECT;
@@ -65,7 +65,6 @@ GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new Game
GameObject::~GameObject()
{
- delete m_goValue;
delete m_AI;
delete m_model;
//if (m_uint32Values) // field array can be not exist if GameOBject not loaded
@@ -119,7 +118,7 @@ void GameObject::RemoveFromOwner()
else if (IS_PET_GUID(ownerGUID))
ownerType = "pet";
- sLog->outCrash("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
+ sLog->outFatal(LOG_FILTER_GENERAL, "Removed GameObject (GUID: %u Entry: %u SpellId: %u LinkedGO: %u) that just lost any reference to the owner (GUID: %u Type: '%s') GO list",
GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);
SetOwnerGUID(0);
}
@@ -133,14 +132,13 @@ void GameObject::AddToWorld()
m_zoneScript->OnGameObjectCreate(this);
sObjectAccessor->AddObject(this);
- bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
+
// The state can be changed after GameObject::Create but before GameObject::AddToWorld
- bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false;
+ bool toggledState = GetGoType() == GAMEOBJECT_TYPE_CHEST ? getLootState() == GO_READY : GetGoState() == GO_STATE_READY;
if (m_model)
- GetMap()->Insert(*m_model);
- if (startOpen ^ toggledState)
- EnableCollision(false);
+ GetMap()->InsertGameObjectModel(*m_model);
+ EnableCollision(toggledState);
WorldObject::AddToWorld();
}
}
@@ -155,8 +153,8 @@ void GameObject::RemoveFromWorld()
RemoveFromOwner();
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
WorldObject::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
}
@@ -170,7 +168,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
Relocate(x, y, z, ang);
if (!IsPositionValid())
{
- sLog->outError("Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y);
+ sLog->outError(LOG_FILTER_GENERAL, "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y);
return false;
}
@@ -187,7 +185,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
if (!goinfo)
{
- sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z);
return false;
}
@@ -197,7 +195,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
{
- sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type);
return false;
}
@@ -227,8 +225,8 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
switch (goinfo->type)
{
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
- m_goValue->Building.Health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits;
- m_goValue->Building.MaxHealth = m_goValue->Building.Health;
+ m_goValue.Building.Health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits;
+ m_goValue.Building.MaxHealth = m_goValue.Building.Health;
SetGoAnimProgress(255);
break;
case GAMEOBJECT_TYPE_TRANSPORT:
@@ -268,7 +266,7 @@ void GameObject::Update(uint32 diff)
if (!AI())
{
if (!AIM_Initialize())
- sLog->outError("Could not initialize GameObjectAI");
+ sLog->outError(LOG_FILTER_GENERAL, "Could not initialize GameObjectAI");
} else
AI()->UpdateAI(diff);
@@ -294,7 +292,7 @@ void GameObject::Update(uint32 diff)
else if (Unit* owner = GetOwner())
{
if (owner->isInCombat())
- m_cooldownTime = time(NULL) + goInfo->trap.cooldown;
+ m_cooldownTime = time(NULL) + goInfo->trap.startDelay;
}
m_lootState = GO_READY;
break;
@@ -361,7 +359,7 @@ void GameObject::Update(uint32 diff)
Unit* caster = GetOwner();
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
- caster->FinishSpell(CURRENT_CHANNELED_SPELL);
+ caster->ToPlayer()->RemoveGameObject(this, false);
WorldPacket data(SMSG_FISH_ESCAPED, 0);
caster->ToPlayer()->GetSession()->SendPacket(&data);
@@ -418,7 +416,7 @@ void GameObject::Update(uint32 diff)
bool IsBattlegroundTrap = false;
//FIXME: this is activation radius (in different casting radius that must be selected from spell data)
//TODO: move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state
- float radius = (float)(goInfo->trap.radius)/2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
+ float radius = (float)(goInfo->trap.radius)/3*2; // TODO rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter)
if (!radius)
{
if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call)
@@ -647,7 +645,7 @@ void GameObject::SaveToDB()
GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid);
if (!data)
{
- sLog->outError("GameObject::SaveToDB failed, cannot get gameobject data!");
+ sLog->outError(LOG_FILTER_GENERAL, "GameObject::SaveToDB failed, cannot get gameobject data!");
return;
}
@@ -721,7 +719,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
if (!data)
{
- sLog->outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid);
return false;
}
@@ -855,6 +853,13 @@ bool GameObject::IsDynTransport() const
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
+bool GameObject::IsDestructibleBuilding() const
+{
+ GameObjectTemplate const* gInfo = GetGOInfo();
+ if (!gInfo) return false;
+ return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
+}
+
Unit* GameObject::GetOwner() const
{
return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
@@ -871,7 +876,7 @@ bool GameObject::IsAlwaysVisibleFor(WorldObject const* seer) const
if (WorldObject::IsAlwaysVisibleFor(seer))
return true;
- if (IsTransport())
+ if (IsTransport() || IsDestructibleBuilding())
return true;
if (!seer)
@@ -1074,7 +1079,8 @@ void GameObject::Use(Unit* user)
if (sScriptMgr->OnGossipHello(playerUser, this))
return;
- AI()->GossipHello(playerUser);
+ if (AI()->GossipHello(playerUser))
+ return;
}
// If cooldown data present in template
@@ -1108,6 +1114,19 @@ void GameObject::Use(Unit* user)
player->SendPreparedGossip(this);
return;
}
+ case GAMEOBJECT_TYPE_TRAP: //6
+ {
+ GameObjectTemplate const* goInfo = GetGOInfo();
+ if (goInfo->trap.spellId)
+ CastSpell(user, goInfo->trap.spellId);
+
+ m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); // template or 4 seconds
+
+ if (goInfo->trap.type == 1) // Deactivate after trigger
+ SetLootState(GO_JUST_DEACTIVATED);
+
+ return;
+ }
//Sitting: Wooden bench, chairs enzz
case GAMEOBJECT_TYPE_CHAIR: //7
{
@@ -1147,8 +1166,8 @@ void GameObject::Use(Unit* user)
// the distance between this slot and the center of the go - imagine a 1D space
float relativeDistance = (info->size*itr->first)-(info->size*(info->chair.slots-1)/2.0f);
- float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
- float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation);
+ float x_i = GetPositionX() + relativeDistance * std::cos(orthogonalOrientation);
+ float y_i = GetPositionY() + relativeDistance * std::sin(orthogonalOrientation);
if (itr->second)
{
@@ -1302,7 +1321,7 @@ void GameObject::Use(Unit* user)
//provide error, no fishable zone or area should be 0
if (!zone_skill)
- sLog->outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone);
+ sLog->outError(LOG_FILTER_SQL, "Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone);
int32 skill = player->GetSkillValue(SKILL_FISHING);
@@ -1318,7 +1337,7 @@ void GameObject::Use(Unit* user)
int32 roll = irand(1, 100);
- sLog->outStaticDebug("Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll);
// but you will likely cause junk in areas that require a high fishing skill (not yet implemented)
if (chance >= roll)
@@ -1341,6 +1360,8 @@ void GameObject::Use(Unit* user)
player->SendLoot(GetGUID(), LOOT_FISHING);
}
// TODO: else: junk
+ else
+ m_respawnTime = time(NULL);
break;
}
@@ -1412,7 +1433,8 @@ void GameObject::Use(Unit* user)
// full amount unique participants including original summoner
if (GetUniqueUseCount() == info->summoningRitual.reqParticipants)
{
- spellCaster = m_ritualOwner ? m_ritualOwner : spellCaster;
+ if (m_ritualOwner)
+ spellCaster = m_ritualOwner;
spellId = info->summoningRitual.spellId;
@@ -1514,14 +1536,18 @@ void GameObject::Use(Unit* user)
Player* player = user->ToPlayer();
- if (player->CanUseBattlegroundObject())
+ if (player->CanUseBattlegroundObject(this))
{
// in battleground check
Battleground* bg = player->GetBattleground();
if (!bg)
return;
+
if (player->GetVehicle())
return;
+
+ player->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+ player->RemoveAurasByType(SPELL_AURA_MOD_INVISIBILITY);
// BG flag click
// AB:
// 15001
@@ -1554,14 +1580,18 @@ void GameObject::Use(Unit* user)
Player* player = user->ToPlayer();
- if (player->CanUseBattlegroundObject())
+ if (player->CanUseBattlegroundObject(this))
{
// in battleground check
Battleground* bg = player->GetBattleground();
if (!bg)
return;
+
if (player->GetVehicle())
return;
+
+ player->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+ player->RemoveAurasByType(SPELL_AURA_MOD_INVISIBILITY);
// BG flag dropped
// WS:
// 179785 - Silverwing Flag
@@ -1612,8 +1642,8 @@ void GameObject::Use(Unit* user)
}
default:
if (GetGoType() >= MAX_GAMEOBJECT_TYPE)
- sLog->outError("GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)",
- user->GetTypeId(), user->GetGUIDLow(), user->GetName(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType());
+ sLog->outError(LOG_FILTER_GENERAL, "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)",
+ user->GetTypeId(), user->GetGUIDLow(), user->GetName().c_str(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType());
break;
}
@@ -1624,7 +1654,7 @@ void GameObject::Use(Unit* user)
if (!spellInfo)
{
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
- sLog->outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType());
+ sLog->outError(LOG_FILTER_GENERAL, "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType());
else
sLog->outDebug(LOG_FILTER_OUTDOORPVP, "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
return;
@@ -1668,7 +1698,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
{
trigger->setFaction(owner->getFaction());
// needed for GO casts for proper target validation checks
- trigger->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID());
+ trigger->SetOwnerGUID(owner->GetGUID());
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
}
else
@@ -1694,12 +1724,17 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
if (!info)
return IsWithinDist3d(x, y, z, radius);
- float sinA = sin(GetOrientation());
- float cosA = cos(GetOrientation());
+ float sinA = std::sin(GetOrientation());
+ float cosA = std::cos(GetOrientation());
float dx = x - GetPositionX();
float dy = y - GetPositionY();
float dz = z - GetPositionZ();
float dist = sqrt(dx*dx + dy*dy);
+ //! Check if the distance between the 2 objects is 0, can happen if both objects are on the same position.
+ //! The code below this check wont crash if dist is 0 because 0/0 in float operations is valid, and returns infinite
+ if (G3D::fuzzyEq(dist, 0.0f))
+ return true;
+
float sinB = dx / dist;
float cosB = dy / dist;
dx = dist * (cosA * cosB + sinA * sinB);
@@ -1722,14 +1757,14 @@ void GameObject::EventInform(uint32 eventId)
}
// overwrite WorldObject function for proper name localization
-const char* GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const
+std::string const & GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const
{
if (loc_idx != DEFAULT_LOCALE)
{
uint8 uloc_idx = uint8(loc_idx);
if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry()))
if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty())
- return cl->Name[uloc_idx].c_str();
+ return cl->Name[uloc_idx];
}
return GetName();
@@ -1739,17 +1774,17 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
{
static double const atan_pow = atan(pow(2.0f, -20.0f));
- double f_rot1 = sin(GetOrientation() / 2.0f);
- double f_rot2 = cos(GetOrientation() / 2.0f);
+ double f_rot1 = std::sin(GetOrientation() / 2.0f);
+ double f_rot2 = std::cos(GetOrientation() / 2.0f);
int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f));
int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF;
- //float f_rot2 = sin(0.0f / 2.0f);
+ //float f_rot2 = std::sin(0.0f / 2.0f);
//int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f));
//rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000;
- //float f_rot3 = sin(0.0f / 2.0f);
+ //float f_rot3 = std::sin(0.0f / 2.0f);
//int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f));
//rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000;
@@ -1767,22 +1802,22 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3
void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, uint32 spellId /*= 0*/)
{
- if (!GetGOValue()->Building.MaxHealth || !change)
+ if (!m_goValue.Building.MaxHealth || !change)
return;
// prevent double destructions of the same object
- if (change < 0 && !GetGOValue()->Building.Health)
+ if (change < 0 && !m_goValue.Building.Health)
return;
- if (int32(GetGOValue()->Building.Health) + change <= 0)
- GetGOValue()->Building.Health = 0;
- else if (int32(GetGOValue()->Building.Health) + change >= int32(GetGOValue()->Building.MaxHealth))
- GetGOValue()->Building.Health = GetGOValue()->Building.MaxHealth;
+ if (int32(m_goValue.Building.Health) + change <= 0)
+ m_goValue.Building.Health = 0;
+ else if (int32(m_goValue.Building.Health) + change >= int32(m_goValue.Building.MaxHealth))
+ m_goValue.Building.Health = m_goValue.Building.MaxHealth;
else
- GetGOValue()->Building.Health += change;
+ m_goValue.Building.Health += change;
// Set the health bar, value = 255 * healthPct;
- SetGoAnimProgress(GetGOValue()->Building.Health * 255 / GetGOValue()->Building.MaxHealth);
+ SetGoAnimProgress(m_goValue.Building.Health * 255 / m_goValue.Building.MaxHealth);
Player* player = attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself();
@@ -1801,11 +1836,11 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u
GameObjectDestructibleState newState = GetDestructibleState();
- if (!GetGOValue()->Building.Health)
+ if (!m_goValue.Building.Health)
newState = GO_DESTRUCTIBLE_DESTROYED;
- else if (GetGOValue()->Building.Health <= GetGOInfo()->building.damagedNumHits)
+ else if (m_goValue.Building.Health <= GetGOInfo()->building.damagedNumHits)
newState = GO_DESTRUCTIBLE_DAMAGED;
- else if (GetGOValue()->Building.Health == GetGOValue()->Building.MaxHealth)
+ else if (m_goValue.Building.Health == m_goValue.Building.MaxHealth)
newState = GO_DESTRUCTIBLE_INTACT;
if (newState == GetDestructibleState())
@@ -1826,7 +1861,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
SetDisplayId(m_goInfo->displayId);
if (setHealth)
{
- m_goValue->Building.Health = m_goValue->Building.MaxHealth;
+ m_goValue.Building.Health = m_goValue.Building.MaxHealth;
SetGoAnimProgress(255);
}
EnableCollision(true);
@@ -1850,12 +1885,12 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
if (setHealth)
{
- m_goValue->Building.Health = m_goInfo->building.damagedNumHits;
- uint32 maxHealth = m_goValue->Building.MaxHealth;
+ m_goValue.Building.Health = m_goInfo->building.damagedNumHits;
+ uint32 maxHealth = m_goValue.Building.MaxHealth;
// in this case current health is 0 anyway so just prevent crashing here
if (!maxHealth)
maxHealth = 1;
- SetGoAnimProgress(m_goValue->Building.Health * 255 / maxHealth);
+ SetGoAnimProgress(m_goValue.Building.Health * 255 / maxHealth);
}
break;
}
@@ -1883,7 +1918,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
if (setHealth)
{
- m_goValue->Building.Health = 0;
+ m_goValue.Building.Health = 0;
SetGoAnimProgress(0);
}
EnableCollision(false);
@@ -1903,7 +1938,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
// restores to full health
if (setHealth)
{
- m_goValue->Building.Health = m_goValue->Building.MaxHealth;
+ m_goValue.Building.Health = m_goValue.Building.MaxHealth;
SetGoAnimProgress(255);
}
EnableCollision(true);
@@ -1919,17 +1954,12 @@ void GameObject::SetLootState(LootState state, Unit* unit)
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
if (m_model)
{
- // startOpen determines whether we are going to add or remove the LoS on activation
- bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
-
+ bool collision = false;
// Use the current go state
- if (GetGoState() == GO_STATE_ACTIVE)
- startOpen = !startOpen;
+ if ((GetGoState() != GO_STATE_READY && (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)) || state == GO_READY)
+ collision = !collision;
- if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
- EnableCollision(startOpen);
- else if (state == GO_READY)
- EnableCollision(!startOpen);
+ EnableCollision(collision);
}
}
@@ -1943,15 +1973,11 @@ void GameObject::SetGoState(GOState state)
return;
// startOpen determines whether we are going to add or remove the LoS on activation
- bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
-
- if (GetGOData() && GetGOData()->go_state == GO_STATE_READY)
- startOpen = !startOpen;
+ bool collision = false;
+ if (state == GO_STATE_READY)
+ collision = !collision;
- if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE)
- EnableCollision(startOpen);
- else if (state == GO_STATE_READY)
- EnableCollision(!startOpen);
+ EnableCollision(collision);
}
}
@@ -1964,7 +1990,8 @@ void GameObject::SetDisplayId(uint32 displayid)
void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update)
{
WorldObject::SetPhaseMask(newPhaseMask, update);
- EnableCollision(true);
+ if (m_model && m_model->isEnabled())
+ EnableCollision(true);
}
void GameObject::EnableCollision(bool enable)
@@ -1972,8 +1999,8 @@ void GameObject::EnableCollision(bool enable)
if (!m_model)
return;
- /*if (enable && !GetMap()->Contains(*m_model))
- GetMap()->Insert(*m_model);*/
+ /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->InsertGameObjectModel(*m_model);*/
m_model->enable(enable ? GetPhaseMask() : 0);
}
@@ -1983,12 +2010,12 @@ void GameObject::UpdateModel()
if (!IsInWorld())
return;
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
delete m_model;
m_model = GameObjectModel::Create(*this);
if (m_model)
- GetMap()->Insert(*m_model);
+ GetMap()->InsertGameObjectModel(*m_model);
}
Player* GameObject::GetLootRecipient() const
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index a8035043543..32d73579f51 100755..100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -628,10 +628,11 @@ class GameObject : public WorldObject, public GridObject<GameObject>
static GameObject* GetGameObject(WorldObject& object, uint64 guid);
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
GameObjectData const* GetGOData() const { return m_goData; }
- GameObjectValue * GetGOValue() const { return m_goValue; }
+ GameObjectValue const* GetGOValue() const { return &m_goValue; }
bool IsTransport() const;
bool IsDynTransport() const;
+ bool IsDestructibleBuilding() const;
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
@@ -644,7 +645,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId, language, TargetGuid); }
// overwrite WorldObject function for proper name localization
- const char* GetNameForLocaleIdx(LocaleConstant locale_idx) const;
+ std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
@@ -801,6 +802,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
std::string GetAIName() const;
void SetDisplayId(uint32 displayid);
+ uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); }
GameObjectModel * m_model;
protected:
@@ -824,7 +826,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
GameObjectTemplate const* m_goInfo;
GameObjectData const* m_goData;
- GameObjectValue * const m_goValue;
+ GameObjectValue m_goValue;
uint64 m_rotation;
diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp
index c4d4adeb6f2..73b38c1da83 100755..100644
--- a/src/server/game/Entities/Item/Container/Bag.cpp
+++ b/src/server/game/Entities/Item/Container/Bag.cpp
@@ -23,6 +23,7 @@
#include "Bag.h"
#include "Log.h"
#include "UpdateData.h"
+#include "Player.h"
Bag::Bag(): Item()
{
@@ -41,7 +42,7 @@ Bag::~Bag()
{
if (item->IsInWorld())
{
- sLog->outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
+ sLog->outFatal(LOG_FILTER_PLAYER_ITEMS, "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.",
item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(),
GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i);
item->RemoveFromWorld();
diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h
index 5a533d9cf57..5a533d9cf57 100755..100644
--- a/src/server/game/Entities/Item/Container/Bag.h
+++ b/src/server/game/Entities/Item/Container/Bag.h
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 209fdae8ce6..bdaf11ad9b8 100755..100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -26,6 +26,8 @@
#include "SpellInfo.h"
#include "ScriptMgr.h"
#include "ConditionMgr.h"
+#include "Player.h"
+#include "Opcodes.h"
void AddItemsSetItem(Player* player, Item* item)
{
@@ -36,7 +38,7 @@ void AddItemsSetItem(Player* player, Item* item)
if (!set)
{
- sLog->outErrorDb("Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId);
+ sLog->outError(LOG_FILTER_SQL, "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId);
return;
}
@@ -96,7 +98,7 @@ void AddItemsSetItem(Player* player, Item* item)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
break;
}
@@ -117,7 +119,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const* proto)
if (!set)
{
- sLog->outErrorDb("Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId);
+ sLog->outError(LOG_FILTER_SQL, "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId);
return;
}
@@ -424,7 +426,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
need_save = true;
}
- Tokens tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
+ Tokenizer tokens(fields[4].GetString(), ' ', MAX_ITEM_PROTO_SPELLS);
if (tokens.size() == MAX_ITEM_PROTO_SPELLS)
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
SetSpellCharges(i, atoi(tokens[i]));
@@ -597,7 +599,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
// item can have not null only one from field values
if ((itemProto->RandomProperty) && (itemProto->RandomSuffix))
{
- sLog->outErrorDb("Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
+ sLog->outError(LOG_FILTER_SQL, "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
return 0;
}
@@ -608,7 +610,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
if (!random_id)
{
- sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
+ sLog->outError(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
return 0;
}
@@ -621,7 +623,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
if (!random_id)
{
- sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
+ sLog->outError(LOG_FILTER_SQL, "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
return 0;
}
@@ -1019,7 +1021,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
if (count > pProto->GetMaxStackSize())
count = pProto->GetMaxStackSize();
- ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");
+ ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
Item* pItem = NewItemOrBag(pProto);
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
@@ -1043,7 +1045,7 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
newItem->SetUInt32Value(ITEM_FIELD_CREATOR, GetUInt32Value(ITEM_FIELD_CREATOR));
newItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR, GetUInt32Value(ITEM_FIELD_GIFTCREATOR));
- newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS));
+ newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS) & ~(ITEM_FLAG_REFUNDABLE | ITEM_FLAG_BOP_TRADEABLE));
newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION));
// player CAN be NULL in which case we must not update random properties because that accesses player's item update queue
if (player)
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index a5f9ed5c008..a5f9ed5c008 100755..100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index f3d7d7fd56c..cfb8c880479 100755..100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -25,6 +25,7 @@
#include <list>
#include <vector>
#include "Util.h"
+#include "DBCStores.h"
struct EnchStoreItem
{
@@ -70,14 +71,10 @@ void LoadRandomEnchantmentsTable()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
- {
- sLog->outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
- sLog->outString();
- }
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
uint32 GetItemEnchantMod(int32 entry)
@@ -91,7 +88,7 @@ uint32 GetItemEnchantMod(int32 entry)
EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry);
if (tab == RandomItemEnch.end())
{
- sLog->outErrorDb("Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
return 0;
}
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.h b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
index fe4dca40d24..fe4dca40d24 100755..100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.h
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.h
diff --git a/src/server/game/Entities/Item/ItemPrototype.h b/src/server/game/Entities/Item/ItemPrototype.h
index 5088a30157c..f2f41d6a8b9 100755..100644
--- a/src/server/game/Entities/Item/ItemPrototype.h
+++ b/src/server/game/Entities/Item/ItemPrototype.h
@@ -181,7 +181,7 @@ enum ItemFieldFlags
ITEM_FLAG_UNK25 = 0x40000000, // ?
ITEM_FLAG_UNK26 = 0x80000000, // ?
- ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14,
+ ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14
};
enum ItemFlagsExtra
@@ -196,7 +196,7 @@ enum ItemFlagsCustom
{
ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline
ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops
- ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004, // Item will always follow group/master/need before greed looting rules
+ ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004 // Item will always follow group/master/need before greed looting rules
};
enum BAG_FAMILY_MASK
@@ -588,7 +588,7 @@ struct ItemTemplate
uint32 ItemId;
uint32 Class; // id from ItemClass.dbc
uint32 SubClass; // id from ItemSubClass.dbc
- int32 Unk0;
+ int32 SoundOverrideSubclass; // < 0: id from ItemSubClass.dbc, used to override weapon sound from actual SubClass
std::string Name1;
uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc
uint32 Quality;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index fc1b56c4b8c..7818cdc6942 100755..100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -41,12 +41,15 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "SpellAuraEffects.h"
-
+#include "UpdateFieldFlags.h"
#include "TemporarySummon.h"
#include "Totem.h"
#include "OutdoorPvPMgr.h"
#include "MovementPacketBuilder.h"
#include "DynamicTree.h"
+#include "Group.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
uint32 GuidHigh2TypeId(uint32 guid_hi)
{
@@ -74,6 +77,7 @@ Object::Object() : m_PackGUID(sizeof(uint64)+1)
m_uint32Values = NULL;
_changedFields = NULL;
m_valuesCount = 0;
+ _fieldNotifyFlags = UF_FLAG_DYNAMIC;
m_inWorld = false;
m_objectUpdated = false;
@@ -88,7 +92,8 @@ WorldObject::~WorldObject()
{
if (GetTypeId() == TYPEID_CORPSE)
{
- sLog->outCrash("Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!",
+ GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
ASSERT(false);
}
ResetMap();
@@ -99,16 +104,16 @@ Object::~Object()
{
if (IsInWorld())
{
- sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
if (isType(TYPEMASK_ITEM))
- sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Item slot %u", ((Item*)this)->GetSlot());
ASSERT(false);
RemoveFromWorld();
}
if (m_objectUpdated)
{
- sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
ASSERT(false);
sObjectAccessor->RemoveUpdateObject(this);
}
@@ -463,17 +468,13 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
IsActivateToQuest = true;
- updateMask->SetBit(GAMEOBJECT_DYNAMIC);
-
if (((GameObject*)this)->GetGoArtKit())
updateMask->SetBit(GAMEOBJECT_BYTES_1);
}
else if (isType(TYPEMASK_UNIT))
{
if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
- {
updateMask->SetBit(UNIT_FIELD_AURASTATE);
- }
}
}
else // case UPDATETYPE_VALUES
@@ -481,10 +482,8 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport())
{
if (((GameObject*)this)->ActivateToQuest(target) || target->isGameMaster())
- {
IsActivateToQuest = true;
- }
- updateMask->SetBit(GAMEOBJECT_DYNAMIC);
+
updateMask->SetBit(GAMEOBJECT_BYTES_1);
if (ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_CHEST && ToGameObject()->GetGOInfo()->chest.groupLootRules &&
@@ -494,9 +493,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
else if (isType(TYPEMASK_UNIT))
{
if (((Unit*)this)->HasFlag(UNIT_FIELD_AURASTATE, PER_CASTER_AURA_STATE_MASK))
- {
updateMask->SetBit(UNIT_FIELD_AURASTATE);
- }
}
}
@@ -771,12 +768,72 @@ void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) cons
BuildValuesUpdateBlockForPlayer(&iter->second, iter->first);
}
-void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 count)
+void Object::GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const
{
- if (!data)
+ // This function assumes updatefield index is always valid
+ switch (GetTypeId())
+ {
+ case TYPEID_ITEM:
+ case TYPEID_CONTAINER:
+ flags = ItemUpdateFieldFlags;
+ isOwner = isItemOwner = ((Item*)this)->GetOwnerGUID() == target->GetGUID();
+ 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);
+ break;
+ }
+ case TYPEID_GAMEOBJECT:
+ flags = GameObjectUpdateFieldFlags;
+ isOwner = ToGameObject()->GetOwnerGUID() == target->GetGUID();
+ break;
+ case TYPEID_DYNAMICOBJECT:
+ flags = DynamicObjectUpdateFieldFlags;
+ isOwner = ((DynamicObject*)this)->GetCasterGUID() == target->GetGUID();
+ break;
+ case TYPEID_CORPSE:
+ flags = CorpseUpdateFieldFlags;
+ isOwner = ToCorpse()->GetOwnerGUID() == target->GetGUID();
+ 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;
+}
+
+void Object::_LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count)
+{
+ if (data.empty())
return;
- Tokens tokens(data, ' ', count);
+ Tokenizer tokens(data, ' ', count);
if (tokens.size() != count)
return;
@@ -788,26 +845,38 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou
}
}
-void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const
+void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
{
bool* indexes = _changedFields;
+ 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);
for (uint16 index = 0; index < m_valuesCount; ++index, ++indexes)
- {
- if (*indexes)
+ if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*indexes && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember)))
updateMask->SetBit(index);
- }
}
-void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const
+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);
for (uint16 index = 0; index < m_valuesCount; ++index, ++value)
- {
- if (*value)
+ if (_fieldNotifyFlags & flags[index] || (flags[index] & UF_FLAG_SPECIAL_INFO && hasSpecialInfo) || (*value && IsUpdateFieldVisible(flags[index], isSelf, isOwner, isItemOwner, isPartyMember)))
updateMask->SetBit(index);
- }
}
void Object::SetInt32Value(uint16 index, int32 value)
@@ -937,7 +1006,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
if (offset > 4)
{
- sLog->outError("Object::SetByteValue: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::SetByteValue: wrong offset %u", offset);
return;
}
@@ -961,7 +1030,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
if (offset > 2)
{
- sLog->outError("Object::SetUInt16Value: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::SetUInt16Value: wrong offset %u", offset);
return;
}
@@ -1073,7 +1142,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
if (offset > 4)
{
- sLog->outError("Object::SetByteFlag: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::SetByteFlag: wrong offset %u", offset);
return;
}
@@ -1096,7 +1165,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
if (offset > 4)
{
- sLog->outError("Object::RemoveByteFlag: wrong offset %u", offset);
+ sLog->outError(LOG_FILTER_GENERAL, "Object::RemoveByteFlag: wrong offset %u", offset);
return;
}
@@ -1115,7 +1184,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
bool Object::PrintIndexError(uint32 index, bool set) const
{
- sLog->outError("Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType);
+ sLog->outError(LOG_FILTER_GENERAL, "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType);
// ASSERT must fail after function call
return false;
@@ -1170,32 +1239,32 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st
void MovementInfo::OutDebug()
{
- sLog->outString("MOVEMENT INFO");
- sLog->outString("guid " UI64FMTD, guid);
- sLog->outString("flags %u", flags);
- sLog->outString("flags2 %u", flags2);
- sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
- sLog->outString("position: `%s`", pos.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_GENERAL, "MOVEMENT INFO");
+ sLog->outInfo(LOG_FILTER_GENERAL, "guid " UI64FMTD, guid);
+ sLog->outInfo(LOG_FILTER_GENERAL, "flags %u", flags);
+ sLog->outInfo(LOG_FILTER_GENERAL, "flags2 %u", flags2);
+ sLog->outInfo(LOG_FILTER_GENERAL, "time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
+ sLog->outInfo(LOG_FILTER_GENERAL, "position: `%s`", pos.ToString().c_str());
if (flags & MOVEMENTFLAG_ONTRANSPORT)
{
- sLog->outString("TRANSPORT:");
- sLog->outString("guid: " UI64FMTD, t_guid);
- sLog->outString("position: `%s`", t_pos.ToString().c_str());
- sLog->outString("seat: %i", t_seat);
- sLog->outString("time: %u", t_time);
+ sLog->outInfo(LOG_FILTER_GENERAL, "TRANSPORT:");
+ sLog->outInfo(LOG_FILTER_GENERAL, "guid: " UI64FMTD, t_guid);
+ sLog->outInfo(LOG_FILTER_GENERAL, "position: `%s`", t_pos.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_GENERAL, "seat: %i", t_seat);
+ sLog->outInfo(LOG_FILTER_GENERAL, "time: %u", t_time);
if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
- sLog->outString("time2: %u", t_time2);
+ sLog->outInfo(LOG_FILTER_GENERAL, "time2: %u", t_time2);
}
if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING))
- sLog->outString("pitch: %f", pitch);
+ sLog->outInfo(LOG_FILTER_GENERAL, "pitch: %f", pitch);
- sLog->outString("fallTime: %u", fallTime);
+ sLog->outInfo(LOG_FILTER_GENERAL, "fallTime: %u", fallTime);
if (flags & MOVEMENTFLAG_FALLING)
- sLog->outString("j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed);
+ sLog->outInfo(LOG_FILTER_GENERAL, "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed);
if (flags & MOVEMENTFLAG_SPLINE_ELEVATION)
- sLog->outString("splineElevation: %f", splineElevation);
+ sLog->outInfo(LOG_FILTER_GENERAL, "splineElevation: %f", splineElevation);
}
WorldObject::WorldObject(bool isWorldObject): WorldLocation(),
@@ -1443,8 +1512,8 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
void Position::RelocateOffset(const Position & offset)
{
- m_positionX = GetPositionX() + (offset.GetPositionX() * cos(GetOrientation()) + offset.GetPositionY() * sin(GetOrientation() + M_PI));
- m_positionY = GetPositionY() + (offset.GetPositionY() * cos(GetOrientation()) + offset.GetPositionX() * sin(GetOrientation()));
+ m_positionX = GetPositionX() + (offset.GetPositionX() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI));
+ m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
m_orientation = GetOrientation() + offset.GetOrientation();
}
@@ -1454,8 +1523,8 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset
float dx = endPos.GetPositionX() - GetPositionX();
float dy = endPos.GetPositionY() - GetPositionY();
- retOffset.m_positionX = dx * cos(GetOrientation()) + dy * sin(GetOrientation());
- retOffset.m_positionY = dy * cos(GetOrientation()) - dx * sin(GetOrientation());
+ retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
+ retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
retOffset.m_orientation = endPos.GetOrientation() - GetOrientation();
}
@@ -1487,8 +1556,8 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
{
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
- vcos = cos(angle);
- vsin = sin(angle);
+ vcos = std::cos(angle);
+ vsin = std::sin(angle);
}
else
{
@@ -1537,7 +1606,7 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2,
float angle = obj1->GetAngle(obj2);
// not using sqrt() for performance
- return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist);
+ return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + std::cos(angle) * dist, obj1->GetPositionY() + std::sin(angle) * dist);
}
bool WorldObject::isInFront(WorldObject const* target, float arc) const
@@ -1562,8 +1631,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
float new_dist = (float)rand_norm()*static_cast<float>(distance);
- rand_x = pos.m_positionX + new_dist * cos(angle);
- rand_y = pos.m_positionY + new_dist * sin(angle);
+ rand_x = pos.m_positionX + new_dist * std::cos(angle);
+ rand_y = pos.m_positionY + new_dist * std::sin(angle);
rand_z = pos.m_positionZ;
Trinity::NormalizeMapCoord(rand_x);
@@ -1696,10 +1765,10 @@ bool WorldObject::canSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
return true;
- bool corpseCheck = false;
bool corpseVisibility = false;
if (distanceCheck)
{
+ bool corpseCheck = false;
if (Player const* thisPlayer = ToPlayer())
{
if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 && // Cheap way to check for ghost state
@@ -1775,7 +1844,7 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const
if (obj->IsAlwaysDetectableFor(seer))
return true;
- if (!seer->CanDetectInvisibilityOf(obj))
+ if (!ignoreStealth && !seer->CanDetectInvisibilityOf(obj))
return false;
if (!ignoreStealth && !seer->CanDetectStealthOf(obj))
@@ -2056,13 +2125,13 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp
player->GetSession()->SendPacket(&data);
}
-void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 targetGuid) const
+void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const &name, uint64 targetGuid) const
{
*data << (uint8)msgtype;
*data << (uint32)language;
*data << (uint64)GetGUID();
*data << (uint32)0; // 2.1.0
- *data << (uint32)(strlen(name)+1);
+ *data << (uint32)(name.size()+1);
*data << name;
*data << (uint64)targetGuid; // Unit Target
if (targetGuid && !IS_PLAYER_GUID(targetGuid))
@@ -2115,7 +2184,7 @@ void WorldObject::SetMap(Map* map)
return;
if (m_currMap)
{
- sLog->outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
+ sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
ASSERT(false);
}
m_currMap = map;
@@ -2150,7 +2219,7 @@ void WorldObject::AddObjectToRemoveList()
Map* map = FindMap();
if (!map)
{
- sLog->outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId());
+ sLog->outError(LOG_FILTER_GENERAL, "Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId());
return;
}
@@ -2263,7 +2332,17 @@ void WorldObject::SetZoneScript()
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
else if (!map->IsBattlegroundOrArena())
- m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ }
+ }
}
}
@@ -2281,119 +2360,6 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempS
return NULL;
}
-Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration)
-{
- Pet* pet = new Pet(this, petType);
-
- if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
- {
- // Remove Demonic Sacrifice auras (known pet)
- Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
- {
- if ((*itr)->GetMiscValue() == 2228)
- {
- RemoveAurasDueToSpell((*itr)->GetId());
- itr = auraClassScripts.begin();
- }
- else
- ++itr;
- }
-
- if (duration > 0)
- pet->SetDuration(duration);
-
- return NULL;
- }
-
- // petentry == 0 for hunter "call pet" (current pet summoned if any)
- if (!entry)
- {
- delete pet;
- return NULL;
- }
-
- pet->Relocate(x, y, z, ang);
- if (!pet->IsPositionValid())
- {
- sLog->outError("Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
- delete pet;
- return NULL;
- }
-
- Map* map = GetMap();
- uint32 pet_number = sObjectMgr->GeneratePetNumber();
- if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
- {
- sLog->outError("no such creature entry %u", entry);
- delete pet;
- return NULL;
- }
-
- pet->SetCreatorGUID(GetGUID());
- pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
-
- pet->setPowerType(POWER_MANA);
- pet->SetUInt32Value(UNIT_NPC_FLAGS, 0);
- pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
- pet->InitStatsForLevel(getLevel());
-
- SetMinion(pet, true);
-
- switch (petType)
- {
- case SUMMON_PET:
- // this enables pet details window (Shift+P)
- pet->GetCharmInfo()->SetPetNumber(pet_number, true);
- pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
- pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
- pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
- pet->SetFullHealth();
- pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
- pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case
- break;
- default:
- break;
- }
-
- map->AddToMap(pet->ToCreature());
-
- switch (petType)
- {
- case SUMMON_PET:
- pet->InitPetCreateSpells();
- pet->InitTalentForLevel();
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- PetSpellInitialize();
- break;
- default:
- break;
- }
-
- if (petType == SUMMON_PET)
- {
- // Remove Demonic Sacrifice auras (known pet)
- Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
- {
- if ((*itr)->GetMiscValue() == 2228)
- {
- RemoveAurasDueToSpell((*itr)->GetId());
- itr = auraClassScripts.begin();
- }
- else
- ++itr;
- }
- }
-
- if (duration > 0)
- pet->SetDuration(duration);
-
- //ObjectAccessor::UpdateObjectVisibility(pet);
-
- return pet;
-}
-
GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
{
if (!IsInWorld())
@@ -2402,7 +2368,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
- sLog->outErrorDb("Gameobject template %u not found in database!", entry);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject template %u not found in database!", entry);
return NULL;
}
Map* map = GetMap();
@@ -2459,6 +2425,15 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
return go;
}
+GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const
+{
+ GameObject* go = NULL;
+ Trinity::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range);
+ Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker);
+ VisitNearbyGridObject(range, searcher);
+ return go;
+}
+
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const
{
CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
@@ -2562,8 +2537,8 @@ namespace Trinity
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const
{
- x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle);
- y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle);
+ x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle);
+ y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle);
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
@@ -2698,13 +2673,13 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
{
angle += m_orientation;
float destx, desty, destz, ground, floor;
- destx = pos.m_positionX + dist * cos(angle);
- desty = pos.m_positionY + dist * sin(angle);
+ destx = pos.m_positionX + dist * std::cos(angle);
+ desty = pos.m_positionY + dist * std::sin(angle);
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
{
- sLog->outCrash("WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty);
+ sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty);
return;
}
@@ -2719,8 +2694,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
{
- destx -= step * cos(angle);
- desty -= step * sin(angle);
+ destx -= step * std::cos(angle);
+ desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
@@ -2744,13 +2719,13 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
angle += m_orientation;
float destx, desty, destz, ground, floor;
pos.m_positionZ += 2.0f;
- destx = pos.m_positionX + dist * cos(angle);
- desty = pos.m_positionY + dist * sin(angle);
+ destx = pos.m_positionX + dist * std::cos(angle);
+ desty = pos.m_positionY + dist * std::sin(angle);
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
{
- sLog->outCrash("WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty);
+ sLog->outFatal(LOG_FILTER_GENERAL, "WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty);
return;
}
@@ -2764,8 +2739,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
if (col)
{
// move back a bit
- destx -= CONTACT_DISTANCE * cos(angle);
- desty -= CONTACT_DISTANCE * sin(angle);
+ destx -= CONTACT_DISTANCE * std::cos(angle);
+ desty -= CONTACT_DISTANCE * std::sin(angle);
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
@@ -2775,8 +2750,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// Collided with a gameobject
if (col)
{
- destx -= CONTACT_DISTANCE * cos(angle);
- desty -= CONTACT_DISTANCE * sin(angle);
+ destx -= CONTACT_DISTANCE * std::cos(angle);
+ desty -= CONTACT_DISTANCE * std::sin(angle);
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
@@ -2787,8 +2762,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
{
- destx -= step * cos(angle);
- desty -= step * sin(angle);
+ destx -= step * std::cos(angle);
+ desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 7a91289a95d..0bb4214de32 100755..100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -51,7 +51,7 @@ enum TypeMask
TYPEMASK_OBJECT = 0x0001,
TYPEMASK_ITEM = 0x0002,
TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004
- TYPEMASK_UNIT = 0x0008, // creature
+ TYPEMASK_UNIT = 0x0008, // creature
TYPEMASK_PLAYER = 0x0010,
TYPEMASK_GAMEOBJECT = 0x0020,
TYPEMASK_DYNAMICOBJECT = 0x0040,
@@ -300,6 +300,9 @@ class Object
virtual void BuildUpdate(UpdateDataMapType&) {}
void BuildFieldsUpdate(Player*, UpdateDataMapType &) const;
+ void SetFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags |= flag; }
+ void RemoveFieldNotifyFlag(uint16 flag) { _fieldNotifyFlags &= ~flag; }
+
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
@@ -320,13 +323,16 @@ class Object
Object();
void _InitValues();
- void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
+ void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
- void _LoadIntoDataField(const char* data, uint32 startOffset, uint32 count);
+ 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;
- virtual void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
+ bool IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool isItemOwner, bool isPartyMember) const;
- virtual void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
+ void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
+ void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
void _BuildMovementUpdate(ByteBuffer * data, uint16 flags) const;
void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask* updateMask, Player* target) const;
@@ -346,6 +352,8 @@ class Object
uint16 m_valuesCount;
+ uint16 _fieldNotifyFlags;
+
bool m_objectUpdated;
private:
@@ -646,10 +654,10 @@ class WorldObject : public Object, public WorldLocation
InstanceScript* GetInstanceScript();
- const char* GetName() const { return m_name.c_str(); }
- void SetName(const std::string& newname) { m_name=newname; }
+ std::string const& GetName() const { return m_name; }
+ void SetName(std::string const& newname) { m_name=newname; }
- virtual const char* GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return GetName(); }
+ virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
float GetDistance(const WorldObject* obj) const
{
@@ -735,7 +743,7 @@ class WorldObject : public Object, public WorldLocation
void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false);
void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false);
void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid);
- void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const;
+ void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const& name, uint64 TargetGuid) const;
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
@@ -791,6 +799,7 @@ class WorldObject : public Object, public WorldLocation
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
GameObject* FindNearestGameObject(uint32 entry, float range) const;
+ GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index c227d081d8b..03fa44da08a 100755..100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -44,7 +44,7 @@ enum HighGuid
HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100
HIGHGUID_CORPSE = 0xF101, // blizz F100
HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)
- HIGHGUID_GROUP = 0x1F50,
+ HIGHGUID_GROUP = 0x1F50
};
#define IS_EMPTY_GUID(Guid) (Guid == 0)
@@ -122,4 +122,3 @@ inline char const* GetLogNameForGuid(uint64 guid)
}
}
#endif
-
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.cpp b/src/server/game/Entities/Object/ObjectPosSelector.cpp
index f5c36f5a3c9..f5c36f5a3c9 100755..100644
--- a/src/server/game/Entities/Object/ObjectPosSelector.cpp
+++ b/src/server/game/Entities/Object/ObjectPosSelector.cpp
diff --git a/src/server/game/Entities/Object/ObjectPosSelector.h b/src/server/game/Entities/Object/ObjectPosSelector.h
index b30694672df..b30694672df 100755..100644
--- a/src/server/game/Entities/Object/ObjectPosSelector.h
+++ b/src/server/game/Entities/Object/ObjectPosSelector.h
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp
index 8f480ab3235..45464f19083 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.cpp
+++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp
@@ -57,7 +57,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
int z_res = deflateInit(&c_stream, sWorld->getIntConfig(CONFIG_COMPRESSION));
if (z_res != Z_OK)
{
- sLog->outError("Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
@@ -70,14 +70,14 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
z_res = deflate(&c_stream, Z_NO_FLUSH);
if (z_res != Z_OK)
{
- sLog->outError("Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
if (c_stream.avail_in != 0)
{
- sLog->outError("Can't compress update packet (zlib: deflate not greedy)");
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate not greedy)");
*dst_size = 0;
return;
}
@@ -85,7 +85,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
z_res = deflate(&c_stream, Z_FINISH);
if (z_res != Z_STREAM_END)
{
- sLog->outError("Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
@@ -93,7 +93,7 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size)
z_res = deflateEnd(&c_stream);
if (z_res != Z_OK)
{
- sLog->outError("Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res));
+ sLog->outError(LOG_FILTER_GENERAL, "Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res));
*dst_size = 0;
return;
}
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.h b/src/server/game/Entities/Object/Updates/UpdateData.h
index ff649b7cb2f..ff649b7cb2f 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.h
+++ b/src/server/game/Entities/Object/Updates/UpdateData.h
diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp
new file mode 100644
index 00000000000..95bdaef221b
--- /dev/null
+++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.cpp
@@ -0,0 +1,1568 @@
+/*
+ * Copyright (C) 2008-2012 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 "UpdateFieldFlags.h"
+
+uint32 ItemUpdateFieldFlags[CONTAINER_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER
+ UF_FLAG_PUBLIC, // ITEM_FIELD_OWNER+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CONTAINED
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CONTAINED+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CREATOR+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_GIFTCREATOR
+ UF_FLAG_PUBLIC, // ITEM_FIELD_GIFTCREATOR+1
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_STACK_COUNT
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_DURATION
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+1
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+2
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+3
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_SPELL_CHARGES+4
+ UF_FLAG_PUBLIC, // ITEM_FIELD_FLAGS
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_1_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_2_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_3_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_4_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_5_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_6_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_7_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_8_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_9_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_10_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_11_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_1+1
+ UF_FLAG_PUBLIC, // ITEM_FIELD_ENCHANTMENT_12_3
+ UF_FLAG_PUBLIC, // ITEM_FIELD_PROPERTY_SEED
+ UF_FLAG_PUBLIC, // ITEM_FIELD_RANDOM_PROPERTIES_ID
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_DURABILITY
+ UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER, // ITEM_FIELD_MAXDURABILITY
+ UF_FLAG_PUBLIC, // ITEM_FIELD_CREATE_PLAYED_TIME
+ UF_FLAG_NONE, // ITEM_FIELD_PAD
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_NUM_SLOTS
+ UF_FLAG_NONE, // CONTAINER_ALIGN_PAD
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+1
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+2
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+3
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+4
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+5
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+6
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+7
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+8
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+9
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+10
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+11
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+12
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+13
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+14
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+15
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+16
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+17
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+18
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+19
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+20
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+21
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+22
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+23
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+24
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+25
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+26
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+27
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+28
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+29
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+30
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+31
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+32
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+33
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+34
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+35
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+36
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+37
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+38
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+39
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+40
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+41
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+42
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+43
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+44
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+45
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+46
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+47
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+48
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+49
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+50
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+51
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+52
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+53
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+54
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+55
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+56
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+57
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+58
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+59
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+60
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+61
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+62
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+63
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+64
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+65
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+66
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+67
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+68
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+69
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+70
+ UF_FLAG_PUBLIC, // CONTAINER_FIELD_SLOT_1+71
+};
+
+uint32 UnitUpdateFieldFlags[PLAYER_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARM+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMON+1
+ UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER
+ UF_FLAG_PRIVATE, // UNIT_FIELD_CRITTER+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARMEDBY
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHARMEDBY+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMONEDBY
+ UF_FLAG_PUBLIC, // UNIT_FIELD_SUMMONEDBY+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CREATEDBY
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CREATEDBY+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET
+ UF_FLAG_PUBLIC, // UNIT_FIELD_TARGET+1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHANNEL_OBJECT
+ UF_FLAG_PUBLIC, // UNIT_FIELD_CHANNEL_OBJECT+1
+ UF_FLAG_PUBLIC, // UNIT_CHANNEL_SPELL
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_0
+ UF_FLAG_PUBLIC, // UNIT_FIELD_HEALTH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER3
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER4
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER5
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_POWER7
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXHEALTH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER3
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER4
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER5
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MAXPOWER7
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER+6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_LEVEL
+ UF_FLAG_PUBLIC, // UNIT_FIELD_FACTIONTEMPLATE
+ UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID
+ UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID+1
+ UF_FLAG_PUBLIC, // UNIT_VIRTUAL_ITEM_SLOT_ID+2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS
+ UF_FLAG_PUBLIC, // UNIT_FIELD_FLAGS_2
+ UF_FLAG_PUBLIC, // UNIT_FIELD_AURASTATE
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BASEATTACKTIME
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BASEATTACKTIME+1
+ UF_FLAG_PRIVATE, // UNIT_FIELD_RANGEDATTACKTIME
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BOUNDINGRADIUS
+ UF_FLAG_PUBLIC, // UNIT_FIELD_COMBATREACH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_DISPLAYID
+ UF_FLAG_PUBLIC, // UNIT_FIELD_NATIVEDISPLAYID
+ UF_FLAG_PUBLIC, // UNIT_FIELD_MOUNTDISPLAYID
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MINDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MAXDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MINOFFHANDDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_MAXOFFHANDDAMAGE
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_1
+ UF_FLAG_PUBLIC, // UNIT_FIELD_PETNUMBER
+ UF_FLAG_PUBLIC, // UNIT_FIELD_PET_NAME_TIMESTAMP
+ UF_FLAG_OWNER, // UNIT_FIELD_PETEXPERIENCE
+ UF_FLAG_OWNER, // UNIT_FIELD_PETNEXTLEVELEXP
+ UF_FLAG_DYNAMIC, // UNIT_DYNAMIC_FLAGS
+ UF_FLAG_PUBLIC, // UNIT_MOD_CAST_SPEED
+ UF_FLAG_PUBLIC, // UNIT_CREATED_BY_SPELL
+ UF_FLAG_DYNAMIC, // UNIT_NPC_FLAGS
+ UF_FLAG_PUBLIC, // UNIT_NPC_EMOTESTATE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT0
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_STAT4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT0
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POSSTAT4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT0
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_NEGSTAT4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER | UF_FLAG_SPECIAL_INFO, // UNIT_FIELD_RESISTANCES+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+6
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BASE_MANA
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_BASE_HEALTH
+ UF_FLAG_PUBLIC, // UNIT_FIELD_BYTES_2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER_MODS
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_ATTACK_POWER_MULTIPLIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER_MODS
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MINRANGEDDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MAXRANGEDDAMAGE
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MODIFIER+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+1
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+2
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+3
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+4
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+5
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_POWER_COST_MULTIPLIER+6
+ UF_FLAG_PRIVATE | UF_FLAG_OWNER, // UNIT_FIELD_MAXHEALTHMODIFIER
+ UF_FLAG_PUBLIC, // UNIT_FIELD_HOVERHEIGHT
+ UF_FLAG_NONE, // UNIT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // PLAYER_DUEL_ARBITER
+ UF_FLAG_PUBLIC, // PLAYER_DUEL_ARBITER+1
+ UF_FLAG_PUBLIC, // PLAYER_FLAGS
+ UF_FLAG_PUBLIC, // PLAYER_GUILDID
+ UF_FLAG_PUBLIC, // PLAYER_GUILDRANK
+ UF_FLAG_PUBLIC, // PLAYER_BYTES
+ UF_FLAG_PUBLIC, // PLAYER_BYTES_2
+ UF_FLAG_PUBLIC, // PLAYER_BYTES_3
+ UF_FLAG_PUBLIC, // PLAYER_DUEL_TEAM
+ UF_FLAG_PUBLIC, // PLAYER_GUILD_TIMESTAMP
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_1_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_1_4
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_2_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_2_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_3_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_3_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_4_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_4_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_5_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_5_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_6_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_6_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_7_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_7_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_8_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_8_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_9_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_9_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_10_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_10_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_11_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_11_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_12_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_12_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_13_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_13_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_14_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_14_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_15_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_15_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_16_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_16_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_17_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_17_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_18_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_18_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_19_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_19_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_20_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_20_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_21_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_21_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_22_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_22_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_23_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_23_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_24_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_24_5
+ UF_FLAG_PARTY_MEMBER, // PLAYER_QUEST_LOG_25_1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_2
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_3
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_3+1
+ UF_FLAG_PRIVATE, // PLAYER_QUEST_LOG_25_5
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_1_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_1_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_2_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_2_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_3_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_3_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_4_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_4_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_5_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_5_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_6_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_6_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_7_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_7_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_8_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_8_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_9_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_9_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_10_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_10_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_11_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_11_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_12_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_12_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_13_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_13_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_14_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_14_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_15_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_15_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_16_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_16_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_17_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_17_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_18_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_18_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_19_ENTRYID
+ UF_FLAG_PUBLIC, // PLAYER_VISIBLE_ITEM_19_ENCHANTMENT
+ UF_FLAG_PUBLIC, // PLAYER_CHOSEN_TITLE
+ UF_FLAG_PUBLIC, // PLAYER_FAKE_INEBRIATION
+ UF_FLAG_NONE, // PLAYER_FIELD_PAD_0
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_INV_SLOT_HEAD+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PACK_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+46
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+47
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+48
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+49
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+50
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+51
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+52
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+53
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+54
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANK_SLOT_1+55
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BANKBAG_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_VENDORBUYBACK_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+46
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+47
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+48
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+49
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+50
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+51
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+52
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+53
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+54
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+55
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+56
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+57
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+58
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+59
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+60
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+61
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+62
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KEYRING_SLOT_1+63
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+25
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+26
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+27
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+28
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+29
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+30
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+31
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+32
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+33
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+34
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+35
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+36
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+37
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+38
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+39
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+40
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+41
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+42
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+43
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+44
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+45
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+46
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+47
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+48
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+49
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+50
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+51
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+52
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+53
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+54
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+55
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+56
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+57
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+58
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+59
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+60
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+61
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+62
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_CURRENCYTOKEN_SLOT_1+63
+ UF_FLAG_PRIVATE, // PLAYER_FARSIGHT
+ UF_FLAG_PRIVATE, // PLAYER_FARSIGHT+1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES+1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES1+1
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES2
+ UF_FLAG_PRIVATE, // PLAYER__FIELD_KNOWN_TITLES2+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KNOWN_CURRENCIES
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KNOWN_CURRENCIES+1
+ UF_FLAG_PRIVATE, // PLAYER_XP
+ UF_FLAG_PRIVATE, // PLAYER_NEXT_LEVEL_XP
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+1
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+2
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+3
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+4
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+5
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+6
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+7
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+8
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+9
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+10
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+11
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+12
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+13
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+14
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+15
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+16
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+17
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+18
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+19
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+20
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+21
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+22
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+23
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+24
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+25
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+26
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+27
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+28
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+29
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+30
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+31
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+32
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+33
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+34
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+35
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+36
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+37
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+38
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+39
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+40
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+41
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+42
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+43
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+44
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+45
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+46
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+47
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+48
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+49
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+50
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+51
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+52
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+53
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+54
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+55
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+56
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+57
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+58
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+59
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+60
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+61
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+62
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+63
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+64
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+65
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+66
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+67
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+68
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+69
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+70
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+71
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+72
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+73
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+74
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+75
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+76
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+77
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+78
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+79
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+80
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+81
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+82
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+83
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+84
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+85
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+86
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+87
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+88
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+89
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+90
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+91
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+92
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+93
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+94
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+95
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+96
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+97
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+98
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+99
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+100
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+101
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+102
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+103
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+104
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+105
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+106
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+107
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+108
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+109
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+110
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+111
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+112
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+113
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+114
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+115
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+116
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+117
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+118
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+119
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+120
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+121
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+122
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+123
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+124
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+125
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+126
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+127
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+128
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+129
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+130
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+131
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+132
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+133
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+134
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+135
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+136
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+137
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+138
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+139
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+140
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+141
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+142
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+143
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+144
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+145
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+146
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+147
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+148
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+149
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+150
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+151
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+152
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+153
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+154
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+155
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+156
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+157
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+158
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+159
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+160
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+161
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+162
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+163
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+164
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+165
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+166
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+167
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+168
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+169
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+170
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+171
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+172
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+173
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+174
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+175
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+176
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+177
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+178
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+179
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+180
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+181
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+182
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+183
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+184
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+185
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+186
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+187
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+188
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+189
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+190
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+191
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+192
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+193
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+194
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+195
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+196
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+197
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+198
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+199
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+200
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+201
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+202
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+203
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+204
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+205
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+206
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+207
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+208
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+209
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+210
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+211
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+212
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+213
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+214
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+215
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+216
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+217
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+218
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+219
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+220
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+221
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+222
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+223
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+224
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+225
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+226
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+227
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+228
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+229
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+230
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+231
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+232
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+233
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+234
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+235
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+236
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+237
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+238
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+239
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+240
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+241
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+242
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+243
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+244
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+245
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+246
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+247
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+248
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+249
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+250
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+251
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+252
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+253
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+254
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+255
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+256
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+257
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+258
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+259
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+260
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+261
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+262
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+263
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+264
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+265
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+266
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+267
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+268
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+269
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+270
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+271
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+272
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+273
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+274
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+275
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+276
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+277
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+278
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+279
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+280
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+281
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+282
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+283
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+284
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+285
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+286
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+287
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+288
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+289
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+290
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+291
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+292
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+293
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+294
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+295
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+296
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+297
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+298
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+299
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+300
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+301
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+302
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+303
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+304
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+305
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+306
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+307
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+308
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+309
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+310
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+311
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+312
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+313
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+314
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+315
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+316
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+317
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+318
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+319
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+320
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+321
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+322
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+323
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+324
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+325
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+326
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+327
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+328
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+329
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+330
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+331
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+332
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+333
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+334
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+335
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+336
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+337
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+338
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+339
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+340
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+341
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+342
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+343
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+344
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+345
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+346
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+347
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+348
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+349
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+350
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+351
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+352
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+353
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+354
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+355
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+356
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+357
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+358
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+359
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+360
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+361
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+362
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+363
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+364
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+365
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+366
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+367
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+368
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+369
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+370
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+371
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+372
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+373
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+374
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+375
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+376
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+377
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+378
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+379
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+380
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+381
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+382
+ UF_FLAG_PRIVATE, // PLAYER_SKILL_INFO_1_1+383
+ UF_FLAG_PRIVATE, // PLAYER_CHARACTER_POINTS1
+ UF_FLAG_PRIVATE, // PLAYER_CHARACTER_POINTS2
+ UF_FLAG_PRIVATE, // PLAYER_TRACK_CREATURES
+ UF_FLAG_PRIVATE, // PLAYER_TRACK_RESOURCES
+ UF_FLAG_PRIVATE, // PLAYER_BLOCK_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_DODGE_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_PARRY_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_EXPERTISE
+ UF_FLAG_PRIVATE, // PLAYER_OFFHAND_EXPERTISE
+ UF_FLAG_PRIVATE, // PLAYER_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_RANGED_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_OFFHAND_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+1
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+2
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+3
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+4
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+5
+ UF_FLAG_PRIVATE, // PLAYER_SPELL_CRIT_PERCENTAGE1+6
+ UF_FLAG_PRIVATE, // PLAYER_SHIELD_BLOCK
+ UF_FLAG_PRIVATE, // PLAYER_SHIELD_BLOCK_CRIT_PERCENTAGE
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+1
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+2
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+3
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+4
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+5
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+6
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+7
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+8
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+9
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+10
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+11
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+12
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+13
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+14
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+15
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+16
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+17
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+18
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+19
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+20
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+21
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+22
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+23
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+24
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+25
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+26
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+27
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+28
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+29
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+30
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+31
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+32
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+33
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+34
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+35
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+36
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+37
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+38
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+39
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+40
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+41
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+42
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+43
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+44
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+45
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+46
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+47
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+48
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+49
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+50
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+51
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+52
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+53
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+54
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+55
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+56
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+57
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+58
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+59
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+60
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+61
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+62
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+63
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+64
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+65
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+66
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+67
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+68
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+69
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+70
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+71
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+72
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+73
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+74
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+75
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+76
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+77
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+78
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+79
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+80
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+81
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+82
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+83
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+84
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+85
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+86
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+87
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+88
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+89
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+90
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+91
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+92
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+93
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+94
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+95
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+96
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+97
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+98
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+99
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+100
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+101
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+102
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+103
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+104
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+105
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+106
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+107
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+108
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+109
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+110
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+111
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+112
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+113
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+114
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+115
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+116
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+117
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+118
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+119
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+120
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+121
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+122
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+123
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+124
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+125
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+126
+ UF_FLAG_PRIVATE, // PLAYER_EXPLORED_ZONES_1+127
+ UF_FLAG_PRIVATE, // PLAYER_REST_STATE_EXPERIENCE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COINAGE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_POS+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_DONE_POS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_PCT
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_HEALING_DONE_PCT
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_TARGET_RESISTANCE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BYTES
+ UF_FLAG_PRIVATE, // PLAYER_AMMO_ID
+ UF_FLAG_PRIVATE, // PLAYER_SELF_RES_SPELL
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_PVP_MEDALS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_PRICE_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BUYBACK_TIMESTAMP_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_KILLS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_TODAY_CONTRIBUTION
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_YESTERDAY_CONTRIBUTION
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_LIFETIME_HONORBALE_KILLS
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_BYTES2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_WATCHED_FACTION_INDEX
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_COMBAT_RATING_1+24
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_TEAM_INFO_1_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_HONOR_CURRENCY
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_ARENA_CURRENCY
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_MAX_LEVEL
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+6
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+7
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+8
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+9
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+10
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+11
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+12
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+13
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+14
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+15
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+16
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+17
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+18
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+19
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+20
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+21
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+22
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+23
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_DAILY_QUESTS_1+24
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+1
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+2
+ UF_FLAG_PRIVATE, // PLAYER_RUNE_REGEN_1+3
+ UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1
+ UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1+1
+ UF_FLAG_PRIVATE, // PLAYER_NO_REAGENT_COST_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPH_SLOTS_1+5
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+1
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+2
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+3
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+4
+ UF_FLAG_PRIVATE, // PLAYER_FIELD_GLYPHS_1+5
+ UF_FLAG_PRIVATE, // PLAYER_GLYPHS_ENABLED
+ UF_FLAG_PRIVATE, // PLAYER_PET_SPELL_POWER
+};
+
+uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_CREATED_BY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_CREATED_BY+1
+ UF_FLAG_PUBLIC, // GAMEOBJECT_DISPLAYID
+ UF_FLAG_PUBLIC, // GAMEOBJECT_FLAGS
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+1
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+2
+ UF_FLAG_PUBLIC, // GAMEOBJECT_PARENTROTATION+3
+ UF_FLAG_DYNAMIC, // GAMEOBJECT_DYNAMIC
+ UF_FLAG_PUBLIC, // GAMEOBJECT_FACTION
+ UF_FLAG_PUBLIC, // GAMEOBJECT_LEVEL
+ UF_FLAG_PUBLIC, // GAMEOBJECT_BYTES_1
+};
+
+uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTER
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTER+1
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_BYTES
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_SPELLID
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_RADIUS
+ UF_FLAG_PUBLIC, // DYNAMICOBJECT_CASTTIME
+};
+
+uint32 CorpseUpdateFieldFlags[CORPSE_END] =
+{
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_GUID+1
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_TYPE
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_ENTRY
+ UF_FLAG_PUBLIC, // OBJECT_FIELD_SCALE_X
+ UF_FLAG_NONE, // OBJECT_FIELD_PADDING
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_OWNER+1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_PARTY
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_PARTY+1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_DISPLAY_ID
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+2
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+3
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+4
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+5
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+6
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+7
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+8
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+9
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+10
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+11
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+12
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+13
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+14
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+15
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+16
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+17
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_ITEM+18
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_BYTES_1
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_BYTES_2
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_GUILD
+ UF_FLAG_PUBLIC, // CORPSE_FIELD_FLAGS
+ UF_FLAG_DYNAMIC, // CORPSE_FIELD_DYNAMIC_FLAGS
+ UF_FLAG_NONE, // CORPSE_FIELD_PAD
+};
diff --git a/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
new file mode 100644
index 00000000000..2cd303d5fc5
--- /dev/null
+++ b/src/server/game/Entities/Object/Updates/UpdateFieldFlags.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef _UPDATEFIELDFLAGS_H
+#define _UPDATEFIELDFLAGS_H
+
+#include "UpdateFields.h"
+#include "Define.h"
+
+enum UpdatefieldFlags
+{
+ UF_FLAG_NONE = 0x000,
+ UF_FLAG_PUBLIC = 0x001,
+ UF_FLAG_PRIVATE = 0x002,
+ UF_FLAG_OWNER = 0x004,
+ UF_FLAG_UNUSED1 = 0x008,
+ UF_FLAG_ITEM_OWNER = 0x010,
+ UF_FLAG_SPECIAL_INFO = 0x020,
+ UF_FLAG_PARTY_MEMBER = 0x040,
+ UF_FLAG_UNUSED2 = 0x080,
+ UF_FLAG_DYNAMIC = 0x100
+};
+
+extern uint32 ItemUpdateFieldFlags[CONTAINER_END];
+extern uint32 UnitUpdateFieldFlags[PLAYER_END];
+extern uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END];
+extern uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END];
+extern uint32 CorpseUpdateFieldFlags[CORPSE_END];
+
+#endif // _UPDATEFIELDFLAGS_H
diff --git a/src/server/game/Entities/Object/Updates/UpdateFields.h b/src/server/game/Entities/Object/Updates/UpdateFields.h
index 825bda98ae6..7e4aa9aaab8 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateFields.h
+++ b/src/server/game/Entities/Object/Updates/UpdateFields.h
@@ -28,7 +28,7 @@ enum EObjectFields
OBJECT_FIELD_ENTRY = 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
OBJECT_FIELD_SCALE_X = 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
OBJECT_FIELD_PADDING = 0x0005, // Size: 1, Type: INT, Flags: NONE
- OBJECT_END = 0x0006,
+ OBJECT_END = 0x0006
};
enum EItemFields
@@ -71,7 +71,7 @@ enum EItemFields
ITEM_FIELD_MAXDURABILITY = OBJECT_END + 0x0037, // Size: 1, Type: INT, Flags: OWNER, ITEM_OWNER
ITEM_FIELD_CREATE_PLAYED_TIME = OBJECT_END + 0x0038, // Size: 1, Type: INT, Flags: PUBLIC
ITEM_FIELD_PAD = OBJECT_END + 0x0039, // Size: 1, Type: INT, Flags: NONE
- ITEM_END = OBJECT_END + 0x003A,
+ ITEM_END = OBJECT_END + 0x003A
};
enum EContainerFields
@@ -79,7 +79,7 @@ enum EContainerFields
CONTAINER_FIELD_NUM_SLOTS = ITEM_END + 0x0000, // Size: 1, Type: INT, Flags: PUBLIC
CONTAINER_ALIGN_PAD = ITEM_END + 0x0001, // Size: 1, Type: BYTES, Flags: NONE
CONTAINER_FIELD_SLOT_1 = ITEM_END + 0x0002, // Size: 72, Type: LONG, Flags: PUBLIC
- CONTAINER_END = ITEM_END + 0x004A,
+ CONTAINER_END = ITEM_END + 0x004A
};
enum EUnitFields
@@ -333,9 +333,9 @@ enum EUnitFields
PLAYER_FIELD_KEYRING_SLOT_1 = UNIT_END + 0x015C, // Size: 64, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_CURRENCYTOKEN_SLOT_1 = UNIT_END + 0x019C, // Size: 64, Type: LONG, Flags: PRIVATE
PLAYER_FARSIGHT = UNIT_END + 0x01DC, // Size: 2, Type: LONG, Flags: PRIVATE
- PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x01DE, // Size: 2, Type: LONG, Flags: PRIVATE
- PLAYER__FIELD_KNOWN_TITLES1 = UNIT_END + 0x01E0, // Size: 2, Type: LONG, Flags: PRIVATE
- PLAYER__FIELD_KNOWN_TITLES2 = UNIT_END + 0x01E2, // Size: 2, Type: LONG, Flags: PRIVATE
+ PLAYER__FIELD_KNOWN_TITLES = UNIT_END + 0x01DE, // Size: 2, Type: LONG, Flags: PRIVATE
+ PLAYER__FIELD_KNOWN_TITLES1 = UNIT_END + 0x01E0, // Size: 2, Type: LONG, Flags: PRIVATE
+ PLAYER__FIELD_KNOWN_TITLES2 = UNIT_END + 0x01E2, // Size: 2, Type: LONG, Flags: PRIVATE
PLAYER_FIELD_KNOWN_CURRENCIES = UNIT_END + 0x01E4, // Size: 2, Type: LONG, Flags: PRIVATE
PLAYER_XP = UNIT_END + 0x01E6, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_NEXT_LEVEL_XP = UNIT_END + 0x01E7, // Size: 1, Type: INT, Flags: PRIVATE
@@ -390,7 +390,7 @@ enum EUnitFields
PLAYER_FIELD_GLYPHS_1 = UNIT_END + 0x0492, // Size: 6, Type: INT, Flags: PRIVATE
PLAYER_GLYPHS_ENABLED = UNIT_END + 0x0498, // Size: 1, Type: INT, Flags: PRIVATE
PLAYER_PET_SPELL_POWER = UNIT_END + 0x0499, // Size: 1, Type: INT, Flags: PRIVATE
- PLAYER_END = UNIT_END + 0x049A,
+ PLAYER_END = UNIT_END + 0x049A
};
enum EGameObjectFields
@@ -403,7 +403,7 @@ enum EGameObjectFields
GAMEOBJECT_FACTION = OBJECT_END + 0x0009, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_LEVEL = OBJECT_END + 0x000A, // Size: 1, Type: INT, Flags: PUBLIC
GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B, // Size: 1, Type: BYTES, Flags: PUBLIC
- GAMEOBJECT_END = OBJECT_END + 0x000C,
+ GAMEOBJECT_END = OBJECT_END + 0x000C
};
enum EDynamicObjectFields
@@ -413,7 +413,7 @@ enum EDynamicObjectFields
DYNAMICOBJECT_SPELLID = OBJECT_END + 0x0003, // Size: 1, Type: INT, Flags: PUBLIC
DYNAMICOBJECT_RADIUS = OBJECT_END + 0x0004, // Size: 1, Type: FLOAT, Flags: PUBLIC
DYNAMICOBJECT_CASTTIME = OBJECT_END + 0x0005, // Size: 1, Type: INT, Flags: PUBLIC
- DYNAMICOBJECT_END = OBJECT_END + 0x0006,
+ DYNAMICOBJECT_END = OBJECT_END + 0x0006
};
enum ECorpseFields
@@ -428,6 +428,6 @@ enum ECorpseFields
CORPSE_FIELD_FLAGS = OBJECT_END + 0x001B, // Size: 1, Type: INT, Flags: PUBLIC
CORPSE_FIELD_DYNAMIC_FLAGS = OBJECT_END + 0x001C, // Size: 1, Type: INT, Flags: DYNAMIC
CORPSE_FIELD_PAD = OBJECT_END + 0x001D, // Size: 1, Type: INT, Flags: NONE
- CORPSE_END = OBJECT_END + 0x001E,
+ CORPSE_END = OBJECT_END + 0x001E
};
#endif
diff --git a/src/server/game/Entities/Object/Updates/UpdateMask.h b/src/server/game/Entities/Object/Updates/UpdateMask.h
index d4ecd42819c..ad70936b81d 100755..100644
--- a/src/server/game/Entities/Object/Updates/UpdateMask.h
+++ b/src/server/game/Entities/Object/Updates/UpdateMask.h
@@ -26,26 +26,26 @@ class UpdateMask
{
public:
UpdateMask() : mCount(0), mBlocks(0), mUpdateMask(0) { }
- UpdateMask(const UpdateMask& mask) : mUpdateMask(0) { *this = mask; }
+ UpdateMask(UpdateMask const& mask) : mUpdateMask(0) { *this = mask; }
~UpdateMask()
{
- delete [] mUpdateMask;
+ delete[] mUpdateMask;
}
- void SetBit (uint32 index)
+ void SetBit(uint32 index)
{
- ((uint8 *)mUpdateMask)[ index >> 3 ] |= 1 << (index & 0x7);
+ ((uint8*)mUpdateMask)[index >> 3] |= 1 << (index & 0x7);
}
- void UnsetBit (uint32 index)
+ void UnsetBit(uint32 index)
{
- ((uint8 *)mUpdateMask)[ index >> 3 ] &= (0xff ^ (1 << (index & 0x7)));
+ ((uint8*)mUpdateMask)[index >> 3] &= (0xff ^ (1 << (index & 0x7)));
}
- bool GetBit (uint32 index) const
+ bool GetBit(uint32 index) const
{
- return (((uint8 *)mUpdateMask)[ index >> 3 ] & (1 << (index & 0x7))) != 0;
+ return (((uint8*)mUpdateMask)[index >> 3] & (1 << (index & 0x7))) != 0;
}
uint32 GetBlockCount() const { return mBlocks; }
@@ -70,7 +70,7 @@ class UpdateMask
memset(mUpdateMask, 0, mBlocks << 2);
}
- UpdateMask& operator = (const UpdateMask& mask)
+ UpdateMask& operator=(UpdateMask const& mask)
{
if (this == &mask)
return *this;
@@ -81,21 +81,21 @@ class UpdateMask
return *this;
}
- void operator &= (const UpdateMask& mask)
+ void operator&=(UpdateMask const& mask)
{
ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i)
mUpdateMask[i] &= mask.mUpdateMask[i];
}
- void operator |= (const UpdateMask& mask)
+ void operator|=(UpdateMask const& mask)
{
ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i)
mUpdateMask[i] |= mask.mUpdateMask[i];
}
- UpdateMask operator & (const UpdateMask& mask) const
+ UpdateMask operator&(UpdateMask const& mask) const
{
ASSERT(mask.mCount <= mCount);
@@ -106,7 +106,7 @@ class UpdateMask
return newmask;
}
- UpdateMask operator | (const UpdateMask& mask) const
+ UpdateMask operator|(UpdateMask const& mask) const
{
ASSERT(mask.mCount <= mCount);
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 75deb8b4216..5238eed2e15 100755..100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -30,13 +30,14 @@
#include "Unit.h"
#include "Util.h"
#include "Group.h"
+#include "Opcodes.h"
#define PET_XP_FACTOR 0.05f
Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner, true),
-m_usedTalentCount(0), m_removed(false), m_owner(owner),
-m_happinessTimer(7500), m_petType(type), m_duration(0),
-m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL)
+ m_usedTalentCount(0), m_removed(false), m_owner(owner),
+ m_happinessTimer(7500), m_petType(type), m_duration(0),
+ m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL)
{
m_unitTypeMask |= UNIT_MASK_PET;
if (type == HUNTER_PET)
@@ -73,11 +74,11 @@ void Pet::AddToWorld()
if (GetCharmInfo() && GetCharmInfo()->HasCommandState(COMMAND_FOLLOW))
{
GetCharmInfo()->SetIsCommandAttack(false);
+ GetCharmInfo()->SetIsCommandFollow(false);
GetCharmInfo()->SetIsAtStay(false);
GetCharmInfo()->SetIsFollowing(false);
GetCharmInfo()->SetIsReturning(false);
}
-
}
void Pet::RemoveFromWorld()
@@ -183,7 +184,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
if (!IsPositionValid())
{
- sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
return false;
}
@@ -229,7 +230,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
break;
default:
if (!IsPetGhoul())
- sLog->outError("Pet have incorrect type (%u) for pet loading.", getPetType());
+ sLog->outError(LOG_FILTER_PETS, "Pet have incorrect type (%u) for pet loading.", getPetType());
break;
}
@@ -456,7 +457,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
{
ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' '
- << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' ';
+ << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' ';
};
ss << "', "
@@ -562,7 +563,7 @@ void Pet::Update(uint32 diff)
{
if (owner->GetPetGUID() != GetGUID())
{
- sLog->outError("Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName());
+ sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName().c_str());
Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT);
return;
}
@@ -663,7 +664,7 @@ void Creature::Regenerate(Powers power)
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if (Powers((*i)->GetMiscValue()) == power)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILLISECONDS);
@@ -760,7 +761,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
if (!IsPositionValid())
{
- sLog->outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_PETS, "Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
return false;
}
@@ -768,7 +769,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
CreatureTemplate const* cinfo = GetCreatureTemplate();
if (!cinfo)
{
- sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
+ sLog->outError(LOG_FILTER_PETS, "CreateBaseAtCreature() failed, creatureInfo is missing!");
return false;
}
@@ -843,7 +844,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
m_unitTypeMask |= UNIT_MASK_HUNTER_PET;
}
else
- sLog->outError("Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass());
+ sLog->outError(LOG_FILTER_PETS, "Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass());
}
uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry;
@@ -1078,7 +1079,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
return diet & FoodMask;
}
-uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
+uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) const
{
// -5 or greater food level
if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect
@@ -1120,7 +1121,7 @@ void Pet::_LoadSpellCooldowns()
if (!sSpellMgr->GetSpellInfo(spell_id))
{
- sLog->outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id);
+ sLog->outError(LOG_FILTER_PETS, "Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id);
continue;
}
@@ -1271,7 +1272,7 @@ void Pet::_LoadAuras(uint32 timediff)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
- sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
+ sLog->outError(LOG_FILTER_PETS, "Unknown aura (spellid %u), ignore.", spellid);
continue;
}
@@ -1302,7 +1303,7 @@ void Pet::_LoadAuras(uint32 timediff)
}
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
- sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
+ sLog->outInfo(LOG_FILTER_PETS, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -1378,7 +1379,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
// do pet spell book cleanup
if (state == PETSPELL_UNCHANGED) // spell load case
{
- sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId);
+ sLog->outError(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL);
@@ -1387,7 +1388,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_PETS, "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -1882,7 +1883,7 @@ void Pet::ToggleAutocast(SpellInfo const* spellInfo, bool apply)
}
}
-bool Pet::IsPermanentPetFor(Player* owner)
+bool Pet::IsPermanentPetFor(Player* owner) const
{
switch (getPetType())
{
@@ -1979,7 +1980,7 @@ void Pet::CastPetAura(PetAura const* aura)
if (auraId == 35696) // Demonic Knowledge
{
- int32 basePoints = CalculatePctF(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
+ int32 basePoints = CalculatePct(aura->GetDamage(), GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT));
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
}
else
@@ -2033,3 +2034,40 @@ void Pet::SynchronizeLevelWithOwner()
break;
}
}
+
+void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
+{
+ WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+m_spells.size()*8);
+ data << uint64(GetGUID());
+ data << uint8(0x0); // flags (0x1, 0x2)
+ time_t curTime = time(NULL);
+ for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
+ {
+ if (itr->second.state == PETSPELL_REMOVED)
+ continue;
+ uint32 unSpellId = itr->first;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
+ if (!spellInfo)
+ {
+ ASSERT(spellInfo);
+ continue;
+ }
+
+ // Not send cooldown for this spells
+ if (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
+ continue;
+
+ if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
+ continue;
+
+ if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetCreatureSpellCooldownDelay(unSpellId) < unTimeMs)
+ {
+ data << uint32(unSpellId);
+ data << uint32(unTimeMs); // in m.secs
+ _AddCreatureSpellCooldown(unSpellId, curTime + unTimeMs/IN_MILLISECONDS);
+ }
+ }
+
+ if (Player* owner = GetOwner())
+ owner->GetSession()->SendPacket(&data);
+}
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 3475817816d..a1dd57a26cc 100755..100644
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -19,50 +19,11 @@
#ifndef TRINITYCORE_PET_H
#define TRINITYCORE_PET_H
-#include "ObjectDefines.h"
-#include "Unit.h"
+#include "PetDefines.h"
#include "TemporarySummon.h"
-enum PetType
-{
- SUMMON_PET = 0,
- HUNTER_PET = 1,
- MAX_PET_TYPE = 4,
-};
-
-#define MAX_PET_STABLES 4
-
-// stored in character_pet.slot
-enum PetSaveMode
-{
- PET_SAVE_AS_DELETED = -1, // not saved in fact
- PET_SAVE_AS_CURRENT = 0, // in current slot (with player)
- PET_SAVE_FIRST_STABLE_SLOT = 1,
- PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT
- PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100
-};
-
-enum HappinessState
-{
- UNHAPPY = 1,
- CONTENT = 2,
- HAPPY = 3
-};
-
-enum PetSpellState
-{
- PETSPELL_UNCHANGED = 0,
- PETSPELL_CHANGED = 1,
- PETSPELL_NEW = 2,
- PETSPELL_REMOVED = 3
-};
-
-enum PetSpellType
-{
- PETSPELL_NORMAL = 0,
- PETSPELL_FAMILY = 1,
- PETSPELL_TALENT = 2,
-};
+#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS
+#define HAPPINESS_LEVEL_SIZE 333000
struct PetSpell
{
@@ -71,51 +32,9 @@ struct PetSpell
PetSpellType type;
};
-enum ActionFeedback
-{
- FEEDBACK_NONE = 0,
- FEEDBACK_PET_DEAD = 1,
- FEEDBACK_NOTHING_TO_ATT = 2,
- FEEDBACK_CANT_ATT_TARGET = 3
-};
-
-enum PetTalk
-{
- PET_TALK_SPECIAL_SPELL = 0,
- PET_TALK_ATTACK = 1
-};
-
-enum PetNameInvalidReason
-{
- // custom, not send
- PET_NAME_SUCCESS = 0,
-
- PET_NAME_INVALID = 1,
- PET_NAME_NO_NAME = 2,
- PET_NAME_TOO_SHORT = 3,
- PET_NAME_TOO_LONG = 4,
- PET_NAME_MIXED_LANGUAGES = 6,
- PET_NAME_PROFANE = 7,
- PET_NAME_RESERVED = 8,
- PET_NAME_THREE_CONSECUTIVE = 11,
- PET_NAME_INVALID_SPACE = 12,
- PET_NAME_CONSECUTIVE_SPACES = 13,
- PET_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 14,
- PET_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 15,
- PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16
-};
-
typedef UNORDERED_MAP<uint32, PetSpell> PetSpellMap;
typedef std::vector<uint32> AutoSpellList;
-#define HAPPINESS_LEVEL_SIZE 333000
-
-#define ACTIVE_SPELLS_MAX 4
-
-#define PET_FOLLOW_DIST 1.0f
-#define PET_FOLLOW_ANGLE (M_PI/2)
-#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS
-
class Player;
class Pet : public Guardian
@@ -132,9 +51,9 @@ class Pet : public Guardian
bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; }
bool isTemporarySummoned() const { return m_duration > 0; }
- bool IsPermanentPetFor(Player* owner); // pet have tab in character windows and set UNIT_FIELD_PETNUMBER
+ bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER
- bool Create (uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
+ bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number);
bool CreateBaseAtCreature(Creature* creature);
bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner);
bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask);
@@ -162,9 +81,9 @@ class Pet : public Guardian
void GivePetLevel(uint8 level);
void SynchronizeLevelWithOwner();
bool HaveInDiet(ItemTemplate const* item) const;
- uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
+ uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const;
void SetDuration(int32 dur) { m_duration = dur; }
- int32 GetDuration() { return m_duration; }
+ int32 GetDuration() const { return m_duration; }
/*
bool UpdateStats(Stats stat);
@@ -200,6 +119,7 @@ class Pet : public Guardian
bool unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true);
bool removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab = true);
void CleanupActionBar();
+ virtual void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
PetSpellMap m_spells;
AutoSpellList m_autospells;
@@ -224,7 +144,7 @@ class Pet : public Guardian
bool m_removed; // prevent overwrite pet state in DB at next Pet::Update if pet already removed(saved)
- Player* GetOwner() { return m_owner; }
+ Player* GetOwner() const { return m_owner; }
protected:
Player* m_owner;
uint32 m_happinessTimer;
diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h
new file mode 100644
index 00000000000..76de2647c8c
--- /dev/null
+++ b/src/server/game/Entities/Pet/PetDefines.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITYCORE_PET_DEFINES_H
+#define TRINITYCORE_PET_DEFINES_H
+
+enum PetType
+{
+ SUMMON_PET = 0,
+ HUNTER_PET = 1,
+ MAX_PET_TYPE = 4
+};
+
+#define MAX_PET_STABLES 4
+
+// stored in character_pet.slot
+enum PetSaveMode
+{
+ PET_SAVE_AS_DELETED = -1, // not saved in fact
+ PET_SAVE_AS_CURRENT = 0, // in current slot (with player)
+ PET_SAVE_FIRST_STABLE_SLOT = 1,
+ PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT
+ PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100
+};
+
+enum HappinessState
+{
+ UNHAPPY = 1,
+ CONTENT = 2,
+ HAPPY = 3
+};
+
+enum PetSpellState
+{
+ PETSPELL_UNCHANGED = 0,
+ PETSPELL_CHANGED = 1,
+ PETSPELL_NEW = 2,
+ PETSPELL_REMOVED = 3
+};
+
+enum PetSpellType
+{
+ PETSPELL_NORMAL = 0,
+ PETSPELL_FAMILY = 1,
+ PETSPELL_TALENT = 2
+};
+
+enum ActionFeedback
+{
+ FEEDBACK_NONE = 0,
+ FEEDBACK_PET_DEAD = 1,
+ FEEDBACK_NOTHING_TO_ATT = 2,
+ FEEDBACK_CANT_ATT_TARGET = 3
+};
+
+enum PetTalk
+{
+ PET_TALK_SPECIAL_SPELL = 0,
+ PET_TALK_ATTACK = 1
+};
+
+#define PET_FOLLOW_DIST 1.0f
+#define PET_FOLLOW_ANGLE (M_PI/2)
+
+#endif
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 5e227e43a42..a3f760921af 100755..100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -16,64 +16,68 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "Language.h"
-#include "DatabaseEnv.h"
-#include "Log.h"
-#include "Opcodes.h"
-#include "SpellMgr.h"
-#include "World.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "UpdateMask.h"
#include "Player.h"
-#include "Vehicle.h"
-#include "SkillDiscovery.h"
-#include "QuestDef.h"
-#include "GossipDef.h"
-#include "UpdateData.h"
+#include "AccountMgr.h"
+#include "AchievementMgr.h"
+#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "BattlefieldWG.h"
+#include "BattlegroundAV.h"
+#include "Battleground.h"
+#include "BattlegroundMgr.h"
+#include "CellImpl.h"
#include "Channel.h"
#include "ChannelMgr.h"
-#include "MapManager.h"
-#include "MapInstanced.h"
-#include "InstanceSaveMgr.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "GuildMgr.h"
-#include "GroupMgr.h"
-#include "ObjectAccessor.h"
+#include "CharacterDatabaseCleaner.h"
+#include "Chat.h"
+#include <cmath>
+#include "Common.h"
+#include "ConditionMgr.h"
#include "CreatureAI.h"
+#include "DatabaseEnv.h"
+#include "DisableMgr.h"
#include "Formulas.h"
+#include "GameEventMgr.h"
+#include "GossipDef.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
#include "Group.h"
+#include "GroupMgr.h"
#include "Guild.h"
-#include "Pet.h"
-#include "Util.h"
-#include "Transport.h"
-#include "Weather.h"
-#include "Battleground.h"
-#include "BattlegroundAV.h"
-#include "BattlegroundMgr.h"
+#include "GuildMgr.h"
+#include "InstanceSaveMgr.h"
+#include "InstanceScript.h"
+#include "Language.h"
+#include "LFGMgr.h"
+#include "Log.h"
+#include "MapInstanced.h"
+#include "MapManager.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
-#include "ArenaTeam.h"
-#include "Chat.h"
-#include "Spell.h"
+#include "ReputationMgr.h"
+#include "Pet.h"
+#include "QuestDef.h"
+#include "SkillDiscovery.h"
#include "SocialMgr.h"
-#include "GameEventMgr.h"
-#include "AchievementMgr.h"
-#include "SpellAuras.h"
#include "SpellAuraEffects.h"
-#include "ConditionMgr.h"
-#include "DisableMgr.h"
+#include "SpellAuras.h"
+#include "Spell.h"
+#include "SpellMgr.h"
+#include "Transport.h"
+#include "UpdateData.h"
+#include "UpdateMask.h"
+#include "Util.h"
+#include "Vehicle.h"
+#include "Weather.h"
#include "WeatherMgr.h"
-#include "LFGMgr.h"
-#include "CharacterDatabaseCleaner.h"
-#include "InstanceScript.h"
-#include <cmath>
-#include "AccountMgr.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -187,16 +191,14 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
SetTaximaskNode(213); //Shattered Sun Staging Area
}
-void PlayerTaxi::LoadTaxiMask(const char* data)
+void PlayerTaxi::LoadTaxiMask(std::string const &data)
{
- Tokens tokens(data, ' ');
+ Tokenizer tokens(data, ' ');
- uint8 index;
- Tokens::iterator iter;
- for (iter = tokens.begin(), index = 0;
- (index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index)
+ uint8 index = 0;
+ for (Tokenizer::const_iterator iter = tokens.begin(); index < TaxiMaskSize && iter != tokens.end(); ++iter, ++index)
{
- // load and set bits only for existed taxi nodes
+ // load and set bits only for existing taxi nodes
m_taximask[index] = sTaxiNodesMask[index] & uint32(atol(*iter));
}
}
@@ -205,12 +207,12 @@ void PlayerTaxi::AppendTaximaskTo(ByteBuffer& data, bool all)
{
if (all)
{
- for (uint8 i=0; i<TaxiMaskSize; i++)
+ for (uint8 i = 0; i < TaxiMaskSize; ++i)
data << uint32(sTaxiNodesMask[i]); // all existed nodes
}
else
{
- for (uint8 i=0; i<TaxiMaskSize; i++)
+ for (uint8 i = 0; i < TaxiMaskSize; ++i)
data << uint32(m_taximask[i]); // known nodes
}
}
@@ -219,9 +221,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint3
{
ClearTaxiDestinations();
- Tokens tokens(values, ' ');
+ Tokenizer Tokenizer(values, ' ');
- for (Tokens::iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
+ for (Tokenizer::const_iterator iter = Tokenizer.begin(); iter != Tokenizer.end(); ++iter)
{
uint32 node = uint32(atol(*iter));
AddTaxiDestination(node);
@@ -517,7 +519,7 @@ inline void KillRewarder::_RewardXP(Player* player, float rate)
// 4.2.2. Apply auras modifying rewarded XP (SPELL_AURA_MOD_XP_PCT).
Unit::AuraEffectList const& auras = player->GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT);
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
- AddPctN(xp, (*i)->GetAmount());
+ AddPct(xp, (*i)->GetAmount());
// 4.2.3. Give XP to player.
player->GiveXP(xp, _victim, _groupRate);
@@ -595,9 +597,16 @@ void KillRewarder::_RewardGroup()
// 3.1.3. Reward each group member (even dead or corpse) within reward distance.
for (GroupReference* itr = _group->GetFirstMember(); itr != NULL; itr = itr->next())
+ {
if (Player* member = itr->getSource())
+ {
if (member->IsAtGroupRewardDistance(_victim))
+ {
_RewardPlayer(member, isDungeon);
+ member->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, _victim);
+ }
+ }
+ }
}
}
}
@@ -630,14 +639,12 @@ void KillRewarder::Reward()
// == Player ====================================================
-UpdateMask Player::updateVisualBits;
-
// we can disable this warning for this since it only
// causes undefined behavior when passed to the base class constructor
#ifdef _MSC_VER
#pragma warning(disable:4355)
#endif
-Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_reputationMgr(this)
+Player::Player(WorldSession* session): Unit(true)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
@@ -721,14 +728,13 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
m_DailyQuestChanged = false;
m_lastDailyQuestTime = 0;
- for (uint8 i=0; i<MAX_TIMERS; i++)
+ for (uint8 i=0; i < MAX_TIMERS; i++)
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
m_MirrorTimerFlags = UNDERWATER_NONE;
m_MirrorTimerFlagsLast = UNDERWATER_NONE;
m_isInWater = false;
m_drunkTimer = 0;
- m_drunk = 0;
m_restTime = 0;
m_deathTimer = 0;
m_deathExpireTime = 0;
@@ -737,7 +743,7 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
{
- m_bgBattlegroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
+ m_bgBattlegroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattlegroundQueueID[j].invitedToInstance = 0;
}
@@ -862,6 +868,10 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
m_SeasonalQuestChanged = false;
SetPendingBind(0, 0);
+
+ _activeCheats = CHEAT_NONE;
+ m_achievementMgr = new AchievementMgr(this);
+ m_reputationMgr = new ReputationMgr(this);
}
Player::~Player()
@@ -897,6 +907,8 @@ Player::~Player()
delete m_declinedname;
delete m_runes;
+ delete m_achievementMgr;
+ delete m_reputationMgr;
sWorld->DecreasePlayerCount();
}
@@ -931,7 +943,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class);
if (!info)
{
- sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class);
return false;
}
@@ -944,7 +956,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class);
if (!cEntry)
{
- sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class);
return false;
}
@@ -960,7 +972,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
if (!IsValidGender(createInfo->Gender))
{
- sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so",
+ sLog->outError(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so",
GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender);
return false;
}
@@ -978,8 +990,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
- // -1 is default value
- SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));
+ SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); // -1 is default value
SetUInt32Value(PLAYER_BYTES, (createInfo->Skin | (createInfo->Face << 8) | (createInfo->HairStyle << 16) | (createInfo->HairColor << 24)));
SetUInt32Value(PLAYER_BYTES_2, (createInfo->FacialHair |
@@ -1230,7 +1241,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
}
// item can't be added
- sLog->outError("STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
return false;
}
@@ -1297,14 +1308,14 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
{
if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage
{
- sLog->outStaticDebug("We are fall to death, loosing 10 percents durability");
+ sLog->outDebug(LOG_FILTER_PLAYER, "We are fall to death, loosing 10 percents durability");
DurabilityLossAll(0.10f, false);
// durability lost message
WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0);
GetSession()->SendPacket(&data2);
}
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, 1, type);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATHS_FROM, 1, type);
}
return final_damage;
@@ -1323,7 +1334,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
int32 UnderWaterTime = 3 * MINUTE * IN_MILLISECONDS;
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
- AddPctN(UnderWaterTime, (*i)->GetAmount());
+ AddPct(UnderWaterTime, (*i)->GetAmount());
return UnderWaterTime;
}
case FIRE_TIMER:
@@ -1460,49 +1471,51 @@ void Player::HandleDrowning(uint32 time_diff)
m_MirrorTimerFlagsLast = m_MirrorTimerFlags;
}
-///The player sobers by 256 every 10 seconds
+///The player sobers by 1% every 9 seconds
void Player::HandleSobering()
{
m_drunkTimer = 0;
- uint32 drunk = (m_drunk <= 256) ? 0 : (m_drunk - 256);
+ uint8 currentDrunkValue = GetDrunkValue();
+ uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0;
SetDrunkValue(drunk);
}
-DrunkenState Player::GetDrunkenstateByValue(uint16 value)
+DrunkenState Player::GetDrunkenstateByValue(uint8 value)
{
- if (value >= 23000)
+ if (value >= 90)
return DRUNKEN_SMASHED;
- if (value >= 12800)
+ if (value >= 50)
return DRUNKEN_DRUNK;
- if (value & 0xFFFE)
+ if (value)
return DRUNKEN_TIPSY;
return DRUNKEN_SOBER;
}
-void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
+void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
{
- uint32 oldDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
+ bool isSobering = newDrunkValue < GetDrunkValue();
+ uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue());
+ if (newDrunkValue > 100)
+ newDrunkValue = 100;
// select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates
- int32 drunkPercent = newDrunkenValue * 100 / 0xFFFF;
- drunkPercent = std::max(drunkPercent, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
-
+ int32 drunkPercent = std::max<int32>(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
if (drunkPercent)
{
m_invisibilityDetect.AddFlag(INVISIBILITY_DRUNK);
m_invisibilityDetect.SetValue(INVISIBILITY_DRUNK, drunkPercent);
}
- else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkenValue)
+ else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue)
m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK);
- m_drunk = newDrunkenValue;
- SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & 0xFFFF0001) | (m_drunk & 0xFFFE));
-
- uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
-
+ uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
+ SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue);
UpdateObjectVisibility();
+ if (!isSobering)
+ m_drunkTimer = 0; // reset sobering timer
+
if (newDrunkenState == oldDrunkenState)
return;
@@ -1510,7 +1523,6 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
data << uint64(GetGUID());
data << uint32(newDrunkenState);
data << uint32(itemId);
-
SendMessageToSet(&data, true);
}
@@ -1534,9 +1546,9 @@ void Player::Update(uint32 p_time)
//ASSERT (!m_spellModTakingSpell);
if (m_spellModTakingSpell)
{
- //sLog->outCrash("Player has m_pad %u during update!", m_pad);
+ //sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad);
//if (m_spellModTakingSpell)
- sLog->outCrash("Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
+ sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
m_spellModTakingSpell = NULL;
}
@@ -1570,6 +1582,16 @@ void Player::Update(uint32 p_time)
if (now > m_Last_tick + 1)
UpdateSoulboundTradeItems();
+ // If mute expired, remove it from the DB
+ if (GetSession()->m_muteTime && GetSession()->m_muteTime < now)
+ {
+ 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());
+ LoginDatabase.Execute(stmt);
+ }
+
if (!m_timedquests.empty())
{
QuestSet::iterator iter = m_timedquests.begin();
@@ -1591,7 +1613,7 @@ void Player::Update(uint32 p_time)
}
}
- GetAchievementMgr().UpdateTimedAchievements(p_time);
+ m_achievementMgr->UpdateTimedAchievements(p_time);
if (HasUnitState(UNIT_STATE_MELEE_ATTACKING) && !HasUnitState(UNIT_STATE_CASTING))
{
@@ -1733,7 +1755,7 @@ void Player::Update(uint32 p_time)
{
// m_nextSave reseted in SaveToDB call
SaveToDB();
- sLog->outDetail("Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName().c_str(), GetGUIDLow());
}
else
m_nextSave -= p_time;
@@ -1751,11 +1773,10 @@ void Player::Update(uint32 p_time)
m_Last_tick = now;
}
- if (m_drunk)
+ if (GetDrunkValue())
{
m_drunkTimer += p_time;
-
- if (m_drunkTimer > 10*IN_MILLISECONDS)
+ if (m_drunkTimer > 9 * IN_MILLISECONDS)
HandleSobering();
}
@@ -1823,7 +1844,7 @@ void Player::setDeathState(DeathState s)
{
if (!cur)
{
- sLog->outError("setDeathState: attempt to kill a dead player %s(%d)", GetName(), GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "setDeathState: attempt to kill a dead player %s(%d)", GetName().c_str(), GetGUIDLow());
return;
}
@@ -1843,12 +1864,12 @@ void Player::setDeathState(DeathState s)
// passive spell
if (!ressSpellId)
ressSpellId = GetResurrectionSpellId();
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1);
- GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH);
- GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH);
- GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DEATH_IN_DUNGEON, 1);
+ ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH);
+ ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL, ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH);
+ ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_CONDITION_NO_DEATH);
}
Unit::setDeathState(s);
@@ -1881,12 +1902,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass);
if (!info)
{
- sLog->outError("Player %u has incorrect race/class pair. Don't build enum.", guid);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid);
return false;
}
else if (!IsValidGender(gender))
{
- sLog->outError("Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
return false;
}
@@ -1973,7 +1994,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
*data << uint32(petLevel);
*data << uint32(petFamily);
- Tokens equipment(fields[19].GetString(), ' ');
+ Tokenizer equipment(fields[19].GetString(), ' ');
for (uint8 slot = 0; slot < INVENTORY_SLOT_BAG_END; ++slot)
{
uint32 visualBase = slot * 2;
@@ -2068,14 +2089,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
- sLog->outError("TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
- mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
+ mapid, x, y, z, orientation, GetGUIDLow(), GetName().c_str(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
{
- sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
+ 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);
return false;
}
@@ -2093,7 +2114,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// client without expansion support
if (GetSession()->Expansion() < mEntry->Expansion())
{
- sLog->outDebug(LOG_FILTER_MAPS, "Player %s using client without required expansion tried teleport to non accessible map %u", GetName(), mapid);
+ sLog->outDebug(LOG_FILTER_MAPS, "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid);
if (GetTransport())
{
@@ -2110,7 +2131,10 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
return false; // normal client can't teleport to this map...
}
else
- sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName(), mapid);
+ sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName().c_str(), mapid);
+
+ if (m_vehicle)
+ ExitVehicle();
// reset movement flags at teleport, because player will continue move with these flags after teleport
SetUnitMovementFlags(0);
@@ -2408,6 +2432,7 @@ void Player::RemoveFromWorld()
StopCastingBindSight();
UnsummonPetTemporaryIfAny();
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
}
///- Do not add/remove the player from the object storage
@@ -2428,7 +2453,8 @@ void Player::RemoveFromWorld()
{
if (WorldObject* viewpoint = GetViewpoint())
{
- sLog->outCrash("Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world",
+ GetName().c_str(), viewpoint->GetEntry(), viewpoint->GetTypeId());
SetViewpoint(viewpoint, false);
}
}
@@ -2534,7 +2560,7 @@ void Player::Regenerate(Powers power)
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if (Powers((*i)->GetMiscValue()) == power)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
// Butchery requires combat for this effect
if (power != POWER_RUNIC_POWER || isInCombat())
@@ -2614,12 +2640,12 @@ void Player::RegenerateHealth()
{
AuraEffectList const& mModHealthRegenPct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
- AddPctN(addvalue, (*i)->GetAmount());
+ AddPct(addvalue, (*i)->GetAmount());
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2 * IN_MILLISECONDS / (5 * IN_MILLISECONDS);
}
else if (HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
- ApplyPctN(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
+ ApplyPct(addvalue, GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT));
if (!IsStandState())
addvalue *= 1.5f;
@@ -2753,7 +2779,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes
return go;
sLog->outDebug(LOG_FILTER_MAPS, "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(),
- go->GetGUIDLow(), GetName(), GetGUIDLow(), go->GetDistance(this));
+ go->GetGUIDLow(), GetName().c_str(), GetGUIDLow(), go->GetDistance(this));
}
}
return NULL;
@@ -3000,6 +3026,9 @@ void Player::GiveLevel(uint8 level)
if (level == oldLevel)
return;
+ if (Guild* guild = GetGuild())
+ guild->UpdateMemberData(this, GUILD_MEMBER_DATA_LEVEL, level);
+
PlayerLevelInfo info;
sObjectMgr->GetPlayerLevelInfo(getRace(), getClass(), level, &info);
@@ -3074,7 +3103,7 @@ void Player::GiveLevel(uint8 level)
CharacterDatabase.CommitTransaction(trans);
}
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
// Refer-A-Friend
if (GetSession()->GetRecruiterId())
@@ -3357,7 +3386,7 @@ void Player::SendInitialSpells()
GetSession()->SendPacket(&data);
- sLog->outDetail("CHARACTER: Sent Initial Spells");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells");
}
void Player::RemoveMail(uint32 id)
@@ -3438,7 +3467,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3447,7 +3476,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3457,7 +3486,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3466,7 +3495,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addTalent: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -3511,7 +3540,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3520,7 +3549,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3530,7 +3559,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError("Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3539,7 +3568,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError("Player::addSpell: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -3864,11 +3893,11 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// not ranked skills
for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx)
{
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE, _spell_idx->second->skillId);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS, _spell_idx->second->skillId);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE, _spell_idx->second->skillId);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS, _spell_idx->second->skillId);
}
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, spellId);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL, spellId);
}
// return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell
@@ -4293,7 +4322,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
if (!sSpellMgr->GetSpellInfo(spell_id))
{
- sLog->outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
continue;
}
@@ -4459,8 +4488,8 @@ bool Player::resetTalents(bool no_cost)
if (!no_cost)
{
ModifyMoney(-(int32)cost);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS, cost);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TALENTS, cost);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
m_resetTalentsCost = cost;
m_resetTalentsTime = time(NULL);
@@ -4492,119 +4521,6 @@ Mail* Player::GetMail(uint32 id)
return NULL;
}
-void Player::_SetCreateBits(UpdateMask* updateMask, Player* target) const
-{
- if (target == this)
- Object::_SetCreateBits(updateMask, target);
- else
- {
- for (uint16 index = 0; index < m_valuesCount; index++)
- if (GetUInt32Value(index) != 0 && updateVisualBits.GetBit(index))
- updateMask->SetBit(index);
- }
-}
-
-void Player::_SetUpdateBits(UpdateMask* updateMask, Player* target) const
-{
- if (target == this)
- Object::_SetUpdateBits(updateMask, target);
- else
- {
- Object::_SetUpdateBits(updateMask, target);
- *updateMask &= updateVisualBits;
- }
-}
-
-void Player::InitVisibleBits()
-{
- updateVisualBits.SetCount(PLAYER_END);
-
- updateVisualBits.SetBit(OBJECT_FIELD_GUID);
- updateVisualBits.SetBit(OBJECT_FIELD_TYPE);
- updateVisualBits.SetBit(OBJECT_FIELD_ENTRY);
- updateVisualBits.SetBit(OBJECT_FIELD_SCALE_X);
- updateVisualBits.SetBit(UNIT_FIELD_CHARM + 0);
- updateVisualBits.SetBit(UNIT_FIELD_CHARM + 1);
- updateVisualBits.SetBit(UNIT_FIELD_SUMMON + 0);
- updateVisualBits.SetBit(UNIT_FIELD_SUMMON + 1);
- updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY + 0);
- updateVisualBits.SetBit(UNIT_FIELD_CHARMEDBY + 1);
- updateVisualBits.SetBit(UNIT_FIELD_TARGET + 0);
- updateVisualBits.SetBit(UNIT_FIELD_TARGET + 1);
- updateVisualBits.SetBit(UNIT_FIELD_CHANNEL_OBJECT + 0);
- updateVisualBits.SetBit(UNIT_FIELD_CHANNEL_OBJECT + 1);
- updateVisualBits.SetBit(UNIT_FIELD_BYTES_0);
- updateVisualBits.SetBit(UNIT_FIELD_HEALTH);
- updateVisualBits.SetBit(UNIT_FIELD_POWER1);
- updateVisualBits.SetBit(UNIT_FIELD_POWER2);
- updateVisualBits.SetBit(UNIT_FIELD_POWER3);
- updateVisualBits.SetBit(UNIT_FIELD_POWER4);
- updateVisualBits.SetBit(UNIT_FIELD_POWER5);
- updateVisualBits.SetBit(UNIT_FIELD_POWER6);
- updateVisualBits.SetBit(UNIT_FIELD_POWER7);
- updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER3);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER4);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6);
- updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7);
- updateVisualBits.SetBit(UNIT_FIELD_LEVEL);
- updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE);
- updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0);
- updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 1);
- updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 2);
- updateVisualBits.SetBit(UNIT_FIELD_FLAGS);
- updateVisualBits.SetBit(UNIT_FIELD_FLAGS_2);
- updateVisualBits.SetBit(UNIT_FIELD_AURASTATE);
- updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 0);
- updateVisualBits.SetBit(UNIT_FIELD_BASEATTACKTIME + 1);
- updateVisualBits.SetBit(UNIT_FIELD_BOUNDINGRADIUS);
- updateVisualBits.SetBit(UNIT_FIELD_COMBATREACH);
- updateVisualBits.SetBit(UNIT_FIELD_DISPLAYID);
- updateVisualBits.SetBit(UNIT_FIELD_NATIVEDISPLAYID);
- updateVisualBits.SetBit(UNIT_FIELD_MOUNTDISPLAYID);
- updateVisualBits.SetBit(UNIT_FIELD_BYTES_1);
- updateVisualBits.SetBit(UNIT_FIELD_PETNUMBER);
- updateVisualBits.SetBit(UNIT_FIELD_PET_NAME_TIMESTAMP);
- updateVisualBits.SetBit(UNIT_DYNAMIC_FLAGS);
- updateVisualBits.SetBit(UNIT_CHANNEL_SPELL);
- updateVisualBits.SetBit(UNIT_MOD_CAST_SPEED);
- updateVisualBits.SetBit(UNIT_FIELD_BASE_MANA);
- updateVisualBits.SetBit(UNIT_FIELD_BYTES_2);
- updateVisualBits.SetBit(UNIT_FIELD_HOVERHEIGHT);
-
- updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 0);
- updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 1);
- updateVisualBits.SetBit(PLAYER_FLAGS);
- updateVisualBits.SetBit(PLAYER_GUILDID);
- updateVisualBits.SetBit(PLAYER_GUILDRANK);
- updateVisualBits.SetBit(PLAYER_BYTES);
- updateVisualBits.SetBit(PLAYER_BYTES_2);
- updateVisualBits.SetBit(PLAYER_BYTES_3);
- updateVisualBits.SetBit(PLAYER_DUEL_TEAM);
- updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP);
- updateVisualBits.SetBit(UNIT_NPC_FLAGS);
-
- // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
- for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
- updateVisualBits.SetBit(i);
-
- // Players visible items are not inventory stuff
- for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
- {
- uint16 offset = i * 2;
-
- // item entry
- updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENTRYID + offset);
- // enchant
- updateVisualBits.SetBit(PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + offset);
- }
-
- updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE);
-}
-
void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const
{
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
@@ -5080,7 +4996,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
break;
}
default:
- sLog->outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method);
}
if (updateRealmChars)
@@ -5110,7 +5026,7 @@ void Player::DeleteOldCharacters()
*/
void Player::DeleteOldCharacters(uint32 keepDays)
{
- sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
+ sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS);
stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY)));
@@ -5118,7 +5034,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
if (result)
{
- sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
do
{
Field* fields = result->Fetch();
@@ -5138,7 +5054,7 @@ void Player::SetMovement(PlayerMovementType pType)
case MOVE_WATER_WALK: data.Initialize(SMSG_MOVE_WATER_WALK, GetPackGUID().size()+4); break;
case MOVE_LAND_WALK: data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size()+4); break;
default:
- sLog->outError("Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType);
return;
}
data.append(GetPackGUID());
@@ -5167,7 +5083,7 @@ void Player::BuildPlayerRepop()
// the player cannot have a corpse already, only bones which are not returned by GetCorpse
if (GetCorpse())
{
- sLog->outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "BuildPlayerRepop: player %s(%d) already has a corpse", GetName().c_str(), GetGUIDLow());
return;
}
@@ -5176,7 +5092,7 @@ void Player::BuildPlayerRepop()
Corpse* corpse = GetCorpse();
if (!corpse)
{
- sLog->outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Error creating corpse for Player %s [%u]", GetName().c_str(), GetGUIDLow());
return;
}
GetMap()->AddToMap(corpse);
@@ -5533,7 +5449,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
if (!dcost)
{
- sLog->outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
return TotalCost;
}
@@ -5541,7 +5457,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
if (!dQualitymodEntry)
{
- sLog->outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
return TotalCost;
}
@@ -5557,7 +5473,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
{
if (GetGuildId() == 0)
{
- sLog->outStaticDebug("You are not member of a guild");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild");
return TotalCost;
}
@@ -5572,7 +5488,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
}
else if (!HasEnoughMoney(costs))
{
- sLog->outStaticDebug("You do not have enough money");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money");
return TotalCost;
}
else
@@ -5609,7 +5525,12 @@ void Player::RepopAtGraveyard()
if (Battleground* bg = GetBattleground())
ClosestGrave = bg->GetClosestGraveYard(this);
else
- ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = bf->GetClosestGraveYard(this);
+ else
+ ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ }
// stop countdown until repop
m_deathTimer = 0;
@@ -5663,11 +5584,11 @@ void Player::CleanupChannels()
{
Channel* ch = *m_channels.begin();
m_channels.erase(m_channels.begin()); // remove from player's channel list
- ch->Leave(GetGUID(), false); // not send to client, not remove from player's channel list
- if (ChannelMgr* cMgr = channelMgr(GetTeam()))
+ ch->LeaveChannel(this, false); // not send to client, not remove from player's channel list
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam()))
cMgr->LeftChannel(ch->GetName()); // deleted channel if empty
}
- sLog->outDebug(LOG_FILTER_CHATSYS, "Player: channels cleaned up!");
+ sLog->outDebug(LOG_FILTER_CHATSYS, "Player %s: channels cleaned up!", GetName().c_str());
}
void Player::UpdateLocalChannels(uint32 newZone)
@@ -5679,7 +5600,7 @@ void Player::UpdateLocalChannels(uint32 newZone)
if (!current_zone)
return;
- ChannelMgr* cMgr = channelMgr(GetTeam());
+ ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam());
if (!cMgr)
return;
@@ -5740,11 +5661,11 @@ void Player::UpdateLocalChannels(uint32 newZone)
removeChannel = usedChannel;
if (joinChannel)
- joinChannel->Join(GetGUID(), ""); // Changed Channel: ... or Joined Channel: ...
+ joinChannel->JoinChannel(this, ""); // Changed Channel: ... or Joined Channel: ...
if (removeChannel)
{
- removeChannel->Leave(GetGUID(), sendRemove); // Leave old channel
+ removeChannel->LeaveChannel(this, sendRemove); // Leave old channel
std::string name = removeChannel->GetName(); // Store name, (*i)erase in LeftChannel
LeftChannel(removeChannel); // Remove from player's channel list
cMgr->LeftChannel(name); // Delete if empty
@@ -5759,7 +5680,7 @@ void Player::LeaveLFGChannel()
{
if ((*i)->IsLFG())
{
- (*i)->Leave(GetGUID());
+ (*i)->LeaveChannel(this);
break;
}
}
@@ -5767,20 +5688,15 @@ void Player::LeaveLFGChannel()
void Player::UpdateDefense()
{
- uint32 defense_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE);
-
- if (UpdateSkill(SKILL_DEFENSE, defense_skill_gain))
- {
- // update dependent from defense skill part
- UpdateDefenseBonusesMod();
- }
+ if (UpdateSkill(SKILL_DEFENSE, sWorld->getIntConfig(CONFIG_SKILL_GAIN_DEFENSE)))
+ UpdateDefenseBonusesMod(); // update dependent from defense skill part
}
void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
{
if (modGroup >= BASEMOD_END || modType >= MOD_END)
{
- sLog->outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
return;
}
@@ -5811,7 +5727,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
{
if (modGroup >= BASEMOD_END || modType > MOD_END)
{
- sLog->outError("trial to access non existed BaseModGroup or wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!");
return 0.0f;
}
@@ -5825,7 +5741,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const
{
if (modGroup >= BASEMOD_END)
{
- sLog->outError("wrong BaseModGroup in GetTotalBaseModValue()!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!");
return 0.0f;
}
@@ -5867,7 +5783,7 @@ void Player::GetDodgeFromAgility(float &diminishing, float &nondiminishing)
const float dodge_base[MAX_CLASSES] =
{
0.036640f, // Warrior
- 0.034943f, // Paladi
+ 0.034943f, // Paladin
-0.040873f, // Hunter
0.020957f, // Rogue
0.034178f, // Priest
@@ -6049,7 +5965,7 @@ void Player::UpdateRating(CombatRating cr)
AuraEffectList const& modRatingFromStat = GetAuraEffectsByType(SPELL_AURA_MOD_RATING_FROM_STAT);
for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
if ((*i)->GetMiscValue() & (1<<cr))
- amount += int32(CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
+ amount += int32(CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount()));
if (amount < 0)
amount = 0;
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
@@ -6180,7 +6096,7 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step)
if (itr->second.uState != SKILL_NEW)
itr->second.uState = SKILL_CHANGED;
UpdateSkillEnchantments(skill_id, value, new_value);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, skill_id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, skill_id);
return true;
}
@@ -6323,7 +6239,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
}
}
UpdateSkillEnchantments(SkillId, SkillValue, new_value);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, SkillId);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, SkillId);
sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance / 10.0f);
return true;
}
@@ -6513,8 +6429,8 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
// if skill value is going up, update enchantments after setting the new value
if (newVal > currVal)
UpdateSkillEnchantments(id, currVal, newVal);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, id);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, id);
}
else //remove
{
@@ -6547,15 +6463,15 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
if (!pSkill)
{
- sLog->outError("Skill not found in SkillLineStore: skill #%u", id);
+ sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id);
return;
}
SetUInt32Value(PLAYER_SKILL_INDEX(i), MAKE_PAIR32(id, step));
SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(i), MAKE_SKILL_VALUE(newVal, maxVal));
UpdateSkillEnchantments(id, currVal, newVal);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, id);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL, id);
// insert new entry or update if not deleted old entry yet
if (itr != mSkillStatus.end())
@@ -6707,8 +6623,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const
void Player::SendActionButtons(uint32 state) const
{
- sLog->outDetail("Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec);
-
WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(state);
/*
@@ -6730,20 +6644,20 @@ void Player::SendActionButtons(uint32 state) const
}
GetSession()->SendPacket(&data);
- sLog->outDetail("Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
}
bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
{
if (button >= MAX_ACTION_BUTTONS)
{
- sLog->outError("Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
+ sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTONS );
return false;
}
if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
- sLog->outError("Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
+ sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTON_ACTION_VALUE);
return false;
}
@@ -6752,25 +6666,31 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_SPELL:
if (!sSpellMgr->GetSpellInfo(action))
{
- sLog->outError("Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName().c_str());
return false;
}
if (!HasSpell(action))
{
- sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::IsActionButtonDataValid Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName().c_str());
return false;
}
break;
case ACTION_BUTTON_ITEM:
if (!sObjectMgr->GetItemTemplate(action))
{
- sLog->outError("Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName().c_str());
return false;
}
break;
+ case ACTION_BUTTON_C:
+ case ACTION_BUTTON_CMACRO:
+ case ACTION_BUTTON_MACRO:
+ case ACTION_BUTTON_EQSET:
+ break;
default:
- break; // other cases not checked at this moment
+ sLog->outError(LOG_FILTER_PLAYER, "Unknown action type %u", type);
+ return false; // other cases not checked at this moment
}
return true;
@@ -6787,7 +6707,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
// set data and update to CHANGED if not NEW
ab.SetActionAndType(action, ActionButtonType(type));
- sLog->outDetail("Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
return &ab;
}
@@ -6802,7 +6722,7 @@ void Player::removeActionButton(uint8 button)
else
buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
- sLog->outDetail("Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
}
ActionButton const* Player::GetActionButton(uint8 button)
@@ -6914,7 +6834,7 @@ void Player::CheckAreaExploreAndOutdoor()
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
{
- sLog->outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
+ sLog->outError(LOG_FILTER_PLAYER, "Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaFlag, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE);
return;
}
@@ -6925,12 +6845,12 @@ void Player::CheckAreaExploreAndOutdoor()
{
SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, (uint32)(currFields | val));
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA);
AreaTableEntry const* areaEntry = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId());
if (!areaEntry)
{
- sLog->outError("Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %u discovered unknown area (x: %f y: %f z: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId());
return;
}
@@ -6967,7 +6887,7 @@ void Player::CheckAreaExploreAndOutdoor()
GiveXP(XP, NULL);
SendExplorationExperience(area, XP);
}
- sLog->outDetail("Player %u discovered a new area: %u", GetGUIDLow(), area);
+ sLog->outInfo(LOG_FILTER_PLAYER, "Player %u discovered a new area: %u", GetGUIDLow(), area);
}
}
}
@@ -6981,10 +6901,10 @@ uint32 Player::TeamForRace(uint8 race)
case 1: return HORDE;
case 7: return ALLIANCE;
}
- sLog->outError("Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
+ sLog->outError(LOG_FILTER_PLAYER, "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
}
else
- sLog->outError("Race (%u) not found in DBC: wrong DBC files?", uint32(race));
+ sLog->outError(LOG_FILTER_PLAYER, "Race (%u) not found in DBC: wrong DBC files?", uint32(race));
return ALLIANCE;
}
@@ -7003,37 +6923,80 @@ ReputationRank Player::GetReputationRank(uint32 faction) const
return GetReputationMgr().GetRank(factionEntry);
}
-//Calculate total reputation percent player gain with quest/creature level
-int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest, bool noQuestBonus)
+// Calculate total reputation percent player gain with quest/creature level
+int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus)
{
float percent = 100.0f;
- // Get the generic rate first
- if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction))
+ float repMod = noQuestBonus ? 0.0f : float(GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
+
+ // faction specific auras only seem to apply to kills
+ if (source == REPUTATION_SOURCE_KILL)
+ repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
+
+ percent += rep > 0 ? repMod : -repMod;
+
+ float rate;
+ switch (source)
{
- float repRate = for_quest ? repData->quest_rate : repData->creature_rate;
- percent *= repRate;
+ case REPUTATION_SOURCE_KILL:
+ rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
+ break;
+ case REPUTATION_SOURCE_QUEST:
+ case REPUTATION_SOURCE_DAILY_QUEST:
+ case REPUTATION_SOURCE_WEEKLY_QUEST:
+ case REPUTATION_SOURCE_MONTHLY_QUEST:
+ rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST);
+ break;
+ case REPUTATION_SOURCE_SPELL:
+ default:
+ rate = 1.0f;
+ break;
}
- float rate = for_quest ? sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST) : sWorld->getRate(RATE_REPUTATION_LOWLEVEL_KILL);
-
if (rate != 1.0f && creatureOrQuestLevel <= Trinity::XP::GetGrayLevel(getLevel()))
percent *= rate;
- float repMod = noQuestBonus ? 0.0f : (float)GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN);
+ if (percent <= 0.0f)
+ return 0;
- if (!for_quest)
- repMod += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, faction);
+ // Multiply result with the faction specific rate
+ if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction))
+ {
+ float repRate = 0.0f;
+ switch (source)
+ {
+ case REPUTATION_SOURCE_KILL:
+ repRate = repData->creatureRate;
+ break;
+ case REPUTATION_SOURCE_QUEST:
+ repRate = repData->questRate;
+ break;
+ case REPUTATION_SOURCE_DAILY_QUEST:
+ repRate = repData->questDailyRate;
+ break;
+ case REPUTATION_SOURCE_WEEKLY_QUEST:
+ repRate = repData->questWeeklyRate;
+ break;
+ case REPUTATION_SOURCE_MONTHLY_QUEST:
+ repRate = repData->questMonthlyRate;
+ break;
+ case REPUTATION_SOURCE_SPELL:
+ repRate = repData->spellRate;
+ break;
+ }
- percent += rep > 0 ? repMod : -repMod;
+ // for custom, a rate of 0.0 will totally disable reputation gain for this faction/type
+ if (repRate <= 0.0f)
+ return 0;
- if (percent <= 0.0f)
- return 0;
+ percent *= repRate;
+ }
- return int32(rep*percent/100);
+ return int32(rep * percent / 100.0f);
}
-//Calculates how many reputation points player gains in victim's enemy factions
+// Calculates how many reputation points player gains in victim's enemy factions
void Player::RewardReputation(Unit* victim, float rate)
{
if (!victim || victim->GetTypeId() == TYPEID_PLAYER)
@@ -7043,7 +7006,6 @@ void Player::RewardReputation(Unit* victim, float rate)
return;
ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(victim->ToCreature()->GetCreatureTemplate()->Entry);
-
if (!Rep)
return;
@@ -7074,8 +7036,10 @@ void Player::RewardReputation(Unit* victim, float rate)
uint32 team = GetTeam();
float favored_rep_mult = 0;
- if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor
- else if (HasAura(30754) && (Rep->RepFaction1 == 609 || Rep->RepFaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor
+ if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714))
+ favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor
+ else if (HasAura(30754) && (Rep->RepFaction1 == 609 || Rep->RepFaction2 == 609) && !ChampioningFaction)
+ favored_rep_mult = 0.25; // Cenarion Favor
if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :)
// Favored reputation increase END
@@ -7084,7 +7048,7 @@ void Player::RewardReputation(Unit* victim, float rate)
if (Rep->RepFaction1 && (!Rep->TeamDependent || team == ALLIANCE))
{
- int32 donerep1 = CalculateReputationGain(victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1, false);
+ int32 donerep1 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
donerep1 = int32(donerep1*(rate + favored_rep_mult));
if (recruitAFriend)
@@ -7098,7 +7062,7 @@ void Player::RewardReputation(Unit* victim, float rate)
if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE))
{
- int32 donerep2 = CalculateReputationGain(victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2, false);
+ int32 donerep2 = CalculateReputationGain(REPUTATION_SOURCE_KILL, victim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
donerep2 = int32(donerep2*(rate + favored_rep_mult));
if (recruitAFriend)
@@ -7111,7 +7075,7 @@ void Player::RewardReputation(Unit* victim, float rate)
}
}
-//Calculate how many reputation points player gain with the quest
+// Calculate how many reputation points player gain with the quest
void Player::RewardReputation(Quest const* quest)
{
bool recruitAFriend = GetsRecruitAFriendBonus(false);
@@ -7123,7 +7087,16 @@ void Player::RewardReputation(Quest const* quest)
continue;
if (quest->RewardFactionValueIdOverride[i])
{
- int32 rep = CalculateReputationGain(GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true, true);
+ int32 rep = 0;
+
+ if (quest->IsDaily())
+ rep = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
+ else if (quest->IsWeekly())
+ rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
+ else if (quest->IsMonthly())
+ rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
+ else
+ rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
if (recruitAFriend)
rep = int32(rep * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
@@ -7136,19 +7109,25 @@ void Player::RewardReputation(Quest const* quest)
uint32 row = ((quest->RewardFactionValueId[i] < 0) ? 1 : 0) + 1;
uint32 field = abs(quest->RewardFactionValueId[i]);
- if (const QuestFactionRewEntry* pRow = sQuestFactionRewardStore.LookupEntry(row))
+ if (QuestFactionRewEntry const* pRow = sQuestFactionRewardStore.LookupEntry(row))
{
int32 repPoints = pRow->QuestRewFactionValue[field];
-
if (!repPoints)
continue;
- repPoints = CalculateReputationGain(GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
+ if (quest->IsDaily())
+ repPoints = CalculateReputationGain(REPUTATION_SOURCE_DAILY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]);
+ else if (quest->IsWeekly())
+ repPoints = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]);
+ else if (quest->IsMonthly())
+ repPoints = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]);
+ else
+ repPoints = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i]);
if (recruitAFriend)
repPoints = int32(repPoints * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
- if (const FactionEntry* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(quest->RewardFactionId[i]))
GetReputationMgr().ModifyReputation(factionEntry, repPoints);
}
}
@@ -7190,21 +7169,21 @@ void Player::UpdateHonorFields()
///Calculate the amount of honor gained based on the victim
///and the size of the group for which the honor is divided
///An exact honor value can also be given (overriding the calcs)
-bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvptoken)
+bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvptoken)
{
// do not reward honor in arenas, but enable onkill spellproc
if (InArena())
{
- if (!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
+ if (!victim || victim == this || victim->GetTypeId() != TYPEID_PLAYER)
return false;
- if (GetBGTeam() == uVictim->ToPlayer()->GetBGTeam())
+ if (GetBGTeam() == victim->ToPlayer()->GetBGTeam())
return false;
return true;
}
- // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
+ // 'Inactive' this aura prevents the player from gaining honor points and battleground Tokenizer
if (HasAura(SPELL_AURA_PLAYER_INACTIVE))
return false;
@@ -7223,16 +7202,14 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
if (honor_f <= 0)
{
- if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
+ if (!victim || victim == this || victim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
return false;
- victim_guid = uVictim->GetGUID();
+ victim_guid = victim->GetGUID();
- if (uVictim->GetTypeId() == TYPEID_PLAYER)
+ if (Player* plrVictim = victim->ToPlayer())
{
- Player* victim = uVictim->ToPlayer();
-
- if (GetTeam() == victim->GetTeam() && !sWorld->IsFFAPvPRealm())
+ if (GetTeam() == plrVictim->GetTeam() && !sWorld->IsFFAPvPRealm())
return false;
uint8 k_level = getLevel();
@@ -7277,7 +7254,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
}
else
{
- if (!uVictim->ToCreature()->isRacialLeader())
+ if (!victim->ToCreature()->isRacialLeader())
return false;
honor_f = 100.0f; // ??? need more info
@@ -7285,13 +7262,13 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
}
}
- if (uVictim != NULL)
+ if (victim != NULL)
{
if (groupsize > 1)
honor_f /= groupsize;
// apply honor multiplier from aura (not stacking-get highest)
- AddPctN(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
+ AddPct(honor_f, GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HONOR_GAIN_PCT));
}
honor_f *= sWorld->getRate(RATE_HONOR);
@@ -7303,9 +7280,9 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
// victim_rank [5..19] HK: <alliance\horde rank>
// victim_rank [0, 20+] HK: <>
WorldPacket data(SMSG_PVP_CREDIT, 4+8+4);
- data << honor;
- data << victim_guid;
- data << victim_rank;
+ data << uint32(honor);
+ data << uint64(victim_guid);
+ data << uint32(victim_rank);
GetSession()->SendPacket(&data);
@@ -7324,10 +7301,10 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken)
{
- if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
+ if (!victim || victim == this || victim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
return true;
- if (uVictim->GetTypeId() == TYPEID_PLAYER)
+ if (victim->GetTypeId() == TYPEID_PLAYER)
{
// Check if allowed to receive it in current map
uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE);
@@ -7340,7 +7317,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
int32 count = sWorld->getIntConfig(CONFIG_PVP_TOKEN_COUNT);
if (AddItem(itemId, count))
- ChatHandler(this).PSendSysMessage("You have been awarded a token for slaying another player.");
+ ChatHandler(GetSession()).PSendSysMessage("You have been awarded a token for slaying another player.");
}
}
@@ -7367,8 +7344,6 @@ void Player::SetArenaPoints(uint32 value)
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
- PreparedStatement* stmt = NULL;
-
int32 newValue = int32(GetHonorPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7376,7 +7351,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -7385,8 +7360,6 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
- PreparedStatement* stmt = NULL;
-
int32 newValue = int32(GetArenaPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7394,7 +7367,7 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -7531,7 +7504,11 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
+ if (Guild* guild = GetGuild())
+ guild->UpdateMemberData(this, GUILD_MEMBER_DATA_ZONEID, newZone);
}
// group update
@@ -7610,8 +7587,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
if (GetRestType() == REST_TYPE_IN_TAVERN) // Still inside a tavern or has recently left
{
// Remove rest state if we have recently left a tavern.
- // Why is 40 yd hardcoded?
- if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 40.0f)
+ if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 1.0f)
{
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_NO);
@@ -7678,7 +7654,7 @@ void Player::CheckDuelDistance(time_t currTime)
bool Player::IsOutdoorPvPActive()
{
- return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && (IsPvP() || sWorld->IsPvPRealm()) && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
+ return isAlive() && !HasInvisibilityAura() && !HasStealthAura() && IsPvP() && !HasUnitMovementFlag(MOVEMENTFLAG_FLYING) && !isInFlight();
}
void Player::DuelComplete(DuelCompleteType type)
@@ -7687,7 +7663,7 @@ void Player::DuelComplete(DuelCompleteType type)
if (!duel)
return;
- sLog->outDebug(LOG_FILTER_UNITS, "Duel Complete %s %s", GetName(), duel->opponent->GetName());
+ sLog->outDebug(LOG_FILTER_UNITS, "Duel Complete %s %s", GetName().c_str(), duel->opponent->GetName().c_str());
WorldPacket data(SMSG_DUEL_COMPLETE, (1));
data << (uint8)((type != DUEL_INTERRUPTED) ? 1 : 0);
@@ -7726,22 +7702,20 @@ void Player::DuelComplete(DuelCompleteType type)
}
break;
case DUEL_WON:
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL, 1);
- if (duel->opponent)
- {
- duel->opponent->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL, 1);
+ duel->opponent->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, 1);
+
+ // Credit for quest Death's Challenge
+ if (getClass() == CLASS_DEATH_KNIGHT && duel->opponent->GetQuestStatus(12733) == QUEST_STATUS_INCOMPLETE)
+ duel->opponent->CastSpell(duel->opponent, 52994, true);
- //Credit for quest Death's Challenge
- if (getClass() == CLASS_DEATH_KNIGHT && duel->opponent->GetQuestStatus(12733) == QUEST_STATUS_INCOMPLETE)
- duel->opponent->CastSpell(duel->opponent, 52994, true);
- }
break;
default:
break;
}
// Victory emote spell
- if (type != DUEL_INTERRUPTED && duel->opponent)
+ if (type != DUEL_INTERRUPTED)
duel->opponent->CastSpell(duel->opponent, 52852, true);
//Remove Duel Flag object
@@ -7813,7 +7787,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
if (item->IsBroken())
return;
- sLog->outDetail("applying mods for item %u ", item->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow());
uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -8019,6 +7993,9 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, -val, apply);
m_spellPenetrationItemMod += apply ? val : -val;
break;
+ case ITEM_MOD_BLOCK_VALUE:
+ HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply);
+ break;
// deprecated item mods
case ITEM_MOD_SPELL_HEALING_DONE:
case ITEM_MOD_SPELL_DAMAGE_DONE:
@@ -8299,7 +8276,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply,
return;
}
- sLog->outStaticDebug("WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id);
+ sLog->outDebug(LOG_FILTER_PLAYER, "WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id);
CastSpell(this, spellInfo, true, item);
}
@@ -8405,7 +8382,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId);
continue;
}
@@ -8474,8 +8451,8 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
- GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
+ GetGUIDLow(), GetName().c_str(), pEnchant->ID, pEnchant->spellid[s]);
continue;
}
@@ -8519,7 +8496,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
if (!spellInfo)
{
- sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
SendEquipError(EQUIP_ERR_NONE, item, NULL);
return;
}
@@ -8551,7 +8528,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
- sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId);
continue;
}
@@ -8579,7 +8556,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
continue;
}
@@ -9142,93 +9119,19 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
{
// data depends on zoneid/mapid...
Battleground* bg = GetBattleground();
- uint16 NumberOfFields = 0;
uint32 mapid = GetMapId();
OutdoorPvP* pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneid);
InstanceScript* instance = GetInstanceScript();
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid);
sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid);
- // may be exist better way to do this...
- switch (zoneid)
- {
- case 0:
- case 1:
- case 4:
- case 8:
- case 10:
- case 11:
- case 12:
- case 36:
- case 38:
- case 40:
- case 41:
- case 51:
- case 267:
- case 1519:
- case 1537:
- case 2257:
- case 2918:
- NumberOfFields = 8;
- break;
- case 139:
- NumberOfFields = 41;
- break;
- case 1377:
- NumberOfFields = 15;
- break;
- case 2597:
- NumberOfFields = 83;
- break;
- case 3277:
- NumberOfFields = 16;
- break;
- case 3358:
- case 3820:
- NumberOfFields = 40;
- break;
- case 3483:
- NumberOfFields = 27;
- break;
- case 3518:
- NumberOfFields = 39;
- break;
- case 3519:
- NumberOfFields = 38;
- break;
- case 3521:
- NumberOfFields = 37;
- break;
- case 3698:
- case 3702:
- case 3968:
- case 4378:
- case 3703:
- NumberOfFields = 11;
- break;
- case 4384:
- NumberOfFields = 30;
- break;
- case 4710:
- NumberOfFields = 28;
- break;
- case 4812: // Icecrown Citadel
- case 4100: // The Culling of Stratholme
- NumberOfFields = 13;
- break;
- case 4273: // Ulduar
- NumberOfFields = 10;
- break;
- default:
- NumberOfFields = 12;
- break;
- }
-
- WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+(NumberOfFields*8)));
+ WorldPacket data(SMSG_INIT_WORLD_STATES, (4+4+4+2+(12*8)));
data << uint32(mapid); // mapid
data << uint32(zoneid); // zone id
data << uint32(areaid); // area id, new 2.1.0
- data << uint16(NumberOfFields); // count of uint64 blocks
+ size_t countPos = data.wpos();
+ data << uint16(0); // count of uint64 blocks
data << uint32(0x8d8) << uint32(0x0); // 1
data << uint32(0x8d7) << uint32(0x0); // 2
data << uint32(0x8d6) << uint32(0x0); // 3
@@ -9259,6 +9162,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 1519: // Stormwind City
case 1537: // Ironforge
case 2257: // Deeprun Tram
+ case 3703: // Shattrath City
break;
case 139: // Eastern Plaguelands
if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP)
@@ -9665,7 +9569,6 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(3610) << uint32(0x0); // 9 show
}
break;
- case 3703: // Shattrath City
case 4384: // Strand of the Ancients
if (bg && bg->GetTypeID(true) == BATTLEGROUND_SA)
bg->FillInitialWorldStates(data);
@@ -9737,6 +9640,17 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(4345) << uint32(1); // 24 unknown
}
break;
+ // The Ruby Sanctum
+ case 4987:
+ if (instance && mapid == 724)
+ instance->FillInitialWorldStates(data);
+ else
+ {
+ data << uint32(5049) << uint32(50); // 9 WORLDSTATE_CORPOREALITY_MATERIAL
+ data << uint32(5050) << uint32(50); // 10 WORLDSTATE_CORPOREALITY_TWILIGHT
+ data << uint32(5051) << uint32(0); // 11 WORLDSTATE_CORPOREALITY_TOGGLE
+ }
+ break;
// Icecrown Citadel
case 4812:
if (instance && mapid == 631)
@@ -9773,6 +9687,14 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(4131) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED
}
break;
+ // Wintergrasp
+ case 4197:
+ if (bf && bf->GetTypeId() == BATTLEFIELD_WG)
+ {
+ bf->FillInitialWorldStates(data);
+ break;
+ }
+ // No break here, intended.
default:
data << uint32(0x914) << uint32(0x0); // 7
data << uint32(0x913) << uint32(0x0); // 8
@@ -9780,8 +9702,13 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(0x915) << uint32(0x0); // 10
break;
}
+
+ uint16 length = (data.wpos() - countPos) / 8;
+ data.put<uint16>(countPos, length);
+
GetSession()->SendPacket(&data);
SendBGWeekendWorldStates();
+ SendBattlefieldWorldStates();
}
void Player::SendBGWeekendWorldStates()
@@ -9799,6 +9726,24 @@ void Player::SendBGWeekendWorldStates()
}
}
+void Player::SendBattlefieldWorldStates()
+{
+ /// Send misc stuff that needs to be sent on every login, like the battle timers.
+ if (sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE))
+ {
+ if (BattlefieldWG* wg = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ {
+ if (wg->IsWarTime())
+ SendUpdateWorldState(ClockWorldState[1], uint32(time(NULL)));
+ else // Time to next battle
+ {
+ uint32 timer = wg->GetTimer() / 1000;
+ SendUpdateWorldState(ClockWorldState[1], time(NULL) + timer);
+ }
+ }
+ }
+}
+
uint32 Player::GetXPRestBonus(uint32 xp)
{
uint32 rested_bonus = (uint32)GetRestBonus(); // xp for each rested bonus
@@ -9808,7 +9753,7 @@ uint32 Player::GetXPRestBonus(uint32 xp)
SetRestBonus(GetRestBonus() - rested_bonus);
- sLog->outDetail("Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus());
+ sLog->outInfo(LOG_FILTER_PLAYER, "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp+rested_bonus, rested_bonus, GetRestBonus());
return rested_bonus;
}
@@ -9840,7 +9785,7 @@ void Player::ResetPetTalents()
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ sLog->outError(LOG_FILTER_PLAYER, "Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
pet->resetTalents();
@@ -11634,7 +11579,11 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool
if (eslot == EQUIPMENT_SLOT_OFFHAND)
{
- if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
+ // Do not allow polearm to be equipped in the offhand (rare case for the only 1h polearm 41750)
+ if (type == INVTYPE_WEAPON && pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM)
+ return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT;
+
+ else if (type == INVTYPE_WEAPON || type == INVTYPE_WEAPONOFFHAND)
{
if (!CanDualWield())
return EQUIP_ERR_CANT_DUAL_WIELD;
@@ -11743,8 +11692,8 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
uint8 pItemslot = pItem->GetSlot();
if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END)
{
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!",
- GetName(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId);
+ sLog->outError(LOG_FILTER_PLAYER, "Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!",
+ GetName().c_str(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId);
return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED;
}
@@ -12018,7 +11967,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje
bool lootedObjectInDungeon = false;
Map const* map = lootedObject->GetMap();
if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true))
- if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
+ if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty()))
lootedObjectInDungeon = true;
@@ -12174,8 +12123,8 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
if (pItem)
{
ItemAddedQuestCheck(item, count);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, item, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, item, 1);
if (randomPropertyId)
pItem->SetItemRandomProperties(randomPropertyId);
pItem = StoreItem(dest, pItem, update);
@@ -12345,7 +12294,7 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update)
if (Item* pItem = Item::CreateItem(item, 1, this))
{
ItemAddedQuestCheck(item, 1);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1);
return EquipItem(pos, pItem, update);
}
@@ -12382,7 +12331,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
if (!spellProto)
- sLog->outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
+ sLog->outError(LOG_FILTER_PLAYER, "Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
else
{
m_weaponChangeTimer = spellProto->StartRecoveryTime;
@@ -12455,8 +12404,8 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
}
// only for full equip instead adding to stack
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
return pItem;
}
@@ -12477,8 +12426,8 @@ void Player::QuickEquipItem(uint16 pos, Item* pItem)
pItem->SendUpdateToPlayer(this);
}
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry());
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, pItem->GetEntry(), slot);
}
}
@@ -12624,7 +12573,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
{
// update quest counters
ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
// store item
Item* pLastItem = StoreItem(dest, pItem, update);
@@ -12639,10 +12588,10 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
// if this original item then it need create record in inventory
// in case trade we already have item in other player inventory
pLastItem->SetState(in_characterInventoryDB ? ITEM_CHANGED : ITEM_NEW, this);
- }
- if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
- AddTradeableItem(pLastItem);
+ if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
+ AddTradeableItem(pLastItem);
+ }
}
void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
@@ -12739,7 +12688,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
}
}
-void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check)
+void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool unequip_check)
{
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", item, count);
uint32 remcount = 0;
@@ -12747,14 +12696,14 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
// in inventory
for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
- if (pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
{
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
// all items in inventory can unequipped
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
if (remcount >= count)
@@ -12762,11 +12711,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
@@ -12775,14 +12724,14 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
- if (pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
{
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
// all keys can be unequipped
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
if (remcount >= count)
@@ -12790,11 +12739,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
@@ -12804,18 +12753,18 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
// in inventory bags
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if (Bag* pBag = GetBagByPos(i))
+ if (Bag* bag = GetBagByPos(i))
{
- for (uint32 j = 0; j < pBag->GetBagSize(); j++)
+ for (uint32 j = 0; j < bag->GetBagSize(); j++)
{
- if (Item* pItem = pBag->GetItemByPos(j))
+ if (Item* item = bag->GetItemByPos(j))
{
- if (pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
{
// all items in bags can be unequipped
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(i, j, update);
if (remcount >= count)
@@ -12823,11 +12772,11 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
@@ -12839,15 +12788,15 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
// in equipment and bag list
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++)
{
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
- if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade())
+ if (item && item->GetEntry() == itemEntry && !item->IsInTrade())
{
- if (pItem->GetCount() + remcount <= count)
+ if (item->GetCount() + remcount <= count)
{
if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK)
{
- remcount += pItem->GetCount();
+ remcount += item->GetCount();
DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
if (remcount >= count)
@@ -12856,16 +12805,78 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ
}
else
{
- ItemRemovedQuestCheck(pItem->GetEntry(), count - remcount);
- pItem->SetCount(pItem->GetCount() - count + remcount);
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
+ if (IsInWorld() && update)
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
+ return;
+ }
+ }
+ }
+ }
+
+ // in bank
+ for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++)
+ {
+ if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
+ {
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
+ {
+ if (item->GetCount() + remcount <= count)
+ {
+ remcount += item->GetCount();
+ DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
+ if (remcount >= count)
+ return;
+ }
+ else
+ {
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
if (IsInWorld() && update)
- pItem->SendUpdateToPlayer(this);
- pItem->SetState(ITEM_CHANGED, this);
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
return;
}
}
}
}
+
+ // in bank bags
+ for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
+ {
+ if (Bag* bag = GetBagByPos(i))
+ {
+ for (uint32 j = 0; j < bag->GetBagSize(); j++)
+ {
+ if (Item* item = bag->GetItemByPos(j))
+ {
+ if (item->GetEntry() == itemEntry && !item->IsInTrade())
+ {
+ // all items in bags can be unequipped
+ if (item->GetCount() + remcount <= count)
+ {
+ remcount += item->GetCount();
+ DestroyItem(i, j, update);
+
+ if (remcount >= count)
+ return;
+ }
+ else
+ {
+ ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
+ item->SetCount(item->GetCount() - count + remcount);
+ if (IsInWorld() && update)
+ item->SendUpdateToPlayer(this);
+ item->SetState(ITEM_CHANGED, this);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
}
void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone)
@@ -14145,7 +14156,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
// nothing do..
break;
default:
- sLog->outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type);
+ sLog->outError(LOG_FILTER_PLAYER, "Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type);
break;
} /*switch (enchant_display_type)*/
} /*for*/
@@ -14317,7 +14328,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
VendorItemData const* vendorItems = creature->GetVendorItems();
if (!vendorItems || vendorItems->Empty())
{
- sLog->outErrorDb("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 %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
canTalk = false;
}
break;
@@ -14366,7 +14377,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
canTalk = false;
break;
default:
- sLog->outErrorDb("Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId);
+ sLog->outError(LOG_FILTER_SQL, "Creature entry %u have unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId);
canTalk = false;
break;
}
@@ -14461,7 +14472,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
{
if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER)
{
- sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry());
+ sLog->outError(LOG_FILTER_PLAYER, "Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry());
return;
}
}
@@ -14565,7 +14576,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
- sLog->outError("a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow());
return;
}
@@ -14815,11 +14826,11 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* quest)
bool Player::CanSeeStartQuest(Quest const* quest)
{
- if (SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) && SatisfyQuestSkill(quest, false) &&
- SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
+ if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) && SatisfyQuestClass(quest, false) && SatisfyQuestRace(quest, false) &&
+ SatisfyQuestSkill(quest, false) && SatisfyQuestExclusiveGroup(quest, false) && SatisfyQuestReputation(quest, false) &&
SatisfyQuestPreviousQuest(quest, false) && SatisfyQuestNextChain(quest, false) &&
SatisfyQuestPrevChain(quest, false) && SatisfyQuestDay(quest, false) && SatisfyQuestWeek(quest, false) &&
- SatisfyQuestSeasonal(quest, false) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this))
+ SatisfyQuestMonth(quest, false) && SatisfyQuestSeasonal(quest, false))
{
return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= quest->GetMinLevel();
}
@@ -14829,13 +14840,14 @@ bool Player::CanSeeStartQuest(Quest const* quest)
bool Player::CanTakeQuest(Quest const* quest, bool msg)
{
- return SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
+ return !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this)
+ && SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg)
&& SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg)
&& SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg)
&& SatisfyQuestPreviousQuest(quest, msg) && SatisfyQuestTimed(quest, msg)
&& SatisfyQuestNextChain(quest, msg) && SatisfyQuestPrevChain(quest, msg)
&& SatisfyQuestDay(quest, msg) && SatisfyQuestWeek(quest, msg)
- && SatisfyQuestSeasonal(quest,msg) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this)
+ && SatisfyQuestMonth(quest, msg) && SatisfyQuestSeasonal(quest, msg)
&& SatisfyQuestConditions(quest, msg);
}
@@ -14959,7 +14971,7 @@ bool Player::CanRewardQuest(Quest const* quest, bool msg)
return false;
// daily quest can't be rewarded (25 daily quest already completed)
- if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestSeasonal(quest,true))
+ if (!SatisfyQuestDay(quest, true) || !SatisfyQuestWeek(quest, true) || !SatisfyQuestMonth(quest, true) || !SatisfyQuestSeasonal(quest, true))
return false;
// rewarded and not repeatable quest (only cheating case, then ignore without message)
@@ -15090,24 +15102,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
m_QuestStatusSave[quest_id] = true;
- GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest_id);
-
- //starting initial quest script
- if (questGiver && quest->GetQuestStartScript() != 0)
- GetMap()->ScriptsStart(sQuestStartScripts, quest->GetQuestStartScript(), questGiver, this);
-
- // Some spells applied at quest activation
- SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(quest_id, true);
- if (saBounds.first != saBounds.second)
- {
- uint32 zone, area;
- GetZoneAndAreaId(zone, area);
-
- for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area))
- if (!HasAura(itr->second->spellId))
- CastSpell(this, itr->second->spellId, true);
- }
+ StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest_id);
UpdateForQuestWorldObjects();
}
@@ -15210,7 +15205,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
- AddPctN(XP, (*i)->GetAmount());
+ AddPct(XP, (*i)->GetAmount());
int32 moneyRew = 0;
if (getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
@@ -15227,7 +15222,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
ModifyMoney(moneyRew);
if (moneyRew > 0)
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, uint32(moneyRew));
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, uint32(moneyRew));
}
// honor reward
@@ -15264,12 +15259,14 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
SetDailyQuestStatus(quest_id);
if (quest->IsDaily())
{
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, quest_id);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY, quest_id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, quest_id);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST_DAILY, quest_id);
}
}
else if (quest->IsWeekly())
SetWeeklyQuestStatus(quest_id);
+ else if (quest->IsMonthly())
+ SetMonthlyQuestStatus(quest_id);
else if (quest->IsSeasonal())
SetSeasonalQuestStatus(quest_id);
@@ -15293,36 +15290,9 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
CastSpell(this, quest->GetRewSpell(), true);
if (quest->GetZoneOrSort() > 0)
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, quest->GetZoneOrSort());
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, quest->GetQuestId());
-
- uint32 zone = 0;
- uint32 area = 0;
-
- // remove auras from spells with quest reward state limitations
- SpellAreaForQuestMapBounds saEndBounds = sSpellMgr->GetSpellAreaForQuestEndMapBounds(quest_id);
- if (saEndBounds.first != saEndBounds.second)
- {
- GetZoneAndAreaId(zone, area);
-
- for (SpellAreaForAreaMap::const_iterator itr = saEndBounds.first; itr != saEndBounds.second; ++itr)
- if (!itr->second->IsFitToRequirements(this, zone, area))
- RemoveAurasDueToSpell(itr->second->spellId);
- }
-
- // Some spells applied at quest reward
- SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(quest_id, false);
- if (saBounds.first != saBounds.second)
- {
- if (!zone || !area)
- GetZoneAndAreaId(zone, area);
-
- for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area))
- if (!HasAura(itr->second->spellId))
- CastSpell(this, itr->second->spellId, true);
- }
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, quest->GetZoneOrSort());
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST, quest->GetQuestId());
//lets remove flag for delayed teleports
SetCanDelayTeleport(false);
@@ -15750,6 +15720,15 @@ bool Player::SatisfyQuestSeasonal(Quest const* qInfo, bool /*msg*/)
return m_seasonalquests[eventId].find(qInfo->GetQuestId()) == m_seasonalquests[eventId].end();
}
+bool Player::SatisfyQuestMonth(Quest const* qInfo, bool /*msg*/)
+{
+ if (!qInfo->IsMonthly() || m_monthlyquests.empty())
+ return true;
+
+ // if not found in cooldown list
+ return m_monthlyquests.find(qInfo->GetQuestId()) == m_monthlyquests.end();
+}
+
bool Player::GiveQuestSourceItem(Quest const* quest)
{
uint32 srcitem = quest->GetSrcItemId();
@@ -15785,7 +15764,6 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
{
uint32 srcItemId = quest->GetSrcItemId();
ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
- bool destroyItem = true;
if (srcItemId > 0)
{
@@ -15805,6 +15783,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
return false;
}
+ bool destroyItem = true;
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
destroyItem = false;
@@ -15866,6 +15845,30 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status)
m_QuestStatusSave[quest_id] = true;
}
+ uint32 zone = 0, area = 0;
+
+ SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(quest_id);
+ if (saBounds.first != saBounds.second)
+ {
+ GetZoneAndAreaId(zone, area);
+
+ for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
+ if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area))
+ if (!HasAura(itr->second->spellId))
+ CastSpell(this, itr->second->spellId, true);
+ }
+
+ saBounds = sSpellMgr->GetSpellAreaForQuestEndMapBounds(quest_id);
+ if (saBounds.first != saBounds.second)
+ {
+ if (!zone || !area)
+ GetZoneAndAreaId(zone, area);
+
+ for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
+ if (!itr->second->IsFitToRequirements(this, zone, area))
+ RemoveAurasDueToSpell(itr->second->spellId);
+ }
+
UpdateForQuestWorldObjects();
}
@@ -16074,8 +16077,8 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
real_entry = killed->GetEntry();
}
- GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : NULL);
+ StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, real_entry); // MUST BE CALLED FIRST
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, real_entry, addkillcount, guid ? GetMap()->GetCreature(guid) : NULL);
for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
@@ -16478,7 +16481,7 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver)
data << uint32(quest->GetRewOrReqMoney() + int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY)));
}
- data << 10 * Trinity::Honor::hk_honor_at_level(getLevel(), quest->GetRewHonorMultiplier());
+ data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest)));
data << uint32(quest->GetBonusTalents()); // bonus talents
data << uint32(quest->GetRewArenaPoints());
GetSession()->SendPacket(&data);
@@ -16637,7 +16640,7 @@ void Player::_LoadArenaTeamInfo(PreparedQueryResult result)
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
if (!arenaTeam)
{
- sLog->outError("Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadArenaTeamInfo: couldn't load arenateam %u", arenaTeamId);
continue;
}
@@ -16736,13 +16739,11 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, flo
return true;
}
-void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/)
+void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
{
- m_homebindMapId = GetMapId();
- m_homebindAreaId = GetAreaId();
- m_homebindX = GetPositionX();
- m_homebindY = GetPositionY();
- m_homebindZ = GetPositionZ();
+ loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ);
+ m_homebindMapId = loc.GetMapId();
+ m_homebindAreaId = areaId;
// update sql homebind
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND);
@@ -16755,7 +16756,7 @@ void Player::SetHomebind(WorldLocation const& /*loc*/, uint32 /*area_id*/)
CharacterDatabase.Execute(stmt);
}
-uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
+uint32 Player::GetUInt32ValueFromArray(Tokenizer const& data, uint16 index)
{
if (index >= data.size())
return 0;
@@ -16763,7 +16764,7 @@ uint32 Player::GetUInt32ValueFromArray(Tokens const& data, uint16 index)
return (uint32)atoi(data[index]);
}
-float Player::GetFloatValueFromArray(Tokens const& data, uint16 index)
+float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index)
{
float result;
uint32 temp = Player::GetUInt32ValueFromArray(data, index);
@@ -16772,6 +16773,11 @@ float Player::GetFloatValueFromArray(Tokens const& data, uint16 index)
return result;
}
+bool Player::isBeingLoaded() const
+{
+ return GetSession()->PlayerLoading();
+}
+
bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
{
//// 0 1 2 3 4 5 6 7 8 9 10 11
@@ -16784,11 +16790,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, "
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
//"health, power1, power2, power3, power4, power5, power6, power7, instance_id, speccount, activespec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars, grantableLevels FROM characters WHERE guid = '%u'", guid);
- PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADFROM);
-
+ PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM);
if (!result)
{
- sLog->outError("Player (GUID: %u) not found in table `characters`, can't load. ", guid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) not found in table `characters`, can't load. ", guid);
return false;
}
@@ -16800,13 +16805,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// player should be able to load/delete character only with correct account!
if (dbAccountId != GetSession()->GetAccountId())
{
- sLog->outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId);
return false;
}
- if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBANNED))
+ if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED))
{
- sLog->outError("Player (GUID: %u) is banned, can't load.", guid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) is banned, can't load.", guid);
return false;
}
@@ -16819,12 +16824,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
(AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sObjectMgr->IsReservedName(m_name)))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
-
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
stmt->setUInt32(1, guid);
-
CharacterDatabase.Execute(stmt);
-
return false;
}
@@ -16834,7 +16836,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
uint8 Gender = fields[5].GetUInt8();
if (!IsValidGender(Gender))
{
- sLog->outError("Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender);
return false;
}
@@ -16856,7 +16858,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
// load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria)
- m_achievementMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS));
+ m_achievementMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS));
uint32 money = fields[8].GetUInt32();
if (money > MAX_MONEY_AMOUNT)
@@ -16865,7 +16867,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32());
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
- SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 1, fields[49].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32());
@@ -16896,7 +16899,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
setFactionForRace(getRace());
// load home bind and check in same time class/race pair, it used later for restore broken positions
- if (!_LoadHomeBind(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADHOMEBIND)))
+ if (!_LoadHomeBind(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND)))
return false;
InitPrimaryProfessions(); // to max set before any spell loaded
@@ -16920,9 +16923,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
#define RelocateToHomebind(){ mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); }
- _LoadGroup(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGROUP));
+ _LoadGroup(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GROUP));
- _LoadArenaTeamInfo(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADARENAINFO));
+ _LoadArenaTeamInfo(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO));
SetArenaPoints(fields[39].GetUInt32());
@@ -16949,15 +16952,15 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[44].GetUInt16());
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[45].GetUInt16());
- _LoadBoundInstances(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
- _LoadInstanceTimeRestrictions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES));
- _LoadBGData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADBGDATA));
+ _LoadBoundInstances(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES));
+ _LoadInstanceTimeRestrictions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES));
+ _LoadBGData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BG_DATA));
GetSession()->SetPlayer(this);
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !IsPositionValid())
{
- sLog->outError("Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
RelocateToHomebind();
}
// Player was saved in Arena or Bg
@@ -16993,9 +16996,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
const WorldLocation& _loc = GetBattlegroundEntryPoint();
mapId = _loc.GetMapId(); instanceId = 0;
- if (mapId == MAPID_INVALID) // Battleground Entry Point not found (???)
+ // Db field type is type int16, so it can never be MAPID_INVALID
+ //if (mapId == MAPID_INVALID) -- code kept for reference
+ if (int16(mapId) == int16(-1)) // Battleground Entry Point not found (???)
{
- sLog->outError("Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) was in BG in database, but BG was not found, and entry point was invalid! Teleport to default race/class locations.", guid);
RelocateToHomebind();
}
else
@@ -17017,7 +17022,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// transport size limited
m_movementInfo.t_pos.m_positionX > 250 || m_movementInfo.t_pos.m_positionY > 250 || m_movementInfo.t_pos.m_positionZ > 250)
{
- sLog->outError("Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid transport coordinates (X: %f Y: %f Z: %f O: %f). Teleport to bind location.",
guid, GetPositionX()+m_movementInfo.t_pos.m_positionX, GetPositionY()+m_movementInfo.t_pos.m_positionY,
GetPositionZ()+m_movementInfo.t_pos.m_positionZ, GetOrientation()+m_movementInfo.t_pos.m_orientation);
@@ -17037,7 +17042,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
if (!m_transport)
{
- sLog->outError("Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.",
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have problems with transport guid (%u). Teleport to bind location.",
guid, transGUID);
RelocateToHomebind();
@@ -17064,12 +17069,12 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (!nodeEntry) // don't know taxi start node, to homebind
{
- sLog->outError("Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u have wrong data in taxi destination list, teleport to homebind.", GetGUIDLow());
RelocateToHomebind();
}
else // have start node, to it
{
- sLog->outError("Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u have too short taxi destination list, teleport to original node.", GetGUIDLow());
mapId = nodeEntry->map_id;
Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z, 0.0f);
}
@@ -17098,7 +17103,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
{
if (GetSession()->Expansion() < mapEntry->Expansion())
{
- sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player %s using client without required expansion tried login at non accessible map %u", GetName(), mapId);
+ sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId);
RelocateToHomebind();
}
@@ -17119,13 +17124,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(mapId);
if (at)
{
- sLog->outError("Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
Relocate(at->target_X, at->target_Y, at->target_Z, GetOrientation());
mapId = at->target_mapId;
}
else
{
- sLog->outError("Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
RelocateToHomebind();
}
@@ -17135,11 +17140,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
mapId = info->mapId;
Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
- sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
- sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
}
@@ -17153,7 +17158,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation);
else
{
- sLog->outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName().c_str(), GetGUIDLow(), mapId);
RelocateToHomebind();
}
}
@@ -17175,13 +17180,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// set value, including drunk invisibility detection
// calculate sobering. after 15 minutes logged out, the player will be sober again
- float soberFactor;
- if (time_diff > 15*MINUTE)
- soberFactor = 0;
- else
- soberFactor = 1-time_diff/(15.0f*MINUTE);
- uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
- SetDrunkValue(newDrunkenValue);
+ uint8 newDrunkValue = 0;
+ if (time_diff < uint32(GetDrunkValue()) * 9)
+ newDrunkValue = GetDrunkValue() - time_diff / 9;
+
+ SetDrunkValue(newDrunkValue);
m_cinematic = fields[18].GetUInt8();
m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32();
@@ -17190,14 +17193,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
m_resetTalentsCost = fields[24].GetUInt32();
m_resetTalentsTime = time_t(fields[25].GetUInt32());
- m_taxi.LoadTaxiMask(fields[17].GetCString()); // must be before InitTaxiNodesForLevel
+ m_taxi.LoadTaxiMask(fields[17].GetString()); // must be before InitTaxiNodesForLevel
uint32 extraflags = fields[31].GetUInt16();
m_stableSlots = fields[32].GetUInt8();
if (m_stableSlots > MAX_PET_STABLES)
{
- sLog->outError("Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots));
+ sLog->outError(LOG_FILTER_PLAYER, "Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots));
m_stableSlots = MAX_PET_STABLES;
}
@@ -17217,14 +17220,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
// clear charm/summon related fields
- SetUInt64Value(UNIT_FIELD_SUMMONEDBY, 0);
+ SetOwnerGUID(0);
SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0);
SetUInt64Value(UNIT_FIELD_CHARM, 0);
SetUInt64Value(UNIT_FIELD_SUMMON, 0);
SetUInt64Value(PLAYER_FARSIGHT, 0);
SetCreatorGUID(0);
- RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
// reset some aura modifiers before aura apply
SetUInt32Value(PLAYER_TRACK_CREATURES, 0);
@@ -17260,7 +17263,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
}
// load skills after InitStatsForLevel because it triggering aura apply also
- _LoadSkills(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSKILLS));
+ _LoadSkills(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SKILLS));
UpdateSkillsForLevel(); //update skills after load, to make sure they are correctly update at player load
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
@@ -17275,45 +17278,46 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS)
{
m_activeSpec = 0;
- sLog->outError("Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName(), GetGUIDLow(), m_specsCount, m_activeSpec);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName().c_str(), GetGUIDLow(), m_specsCount, m_activeSpec);
}
- _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADTALENTS));
- _LoadSpells(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSPELLS));
+ _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_TALENTS));
+ _LoadSpells(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELLS));
- _LoadGlyphs(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));
- _LoadAuras(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff);
+ _LoadGlyphs(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GLYPHS));
+ _LoadAuras(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AURAS), time_diff);
_LoadGlyphAuras();
// add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
m_deathState = DEAD;
// after spell load, learn rewarded spell if need also
- _LoadQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS));
- _LoadQuestStatusRewarded(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW));
- _LoadDailyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS));
- _LoadWeeklyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS));
- _LoadSeasonalQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS));
- _LoadRandomBGStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADRANDOMBG));
+ _LoadQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS));
+ _LoadQuestStatusRewarded(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW));
+ _LoadDailyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS));
+ _LoadWeeklyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS));
+ _LoadSeasonalQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS));
+ _LoadMonthlyQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS));
+ _LoadRandomBGStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG));
// after spell and quest load
InitTalentForLevel();
learnDefaultSpells();
// must be before inventory (some items required reputation check)
- m_reputationMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADREPUTATION));
+ m_reputationMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_REPUTATION));
- _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINVENTORY), time_diff);
+ _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY), time_diff);
// update items with duration and realtime
UpdateItemDuration(time_diff, true);
- _LoadActions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACTIONS));
+ _LoadActions(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACTIONS));
// unread mails and next delivery time, actual mails not loaded
- _LoadMailInit(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADMAILCOUNT), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADMAILDATE));
+ _LoadMailInit(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE));
- m_social = sSocialMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSOCIALLIST), GetGUIDLow());
+ m_social = sSocialMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST), GetGUIDLow());
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
@@ -17326,7 +17330,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// has to be called after last Relocate() in Player::LoadFromDB
SetFallInformation(0, GetPositionZ());
- _LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS));
+ _LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS));
// Spell code allow apply any auras to dead character in load time in aura/spell/item loading
// Do now before stats re-calculation cleanup for ghost state unexpected auras
@@ -17407,11 +17411,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
if (m_grantableLevels > 0)
SetByteValue(PLAYER_FIELD_BYTES, 1, 0x01);
- _LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES));
+ _LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES));
- m_achievementMgr.CheckAllAchievementCriteria();
+ m_achievementMgr->CheckAllAchievementCriteria();
- _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS));
+ _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS));
return true;
}
@@ -17480,7 +17484,7 @@ void Player::_LoadActions(PreparedQueryResult result)
ab->uState = ACTIONBUTTON_UNCHANGED;
else
{
- sLog->outError(" ...at loading, and will deleted in DB also");
+ sLog->outError(LOG_FILTER_PLAYER, " ...at loading, and will deleted in DB also");
// Will deleted in DB at next save (it can create data until save but marked as deleted)
m_actionButtons[button].uState = ACTIONBUTTON_DELETED;
@@ -17524,7 +17528,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
- sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
+ sLog->outError(LOG_FILTER_PLAYER, "Unknown aura (spellid %u), ignore.", spellid);
continue;
}
@@ -17558,7 +17562,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
- sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
+ sLog->outInfo(LOG_FILTER_PLAYER, "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -17581,13 +17585,13 @@ void Player::_LoadGlyphAuras()
continue;
}
else
- sLog->outError("Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), gp->TypeFlags, gs->TypeFlags);
}
else
- sLog->outError("Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i);
}
else
- sLog->outError("Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i);
// On any error remove glyph
SetGlyph(i, 0);
@@ -17621,8 +17625,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
uint32 zoneId = GetZoneId();
- std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
- std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags
+ std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
+ std::map<uint32, Item*> invalidBagMap; // fast guid lookup for bags
std::list<Item*> problematicItems;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -17681,7 +17685,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
item->SetSlot(NULL_SLOT);
// Item is in the bag, find the bag
- std::map<uint64, Bag*>::iterator itr = bagMap.find(bagGuid);
+ std::map<uint32, Bag*>::iterator itr = bagMap.find(bagGuid);
if (itr != bagMap.end())
{
ItemPosCountVec dest;
@@ -17691,14 +17695,14 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
- std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid);
- if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end())
+ std::map<uint32, Item*>::iterator itr = invalidBagMap.find(bagGuid);
+ if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
err = EQUIP_ERR_INT_BAG_ERROR;
}
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?",
- GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?",
+ GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot);
item->DeleteFromInventoryDB(trans);
delete item;
continue;
@@ -17711,8 +17715,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
item->SetState(ITEM_UNCHANGED, this);
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.",
- GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.",
+ GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err);
item->DeleteFromInventoryDB(trans);
problematicItems.push_back(item);
}
@@ -17742,7 +17746,6 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
{
- PreparedStatement* stmt = NULL;
Item* item = NULL;
uint32 itemGuid = fields[13].GetUInt32();
uint32 itemEntry = fields[14].GetUInt32();
@@ -17752,18 +17755,20 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
item = NewItemOrBag(proto);
if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
{
+ PreparedStatement* stmt = NULL;
+
// Do not allow to have item limited to another map/zone in alive state
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
{
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', map: %u) has item (GUID: %u, entry: %u) limited to another map (%u). Deleting item.",
- GetGUIDLow(), GetName(), GetMapId(), item->GetGUIDLow(), item->GetEntry(), zoneId);
+ GetGUIDLow(), GetName().c_str(), GetMapId(), item->GetGUIDLow(), item->GetEntry(), zoneId);
remove = true;
}
// "Conjured items disappear if you are logged out for more than 15 minutes"
else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_PROTO_FLAG_CONJURED)
{
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.",
- GetGUIDLow(), GetName(), timeDiff, item->GetGUIDLow(), item->GetEntry());
+ GetGUIDLow(), GetName().c_str(), timeDiff, item->GetGUIDLow(), item->GetEntry());
remove = true;
}
else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE))
@@ -17771,7 +17776,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
if (item->GetPlayedTime() > (2 * HOUR))
{
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.",
- GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime());
+ GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime());
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE);
stmt->setUInt32(0, item->GetGUIDLow());
@@ -17794,7 +17799,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
else
{
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.",
- GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry());
+ GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry());
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE);
}
}
@@ -17806,17 +17811,23 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
std::string strGUID = (*result)[0].GetString();
- Tokens GUIDlist(strGUID, ' ');
+ Tokenizer GUIDlist(strGUID, ' ');
AllowedLooterSet looters;
- for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
+ for (Tokenizer::const_iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
looters.insert(atol(*itr));
- item->SetSoulboundTradeable(looters);
- AddTradeableItem(item);
+
+ if (looters.size() > 1 && item->GetTemplate()->GetMaxStackSize() == 1 && item->IsSoulBound())
+ {
+ item->SetSoulboundTradeable(looters);
+ AddTradeableItem(item);
+ }
+ else
+ item->ClearSoulboundTradeable(this);
}
else
{
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.",
- GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry());
+ GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry());
item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE);
}
}
@@ -17837,8 +17848,8 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.",
- GetGUIDLow(), GetName(), itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.",
+ GetGUIDLow(), GetName().c_str(), itemGuid, itemEntry);
remove = true;
}
// Remove item from inventory if necessary
@@ -17852,8 +17863,8 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
}
else
{
- sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.",
- GetGUIDLow(), GetName(), itemEntry);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.",
+ GetGUIDLow(), GetName().c_str(), itemEntry);
Item::DeleteFromInventoryDB(trans, itemGuid);
Item::DeleteFromDB(trans, itemGuid);
}
@@ -17883,7 +17894,7 @@ void Player::_LoadMailedItems(Mail* mail)
if (!proto)
{
- sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);
stmt->setUInt32(0, itemGuid);
@@ -17899,7 +17910,7 @@ void Player::_LoadMailedItems(Mail* mail)
if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate))
{
- sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
stmt->setUInt32(0, itemGuid);
@@ -17962,7 +17973,7 @@ void Player::_LoadMail()
if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId))
{
- sLog->outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId);
m->mailTemplateId = 0;
}
@@ -18019,8 +18030,8 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
else
{
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
- sLog->outError("Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).",
- GetName(), GetGUIDLow(), quest_id, qstatus);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).",
+ GetName().c_str(), GetGUIDLow(), quest_id, qstatus);
}
questStatusData.Explored = (fields[2].GetUInt8() > 0);
@@ -18143,7 +18154,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result)
if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query
{
- sLog->outError("Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow());
break;
}
@@ -18214,6 +18225,29 @@ void Player::_LoadSeasonalQuestStatus(PreparedQueryResult result)
m_SeasonalQuestChanged = false;
}
+void Player::_LoadMonthlyQuestStatus(PreparedQueryResult result)
+{
+ m_monthlyquests.clear();
+
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 quest_id = fields[0].GetUInt32();
+ Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
+ if (!quest)
+ continue;
+
+ m_monthlyquests.insert(quest_id);
+ sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Monthly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow());
+ }
+ while (result->NextRow());
+ }
+
+ m_MonthlyQuestChanged = false;
+}
+
void Player::_LoadSpells(PreparedQueryResult result)
{
//QueryResult* result = CharacterDatabase.PQuery("SELECT spell, active, disabled FROM character_spell WHERE guid = '%u'", GetGUIDLow());
@@ -18274,12 +18308,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || !mapEntry->IsDungeon())
{
- sLog->outError("_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName(), GetGUIDLow(), mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName().c_str(), GetGUIDLow(), mapId);
deleteInstance = true;
}
else if (difficulty >= MAX_DIFFICULTY)
{
- sLog->outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName().c_str(), GetGUIDLow(), difficulty, mapId);
deleteInstance = true;
}
else
@@ -18287,12 +18321,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result)
MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty));
if (!mapDiff)
{
- sLog->outError("_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName().c_str(), GetGUIDLow(), difficulty, mapId);
deleteInstance = true;
}
else if (!perm && group)
{
- sLog->outError("_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty);
+ sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty);
deleteInstance = true;
}
}
@@ -18417,7 +18451,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b
bind.save = save;
bind.perm = permanent;
if (!load)
- sLog->outDebug(LOG_FILTER_MAPS, "Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
+ sLog->outDebug(LOG_FILTER_MAPS, "Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName().c_str(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
sScriptMgr->OnPlayerBindToInstance(this, save->GetDifficulty(), save->GetMapId(), permanent);
return &bind;
}
@@ -18558,11 +18592,11 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
uint32 missingItem = 0;
if (ar->item)
{
- if (!HasItemCount(ar->item, 1) &&
- (!ar->item2 || !HasItemCount(ar->item2, 1)))
+ if (!HasItemCount(ar->item) &&
+ (!ar->item2 || !HasItemCount(ar->item2)))
missingItem = ar->item;
}
- else if (ar->item2 && !HasItemCount(ar->item2, 1))
+ else if (ar->item2 && !HasItemCount(ar->item2))
missingItem = ar->item2;
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
@@ -18584,7 +18618,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
leader = ObjectAccessor::FindPlayer(leaderGuid);
if (ar->achievement)
- if (!leader || !leader->GetAchievementMgr().HasAchieved(ar->achievement))
+ if (!leader || !leader->HasAchieved(ar->achievement))
missingAchievement = ar->achievement;
Difficulty target_difficulty = GetDifficulty(mapEntry->IsRaid());
@@ -18633,12 +18667,20 @@ bool Player::CheckInstanceLoginValid()
return sMapMgr->CanPlayerEnter(GetMap()->GetId(), this, true);
}
+bool Player::CheckInstanceCount(uint32 instanceId) const
+{
+ if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR))
+ return true;
+ return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end();
+}
+
+
bool Player::_LoadHomeBind(PreparedQueryResult result)
{
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
- sLog->outError("Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName());
+ sLog->outError(LOG_FILTER_PLAYER, "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName().c_str());
return false;
}
@@ -18686,7 +18728,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
CharacterDatabase.Execute(stmt);
}
- sLog->outStaticDebug("Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f",
+ sLog->outDebug(LOG_FILTER_PLAYER, "Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f",
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
return true;
@@ -18775,7 +18817,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -18886,7 +18928,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -18946,14 +18988,15 @@ void Player::SaveToDB(bool create /*=false*/)
_SaveDailyQuestStatus(trans);
_SaveWeeklyQuestStatus(trans);
_SaveSeasonalQuestStatus(trans);
+ _SaveMonthlyQuestStatus(trans);
_SaveTalents(trans);
_SaveSpells(trans);
_SaveSpellCooldowns(trans);
_SaveActions(trans);
_SaveAuras(trans);
_SaveSkills(trans);
- m_achievementMgr.SaveToDB(trans);
- m_reputationMgr.SaveToDB(trans);
+ m_achievementMgr->SaveToDB(trans);
+ m_reputationMgr->SaveToDB(trans);
_SaveEquipmentSets(trans);
GetSession()->SaveTutorialsData(trans); // changed only while character in game
_SaveGlyphs(trans);
@@ -19130,7 +19173,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
}
else
{
- sLog->outError("Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow());
m_refundableItems.erase(itr);
}
}
@@ -19161,7 +19204,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
uint32 bagTestGUID = 0;
if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot()))
bagTestGUID = test2->GetGUIDLow();
- sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState());
+ sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState());
// according to the test that was just performed nothing should be in this slot, delete
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT);
stmt->setUInt32(0, bagTestGUID);
@@ -19177,7 +19220,7 @@ void Player::_SaveInventory(SQLTransaction& trans)
}
else if (test != item)
{
- sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow());
// save all changes to the item...
if (item->GetState() != ITEM_NEW) // only for existing items, no dupes
item->SaveToDB(trans);
@@ -19448,6 +19491,28 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans)
m_SeasonalQuestChanged = false;
}
+void Player::_SaveMonthlyQuestStatus(SQLTransaction& trans)
+{
+ if (!m_MonthlyQuestChanged || m_monthlyquests.empty())
+ return;
+
+ // we don't need transactions here.
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR);
+ stmt->setUInt32(0, GetGUIDLow());
+ trans->Append(stmt);
+
+ for (QuestSet::const_iterator iter = m_monthlyquests.begin(); iter != m_monthlyquests.end(); ++iter)
+ {
+ uint32 quest_id = *iter;
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS);
+ stmt->setUInt32(0, GetGUIDLow());
+ stmt->setUInt32(1, quest_id);
+ trans->Append(stmt);
+ }
+
+ m_MonthlyQuestChanged = false;
+}
+
void Player::_SaveSkills(SQLTransaction& trans)
{
PreparedStatement* stmt = NULL;
@@ -19587,7 +19652,7 @@ void Player::_SaveStats(SQLTransaction& trans)
void Player::outDebugValues() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_UNITS, LOG_LEVEL_DEBUG))
return;
sLog->outDebug(LOG_FILTER_UNITS, "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA));
@@ -19668,7 +19733,7 @@ void Player::SavePositionInDB(uint32 mapid, float x, float y, float z, float o,
CharacterDatabase.Execute(stmt);
}
-void Player::SetUInt32ValueInArray(Tokens& tokens, uint16 index, uint32 value)
+void Player::SetUInt32ValueInArray(Tokenizer& tokens, uint16 index, uint32 value)
{
char buf[11];
snprintf(buf, 11, "%u", value);
@@ -19907,7 +19972,7 @@ Pet* Player::GetPet() const
return pet;
//there may be a guardian in slot
- //sLog->outError("Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid));
+ //sLog->outError(LOG_FILTER_PLAYER, "Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid));
//const_cast<Player*>(this)->SetPetGUID(0);
}
@@ -20009,10 +20074,10 @@ void Player::StopCastingCharm()
if (GetCharmGUID())
{
- sLog->outCrash("Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId());
if (charm->GetCharmerGUID())
{
- sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID());
ASSERT(false);
}
else
@@ -20025,7 +20090,7 @@ inline void Player::BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std:
*data << uint8(msgtype);
*data << uint32(language);
*data << uint64(GetGUID());
- *data << uint32(language); //language 2.1.0 ?
+ *data << uint32(0); // constant unknown time
*data << uint64(GetGUID());
*data << uint32(text.length() + 1);
*data << text;
@@ -20091,7 +20156,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
}
else if (!isAddonMessage)
// announce to player that player he is whispering to is dnd and cannot receive his message
- ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName(), rPlayer->dndMsg.c_str());
+ ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->dndMsg.c_str());
// rest stuff shouldn't happen in case of addon message
if (isAddonMessage)
@@ -20100,12 +20165,12 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
if (!isAcceptWhispers() && !isGameMaster() && !rPlayer->isGameMaster())
{
SetAcceptWhispers(true);
- ChatHandler(this).SendSysMessage(LANG_COMMAND_WHISPERON);
+ ChatHandler(GetSession()).SendSysMessage(LANG_COMMAND_WHISPERON);
}
// announce to player that player he is whispering to is afk
if (rPlayer->isAFK())
- ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName(), rPlayer->afkMsg.c_str());
+ ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->afkMsg.c_str());
// if player whisper someone, auto turn of dnd to be able to receive an answer
if (isDND() && !rPlayer->isGameMaster())
@@ -20204,7 +20269,7 @@ void Player::PossessSpellInitialize()
if (!charmInfo)
{
- sLog->outError("Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
+ sLog->outError(LOG_FILTER_PLAYER, "Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
return;
}
@@ -20316,7 +20381,7 @@ void Player::CharmSpellInitialize()
CharmInfo* charmInfo = charm->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
+ sLog->outError(LOG_FILTER_PLAYER, "Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
return;
}
@@ -20842,8 +20907,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
//Checks and preparations done, DO FLIGHT
ModifyMoney(-(int32)totalcost);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1);
// prevent stealth flight
//RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
@@ -20895,6 +20960,9 @@ void Player::ContinueTaxiFlight()
sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Restart character %u taxi flight", GetGUIDLow());
uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeam(), true);
+ if (!mountDisplayId)
+ return;
+
uint32 path = m_taxi.GetCurrentTaxiPath();
// search appropriate start path node
@@ -21027,7 +21095,7 @@ void Player::InitDisplayIds()
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
- sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow());
return;
}
@@ -21043,7 +21111,7 @@ void Player::InitDisplayIds()
SetNativeDisplayId(info->displayId_m);
break;
default:
- sLog->outError("Invalid gender %u for player", gender);
+ sLog->outError(LOG_FILTER_PLAYER, "Invalid gender %u for player", gender);
return;
}
}
@@ -21117,7 +21185,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
if (count < 1) count = 1;
// cheating attempt
- if (slot > MAX_BAG_SIZE && slot !=NULL_SLOT)
+ if (slot > MAX_BAG_SIZE && slot != NULL_SLOT)
return false;
if (!isAlive())
@@ -21180,7 +21248,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
if (!iece)
{
- sLog->outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
+ sLog->outError(LOG_FILTER_PLAYER, "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
return false;
}
@@ -21223,7 +21291,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice;
if ((uint32)count > maxCount)
{
- sLog->outError("Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId);
count = (uint8)maxCount;
}
price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT
@@ -21317,7 +21385,7 @@ void Player::UpdateHomebindTime(uint32 time)
data << uint32(m_HomebindTimer);
data << uint32(1);
GetSession()->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_MAPS, "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName(), GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_MAPS, "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName().c_str(), GetGUIDLow());
}
}
@@ -21643,7 +21711,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply)
//cycle all equipped items
for (int slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
{
- //enchants for the slot being socketed are handled by WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
+ //enchants for the slot being socketed are handled by WorldSession::HandleSocketOpcode(WorldPacket& recvData)
if (slot == exceptslot)
continue;
@@ -21703,7 +21771,7 @@ void Player::SetBattlegroundEntryPoint()
if (const WorldSafeLocsEntry* entry = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()))
m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f);
else
- sLog->outError("SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
+ sLog->outError(LOG_FILTER_PLAYER, "SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
}
// If new entry point is not BG or arena set it
else if (!GetMap()->IsBattlegroundOrArena())
@@ -21823,7 +21891,7 @@ bool Player::IsAlwaysDetectableFor(WorldObject const* seer) const
return false;
}
-bool Player::IsVisibleGloballyFor(Player* u) const
+bool Player::IsVisibleGloballyFor(Player const* u) const
{
if (!u)
return false;
@@ -21855,6 +21923,14 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target, std::set
}
template<>
+inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target, std::set<Unit*>& /*v*/)
+{
+ // Don't update only GAMEOBJECT_TYPE_TRANSPORT (or all transports and destructible buildings?)
+ if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT))
+ s64.insert(target->GetGUID());
+}
+
+template<>
inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, Creature* target, std::set<Unit*>& v)
{
s64.insert(target->GetGUID());
@@ -22190,13 +22266,13 @@ void Player::SendInitialPacketsBeforeAddToMap()
GetSession()->SendPacket(&data);
SendInitialActionButtons();
- m_reputationMgr.SendInitialReputations();
- m_achievementMgr.SendAllAchievementData();
+ m_reputationMgr->SendInitialReputations();
+ m_achievementMgr->SendAllAchievementData();
SendEquipmentSetList();
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
- data << uint32(secsToTimeBitFields(sWorld->GetGameTime()));
+ data.AppendPackedTime(sWorld->GetGameTime());
data << float(0.01666667f); // game speed
data << uint32(0); // added in 3.1.2
GetSession()->SendPacket(&data);
@@ -22619,6 +22695,12 @@ void Player::SetSeasonalQuestStatus(uint32 quest_id)
m_SeasonalQuestChanged = true;
}
+void Player::SetMonthlyQuestStatus(uint32 quest_id)
+{
+ m_monthlyquests.insert(quest_id);
+ m_MonthlyQuestChanged = true;
+}
+
void Player::ResetDailyQuestStatus()
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
@@ -22651,6 +22733,16 @@ void Player::ResetSeasonalQuestStatus(uint16 event_id)
m_SeasonalQuestChanged = false;
}
+void Player::ResetMonthlyQuestStatus()
+{
+ if (m_monthlyquests.empty())
+ return;
+
+ m_monthlyquests.clear();
+ // DB data deleted in caller
+ m_MonthlyQuestChanged = false;
+}
+
Battleground* Player::GetBattleground() const
{
if (GetBattlegroundId() == 0)
@@ -22833,7 +22925,7 @@ void Player::SummonIfPossible(bool agree)
m_summon_expire = 0;
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS, 1);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS, 1);
TeleportTo(m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, GetOrientation());
}
@@ -22937,7 +23029,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
break;
}
default:
- sLog->outError("HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass);
+ sLog->outError(LOG_FILTER_PLAYER, "HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass);
break;
}
@@ -23015,7 +23107,7 @@ uint32 Player::GetResurrectionSpellId()
case 27239: spell_id = 27240; break; // rank 6
case 47883: spell_id = 47882; break; // rank 7
default:
- sLog->outError("Unhandled spell %u: S.Resurrection", (*itr)->GetId());
+ sLog->outError(LOG_FILTER_PLAYER, "Unhandled spell %u: S.Resurrection", (*itr)->GetId());
continue;
}
@@ -23030,7 +23122,7 @@ uint32 Player::GetResurrectionSpellId()
}
// Reincarnation (passive spell) // prio: 1 // Glyph of Renewed Life
- if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030, 1)))
+ if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030)))
spell_id = 21169;
return spell_id;
@@ -23382,7 +23474,7 @@ PartyResult Player::CanUninviteFromGroup() const
if (state == LFG_STATE_BOOT)
return ERR_PARTY_LFG_BOOT_IN_PROGRESS;
- if (grp->GetMembersCount() <= sLFGMgr->GetVotesNeeded(gguid))
+ if (grp->GetMembersCount() <= LFG_GROUP_KICK_VOTES_NEEDED)
return ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS;
if (state == LFG_STATE_FINISHED_DUNGEON)
@@ -23415,11 +23507,25 @@ PartyResult Player::CanUninviteFromGroup() const
bool Player::isUsingLfg()
{
- uint64 guid = GetGUID();
- return sLFGMgr->GetState(guid) != LFG_STATE_NONE;
+ return sLFGMgr->GetState(GetGUID()) != LFG_STATE_NONE;
+}
+
+bool Player::inRandomLfgDungeon()
+{
+ if (isUsingLfg())
+ {
+ 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;
+ }
+ }
+ return false;
}
-void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
+void Player::SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup)
{
//we must move references from m_group to m_originalGroup
SetOriginalGroup(GetGroup(), GetSubGroup());
@@ -23429,7 +23535,7 @@ void Player::SetBattlegroundRaid(Group* group, int8 subgroup)
m_group.setSubGroup((uint8)subgroup);
}
-void Player::RemoveFromBattlegroundRaid()
+void Player::RemoveFromBattlegroundOrBattlefieldRaid()
{
//remove existing reference
m_group.unlink();
@@ -23567,11 +23673,11 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
{
if (apply)
{
- sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName(), target->GetEntry(), target->GetTypeId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId());
if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
{
- sLog->outCrash("Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str());
return;
}
@@ -23583,11 +23689,11 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
}
else
{
- sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName());
+ sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName().c_str());
if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID()))
{
- sLog->outCrash("Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName());
+ sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str());
return;
}
@@ -23609,29 +23715,30 @@ WorldObject* Player::GetViewpoint() const
return NULL;
}
-bool Player::CanUseBattlegroundObject()
+bool Player::CanUseBattlegroundObject(GameObject* gameobject)
{
- // TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction)
- // maybe gameobject code should handle that ForceReaction usage
+ // It is possible to call this method with a null pointer, only skipping faction check.
+ if (gameobject)
+ {
+ FactionTemplateEntry const* playerFaction = getFactionTemplateEntry();
+ FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(gameobject->GetUInt32Value(GAMEOBJECT_FACTION));
+
+ if (playerFaction && faction && !playerFaction->IsFriendlyTo(*faction))
+ return false;
+ }
+
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
- return (//InBattleground() && // in battleground - not need, check in other cases
- //!IsMounted() && - not correct, player is dismounted when he clicks on flag
- //player cannot use object when he is invulnerable (immune)
- !isTotalImmune() && // not totally immune
- //i'm not sure if these two are correct, because invisible players should get visible when they click on flag
- !HasStealthAura() && // not stealthed
- !HasInvisibilityAura() && // not invisible
- !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // can't pickup
- isAlive() // live player
-);
+ // Note: Mount, stealth and invisibility will be removed when used
+ return (!isTotalImmune() && // Damage immune
+ !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // Still has recently held flag debuff
+ isAlive()); // Alive
}
bool Player::CanCaptureTowerPoint()
{
- return (!HasStealthAura() && // not stealthed
- !HasInvisibilityAura() && // not invisible
- isAlive() // live player
-);
+ return (!HasStealthAura() && // not stealthed
+ !HasInvisibilityAura() && // not invisible
+ isAlive()); // live player
}
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin)
@@ -24007,9 +24114,9 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
--loot->unlootedCount;
SendNewItem(newitem, uint32(item->count), false, false, true);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count);
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count);
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count);
}
else
SendEquipError(msg, NULL, NULL, item->itemid);
@@ -24064,7 +24171,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill);
if (!pSkill)
{
- sLog->outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill);
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u has skill %u that does not exist.", GetGUIDLow(), skill);
continue;
}
@@ -24082,7 +24189,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
}
if (value == 0)
{
- sLog->outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL);
@@ -24111,7 +24218,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
if (count >= PLAYER_MAX_SKILLS) // client limit
{
- sLog->outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
+ sLog->outError(LOG_FILTER_PLAYER, "Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS);
break;
}
}
@@ -24275,24 +24382,54 @@ void Player::HandleFall(MovementInfo const& movementInfo)
// recheck alive, might have died of EnvironmentalDamage, avoid cases when player die in fact like Spirit of Redemption case
if (isAlive() && final_damage < original_health)
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff*100));
+ UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff*100));
}
//Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
- sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
+ sLog->outDebug(LOG_FILTER_PLAYER, "FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
}
}
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute
}
+void Player::ResetAchievements()
+{
+ m_achievementMgr->Reset();
+}
+
+void Player::SendRespondInspectAchievements(Player* player) const
+{
+ m_achievementMgr->SendRespondInspectAchievements(player);
+}
+
+bool Player::HasAchieved(uint32 achievementId) const
+{
+ return m_achievementMgr->HasAchieved(achievementId);
+}
+
+void Player::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost/* = 0*/)
+{
+ m_achievementMgr->StartTimedAchievement(type, entry, timeLost);
+}
+
+void Player::RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
+{
+ m_achievementMgr->RemoveTimedAchievement(type, entry);
+}
+
+void Player::ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, bool evenIfCriteriaComplete /* = false*/)
+{
+ m_achievementMgr->ResetAchievementCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete);
+}
+
void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= NULL*/)
{
- GetAchievementMgr().UpdateAchievementCriteria(type, miscValue1, miscValue2, unit);
+ m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit);
}
void Player::CompletedAchievement(AchievementEntry const* entry)
{
- GetAchievementMgr().CompletedAchievement(entry);
+ m_achievementMgr->CompletedAchievement(entry);
}
void Player::LearnTalent(uint32 talentId, uint32 talentRank)
@@ -24393,7 +24530,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
uint32 spellid = talentInfo->RankID[talentRank];
if (spellid == 0)
{
- sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
+ sLog->outError(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
return;
}
@@ -24405,7 +24542,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
learnSpell(spellid, false);
AddTalent(spellid, m_activeSpec, true);
- sLog->outDetail("TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec);
+ sLog->outInfo(LOG_FILTER_PLAYER, "TalentID: %u Rank: %u Spell: %u Spec: %u\n", talentId, talentRank, spellid, m_activeSpec);
// update free talent points
SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
@@ -24530,7 +24667,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
uint32 spellid = talentInfo->RankID[talentRank];
if (spellid == 0)
{
- sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
+ sLog->outError(LOG_FILTER_PLAYER, "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank);
return;
}
@@ -24540,7 +24677,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
// learn! (other talent ranks will unlearned at learning)
pet->learnSpell(spellid);
- sLog->outDetail("PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
+ sLog->outInfo(LOG_FILTER_PLAYER, "PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid);
// update free talent points
pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
@@ -24608,11 +24745,11 @@ bool Player::canSeeSpellClickOn(Creature const* c) const
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c));
- if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
- return false;
+ if (sConditionMgr->IsObjectMeetToConditions(info, conds))
+ return true;
}
- return true;
+ return false;
}
void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
@@ -24854,7 +24991,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
if (!found) // something wrong...
{
- sLog->outError("Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index);
return;
}
}
@@ -25316,12 +25453,12 @@ void Player::SetReputation(uint32 factionentry, uint32 value)
{
GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value);
}
-uint32 Player::GetReputation(uint32 factionentry)
+uint32 Player::GetReputation(uint32 factionentry) const
{
return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry));
}
-std::string Player::GetGuildName()
+std::string const& Player::GetGuildName()
{
return sGuildMgr->GetGuildById(GetGuildId())->GetName();
}
@@ -25398,7 +25535,7 @@ bool Player::AddItem(uint32 itemId, uint32 count)
if (count == 0 || dest.empty())
{
// -- TODO: Send to mailbox if no space
- ChatHandler(this).PSendSysMessage("You don't have any space in your bags.");
+ ChatHandler(GetSession()).PSendSysMessage("You don't have any space in your bags.");
return false;
}
@@ -25607,14 +25744,6 @@ bool Player::IsInWhisperWhiteList(uint64 guid)
return false;
}
-bool Player::SetHover(bool enable)
-{
- if (!Unit::SetHover(enable))
- return false;
-
- return true;
-}
-
void Player::SendMovementSetCanFly(bool apply)
{
WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12);
@@ -25656,3 +25785,122 @@ void Player::SendMovementSetFeatherFall(bool apply)
data << uint32(0); //! movement counter
SendDirectMessage(&data);
}
+
+Guild* Player::GetGuild()
+{
+ uint32 guildId = GetGuildId();
+ return guildId ? sGuildMgr->GetGuildById(guildId) : NULL;
+}
+
+Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration)
+{
+ Pet* pet = new Pet(this, petType);
+
+ if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
+ {
+ // Remove Demonic Sacrifice auras (known pet)
+ Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
+ {
+ if ((*itr)->GetMiscValue() == 2228)
+ {
+ RemoveAurasDueToSpell((*itr)->GetId());
+ itr = auraClassScripts.begin();
+ }
+ else
+ ++itr;
+ }
+
+ if (duration > 0)
+ pet->SetDuration(duration);
+
+ return NULL;
+ }
+
+ // petentry == 0 for hunter "call pet" (current pet summoned if any)
+ if (!entry)
+ {
+ delete pet;
+ return NULL;
+ }
+
+ pet->Relocate(x, y, z, ang);
+ if (!pet->IsPositionValid())
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
+ delete pet;
+ return NULL;
+ }
+
+ Map* map = GetMap();
+ uint32 pet_number = sObjectMgr->GeneratePetNumber();
+ if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number))
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry);
+ delete pet;
+ return NULL;
+ }
+
+ pet->SetCreatorGUID(GetGUID());
+ pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
+
+ pet->setPowerType(POWER_MANA);
+ pet->SetUInt32Value(UNIT_NPC_FLAGS, 0);
+ pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
+ pet->InitStatsForLevel(getLevel());
+
+ SetMinion(pet, true);
+
+ switch (petType)
+ {
+ case SUMMON_PET:
+ // this enables pet details window (Shift+P)
+ pet->GetCharmInfo()->SetPetNumber(pet_number, true);
+ pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
+ pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
+ pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
+ pet->SetFullHealth();
+ pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
+ pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case
+ break;
+ default:
+ break;
+ }
+
+ map->AddToMap(pet->ToCreature());
+
+ switch (petType)
+ {
+ case SUMMON_PET:
+ pet->InitPetCreateSpells();
+ pet->InitTalentForLevel();
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ PetSpellInitialize();
+ break;
+ default:
+ break;
+ }
+
+ if (petType == SUMMON_PET)
+ {
+ // Remove Demonic Sacrifice auras (known pet)
+ Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();)
+ {
+ if ((*itr)->GetMiscValue() == 2228)
+ {
+ RemoveAurasDueToSpell((*itr)->GetId());
+ itr = auraClassScripts.begin();
+ }
+ else
+ ++itr;
+ }
+ }
+
+ if (duration > 0)
+ pet->SetDuration(duration);
+
+ //ObjectAccessor::UpdateObjectVisibility(pet);
+
+ return pet;
+}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index b1e4e81900d..cc08e9c2e18 100755..100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -19,35 +19,32 @@
#ifndef _PLAYER_H
#define _PLAYER_H
-#include "AchievementMgr.h"
-#include "Battleground.h"
-#include "Bag.h"
-#include "Common.h"
-#include "DatabaseEnv.h"
-#include "DBCEnums.h"
+#include "DBCStores.h"
#include "GroupReference.h"
-#include "ItemPrototype.h"
-#include "Item.h"
#include "MapReference.h"
-#include "NPCHandler.h"
-#include "Pet.h"
-#include "QuestDef.h"
-#include "ReputationMgr.h"
-#include "Unit.h"
-#include "Util.h" // for Tokens typedef
-#include "WorldSession.h"
-// for template
+#include "Item.h"
+#include "PetDefines.h"
+#include "QuestDef.h"
#include "SpellMgr.h"
+#include "Unit.h"
-#include<string>
-#include<vector>
+#include <string>
+#include <vector>
+struct CreatureTemplate;
struct Mail;
+struct TrainerSpell;
+struct VendorItem;
+
+class AchievementMgr;
+class ReputationMgr;
class Channel;
+class CharacterCreateInfo;
class Creature;
class DynamicObject;
class Group;
+class Guild;
class OutdoorPvP;
class Pet;
class PlayerMenu;
@@ -114,7 +111,7 @@ struct PlayerTalent
// Spell modifier (used for modify other spells)
struct SpellModifier
{
- SpellModifier(Aura* _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {}
+ SpellModifier(Aura* _ownerAura = NULL) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {}
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
@@ -165,6 +162,16 @@ enum ActionButtonType
ACTION_BUTTON_ITEM = 0x80
};
+enum ReputationSource
+{
+ REPUTATION_SOURCE_KILL,
+ REPUTATION_SOURCE_QUEST,
+ REPUTATION_SOURCE_DAILY_QUEST,
+ REPUTATION_SOURCE_WEEKLY_QUEST,
+ REPUTATION_SOURCE_MONTHLY_QUEST,
+ REPUTATION_SOURCE_SPELL
+};
+
#define ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
#define MAX_ACTION_BUTTON_ACTION_VALUE (0x00FFFFFF+1)
@@ -243,9 +250,7 @@ typedef std::list<PlayerCreateInfoAction> PlayerCreateInfoActions;
struct PlayerInfo
{
// existence checked by displayId != 0
- PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL)
- {
- }
+ PlayerInfo() : displayId_m(0), displayId_f(0), levelInfo(NULL) { }
uint32 mapId;
uint32 areaId;
@@ -299,7 +304,7 @@ struct Areas
enum RuneCooldowns
{
RUNE_BASE_COOLDOWN = 10000,
- RUNE_MISS_COOLDOWN = 1500, // cooldown applied on runes when the spell misses
+ RUNE_MISS_COOLDOWN = 1500 // cooldown applied on runes when the spell misses
};
enum RuneType
@@ -399,7 +404,7 @@ enum PlayerFlags
PLAYER_FLAGS_UNK28 = 0x10000000,
PLAYER_FLAGS_UNK29 = 0x20000000,
PLAYER_FLAGS_UNK30 = 0x40000000,
- PLAYER_FLAGS_UNK31 = 0x80000000,
+ PLAYER_FLAGS_UNK31 = 0x80000000
};
// used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
@@ -672,7 +677,7 @@ enum TradeSlots
TRADE_SLOT_COUNT = 7,
TRADE_SLOT_TRADED_COUNT = 6,
TRADE_SLOT_NONTRADED = 6,
- TRADE_SLOT_INVALID = -1,
+ TRADE_SLOT_INVALID = -1
};
enum TransferAbortReason
@@ -692,7 +697,7 @@ enum TransferAbortReason
TRANSFER_ABORT_NOT_FOUND2 = 0x0D, // 3.1
TRANSFER_ABORT_NOT_FOUND3 = 0x0E, // 3.2
TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm.
- TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time.
+ TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10 // Map can't be entered at this time.
};
enum InstanceResetWarningType
@@ -726,20 +731,13 @@ enum RestType
REST_TYPE_IN_CITY = 2
};
-enum DuelCompleteType
-{
- DUEL_INTERRUPTED = 0,
- DUEL_WON = 1,
- DUEL_FLED = 2
-};
-
enum TeleportToOptions
{
TELE_TO_GM_MODE = 0x01,
TELE_TO_NOT_LEAVE_TRANSPORT = 0x02,
TELE_TO_NOT_LEAVE_COMBAT = 0x04,
TELE_TO_NOT_UNSUMMON_PET = 0x08,
- TELE_TO_SPELL = 0x10,
+ TELE_TO_SPELL = 0x10
};
/// Type of environmental damages
@@ -761,7 +759,7 @@ enum PlayerChatTag
CHAT_TAG_DND = 0x02,
CHAT_TAG_GM = 0x04,
CHAT_TAG_COM = 0x08, // Commentator
- CHAT_TAG_DEV = 0x10,
+ CHAT_TAG_DEV = 0x10
};
enum PlayedTimeIndex
@@ -775,39 +773,40 @@ enum PlayedTimeIndex
// used at player loading query list preparing, and later result selection
enum PlayerLoginQueryIndex
{
- PLAYER_LOGIN_QUERY_LOADFROM = 0,
- PLAYER_LOGIN_QUERY_LOADGROUP = 1,
- PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES = 2,
- PLAYER_LOGIN_QUERY_LOADAURAS = 3,
- PLAYER_LOGIN_QUERY_LOADSPELLS = 4,
- PLAYER_LOGIN_QUERY_LOADQUESTSTATUS = 5,
- PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS = 6,
- PLAYER_LOGIN_QUERY_LOADREPUTATION = 7,
- PLAYER_LOGIN_QUERY_LOADINVENTORY = 8,
- PLAYER_LOGIN_QUERY_LOADACTIONS = 9,
- PLAYER_LOGIN_QUERY_LOADMAILCOUNT = 10,
- PLAYER_LOGIN_QUERY_LOADMAILDATE = 11,
- PLAYER_LOGIN_QUERY_LOADSOCIALLIST = 12,
- PLAYER_LOGIN_QUERY_LOADHOMEBIND = 13,
- PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS = 14,
- PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES = 15,
- PLAYER_LOGIN_QUERY_LOADGUILD = 16,
- PLAYER_LOGIN_QUERY_LOADARENAINFO = 17,
- PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 18,
- PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 19,
- PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 20,
- PLAYER_LOGIN_QUERY_LOADBGDATA = 21,
- PLAYER_LOGIN_QUERY_LOADGLYPHS = 22,
- PLAYER_LOGIN_QUERY_LOADTALENTS = 23,
- PLAYER_LOGIN_QUERY_LOADACCOUNTDATA = 24,
- PLAYER_LOGIN_QUERY_LOADSKILLS = 25,
- PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS = 26,
- PLAYER_LOGIN_QUERY_LOADRANDOMBG = 27,
- PLAYER_LOGIN_QUERY_LOADBANNED = 28,
- PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW = 29,
- PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES = 30,
- PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS = 31,
- MAX_PLAYER_LOGIN_QUERY,
+ PLAYER_LOGIN_QUERY_LOAD_FROM = 0,
+ PLAYER_LOGIN_QUERY_LOAD_GROUP = 1,
+ PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES = 2,
+ PLAYER_LOGIN_QUERY_LOAD_AURAS = 3,
+ PLAYER_LOGIN_QUERY_LOAD_SPELLS = 4,
+ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS = 5,
+ PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS = 6,
+ PLAYER_LOGIN_QUERY_LOAD_REPUTATION = 7,
+ PLAYER_LOGIN_QUERY_LOAD_INVENTORY = 8,
+ PLAYER_LOGIN_QUERY_LOAD_ACTIONS = 9,
+ PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT = 10,
+ PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE = 11,
+ PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST = 12,
+ PLAYER_LOGIN_QUERY_LOAD_HOME_BIND = 13,
+ PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS = 14,
+ PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES = 15,
+ PLAYER_LOGIN_QUERY_LOAD_GUILD = 16,
+ PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO = 17,
+ PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS = 18,
+ PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS = 19,
+ PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS = 20,
+ PLAYER_LOGIN_QUERY_LOAD_BG_DATA = 21,
+ PLAYER_LOGIN_QUERY_LOAD_GLYPHS = 22,
+ PLAYER_LOGIN_QUERY_LOAD_TALENTS = 23,
+ PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA = 24,
+ PLAYER_LOGIN_QUERY_LOAD_SKILLS = 25,
+ PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS = 26,
+ PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG = 27,
+ PLAYER_LOGIN_QUERY_LOAD_BANNED = 28,
+ PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW = 29,
+ PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES = 30,
+ PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS = 31,
+ PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS = 32,
+ MAX_PLAYER_LOGIN_QUERY
};
enum PlayerDelayedOperations
@@ -835,17 +834,6 @@ struct InstancePlayerBind
InstancePlayerBind() : save(NULL), perm(false) {}
};
-enum DungeonStatusFlag
-{
- DUNGEON_STATUSFLAG_NORMAL = 0x01,
- DUNGEON_STATUSFLAG_HEROIC = 0x02,
-
- RAID_STATUSFLAG_10MAN_NORMAL = 0x01,
- RAID_STATUSFLAG_25MAN_NORMAL = 0x02,
- RAID_STATUSFLAG_10MAN_HEROIC = 0x04,
- RAID_STATUSFLAG_25MAN_HEROIC = 0x08
-};
-
struct AccessRequirement
{
uint8 levelMin;
@@ -896,6 +884,16 @@ enum PlayerRestState
REST_STATE_RAF_LINKED = 0x06
};
+enum PlayerCommandStates
+{
+ CHEAT_NONE = 0x00,
+ CHEAT_GOD = 0x01,
+ CHEAT_CASTTIME = 0x02,
+ CHEAT_COOLDOWN = 0x04,
+ CHEAT_POWER = 0x08,
+ CHEAT_WATERWALK = 0x10
+};
+
class PlayerTaxi
{
public:
@@ -903,7 +901,7 @@ class PlayerTaxi
~PlayerTaxi() {}
// Nodes
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level);
- void LoadTaxiMask(const char* data);
+ void LoadTaxiMask(std::string const& data);
bool IsTaximaskNodeKnown(uint32 nodeidx) const
{
@@ -926,7 +924,7 @@ class PlayerTaxi
void AppendTaximaskTo(ByteBuffer& data, bool all);
// Destinations
- bool LoadTaxiDestinationsFromString(const std::string& values, uint32 team);
+ bool LoadTaxiDestinationsFromString(std::string const& values, uint32 team);
std::string SaveTaxiDestinationsToString();
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
@@ -981,7 +979,7 @@ class TradeData
public: // constructors
TradeData(Player* player, Player* trader) :
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
- m_money(0), m_spell(0) {}
+ m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); }
Player* GetTrader() const { return m_trader; }
TradeData* GetTraderData() const;
@@ -1069,9 +1067,6 @@ class Player : public Unit, public GridObject<Player>
void CleanupsBeforeDelete(bool finalCleanup = true);
- static UpdateMask updateVisualBits;
- static void InitVisibleBits();
-
void AddToWorld();
void RemoveFromWorld();
@@ -1151,6 +1146,11 @@ class Player : public Unit, public GridObject<Player>
void InitStatsForLevel(bool reapplyMods = false);
+ // .cheat command related
+ bool GetCommandStatus(uint32 command) const { return _activeCheats & command; }
+ void SetCommandStatusOn(uint32 command) { _activeCheats |= command; }
+ void SetCommandStatusOff(uint32 command) { _activeCheats &= ~command; }
+
// Played Time Stuff
time_t m_logintime;
time_t m_Last_tick;
@@ -1188,11 +1188,11 @@ class Player : public Unit, public GridObject<Player>
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
- void Say(const std::string& text, const uint32 language);
- void Yell(const std::string& text, const uint32 language);
- void TextEmote(const std::string& text);
- void Whisper(const std::string& text, const uint32 language, uint64 receiver);
- void BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std::string& text, uint32 language) const;
+ void Say(std::string const& text, const uint32 language);
+ void Yell(std::string const& text, const uint32 language);
+ void TextEmote(std::string const& text);
+ void Whisper(std::string const& text, const uint32 language, uint64 receiver);
+ void BuildPlayerChat(WorldPacket* data, uint8 msgtype, std::string const& text, uint32 language) const;
/*********************************************************/
/*** STORAGE SYSTEM ***/
@@ -1229,7 +1229,7 @@ class Player : public Unit, public GridObject<Player>
bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos);
uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
- bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
+ bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const;
bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellInfo const* spellInfo) const;
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
@@ -1246,7 +1246,6 @@ class Player : public Unit, public GridObject<Player>
return EQUIP_ERR_ITEM_NOT_FOUND;
uint32 count = pItem->GetCount();
return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
-
}
InventoryResult CanStoreItems(Item** pItem, int count) const;
InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
@@ -1409,6 +1408,7 @@ class Player : public Unit, public GridObject<Player>
bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg);
bool SatisfyQuestDay(Quest const* qInfo, bool msg);
bool SatisfyQuestWeek(Quest const* qInfo, bool msg);
+ bool SatisfyQuestMonth(Quest const* qInfo, bool msg);
bool SatisfyQuestSeasonal(Quest const* qInfo, bool msg);
bool GiveQuestSourceItem(Quest const* quest);
bool TakeQuestSourceItem(uint32 questId, bool msg);
@@ -1420,9 +1420,11 @@ class Player : public Unit, public GridObject<Player>
void SetDailyQuestStatus(uint32 quest_id);
void SetWeeklyQuestStatus(uint32 quest_id);
+ void SetMonthlyQuestStatus(uint32 quest_id);
void SetSeasonalQuestStatus(uint32 quest_id);
void ResetDailyQuestStatus();
void ResetWeeklyQuestStatus();
+ void ResetMonthlyQuestStatus();
void ResetSeasonalQuestStatus(uint16 event_id);
uint16 FindQuestSlot(uint32 quest_id) const;
@@ -1503,11 +1505,11 @@ class Player : public Unit, public GridObject<Player>
/*********************************************************/
bool LoadFromDB(uint32 guid, SQLQueryHolder *holder);
- bool isBeingLoaded() const { return GetSession()->PlayerLoading();}
+ bool isBeingLoaded() const;
void Initialize(uint32 guid);
- static uint32 GetUInt32ValueFromArray(Tokens const& data, uint16 index);
- static float GetFloatValueFromArray(Tokens const& data, uint16 index);
+ static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index);
+ static float GetFloatValueFromArray(Tokenizer const& data, uint16 index);
static uint32 GetZoneIdFromDB(uint64 guid);
static uint32 GetLevelFromDB(uint64 guid);
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
@@ -1522,8 +1524,8 @@ class Player : public Unit, public GridObject<Player>
void SaveInventoryAndGoldToDB(SQLTransaction& trans); // fast save function for item/money cheating preventing
void SaveGoldToDB(SQLTransaction& trans);
- static void SetUInt32ValueInArray(Tokens& data, uint16 index, uint32 value);
- static void SetFloatValueInArray(Tokens& data, uint16 index, float value);
+ static void SetUInt32ValueInArray(Tokenizer& data, uint16 index, uint32 value);
+ static void SetFloatValueInArray(Tokenizer& data, uint16 index, float value);
static void Customize(uint64 guid, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair);
static void SavePositionInDB(uint32 mapid, float x, float y, float z, float o, uint32 zone, uint64 guid);
@@ -1651,8 +1653,8 @@ class Player : public Unit, public GridObject<Player>
void AddTemporarySpell(uint32 spellId);
void RemoveTemporarySpell(uint32 spellId);
void SetReputation(uint32 factionentry, uint32 value);
- uint32 GetReputation(uint32 factionentry);
- std::string GetGuildName();
+ uint32 GetReputation(uint32 factionentry) const;
+ std::string const& GetGuildName();
uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); }
void SetFreeTalentPoints(uint32 points);
bool resetTalents(bool no_cost = false);
@@ -1810,9 +1812,10 @@ class Player : public Unit, public GridObject<Player>
void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); }
void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
- uint8 GetRank() { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
+ uint8 GetRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
- uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); }
+ uint32 GetGuildId() const { return GetUInt32Value(PLAYER_GUILDID); }
+ Guild* GetGuild();
static uint32 GetGuildIdFromDB(uint64 guid);
static uint8 GetRankFromDB(uint64 guid);
int GetGuildIdInvited() { return m_GuildIdInvited; }
@@ -2026,12 +2029,14 @@ class Player : public Unit, public GridObject<Player>
uint8 GetGrantableLevels() { return m_grantableLevels; }
void SetGrantableLevels(uint8 val) { m_grantableLevels = val; }
- ReputationMgr& GetReputationMgr() { return m_reputationMgr; }
- ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; }
+ ReputationMgr& GetReputationMgr() { return *m_reputationMgr; }
+ ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; }
ReputationRank GetReputationRank(uint32 faction_id) const;
void RewardReputation(Unit* victim, float rate);
void RewardReputation(Quest const* quest);
+ int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus = false);
+
void UpdateSkillsForLevel();
void UpdateSkillsToMaxSkillsForLevel(); // for .levelup
void ModifySkillBonus(uint32 skillid, int32 val, bool talent);
@@ -2053,9 +2058,9 @@ class Player : public Unit, public GridObject<Player>
inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; }
- void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0);
- uint16 GetDrunkValue() const { return m_drunk; }
- static DrunkenState GetDrunkenstateByValue(uint16 value);
+ void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
+ uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); }
+ static DrunkenState GetDrunkenstateByValue(uint8 value);
uint32 GetDeathTimer() const { return m_deathTimer; }
uint32 GetCorpseReclaimDelay(bool pvp) const;
@@ -2113,6 +2118,7 @@ class Player : public Unit, public GridObject<Player>
void SendUpdateWorldState(uint32 Field, uint32 Value);
void SendDirectMessage(WorldPacket* data);
void SendBGWeekendWorldStates();
+ void SendBattlefieldWorldStates();
void SendAurasForTarget(Unit* target);
@@ -2226,7 +2232,7 @@ class Player : public Unit, public GridObject<Player>
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
bool isTotalImmunity();
- bool CanUseBattlegroundObject();
+ bool CanUseBattlegroundObject(GameObject* gameobject);
bool isTotalImmune();
bool CanCaptureTowerPoint();
@@ -2289,8 +2295,6 @@ class Player : public Unit, public GridObject<Player>
m_mover->m_movedPlayer = this;
}
- bool SetHover(bool enable);
-
void SetSeer(WorldObject* target) { m_seer = target; }
void SetViewpoint(WorldObject* target, bool apply);
WorldObject* GetViewpoint() const;
@@ -2308,7 +2312,7 @@ class Player : public Unit, public GridObject<Player>
float m_recallO;
void SaveRecallPosition();
- void SetHomebind(WorldLocation const& loc, uint32 area_id);
+ void SetHomebind(WorldLocation const& loc, uint32 areaId);
// Homebind coordinates
uint32 m_homebindMapId;
@@ -2327,7 +2331,7 @@ class Player : public Unit, public GridObject<Player>
bool IsNeverVisible() const;
- bool IsVisibleGloballyFor(Player* player) const;
+ bool IsVisibleGloballyFor(Player const* player) const;
void SendInitialVisiblePackets(Unit* target);
void UpdateObjectVisibility(bool forced = true);
@@ -2345,6 +2349,7 @@ class Player : public Unit, public GridObject<Player>
void RemoveAtLoginFlag(AtLoginFlags flags, bool persist = false);
bool isUsingLfg();
+ bool inRandomLfgDungeon();
typedef std::set<uint32> DFQuestsDoneList;
DFQuestsDoneList m_DFQuests;
@@ -2385,12 +2390,7 @@ class Player : public Unit, public GridObject<Player>
static void ConvertInstancesToGroup(Player* player, Group* group, bool switchLeader);
bool Satisfy(AccessRequirement const* ar, uint32 target_map, bool report = false);
bool CheckInstanceLoginValid();
- bool CheckInstanceCount(uint32 instanceId) const
- {
- if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR))
- return true;
- return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end();
- }
+ bool CheckInstanceCount(uint32 instanceId) const;
void AddInstanceEnterTime(uint32 instanceId, time_t enterTime)
{
@@ -2420,9 +2420,9 @@ class Player : public Unit, public GridObject<Player>
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
- // Battleground Group System
- void SetBattlegroundRaid(Group* group, int8 subgroup = -1);
- void RemoveFromBattlegroundRaid();
+ // Battleground / Battlefield Group System
+ void SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup = -1);
+ void RemoveFromBattlegroundOrBattlefieldRaid();
Group* GetOriginalGroup() { return m_originalGroup.getTarget(); }
GroupReference& GetOriginalGroupRef() { return m_originalGroup; }
uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
@@ -2460,9 +2460,14 @@ class Player : public Unit, public GridObject<Player>
void AddRunePower(uint8 index);
void InitRunes();
- AchievementMgr& GetAchievementMgr() { return m_achievementMgr; }
- AchievementMgr const& GetAchievementMgr() const { return m_achievementMgr; }
+ void SendRespondInspectAchievements(Player* player) const;
+ bool HasAchieved(uint32 achievementId) const;
+ void ResetAchievements();
+ void CheckAllAchievementCriteria();
+ void ResetAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, bool evenIfCriteriaComplete = false);
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 = 0, uint32 miscValue2 = 0, Unit* unit = NULL);
+ void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
+ void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
void CompletedAchievement(AchievementEntry const* entry);
bool HasTitle(uint32 bitIndex);
@@ -2563,6 +2568,7 @@ class Player : public Unit, public GridObject<Player>
typedef UNORDERED_MAP<uint32,SeasonalQuestSet> SeasonalEventQuestMap;
QuestSet m_timedquests;
QuestSet m_weeklyquests;
+ QuestSet m_monthlyquests;
SeasonalEventQuestMap m_seasonalquests;
uint64 m_divider;
@@ -2584,6 +2590,7 @@ class Player : public Unit, public GridObject<Player>
void _LoadQuestStatusRewarded(PreparedQueryResult result);
void _LoadDailyQuestStatus(PreparedQueryResult result);
void _LoadWeeklyQuestStatus(PreparedQueryResult result);
+ void _LoadMonthlyQuestStatus(PreparedQueryResult result);
void _LoadSeasonalQuestStatus(PreparedQueryResult result);
void _LoadRandomBGStatus(PreparedQueryResult result);
void _LoadGroup(PreparedQueryResult result);
@@ -2610,6 +2617,7 @@ class Player : public Unit, public GridObject<Player>
void _SaveQuestStatus(SQLTransaction& trans);
void _SaveDailyQuestStatus(SQLTransaction& trans);
void _SaveWeeklyQuestStatus(SQLTransaction& trans);
+ void _SaveMonthlyQuestStatus(SQLTransaction& trans);
void _SaveSeasonalQuestStatus(SQLTransaction& trans);
void _SaveSkills(SQLTransaction& trans);
void _SaveSpells(SQLTransaction& trans);
@@ -2620,9 +2628,6 @@ class Player : public Unit, public GridObject<Player>
void _SaveStats(SQLTransaction& trans);
void _SaveInstanceTimeRestrictions(SQLTransaction& trans);
- void _SetCreateBits(UpdateMask* updateMask, Player* target) const;
- void _SetUpdateBits(UpdateMask* updateMask, Player* target) const;
-
/*********************************************************/
/*** ENVIRONMENTAL SYSTEM ***/
/*********************************************************/
@@ -2722,11 +2727,11 @@ class Player : public Unit, public GridObject<Player>
bool m_DailyQuestChanged;
bool m_WeeklyQuestChanged;
+ bool m_MonthlyQuestChanged;
bool m_SeasonalQuestChanged;
time_t m_lastDailyQuestTime;
uint32 m_drunkTimer;
- uint16 m_drunk;
uint32 m_weaponChangeTimer;
uint32 m_zoneUpdateId;
@@ -2806,7 +2811,6 @@ class Player : public Unit, public GridObject<Player>
// know currencies are not removed at any point (0 displayed)
void AddKnownCurrency(uint32 itemId);
- int32 CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool for_quest, bool noQuestBonus = false);
void AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questStatusData);
bool IsCanDelayTeleport() const { return m_bCanDelayTeleport; }
@@ -2846,8 +2850,8 @@ class Player : public Unit, public GridObject<Player>
uint32 m_temporaryUnsummonedPetNumber;
uint32 m_oldpetspell;
- AchievementMgr m_achievementMgr;
- ReputationMgr m_reputationMgr;
+ AchievementMgr* m_achievementMgr;
+ ReputationMgr* m_reputationMgr;
SpellCooldowns m_spellCooldowns;
@@ -2861,6 +2865,8 @@ class Player : public Unit, public GridObject<Player>
InstanceTimeMap _instanceResetTimes;
uint32 _pendingBindId;
uint32 _pendingBindTimer;
+
+ uint32 _activeCheats;
};
void AddItemsSetItem(Player*player, Item* item);
@@ -2902,7 +2908,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
continue;
- totalmul += CalculatePctN(1.0f, mod->value);
+ totalmul += CalculatePct(1.0f, mod->value);
}
DropModCharge(mod, spell);
diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp
index 1ded8cda81b..bc16a7f42a2 100755..100644
--- a/src/server/game/Entities/Player/SocialMgr.cpp
+++ b/src/server/game/Entities/Player/SocialMgr.cpp
@@ -182,9 +182,9 @@ void PlayerSocial::SendSocialList(Player* player)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST");
}
-bool PlayerSocial::HasFriend(uint32 friend_guid)
+bool PlayerSocial::HasFriend(uint32 friendGuid)
{
- PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid);
+ PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friendGuid);
if (itr != m_playerSocialMap.end())
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
return false;
@@ -231,7 +231,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
- if (pFriend && pFriend->GetName() &&
+ if (pFriend &&
(!AccountMgr::IsPlayerAccount(security) ||
((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) &&
pFriend->IsVisibleGloballyFor(player))
@@ -249,18 +249,18 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket* data)
{
- data->Initialize(SMSG_FRIEND_STATUS, 5);
+ data->Initialize(SMSG_FRIEND_STATUS, 9);
*data << uint8(result);
*data << uint64(guid);
}
-void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, uint32 friend_guid, bool broadcast)
+void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, uint32 friendGuid, bool broadcast)
{
FriendInfo fi;
WorldPacket data;
- MakeFriendStatusPacket(result, friend_guid, &data);
- GetFriendInfo(player, friend_guid, fi);
+ MakeFriendStatusPacket(result, friendGuid, &data);
+ GetFriendInfo(player, friendGuid, fi);
switch (result)
{
case FRIEND_ADDED_OFFLINE:
@@ -329,7 +329,7 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid)
if (!result)
return social;
- uint32 friend_guid = 0;
+ uint32 friendGuid = 0;
uint8 flags = 0;
std::string note = "";
@@ -337,11 +337,11 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid)
{
Field* fields = result->Fetch();
- friend_guid = fields[0].GetUInt32();
+ friendGuid = fields[0].GetUInt32();
flags = fields[1].GetUInt8();
note = fields[2].GetString();
- social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note);
+ social->m_playerSocialMap[friendGuid] = FriendInfo(flags, note);
// client's friends list and ignore list limit
if (social->m_playerSocialMap.size() >= (SOCIALMGR_FRIEND_LIMIT + SOCIALMGR_IGNORE_LIMIT))
@@ -351,4 +351,3 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid)
return social;
}
-
diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h
index 3c7d13070fa..85daf369f69 100755..100644
--- a/src/server/game/Entities/Player/SocialMgr.h
+++ b/src/server/game/Entities/Player/SocialMgr.h
@@ -54,25 +54,11 @@ struct FriendInfo
uint8 Class;
std::string Note;
- FriendInfo()
- {
- Status = FRIEND_STATUS_OFFLINE;
- Flags = 0;
- Area = 0;
- Level = 0;
- Class = 0;
- Note = "";
- }
-
- FriendInfo(uint8 flags, const std::string& note)
- {
- Status = FRIEND_STATUS_OFFLINE;
- Flags = flags;
- Area = 0;
- Level = 0;
- Class = 0;
- Note = note;
- }
+ FriendInfo() : Status(FRIEND_STATUS_OFFLINE), Flags(0), Area(0), Level(0), Class(0), Note()
+ { }
+
+ FriendInfo(uint8 flags, std::string const& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note)
+ { }
};
typedef std::map<uint32, FriendInfo> PlayerSocialMap;
@@ -161,4 +147,3 @@ class SocialMgr
#define sSocialMgr ACE_Singleton<SocialMgr, ACE_Null_Mutex>::instance()
#endif
-
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 80c5de35e59..4d726181c4f 100755..100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -17,13 +17,14 @@
*/
#include "Totem.h"
-#include "WorldPacket.h"
#include "Log.h"
#include "Group.h"
-#include "Player.h"
#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
+#include "WorldPacket.h"
Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner, false)
{
@@ -86,7 +87,7 @@ void Totem::InitStats(uint32 duration)
void Totem::InitSummon()
{
- if (m_type == TOTEM_PASSIVE)
+ if (m_type == TOTEM_PASSIVE && GetSpell())
{
CastSpell(this, GetSpell(), true);
}
@@ -96,10 +97,16 @@ void Totem::InitSummon()
CastSpell(this, GetSpell(1), true);
}
-void Totem::UnSummon()
+void Totem::UnSummon(uint32 msTime)
{
+ if (msTime)
+ {
+ m_Events.AddEvent(new ForcedUnsummonDelayEvent(*this), m_Events.CalculateTime(msTime));
+ return;
+ }
+
CombatStop();
- RemoveAurasDueToSpell(GetSpell());
+ RemoveAurasDueToSpell(GetSpell(), GetGUID());
// clear owner's totem slot
for (int i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i)
@@ -111,7 +118,11 @@ void Totem::UnSummon()
}
}
- m_owner->RemoveAurasDueToSpell(GetSpell());
+ m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID());
+
+ // Remove Sentry Totem Aura
+ if (GetEntry() == SENTRY_TOTEM_ENTRY)
+ m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
//remove aura all party members too
if (Player* owner = m_owner->ToPlayer())
@@ -127,7 +138,7 @@ void Totem::UnSummon()
{
Player* target = itr->getSource();
if (target && group->SameSubGroup(owner, target))
- target->RemoveAurasDueToSpell(GetSpell());
+ target->RemoveAurasDueToSpell(GetSpell(), GetGUID());
}
}
}
diff --git a/src/server/game/Entities/Totem/Totem.h b/src/server/game/Entities/Totem/Totem.h
index c33b8776660..6271253498d 100755..100644
--- a/src/server/game/Entities/Totem/Totem.h
+++ b/src/server/game/Entities/Totem/Totem.h
@@ -27,8 +27,10 @@ enum TotemType
TOTEM_ACTIVE = 1,
TOTEM_STATUE = 2 // copied straight from MaNGOS, may need more implementation to work
};
+// Some Totems cast spells that are not in creature DB
+#define SENTRY_TOTEM_SPELLID 6495
-#define SENTRY_TOTEM_ENTRY 3968
+#define SENTRY_TOTEM_ENTRY 3968
class Totem : public Minion
{
@@ -38,7 +40,7 @@ class Totem : public Minion
void Update(uint32 time);
void InitStats(uint32 duration);
void InitSummon();
- void UnSummon();
+ void UnSummon(uint32 msTime = 0);
uint32 GetSpell(uint8 slot = 0) const { return m_spells[slot]; }
uint32 GetTotemDuration() const { return m_duration; }
void SetTotemDuration(uint32 duration) { m_duration = duration; }
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 95c6d308626..6de359c67dd 100755..100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -26,6 +26,7 @@
#include "DBCStores.h"
#include "World.h"
#include "GameObjectAI.h"
+#include "Player.h"
void MapManager::LoadTransports()
{
@@ -35,8 +36,7 @@ void MapManager::LoadTransports()
if (!result)
{
- sLog->outString(">> Loaded 0 transports. DB table `transports` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transports. DB table `transports` is empty!");
return;
}
@@ -56,17 +56,17 @@ void MapManager::LoadTransports()
if (!goinfo)
{
- sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
continue;
}
if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
{
- sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
continue;
}
- // sLog->outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
+ // sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
std::set<uint32> mapsUsed;
@@ -74,7 +74,7 @@ void MapManager::LoadTransports()
if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
// skip transports with empty waypoints list
{
- sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
+ sLog->outError(LOG_FILTER_SQL, "Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
delete t;
continue;
}
@@ -116,13 +116,12 @@ void MapManager::LoadTransports()
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
std::string name = fields[2].GetString();
- sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);
+ sLog->outError(LOG_FILTER_SQL, "Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);
}
while (result->NextRow());
}
- sLog->outString(">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void MapManager::LoadTransportNPCs()
@@ -134,8 +133,7 @@ void MapManager::LoadTransportNPCs()
if (!result)
{
- sLog->outString(">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
return;
}
@@ -166,8 +164,7 @@ void MapManager::LoadTransportNPCs()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0),
@@ -197,7 +194,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
if (!IsPositionValid())
{
- sLog->outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
+ sLog->outError(LOG_FILTER_TRANSPORTS, "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, x, y);
return false;
}
@@ -208,7 +205,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
if (!goinfo)
{
- sLog->outErrorDb("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
+ sLog->outError(LOG_FILTER_SQL, "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
return false;
}
@@ -354,7 +351,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
}
// for (int i = 0; i < keyFrames.size(); ++i) {
- // sLog->outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, "%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo);
// }
// Now we're completely set up; we can move along the length of each waypoint at 100 ms intervals
@@ -397,7 +394,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
cM = keyFrames[i].node->mapid;
}
- // sLog->outString("T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, "T: %d, D: %f, x: %f, y: %f, z: %f", t, d, newX, newY, newZ);
if (teleport)
m_WayPoints[t] = WayPoint(keyFrames[i].node->mapid, newX, newY, newZ, teleport, 0);
}
@@ -445,14 +442,14 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids)
m_WayPoints[t] = WayPoint(keyFrames[i + 1].node->mapid, keyFrames[i + 1].node->x, keyFrames[i + 1].node->y, keyFrames[i + 1].node->z, teleport,
0, keyFrames[i + 1].node->arrivalEventID, keyFrames[i + 1].node->departureEventID);
- // sLog->outString("T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, "T: %d, x: %f, y: %f, z: %f, t:%d", t, pos.x, pos.y, pos.z, teleport);
t += keyFrames[i + 1].node->delay * 1000;
}
uint32 timer = t;
- // sLog->outDetail(" Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer);
+ // sLog->outInfo(LOG_FILTER_TRANSPORTS, " Generated %lu waypoints, total time %u.", (unsigned long)m_WayPoints.size(), timer);
m_curr = m_WayPoints.begin();
m_next = GetNextWayPoint();
@@ -511,7 +508,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
bool Transport::AddPassenger(Player* passenger)
{
if (m_passengers.insert(passenger).second)
- sLog->outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
+ sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s boarded transport %s.", passenger->GetName().c_str(), GetName().c_str());
sScriptMgr->OnAddPassenger(this, passenger);
return true;
@@ -520,7 +517,7 @@ bool Transport::AddPassenger(Player* passenger)
bool Transport::RemovePassenger(Player* passenger)
{
if (m_passengers.erase(passenger))
- sLog->outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName());
+ sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str());
sScriptMgr->OnRemovePassenger(this, passenger);
return true;
@@ -531,7 +528,7 @@ void Transport::Update(uint32 p_diff)
if (!AI())
{
if (!AIM_Initialize())
- sLog->outError("Could not initialize GameObjectAI for Transport");
+ sLog->outError(LOG_FILTER_TRANSPORTS, "Could not initialize GameObjectAI for Transport");
} else
AI()->UpdateAI(p_diff);
@@ -609,7 +606,7 @@ void Transport::DoEventIfAny(WayPointMap::value_type const& node, bool departure
{
if (uint32 eventid = departure ? node.second.departureEventID : node.second.arrivalEventID)
{
- sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.first, GetName());
+ sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.first, GetName().c_str());
GetMap()->ScriptsStart(sEventScripts, eventid, this, this);
EventInform(eventid);
}
@@ -650,8 +647,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim);
creature->Relocate(
- GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))),
- GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())),
+ GetPositionX() + (x * std::cos(GetOrientation()) + y * std::sin(GetOrientation() + float(M_PI))),
+ GetPositionY() + (y * std::cos(GetOrientation()) + x * std::sin(GetOrientation())),
z + GetPositionZ(),
o + GetOrientation());
@@ -660,7 +657,7 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y,
if (!creature->IsPositionValid())
{
- sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
+ sLog->outError(LOG_FILTER_TRANSPORTS, "Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
delete creature;
return 0;
}
@@ -684,8 +681,8 @@ 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 * cos(transport_o) - mi->t_pos.m_positionY*sin(transport_o));
- float transport_y = mi->pos.m_positionY - (mi->t_pos.m_positionY * cos(transport_o) + mi->t_pos.m_positionX*sin(transport_o));
+ 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);
@@ -708,24 +705,22 @@ void Transport::UpdateNPCPositions()
}
}
-//! This method transforms supplied transport offsets into global coordinates
void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
{
float inx = x, iny = y, inz = z, ino = o;
o = GetOrientation() + ino;
- x = GetPositionX() + (inx * cos(GetOrientation()) + iny * sin(GetOrientation() + M_PI));
- y = GetPositionY() + (iny * cos(GetOrientation()) + inx * sin(GetOrientation()));
+ x = GetPositionX() + inx * std::cos(GetOrientation()) - iny * std::sin(GetOrientation());
+ y = GetPositionY() + iny * std::cos(GetOrientation()) + inx * std::sin(GetOrientation());
z = GetPositionZ() + inz;
}
-//! This method transforms supplied global coordinates into local offsets
void Transport::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetOrientation();
z -= GetPositionZ();
- y -= GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
- x -= GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
+ y -= GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
+ x -= GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
float inx = x, iny = y;
- y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) - sin(GetOrientation() + M_PI) * tan(GetOrientation()));
- x = (inx - iny * sin(GetOrientation() + M_PI) / cos(GetOrientation())) / (cos(GetOrientation()) - tan(GetOrientation()) * sin(GetOrientation() + M_PI));
+ y = (iny - inx * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
+ x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + std::sin(GetOrientation()) * tan(GetOrientation()));
}
diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h
index 4b0c42c9071..8fd12b50695 100755..100644
--- a/src/server/game/Entities/Transport/Transport.h
+++ b/src/server/game/Entities/Transport/Transport.h
@@ -20,12 +20,13 @@
#define TRANSPORTS_H
#include "GameObject.h"
+#include "VehicleDefines.h"
#include <map>
#include <set>
#include <string>
-class Transport : public GameObject
+class Transport : public GameObject, public TransportBase
{
public:
Transport(uint32 period, uint32 script);
@@ -47,8 +48,13 @@ class Transport : public GameObject
uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0);
void UpdatePosition(MovementInfo* mi);
void UpdateNPCPositions();
+
+ /// This method transforms supplied transport offsets into global coordinates
void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+
+ /// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
+
void BuildStartMovePacket(Map const* targetMap);
void BuildStopMovePacket(Map const* targetMap);
uint32 GetScriptId() const { return ScriptId; }
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5cec0cf4375..2a17367e7a8 100755..100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -78,16 +78,16 @@ bool Player::UpdateStats(Stats stat)
UpdateAllCritPercentages();
UpdateDodgePercentage();
break;
- case STAT_STAMINA: UpdateMaxHealth(); break;
+ case STAT_STAMINA:
+ UpdateMaxHealth();
+ break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
UpdateAllSpellCritChances();
UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
break;
-
case STAT_SPIRIT:
break;
-
default:
break;
}
@@ -213,7 +213,7 @@ void Player::UpdateArmor()
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
{
if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
- value += CalculatePctN(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
+ value += CalculatePct(GetStat(Stats((*i)->GetMiscValueB())), (*i)->GetAmount());
}
value *= GetModifierValue(unitMod, TOTAL_PCT);
@@ -359,7 +359,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
switch (aurEff->GetEffIndex())
{
case 0: // Predatory Strikes (effect 0)
- mLevelMult = CalculatePctN(1.0f, aurEff->GetAmount());
+ mLevelMult = CalculatePct(1.0f, aurEff->GetAmount());
break;
case 1: // Predatory Strikes (effect 1)
if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND])
@@ -369,7 +369,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
if (!proto)
continue;
- weapon_bonus = CalculatePctN(float(proto->getFeralBonus()), aurEff->GetAmount());
+ weapon_bonus = CalculatePct(float(proto->getFeralBonus()), aurEff->GetAmount());
}
break;
default:
@@ -421,14 +421,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
{
AuraEffectList const& mRAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
- attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
+ attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
}
}
else
{
AuraEffectList const& mAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
- attPowerMod += CalculatePctN(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
+ attPowerMod += CalculatePct(GetStat(Stats((*i)->GetMiscValue())), (*i)->GetAmount());
AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
@@ -856,7 +856,7 @@ void Player::UpdateManaRegen()
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
if (modManaRegenInterrupt > 100)
modManaRegenInterrupt = 100;
- SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePctN(power_regen, modManaRegenInterrupt));
+ SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + CalculatePct(power_regen, modManaRegenInterrupt));
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
}
@@ -1098,12 +1098,12 @@ bool Guardian::UpdateStats(Stats stat)
if (aurEff)
{
SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ AddPct(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
if (aurEff)
- mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
ownersBonus = float(owner->GetStat(stat)) * mod;
value += ownersBonus;
}
@@ -1111,7 +1111,7 @@ bool Guardian::UpdateStats(Stats stat)
{
if (owner->getClass() == CLASS_WARLOCK && isPet())
{
- ownersBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
+ ownersBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
value += ownersBonus;
}
else
@@ -1126,7 +1126,7 @@ bool Guardian::UpdateStats(Stats stat)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
}
ownersBonus = float(owner->GetStat(stat)) * mod;
@@ -1138,7 +1138,7 @@ bool Guardian::UpdateStats(Stats stat)
{
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
{
- ownersBonus = CalculatePctN(owner->GetStat(stat), 30);
+ ownersBonus = CalculatePct(owner->GetStat(stat), 30);
value += ownersBonus;
}
}
@@ -1190,7 +1190,7 @@ void Guardian::UpdateResistances(uint32 school)
// hunter and warlock pets gain 40% of owner's resistance
if (isPet())
- value += float(CalculatePctN(m_owner->GetResistance(SpellSchools(school)), 40));
+ value += float(CalculatePct(m_owner->GetResistance(SpellSchools(school)), 40));
SetResistance(SpellSchools(school), int32(value));
}
@@ -1206,7 +1206,7 @@ void Guardian::UpdateArmor()
// hunter and warlock pets gain 35% of owner's armor value
if (isPet())
- bonus_armor = float(CalculatePctN(m_owner->GetArmor(), 35));
+ bonus_armor = float(CalculatePct(m_owner->GetArmor(), 35));
value = GetModifierValue(unitMod, BASE_VALUE);
value *= GetModifierValue(unitMod, BASE_PCT);
@@ -1296,7 +1296,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, sProto->Effects[1].CalcValue());
+ mod += CalculatePct(1.0f, sProto->Effects[1].CalcValue());
}
}
@@ -1414,8 +1414,8 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
{
case 61682:
case 61683:
- AddPctN(mindamage, -(*itr)->GetAmount());
- AddPctN(maxdamage, -(*itr)->GetAmount());
+ AddPct(mindamage, -(*itr)->GetAmount());
+ AddPct(maxdamage, -(*itr)->GetAmount());
break;
default:
break;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 83ed3917235..f1d421b916a 100755..100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -16,46 +16,50 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Unit.h"
#include "Common.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Battleground.h"
+#include "CellImpl.h"
+#include "ConditionMgr.h"
+#include "CreatureAI.h"
#include "CreatureAIImpl.h"
-#include "Log.h"
-#include "Opcodes.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Unit.h"
-#include "QuestDef.h"
-#include "Player.h"
+#include "CreatureGroups.h"
#include "Creature.h"
-#include "Spell.h"
+#include "Formulas.h"
+#include "GridNotifiersImpl.h"
#include "Group.h"
-#include "SpellAuras.h"
-#include "SpellAuraEffects.h"
+#include "InstanceSaveMgr.h"
+#include "InstanceScript.h"
+#include "Log.h"
#include "MapManager.h"
+#include "MoveSpline.h"
+#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
-#include "CreatureAI.h"
-#include "Formulas.h"
-#include "Pet.h"
-#include "Util.h"
-#include "Totem.h"
-#include "Battleground.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "OutdoorPvP.h"
-#include "InstanceSaveMgr.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "CreatureGroups.h"
-#include "PetAI.h"
#include "PassiveAI.h"
+#include "PetAI.h"
+#include "Pet.h"
+#include "Player.h"
+#include "QuestDef.h"
+#include "ReputationMgr.h"
+#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "Spell.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "TemporarySummon.h"
-#include "Vehicle.h"
+#include "Totem.h"
#include "Transport.h"
-#include "InstanceScript.h"
-#include "SpellInfo.h"
-#include "MoveSplineInit.h"
-#include "MoveSpline.h"
-#include "ConditionMgr.h"
+#include "UpdateFieldFlags.h"
+#include "Util.h"
+#include "Vehicle.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
#include <math.h>
@@ -151,12 +155,26 @@ _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo)
#ifdef _MSC_VER
#pragma warning(disable:4355)
#endif
-Unit::Unit(bool isWorldObject): WorldObject(isWorldObject),
-m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false),
-m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL),
-i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(this),
-m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
-m_HostileRefManager(this)
+Unit::Unit(bool isWorldObject): WorldObject(isWorldObject)
+ , m_movedPlayer(NULL)
+ , m_lastSanctuaryTime(0)
+ , m_TempSpeed(0.0f)
+ , IsAIEnabled(false)
+ , NeedChangeAI(false)
+ , m_ControlledByPlayer(false)
+ , movespline(new Movement::MoveSpline())
+ , i_AI(NULL)
+ , i_disabledAI(NULL)
+ , m_AutoRepeatFirstCast(false)
+ , m_procDeep(0)
+ , m_removedAurasCount(0)
+ , i_motionMaster(this)
+ , m_ThreatManager(this)
+ , m_vehicle(NULL)
+ , m_vehicleKit(NULL)
+ , m_unitTypeMask(UNIT_MASK_NONE)
+ , m_HostileRefManager(this)
+ , _lastDamagedTime(0)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
@@ -251,8 +269,8 @@ m_HostileRefManager(this)
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
_focusSpell = NULL;
- _targetLocked = false;
_lastLiquid = NULL;
+ _isWalkingBeforeCharm = false;
}
////////////////////////////////////////////////////////////
@@ -377,9 +395,7 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed)
void Unit::UpdateSplineMovement(uint32 t_diff)
{
- enum{
- POSITION_UPDATE_DELAY = 400,
- };
+ uint32 const positionUpdateDelay = 400;
if (movespline->Finalized())
return;
@@ -393,7 +409,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
m_movesplineTimer.Update(t_diff);
if (m_movesplineTimer.Passed() || arrived)
{
- m_movesplineTimer.Reset(POSITION_UPDATE_DELAY);
+ m_movesplineTimer.Reset(positionUpdateDelay);
Movement::Location loc = movespline->ComputePosition();
if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
@@ -403,17 +419,14 @@ void Unit::UpdateSplineMovement(uint32 t_diff)
pos.m_positionY = loc.y;
pos.m_positionZ = loc.z;
pos.m_orientation = loc.orientation;
- if (Unit* vehicle = GetVehicleBase())
- {
- loc.x += vehicle->GetPositionX();
- loc.y += vehicle->GetPositionY();
- loc.z += vehicle->GetPositionZMinusOffset();
- loc.orientation = vehicle->GetOrientation();
- }
- else if (Transport* trans = GetTransport())
- trans->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
+
+ if (TransportBase* transport = GetDirectTransport())
+ transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, loc.orientation);
}
+ if (HasUnitState(UNIT_STATE_CANNOT_TURN))
+ loc.orientation = GetOrientation();
+
UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
}
}
@@ -538,15 +551,22 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (IsAIEnabled)
GetAI()->DamageDealt(victim, damage, damagetype);
- // Signal to pets that their owner was attacked
- if (victim->GetTypeId() == TYPEID_PLAYER)
+ if (victim->GetTypeId() == TYPEID_PLAYER && this != victim)
{
+ // Signal to pets that their owner was attacked
Pet* pet = victim->ToPlayer()->GetPet();
if (pet && pet->isAlive())
- pet->AI()->OwnerDamagedBy(this);
+ pet->AI()->OwnerAttackedBy(this);
+
+ if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
+ return 0;
}
+ // Signal the pet it was attacked so the AI can respond if needed
+ if (victim->GetTypeId() == TYPEID_UNIT && this != victim && victim->isPet() && victim->isAlive())
+ victim->ToPet()->AI()->AttackedBy(this);
+
if (damagetype != NODAMAGE)
{
// interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
@@ -576,7 +596,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
continue;
SpellInfo const* spell = (*i)->GetSpellInfo();
- uint32 share = CalculatePctN(damage, (*i)->GetAmount());
+ uint32 share = CalculatePct(damage, (*i)->GetAmount());
// TODO: check packets if damage is done by victim, or by attacker of victim
DealDamageMods(shareDamageTarget, share, NULL);
@@ -628,10 +648,10 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
return 0;
}
- sLog->outStaticDebug("DealDamageStart");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageStart");
uint32 health = victim->GetHealth();
- sLog->outDetail("deal dmg:%d to health:%d ", damage, health);
+ sLog->outInfo(LOG_FILTER_UNITS, "deal dmg:%d to health:%d ", damage, health);
// duel ends when player has 1 or less hp
bool duel_hasEnded = false;
@@ -685,22 +705,16 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
if (health <= damage)
{
- sLog->outStaticDebug("DealDamage: victim just died");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamage: victim just died");
if (victim->GetTypeId() == TYPEID_PLAYER && victim != this)
- {
victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health);
- // call before auras are removed
- if (Player* killer = GetCharmerOrOwnerPlayerOrPlayerItself())
- killer->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_SPECIAL_PVP_KILL, 1, 0, victim);
- }
-
Kill(victim, durabilityLoss);
}
else
{
- sLog->outStaticDebug("DealDamageAlive");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageAlive");
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage);
@@ -784,7 +798,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
}
}
- sLog->outStaticDebug("DealDamageEnd returned %d damage", damage);
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageEnd returned %d damage", damage);
return damage;
}
@@ -800,7 +814,7 @@ void Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo
{
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -828,7 +842,7 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
@@ -856,28 +870,35 @@ void Unit::CastCustomSpell(Unit* target, uint32 spellId, int32 const* bp0, int32
values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
if (bp2)
values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
- CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
+ CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
}
void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
CustomSpellValues values;
values.AddSpellMod(mod, value);
- CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
+ CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
+}
+
+void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* target, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+{
+ CustomSpellValues values;
+ values.AddSpellMod(mod, value);
+ CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
SpellCastTargets targets;
targets.SetUnitTarget(victim);
- CastSpell(targets, spellInfo, &value, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
+ CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
}
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
@@ -885,7 +906,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
SpellCastTargets targets;
@@ -899,7 +920,7 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
+ sLog->outError(LOG_FILTER_UNITS, "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry()));
return;
}
SpellCastTargets targets;
@@ -978,7 +999,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
if (critPctDamageMod != 0)
- AddPctF(damage, critPctDamageMod);
+ AddPct(damage, critPctDamageMod);
}
// Spell weapon based damage CAN BE crit & blocked at same time
@@ -1167,7 +1188,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
// Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, crTypeMask);
if (mod != 0)
- AddPctF(damageInfo->damage, mod);
+ AddPct(damageInfo->damage, mod);
break;
}
case MELEE_HIT_PARRY:
@@ -1312,7 +1333,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
- && (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss()))
+ && (victim->GetTypeId() == TYPEID_PLAYER || !victim->ToCreature()->isWorldBoss())&& !victim->IsVehicle())
{
// -probability is between 0% and 40%
// 20% base chance
@@ -1325,7 +1346,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
uint32 VictimDefense=victim->GetDefenseSkillValue();
uint32 AttackerMeleeSkill=GetUnitMeleeSkill();
- Probability *= AttackerMeleeSkill/(float)VictimDefense;
+ Probability *= AttackerMeleeSkill/(float)VictimDefense*0.16;
+
+ if (Probability < 0)
+ Probability = 0;
if (Probability > 40.0f)
Probability = 40.0f;
@@ -1435,14 +1459,14 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
&& (*j)->IsAffectedOnSpell(spellInfo))
- armor = floor(AddPctN(armor, -(*j)->GetAmount()));
+ armor = floor(AddPct(armor, -(*j)->GetAmount()));
}
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
{
if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
- armor = floor(AddPctN(armor, -(*j)->GetAmount()));
+ armor = floor(AddPct(armor, -(*j)->GetAmount()));
}
// Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
@@ -1475,7 +1499,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
// Cap armor penetration to this number
maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
// Figure out how much armor do we ignore
- float armorPen = CalculatePctF(maxArmorPen, bonusPct + ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
+ float armorPen = CalculatePct(maxArmorPen, bonusPct + ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
// Got the value, apply it
armor -= std::min(armorPen, maxArmorPen);
}
@@ -1559,12 +1583,12 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
AuraEffectList const& ResIgnoreAurasAb = GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo))
- AddPctN(damageResisted, -(*j)->GetAmount());
+ AddPct(damageResisted, -(*j)->GetAmount());
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
if ((*j)->GetMiscValue() & schoolMask)
- AddPctN(damageResisted, -(*j)->GetAmount());
+ AddPct(damageResisted, -(*j)->GetAmount());
dmgInfo.ResistDamage(uint32(damageResisted));
}
@@ -1625,7 +1649,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
continue;
// Apply absorb mod auras
- AddPctF(currentAbsorb, -auraAbsorbMod);
+ AddPct(currentAbsorb, -auraAbsorbMod);
// absorb must be smaller than the damage itself
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
@@ -1675,7 +1699,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
if (defaultPrevented)
continue;
- AddPctF(currentAbsorb, -auraAbsorbMod);
+ AddPct(currentAbsorb, -auraAbsorbMod);
// absorb must be smaller than the damage itself
currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
@@ -1748,8 +1772,10 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(), next; (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
{
// Check if aura was removed during iteration - we don't need to work on such auras
- if (!((*itr)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
+ AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID());
+ if (!aurApp)
continue;
+
// check damage school mask
if (!((*itr)->GetMiscValue() & schoolMask))
continue;
@@ -1759,13 +1785,14 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->isAlive())
continue;
- int32 splitDamage = CalculatePctN(dmgInfo.GetDamage(), (*itr)->GetAmount());
+ uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
+
+ (*itr)->GetBase()->CallScriptEffectSplitHandlers((*itr), aurApp, dmgInfo, splitDamage);
// absorb must be smaller than the damage itself
- splitDamage = RoundToInterval(splitDamage, 0, int32(dmgInfo.GetDamage()));
+ splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
dmgInfo.AbsorbDamage(splitDamage);
-
uint32 splitted = splitDamage;
uint32 split_absorb = 0;
DealDamageMods(caster, splitted, &split_absorb);
@@ -1880,10 +1907,10 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext
DealMeleeDamage(&damageInfo, true);
if (GetTypeId() == TYPEID_PLAYER)
- sLog->outStaticDebug("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
+ sLog->outDebug(LOG_FILTER_UNITS, "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
else
- sLog->outStaticDebug("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
+ sLog->outDebug(LOG_FILTER_UNITS, "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.",
GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
}
}
@@ -1914,7 +1941,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy
float parry_chance = victim->GetUnitParryChance();
// Useful if want to specify crit & miss chances for melee, else it could be removed
- sLog->outStaticDebug("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
+ sLog->outDebug(LOG_FILTER_UNITS, "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance*100), int32(miss_chance*100), int32(dodge_chance*100), int32(parry_chance*100), int32(block_chance*100));
}
@@ -1935,22 +1962,22 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
int32 sum = 0, tmp = 0;
int32 roll = urand (0, 10000);
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus);
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d",
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d",
roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
tmp = miss_chance;
if (tmp > 0 && roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: MISS");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: MISS");
return MELEE_HIT_MISS;
}
// always crit against a sitting target (except 0 crit chance)
if (victim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !victim->IsStandState())
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT (sitting victim)");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT (sitting victim)");
return MELEE_HIT_CRIT;
}
@@ -1959,7 +1986,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// only players can't dodge if attacker is behind
if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
}
else
{
@@ -1978,7 +2005,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
&& ((tmp -= skillBonus) > 0)
&& roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum-tmp, sum);
return MELEE_HIT_DODGE;
}
}
@@ -1987,7 +2014,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
// check if attack comes from behind, nobody can parry or block if attacker is behind
if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind.");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: attack came from behind.");
else
{
// Reduce parry chance by attacker expertise rating
@@ -2003,7 +2030,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
&& (tmp2 -= skillBonus) > 0
&& roll < (sum += tmp2))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum-tmp2, sum);
return MELEE_HIT_PARRY;
}
}
@@ -2015,7 +2042,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
&& (tmp -= skillBonus) > 0
&& roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum-tmp, sum);
return MELEE_HIT_BLOCK;
}
}
@@ -2026,9 +2053,9 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
if (tmp > 0 && roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT DISABLED)");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRIT DISABLED)");
else
return MELEE_HIT_CRIT;
}
@@ -2048,7 +2075,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
tmp = tmp > 4000 ? 4000 : tmp;
if (roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum-4000, sum);
return MELEE_HIT_GLANCING;
}
}
@@ -2072,13 +2099,13 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
tmp = tmp * 200 - 1500;
if (roll < (sum += tmp))
{
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum);
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum-tmp, sum);
return MELEE_HIT_CRUSHING;
}
}
}
- sLog->outStaticDebug ("RollMeleeOutcomeAgainst: NORMAL");
+ sLog->outDebug(LOG_FILTER_UNITS, "RollMeleeOutcomeAgainst: NORMAL");
return MELEE_HIT_NORMAL;
}
@@ -2134,7 +2161,7 @@ float Unit::CalculateLevelPenalty(SpellInfo const* spellProto) const
if (LvlFactor > 1.0f)
LvlFactor = 1.0f;
- return AddPctF(LvlFactor, -LvlPenalty);
+ return AddPct(LvlFactor, -LvlPenalty);
}
void Unit::SendMeleeAttackStart(Unit* victim)
@@ -2143,7 +2170,7 @@ void Unit::SendMeleeAttackStart(Unit* victim)
data << uint64(GetGUID());
data << uint64(victim->GetGUID());
SendMessageToSet(&data, true);
- sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART");
+ sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTART");
}
void Unit::SendMeleeAttackStop(Unit* victim)
@@ -2153,12 +2180,12 @@ void Unit::SendMeleeAttackStop(Unit* victim)
data.append(victim ? victim->GetPackGUID() : 0);
data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation
SendMessageToSet(&data, true);
- sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP");
+ sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTOP");
if (victim)
- sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_UNITS, "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow());
else
- sLog->outDetail("%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_UNITS, "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow());
}
bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttackType attackType)
@@ -2277,6 +2304,9 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
// Ranged attacks can only miss, resist and deflect
if (attType == RANGED_ATTACK)
{
+ canParry = false;
+ canDodge = false;
+
// only if in front
if (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
{
@@ -2328,7 +2358,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
case MELEE_HIT_BLOCK: canBlock = false; break;
case MELEE_HIT_PARRY: canParry = false; break;
default:
- sLog->outStaticDebug("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
+ sLog->outDebug(LOG_FILTER_UNITS, "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
break;
}
}
@@ -4292,11 +4322,16 @@ uint32 Unit::GetDoTsByCaster(uint64 casterGUID) const
int32 Unit::GetTotalAuraModifier(AuraType auratype) const
{
+ std::map<SpellGroup, int32> SameEffectSpellGroup;
int32 modifier = 0;
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
- modifier += (*i)->GetAmount();
+ if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
+ modifier += (*i)->GetAmount();
+
+ for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
+ modifier += itr->second;
return modifier;
}
@@ -4307,7 +4342,7 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
return multiplier;
}
@@ -4340,14 +4375,19 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const
int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
{
+ std::map<SpellGroup, int32> SameEffectSpellGroup;
int32 modifier = 0;
AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
+
for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
- {
- if ((*i)->GetMiscValue()& misc_mask)
- modifier += (*i)->GetAmount();
- }
+ if ((*i)->GetMiscValue() & misc_mask)
+ if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
+ modifier += (*i)->GetAmount();
+
+ for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
+ modifier += itr->second;
+
return modifier;
}
@@ -4364,12 +4404,12 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask
// Check if the Aura Effect has a the Same Effect Stack Rule and if so, use the highest amount of that SpellGroup
// If the Aura Effect does not have this Stack Rule, it returns false so we can add to the multiplier as usual
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
}
}
// Add the highest of the Same Effect Stack Rule SpellGroups to the multiplier
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
- AddPctN(multiplier, itr->second);
+ AddPct(multiplier, itr->second);
return multiplier;
}
@@ -4431,11 +4471,11 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu
{
if ((*i)->GetMiscValue() == misc_value)
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
}
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
- AddPctN(multiplier, itr->second);
+ AddPct(multiplier, itr->second);
return multiplier;
}
@@ -4497,11 +4537,11 @@ float Unit::GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellInfo cons
{
if ((*i)->IsAffectedOnSpell(affectedSpell))
if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup))
- AddPctN(multiplier, (*i)->GetAmount());
+ AddPct(multiplier, (*i)->GetAmount());
}
for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr)
- AddPctN(multiplier, itr->second);
+ AddPct(multiplier, itr->second);
return multiplier;
}
@@ -4768,7 +4808,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo)
data << float(pInfo->multiplier); // gain multiplier
break;
default:
- sLog->outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType()));
+ sLog->outError(LOG_FILTER_UNITS, "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType()));
return;
}
@@ -4929,7 +4969,7 @@ bool Unit::HandleHasteAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!triggerEntry)
{
- sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", hasteSpell->Id, triggered_spell_id);
return false;
}
@@ -4987,7 +5027,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit* victim, uint32 /*damage*/, AuraEf
if (!triggerEntry)
{
- sLog->outError("Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleHasteAuraProc: Spell %u has non-existing triggered spell %u", triggeredByAuraSpell->Id, triggered_spell_id);
return false;
}
@@ -5049,7 +5089,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 25988:
{
// return damage % to attacker but < 50% own total health
- basepoints0 = int32(std::min(CalculatePctN(damage, triggerAmount), CountPctFromMaxHealth(50)));
+ basepoints0 = int32(std::min(CalculatePct(damage, triggerAmount), CountPctFromMaxHealth(50)));
triggered_spell_id = 25997;
break;
}
@@ -5501,7 +5541,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 71875: // Item - Black Bruise: Necrotic Touch Proc
case 71877:
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 71879;
break;
}
@@ -5561,7 +5601,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Essence of the Blood Queen
case 70871:
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
CastCustomSpell(70872, SPELLVALUE_BASE_POINT0, basepoints0, this);
return true;
}
@@ -5580,7 +5620,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Dark Hunger (The Lich King encounter)
case 69383:
{
- basepoints0 = CalculatePctN(int32(damage), 50);
+ basepoints0 = CalculatePct(int32(damage), 50);
triggered_spell_id = 69384;
break;
}
@@ -5596,7 +5636,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// mana reward
- basepoints0 = CalculatePctN(int32(GetMaxPower(POWER_MANA)), triggerAmount);
+ basepoints0 = CalculatePct(int32(GetMaxPower(POWER_MANA)), triggerAmount);
target = this;
triggered_spell_id = 29442;
break;
@@ -5608,8 +5648,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// mana cost save
- int32 cost = int32(procSpell->ManaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, triggerAmount);
+ int32 cost = int32(procSpell->ManaCost + CalculatePct(GetCreateMana(), procSpell->ManaCostPercentage));
+ basepoints0 = CalculatePct(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -5629,7 +5669,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 31571: triggered_spell_id = 57529; break;
case 31572: triggered_spell_id = 57531; break;
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u", dummySpell->Id);
return false;
}
break;
@@ -5663,8 +5703,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!procSpell)
return false;
- int32 cost = int32(procSpell->ManaCost + CalculatePctU(GetCreateMana(), procSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, triggerAmount);
+ int32 cost = int32(procSpell->ManaCost + CalculatePct(GetCreateMana(), procSpell->ManaCostPercentage));
+ basepoints0 = CalculatePct(cost, triggerAmount);
if (basepoints0 <= 0)
return false;
triggered_spell_id = 44450;
@@ -5715,7 +5755,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 12847: basepoints0 = int32(0.16f * damage); break;
case 12848: basepoints0 = int32(0.20f * damage); break;
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
return false;
}
@@ -5747,7 +5787,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!victim)
return false;
- basepoints0 = int32(CalculatePctN(damage, 15));
+ basepoints0 = int32(CalculatePct(damage, 15));
if (AuraEffect* aurEff = victim->GetAuraEffect(64413, 0, GetGUID()))
{
// The shield can grow to a maximum size of 20, 000 damage absorbtion
@@ -5833,7 +5873,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 29834: triggered_spell_id=29841; break;
case 42770: triggered_spell_id=42771; break;
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id);
return false;
}
@@ -5845,7 +5885,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
triggered_spell_id = 59653;
// % of amount blocked
- basepoints0 = CalculatePctN(int32(GetShieldBlockValue()), triggerAmount);
+ basepoints0 = CalculatePct(int32(GetShieldBlockValue()), triggerAmount);
break;
}
// Glyph of Blocking
@@ -5924,7 +5964,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = GetGuardianPet();
if (!target)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 54181;
break;
}
@@ -5940,7 +5980,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggerAmount += triggerAmount / 4;
triggered_spell_id = 63106;
target = this;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Glyph of Shadowflame
@@ -5986,15 +6026,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
// Replenishment - roll chance
if (roll_chance_i(aurEff->GetAmount()))
- {
CastSpell(this, 57669, true, castItem, triggeredByAura);
- }
}
break;
}
}
// health
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 30294;
break;
@@ -6013,7 +6051,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 37382;
break;
}
@@ -6066,7 +6104,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (AuraEffect const* aurEff = target->GetAuraEffect(47753, 0))
bonus = aurEff->GetAmount();
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) + bonus;
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) + bonus;
if (basepoints0 > target->getLevel() * 125)
basepoints0 = target->getLevel() * 125;
@@ -6092,7 +6130,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- int32 total = CalculatePctN(int32(damage), triggerAmount);
+ int32 total = CalculatePct(int32(damage), triggerAmount);
int32 team = total / 5;
int32 self = total - team;
CastCustomSpell(this, 15290, &team, &self, NULL, true, castItem, triggeredByAura);
@@ -6135,7 +6173,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (!tickcount)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / tickcount;
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / tickcount;
break;
}
// Improved Shadowform
@@ -6165,7 +6203,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 26169:
{
// heal amount
- basepoints0 = int32(CalculatePctN(damage, 10));
+ basepoints0 = int32(CalculatePct(damage, 10));
target = this;
triggered_spell_id = 26170;
break;
@@ -6177,7 +6215,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 39373;
break;
@@ -6197,7 +6235,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!blessHealing)
return false;
- basepoints0 = int32(CalculatePctN(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
+ basepoints0 = int32(CalculatePct(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
}
break;
}
@@ -6214,7 +6252,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
- basepoints0 = int32(CalculatePctN(GetCreatePowers(POWER_MANA), mana_perc) / 10);
+ basepoints0 = int32(CalculatePct(GetCreatePowers(POWER_MANA), mana_perc) / 10);
triggered_spell_id = 54833;
target = this;
break;
@@ -6291,7 +6329,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 28719:
{
// mana back
- basepoints0 = int32(CalculatePctN(procSpell->ManaCost, 30));
+ basepoints0 = int32(CalculatePct(procSpell->ManaCost, 30));
target = this;
triggered_spell_id = 28742;
break;
@@ -6301,7 +6339,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!victim || !victim->HealthBelowPct(uint32(triggerAmount)))
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 54755;
break;
}
@@ -6369,7 +6407,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
// Add remaining ticks to damage done
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
}
@@ -6414,33 +6452,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
else if (dummySpell->SpellIconID == 2860)
{
triggered_spell_id = 48504;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
- // King of the Jungle
- else if (dummySpell->SpellIconID == 2850)
- {
- // Effect 0 - mod damage while having Enrage
- if (effIndex == 0)
- {
- if (!(procSpell->SpellFamilyFlags[0] & 0x00080000) || procSpell->SpellIconID != 961)
- return false;
- triggered_spell_id = 51185;
- basepoints0 = triggerAmount;
- target = this;
- break;
- }
- // Effect 1 - Tiger's Fury restore energy
- else if (effIndex == 1)
- {
- if (!(procSpell->SpellFamilyFlags[2] & 0x00000800) || procSpell->SpellIconID != 1181)
- return false;
- triggered_spell_id = 51178;
- basepoints0 = triggerAmount;
- target = this;
- break;
- }
- }
break;
}
case SPELLFAMILY_ROGUE:
@@ -6481,7 +6495,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// energy cost save
- basepoints0 = CalculatePctN(int32(procSpell->ManaCost), triggerAmount);
+ basepoints0 = CalculatePct(int32(procSpell->ManaCost), triggerAmount);
if (basepoints0 <= 0)
return false;
@@ -6622,23 +6636,49 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Light's Beacon - Beacon of Light
if (dummySpell->Id == 53651)
{
- // Get target of beacon of light
- if (Unit* beaconTarget = triggeredByAura->GetBase()->GetCaster())
+ if (!victim)
+ return false;
+ triggered_spell_id = 0;
+ Unit* beaconTarget = NULL;
+ if (GetTypeId() != TYPEID_PLAYER)
{
- // do not proc when target of beacon of light is healed
- if (beaconTarget == this)
+ beaconTarget = triggeredByAura->GetBase()->GetCaster();
+ if (!beaconTarget || beaconTarget == this || !(beaconTarget->GetAura(53563, victim->GetGUID())))
return false;
- // check if it was heal by paladin which casted this beacon of light
- if (beaconTarget->GetAura(53563, victim->GetGUID()))
+ basepoints0 = int32(damage);
+ triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654;
+ }
+ else
+ { // Check Party/Raid Group
+ if (Group* group = ToPlayer()->GetGroup())
{
- if (beaconTarget->IsWithinLOSInMap(victim))
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
- basepoints0 = damage;
- victim->CastCustomSpell(beaconTarget, 53654, &basepoints0, NULL, NULL, true);
- return true;
+ if (Player* member = itr->getSource())
+ {
+ // check if it was heal by paladin which casted this beacon of light
+ if (member->GetAura(53563, victim->GetGUID()))
+ {
+ // do not proc when target of beacon of light is healed
+ if (member == this)
+ return false;
+
+ beaconTarget = member;
+ basepoints0 = int32(damage);
+ triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654;
+ break;
+ }
+ }
}
}
}
+
+ if (triggered_spell_id && beaconTarget)
+ {
+ victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura);
+ return true;
+ }
+
return false;
}
// Judgements of the Wise
@@ -6659,34 +6699,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
CastCustomSpell(target, triggered_spell_id, &basepoints0, &basepoints0, NULL, true, castItem, triggeredByAura);
return true;
}
- // Sacred Shield
- if (dummySpell->SpellFamilyFlags[1] & 0x80000)
- {
- if (procFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
- {
- if (procSpell->SpellFamilyName == SPELLFAMILY_PALADIN && (procSpell->SpellFamilyFlags[0] & 0x40000000))
- {
- basepoints0 = damage / 12;
-
- if (basepoints0)
- CastCustomSpell(this, 66922, &basepoints0, NULL, NULL, true, 0, triggeredByAura, victim->GetGUID());
-
- return true;
- }
- else
- return false;
- }
- else if (damage > 0)
- triggered_spell_id = 58597;
-
- // Item - Paladin T8 Holy 4P Bonus
- if (Unit* caster = triggeredByAura->GetCaster())
- if (AuraEffect const* aurEff = caster->GetAuraEffect(64895, 0))
- cooldown = aurEff->GetAmount();
-
- target = this;
- break;
- }
// Righteous Vengeance
if (dummySpell->SpellIconID == 3025)
{
@@ -6707,6 +6719,23 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
switch (dummySpell->Id)
{
+ // Sacred Shield
+ case 53601:
+ {
+ if (procFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS)
+ return false;
+
+ if (damage > 0)
+ triggered_spell_id = 58597;
+
+ // Item - Paladin T8 Holy 4P Bonus
+ if (Unit* caster = triggeredByAura->GetCaster())
+ if (AuraEffect const* aurEff = caster->GetAuraEffect(64895, 0))
+ cooldown = aurEff->GetAmount();
+
+ target = this;
+ break;
+ }
// Heart of the Crusader
case 20335: // rank 1
triggered_spell_id = 21183;
@@ -6720,10 +6749,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Judgement of Light
case 20185:
{
- // 2% of base mana
- basepoints0 = int32(victim->CountPctFromMaxHealth(2));
- victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
- return true;
+ if (!victim)
+ return false;
+
+ // 2% of maximum health
+ basepoints0 = int32(victim->CountPctFromMaxHealth(2));
+ victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
+ return true;
}
// Judgement of Wisdom
case 20186:
@@ -6731,7 +6763,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (victim && victim->isAlive() && victim->getPowerType() == POWER_MANA)
{
// 2% of base mana
- basepoints0 = int32(CalculatePctN(victim->GetCreateMana(), 2));
+ basepoints0 = int32(CalculatePct(victim->GetCreateMana(), 2));
victim->CastCustomSpell(victim, 20268, &basepoints0, NULL, NULL, true, 0, triggeredByAura);
}
return true;
@@ -6790,7 +6822,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
bool stacker = !procSpell || procSpell->Id == 53595;
// spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
- bool damager = procSpell && procSpell->EquippedItemClass != -1;
+ bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
if (!stacker && !damager)
return false;
@@ -6822,7 +6854,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// At melee attack or Hammer of the Righteous spell damage considered as melee attack
bool stacker = !procSpell || procSpell->Id == 53595;
// spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
- bool damager = procSpell && procSpell->EquippedItemClass != -1;
+ bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
if (!stacker && !damager)
return false;
@@ -6854,7 +6886,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
return false;
// heal amount
- basepoints0 = int32(CalculatePctN(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount));
+ basepoints0 = int32(CalculatePct(std::min(damage, GetMaxHealth() - GetHealth()), triggerAmount));
target = this;
if (basepoints0)
@@ -6893,7 +6925,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 54937:
{
triggered_spell_id = 54968;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Item - Paladin T8 Holy 2P Bonus
@@ -7069,7 +7101,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 3787:spellId = 58804; break; // 8 Rank
default:
{
- sLog->outError("Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)",
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)",
castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id);
return false;
}
@@ -7078,7 +7110,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!windfurySpellInfo)
{
- sLog->outError("Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId);
return false;
}
@@ -7140,7 +7172,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Not proc from self heals
if (this == victim)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 55533;
break;
@@ -7152,7 +7184,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = GetOwner();
if (!target)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 58879;
// Cast on spirit wolf
CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, NULL, triggeredByAura);
@@ -7161,7 +7193,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Shaman T8 Elemental 4P Bonus
case 64928:
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 64930; // Electrified
break;
}
@@ -7175,7 +7207,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
}
break;
}
@@ -7189,7 +7221,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggeredSpell)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
// Add remaining ticks to healing done
basepoints0 += GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_HEAL);
}
@@ -7251,8 +7283,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(totem->m_spells[0]))
{
- int32 bp0 = CalculatePctN(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount);
- int32 bp1 = CalculatePctN(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount);
+ int32 bp0 = CalculatePct(totemSpell->Effects[EFFECT_0].CalcValue(), triggerAmount);
+ int32 bp1 = CalculatePct(totemSpell->Effects[EFFECT_1].CalcValue(), triggerAmount);
CastCustomSpell(this, 63283, &bp0, &bp1, NULL, true);
return true;
}
@@ -7279,7 +7311,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (dummySpell->SpellIconID == 3065)
{
triggered_spell_id = 52759;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
break;
}
@@ -7293,7 +7325,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Glyph of Earth Shield
if (AuraEffect* aur = GetAuraEffect(63279, 0))
- AddPctN(basepoints0, aur->GetAmount());
+ AddPct(basepoints0, aur->GetAmount());
triggered_spell_id = 379;
break;
}
@@ -7309,13 +7341,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|| (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
return false;
- float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
+ float fire_onhit = float(CalculatePct(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE)
+ victim->SpellBaseDamageBonusTaken(SPELL_SCHOOL_MASK_FIRE));
// 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
- ApplyPctF(add_spellpower, 3.84f);
+ ApplyPct(add_spellpower, 3.84f);
// Enchant on Off-Hand and ready?
if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
@@ -7408,7 +7440,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 49270: spellId = 49268; break; // Rank 7
case 49271: spellId = 49269; break; // Rank 8
default:
- sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
return false;
}
@@ -7469,7 +7501,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (GetTypeId() != TYPEID_PLAYER)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
break;
}
// Butchery
@@ -7515,12 +7547,18 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Unholy Blight
if (dummySpell->Id == 49194)
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
- // Glyph of Unholy Blight
+ triggered_spell_id = 50536;
+ SpellInfo const* unholyBlight = sSpellMgr->GetSpellInfo(triggered_spell_id);
+ if (!unholyBlight)
+ return false;
+
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
+
+ //Glyph of Unholy Blight
if (AuraEffect* glyph=GetAuraEffect(63332, 0))
- AddPctN(basepoints0, glyph->GetAmount());
+ AddPct(basepoints0, glyph->GetAmount());
- triggered_spell_id = 50536;
+ basepoints0 = basepoints0 / (unholyBlight->GetMaxDuration() / unholyBlight->Effects[0].Amplitude);
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
@@ -7535,7 +7573,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Necrosis
if (dummySpell->SpellIconID == 2709)
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 51460;
break;
}
@@ -7613,7 +7651,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{
if (!roll_chance_f(GetUnitCriticalChance(BASE_ATTACK, victim)))
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
triggered_spell_id = 50526;
break;
}
@@ -7695,7 +7733,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 54445;
target = this;
- float addThreat = float(CalculatePctN(procSpell->Effects[0].CalcValue(this), triggerAmount));
+ float addThreat = float(CalculatePct(procSpell->Effects[0].CalcValue(this), triggerAmount));
victim->AddThreat(this, addThreat);
break;
}
@@ -7722,7 +7760,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
if (!triggerEntry)
{
- sLog->outError("Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7763,7 +7801,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
if (dummySpell->SpellFamilyFlags[1] & 0x40000)
{
uint32 maxmana = GetMaxPower(POWER_MANA);
- basepoints0 = CalculatePctF(maxmana, GetAttackTime(RANGED_ATTACK) / 1000.0f);
+ basepoints0 = CalculatePct(maxmana, GetAttackTime(RANGED_ATTACK) / 1000.0f);
target = this;
triggered_spell_id = 34075;
break;
@@ -7780,7 +7818,7 @@ bool Unit::HandleObsModEnergyAuraProc(Unit* victim, uint32 /*damage*/, AuraEffec
// Try handle unknown trigger spells
if (!triggerEntry)
{
- sLog->outError("Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleObsModEnergyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7833,7 +7871,7 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit* victim, uint32 /*damage*/, Aura
if (!triggerEntry)
{
- sLog->outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleModDamagePctTakenAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
@@ -7901,7 +7939,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Swift Hand of Justice
case 59906:
{
- int32 bp0 = CalculatePctN(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
+ int32 bp0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
CastCustomSpell(this, 59913, &bp0, NULL, NULL, true);
*handled = true;
break;
@@ -7920,10 +7958,10 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
*handled = true;
if (victim && victim->HasAura(53601))
{
- int32 bp0 = CalculatePctN(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue());
+ int32 bp0 = CalculatePct(int32(damage / 12), dummySpell->Effects[EFFECT_2].CalcValue());
// Item - Paladin T9 Holy 4P Bonus
if (AuraEffect const* aurEff = GetAuraEffect(67191, 0))
- AddPctN(bp0, aurEff->GetAmount());
+ AddPct(bp0, aurEff->GetAmount());
CastCustomSpell(victim, 66922, &bp0, NULL, NULL, true);
return true;
}
@@ -7992,7 +8030,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
if (!spInfo)
return false;
- int32 bp0 = int32(CalculatePctN(GetCreateMana(), spInfo->Effects[0].CalcValue()));
+ int32 bp0 = int32(CalculatePct(GetCreateMana(), spInfo->Effects[0].CalcValue()));
CastCustomSpell(this, 67545, &bp0, NULL, NULL, true, NULL, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
return true;
}
@@ -8087,7 +8125,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Item - Warrior T10 Protection 4P Bonus
case 70844:
{
- int32 basepoints0 = CalculatePctN(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
+ int32 basepoints0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true);
break;
}
@@ -8194,7 +8232,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 40336:
{
// On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
- if (this && isAlive())
+ if (isAlive())
CastSpell(this, 29471, true, castItem, triggeredByAura);
if (victim && victim->isAlive())
CastSpell(victim, 27526, true, castItem, triggeredByAura);
@@ -8205,7 +8243,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
// Remove a Evasive Charge
Aura* charge = GetAura(50241);
- if (charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
+ if (charge && charge->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL))
RemoveAurasDueToSpell(50240);
}
}
@@ -8220,7 +8258,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
trigger_spell_id = 31643;
break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id);
return false;
}
}
@@ -8251,7 +8289,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellInfo()->SpellIconID == 113)
{
int32 value2 = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 2);
- basepoints0 = int32(CalculatePctN(GetMaxPower(POWER_MANA), value2));
+ basepoints0 = int32(CalculatePct(GetMaxPower(POWER_MANA), value2));
// Drain Soul
CastCustomSpell(this, 18371, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
break;
@@ -8296,10 +8334,10 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 27815: trigger_spell_id = 27817; break;
case 27816: trigger_spell_id = 27818; break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id);
return false;
}
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / 3;
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3;
target = this;
// Add remaining ticks to healing done
basepoints0 += GetRemainingPeriodicAmount(GetGUID(), trigger_spell_id, SPELL_AURA_PERIODIC_HEAL);
@@ -8356,14 +8394,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
trigger_spell_id = 63468;
break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id);
return false;
}
SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id);
if (!TriggerPS)
return false;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break;
}
@@ -8469,19 +8507,19 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
case 48820: originalSpellId = 48824; break;
case 48821: originalSpellId = 48825; break;
default:
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id);
return false;
}
}
SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId);
if (!originalSpell)
{
- sLog->outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId);
return false;
}
// percent stored in effect 1 (class scripts) base points
- int32 cost = int32(originalSpell->ManaCost + CalculatePctU(GetCreateMana(), originalSpell->ManaCostPercentage));
- basepoints0 = CalculatePctN(cost, auraSpellInfo->Effects[1].CalcValue());
+ int32 cost = int32(originalSpell->ManaCost + CalculatePct(GetCreateMana(), originalSpell->ManaCostPercentage));
+ basepoints0 = CalculatePct(cost, auraSpellInfo->Effects[1].CalcValue());
trigger_spell_id = 20272;
target = this;
}
@@ -8511,7 +8549,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
{
if (!procSpell)
return false;
- basepoints0 = int32(CalculatePctN(procSpell->ManaCost, 35));
+ basepoints0 = int32(CalculatePct(procSpell->ManaCost, 35));
trigger_spell_id = 23571;
target = this;
break;
@@ -8586,7 +8624,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
trigger_spell_id = 50475;
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
}
// Item - Death Knight T10 Melee 4P Bonus
else if (auraSpellInfo->Id == 70656)
@@ -8630,7 +8668,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
if (triggerEntry == NULL)
{
// Don't cast unknown spell
- // sLog->outError("Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
+ // sLog->outError(LOG_FILTER_UNITS, "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex());
return false;
}
@@ -8673,7 +8711,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
case 26467:
{
- basepoints0 = int32(CalculatePctN(damage, 15));
+ basepoints0 = int32(CalculatePct(damage, 15));
target = victim;
trigger_spell_id = 26470;
break;
@@ -8865,7 +8903,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Shamanistic Rage triggered spell
case 30824:
{
- basepoints0 = int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
+ basepoints0 = int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
break;
}
// Enlightenment (trigger only from mana cost spells)
@@ -8977,7 +9015,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Savage Defense
case 62606:
{
- basepoints0 = CalculatePctF(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
+ basepoints0 = CalculatePct(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
break;
}
// Body and Soul
@@ -9139,7 +9177,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au
if (!triggerEntry)
{
- sLog->outError("Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId);
return false;
}
@@ -9206,11 +9244,11 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
if (GetGUID() != guid)
{
if (Player const* player = ToPlayer())
- sLog->outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
+ sLog->outError(LOG_FILTER_UNITS, "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction());
else if (Creature const* creature = ToCreature())
- sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
+ sLog->outError(LOG_FILTER_UNITS, "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
else
- sLog->outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction());
+ sLog->outError(LOG_FILTER_UNITS, "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction());
guid = GetGUID();
}
@@ -9558,7 +9596,7 @@ void Unit::RemoveAllAttackers()
AttackerSet::iterator iter = m_attackers.begin();
if (!(*iter)->AttackStop())
{
- sLog->outError("WORLD: Unit has an attacker that isn't attacking it!");
+ sLog->outError(LOG_FILTER_UNITS, "WORLD: Unit has an attacker that isn't attacking it!");
m_attackers.erase(iter);
}
}
@@ -9658,6 +9696,31 @@ bool Unit::HasAuraState(AuraStateType flag, SpellInfo const* spellProto, Unit co
return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
}
+void Unit::SetOwnerGUID(uint64 owner)
+{
+ if (GetOwnerGUID() == owner)
+ return;
+
+ SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner);
+ if (!owner)
+ return;
+
+ // Update owner dependent fields
+ Player* player = ObjectAccessor::GetPlayer(*this, owner);
+ if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
+ return;
+
+ SetFieldNotifyFlag(UF_FLAG_OWNER);
+
+ UpdateData udata;
+ WorldPacket packet;
+ BuildValuesUpdateBlockForPlayer(&udata, player);
+ udata.BuildPacket(&packet);
+ player->SendDirectMessage(&packet);
+
+ RemoveFieldNotifyFlag(UF_FLAG_OWNER);
+}
+
Unit* Unit::GetOwner() const
{
if (uint64 ownerid = GetOwnerGUID())
@@ -9701,7 +9764,7 @@ Minion *Unit::GetFirstMinion() const
if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
return (Minion*)pet;
- sLog->outError("Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid));
+ sLog->outError(LOG_FILTER_UNITS, "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid));
const_cast<Unit*>(this)->SetMinionGUID(0);
}
@@ -9716,7 +9779,7 @@ Guardian* Unit::GetGuardianPet() const
if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
return (Guardian*)pet;
- sLog->outCrash("Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid);
const_cast<Unit*>(this)->SetPetGUID(0);
}
@@ -9730,7 +9793,7 @@ Unit* Unit::GetCharm() const
if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
return pet;
- sLog->outError("Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid));
+ sLog->outError(LOG_FILTER_UNITS, "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid));
const_cast<Unit*>(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0);
}
@@ -9743,12 +9806,14 @@ void Unit::SetMinion(Minion *minion, bool apply)
if (apply)
{
- if (!minion->AddUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()))
+ if (minion->GetOwnerGUID())
{
- sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
return;
}
+ minion->SetOwnerGUID(GetGUID());
+
m_Controlled.insert(minion);
if (GetTypeId() == TYPEID_PLAYER)
@@ -9817,7 +9882,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
{
if (minion->GetOwnerGUID() != GetGUID())
{
- sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry());
return;
}
@@ -9929,7 +9994,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- sLog->outCrash("Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
charm->m_ControlledByPlayer = true;
// TODO: maybe we can use this flag to check if controlled by player
@@ -9942,9 +10007,10 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- sLog->outCrash("Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
- if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
+ _isWalkingBeforeCharm = charm->IsWalking();
+ if (_isWalkingBeforeCharm)
{
charm->SetWalk(false);
charm->SendMovementFlagUpdate();
@@ -9957,11 +10023,11 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (GetTypeId() == TYPEID_PLAYER)
{
if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID()))
- sLog->outCrash("Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID());
}
if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID()))
- sLog->outCrash("Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID());
if (charm->GetTypeId() == TYPEID_PLAYER)
{
@@ -9982,6 +10048,12 @@ void Unit::SetCharm(Unit* charm, bool apply)
charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
}
+ if (charm->IsWalking() != _isWalkingBeforeCharm)
+ {
+ charm->SetWalk(_isWalkingBeforeCharm);
+ charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
+ }
+
if (charm->GetTypeId() == TYPEID_PLAYER
|| !charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_MINION)
|| charm->GetOwnerGUID() != GetGUID())
@@ -10014,15 +10086,15 @@ int32 Unit::DealHeal(Unit* victim, uint32 addhealth)
// use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
if (gain)
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth);
}
if (Player* player = victim->ToPlayer())
{
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain);
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth);
}
return gain;
@@ -10040,8 +10112,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
if (Unit* magnet = (*itr)->GetBase()->GetCaster())
if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
- && _IsValidAttackTarget(magnet, spellInfo)
- && IsWithinLOSInMap(magnet))
+ && _IsValidAttackTarget(magnet, spellInfo))
{
// TODO: handle this charge drop by proc in cast phase on explicit target
(*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
@@ -10095,14 +10166,14 @@ void Unit::RemoveAllControlled()
else if (target->GetOwnerGUID() == GetGUID() && target->isSummon())
target->ToTempSummon()->UnSummon();
else
- sLog->outError("Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
}
if (GetPetGUID())
- sLog->outCrash("Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID());
if (GetMinionGUID())
- sLog->outCrash("Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID());
if (GetCharmGUID())
- sLog->outCrash("Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID());
}
Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
@@ -10256,6 +10327,10 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
return pdamage;
+ // Some spells don't benefit from done mods
+ if (spellProto->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS)
+ return pdamage;
+
// small exception for Deep Wounds, can't find any general rule
// should ignore ALL damage mods, they already calculated in trigger spell
if (spellProto->Id == 12721) // Deep Wounds
@@ -10287,11 +10362,11 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
{
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
}
}
@@ -10302,13 +10377,13 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// bonus against aurastate
AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE);
for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -10327,7 +10402,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 6928:
{
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Soul Siphon
@@ -10354,19 +10429,19 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
break;
}
}
- AddPctN(DoneTotalMod, modPercent);
+ AddPct(DoneTotalMod, modPercent);
break;
}
case 6916: // Death's Embrace
case 6925:
case 6927:
if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
case 5481: // Starfire Bonus
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
case 4418: // Increased Shock Damage
@@ -10389,14 +10464,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if (!victim->HealthAbovePct(35))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
// Tundra Stalker
else
{
// Frost Fever (target debuff)
if (victim->HasAura(55095))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
break;
@@ -10405,14 +10480,14 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 7293:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
- AddPctF(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
+ AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
break;
}
// Twisted Faith
case 7377:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Marked for Death
@@ -10423,7 +10498,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 7602:
{
if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Dirty Deeds
@@ -10436,7 +10511,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
{
// effect 0 has expected value but in negative state
int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
- AddPctN(DoneTotalMod, bonus);
+ AddPct(DoneTotalMod, bonus);
}
break;
}
@@ -10468,7 +10543,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
if ((*i)->GetSpellInfo()->SpellIconID == 3263)
{
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
}
@@ -10481,13 +10556,13 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
// Increase Mind Flay damage if Shadow Word: Pain present on target
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
// Twisted Faith - Mind Flay part
if (AuraEffect* aurEff = GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_PRIEST, 2848, 1))
// Increase Mind Flay damage if Shadow Word: Pain present on target
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
// Smite
else if (spellProto->SpellFamilyFlags[0] & 0x80)
@@ -10495,7 +10570,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Glyph of Smite
if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
// Shadow Word: Death
else if (spellProto->SpellFamilyFlags[1] & 0x2)
@@ -10503,7 +10578,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Glyph of Shadow Word: Death
if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
break;
case SPELLFAMILY_PALADIN:
@@ -10521,7 +10596,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
}
// + 10% for each application of Holy Vengeance/Blood Corruption on the target
if (stacks)
- AddPctU(DoneTotalMod, 10 * stacks);
+ AddPct(DoneTotalMod, 10 * stacks);
}
break;
case SPELLFAMILY_DRUID:
@@ -10530,7 +10605,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
{
// Brambles
if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
}
break;
case SPELLFAMILY_WARLOCK:
@@ -10542,7 +10617,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
if ((*i)->GetSpellInfo()->SpellIconID == 3173)
{
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
}
@@ -10553,31 +10628,31 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
// Shadow Bite (15% increase from each dot)
if (spellProto->SpellFamilyFlags[1] & 0x00400000 && isPet())
if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
- AddPctN(DoneTotalMod, 15 * count);
+ AddPct(DoneTotalMod, 15 * count);
break;
case SPELLFAMILY_HUNTER:
// Steady Shot
if (spellProto->SpellFamilyFlags[1] & 0x1)
if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
break;
case SPELLFAMILY_DEATHKNIGHT:
// Improved Icy Touch
if (spellProto->SpellFamilyFlags[0] & 0x2)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2721, 0))
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
// Sigil of the Vengeful Heart
if (spellProto->SpellFamilyFlags[0] & 0x2000)
if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
- AddPctN(DoneTotal, aurEff->GetAmount());
+ AddPct(DoneTotal, aurEff->GetAmount());
// Glacier Rot
if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 196, 0))
if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
// Impurity (dummy effect)
if (GetTypeId() == TYPEID_PLAYER)
@@ -10596,7 +10671,7 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
case 49638:
{
if (SpellInfo const* proto = sSpellMgr->GetSpellInfo(itr->first))
- AddPctN(ApCoeffMod, proto->Effects[0].CalcValue());
+ AddPct(ApCoeffMod, proto->Effects[0].CalcValue());
}
break;
}
@@ -10657,13 +10732,6 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- // Some spells don't benefit from done mods
- if (spellProto->AttributesEx3 & SPELL_ATTR3_NO_DONE_BONUS)
- {
- DoneTotal = 0;
- DoneTotalMod = 1.0f;
- }
-
float tmpDamage = (int32(pdamage) + DoneTotal) * DoneTotalMod;
// apply spellmod to Done damage (flat and pct)
if (Player* modOwner = GetSpellModOwner())
@@ -10706,7 +10774,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
if (GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
- AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
+ AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
}
@@ -10716,7 +10784,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
// Mod damage from spell mechanic
if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
@@ -10724,7 +10792,7 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
if (mechanicMask & uint32(1<<((*i)->GetMiscValue())))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask());
@@ -10759,12 +10827,12 @@ uint32 Unit::SpellDamageBonusTaken(Unit* caster, SpellInfo const* spellProto, ui
if (TakenTotal < 0)
{
if (TakenTotalMod < 1)
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod));
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenTotal) * TakenTotalMod) + CalculatePct(pdamage, TakenTotalCasterMod));
else
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenTotal) + CalculatePct(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
}
else if (TakenTotalMod < 1)
- tmpDamage = ((CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenTotal, TakenTotalCasterMod));
+ tmpDamage = ((CalculatePct(float(pdamage) + TakenTotal, TakenTotalCasterMod) * TakenTotalMod) + CalculatePct(float(pdamage) + TakenTotal, TakenTotalCasterMod));
}
if (!tmpDamage)
tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
@@ -10798,14 +10866,14 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
{
// stat used stored in miscValueB for this aura
Stats usedStat = Stats((*i)->GetMiscValueB());
- DoneAdvertisedBenefit += int32(CalculatePctN(GetStat(usedStat), (*i)->GetAmount()));
+ DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
}
}
// ... and attack power
AuraEffectList const& mDamageDonebyAP = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER);
for (AuraEffectList::const_iterator i =mDamageDonebyAP.begin(); i != mDamageDonebyAP.end(); ++i)
if ((*i)->GetMiscValue() & schoolMask)
- DoneAdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
+ DoneAdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
}
return DoneAdvertisedBenefit;
@@ -10844,6 +10912,8 @@ bool Unit::isSpellCrit(Unit* victim, SpellInfo const* spellProto, SpellSchoolMas
case 379: // Earth Shield
case 33778: // Lifebloom Final Bloom
case 64844: // Divine Hymn
+ case 71607: // Item - Bauble of True Blood 10m
+ case 71646: // Item - Bauble of True Blood 25m
break;
default:
return false;
@@ -11041,13 +11111,16 @@ uint32 Unit::SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage
crit_mod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
if (crit_bonus != 0)
- AddPctF(crit_bonus, crit_mod);
+ AddPct(crit_bonus, crit_mod);
crit_bonus -= damage;
- // adds additional damage to crit_bonus (from talents)
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ if (damage > uint32(crit_bonus))
+ {
+ // adds additional damage to critBonus (from talents)
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
+ }
crit_bonus += damage;
@@ -11101,7 +11174,7 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
// Healing done percent
AuraEffectList const& mHealingDonePct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
for (AuraEffectList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -11121,12 +11194,12 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
case 6935:
case 6918:
if (victim->HealthBelowPct(50))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
case 7798: // Glyph of Regrowth
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
case 8477: // Nourish Heal Boost
@@ -11145,13 +11218,13 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
continue;
modPercent += stepPercent * aura->GetStackAmount();
}
- AddPctN(DoneTotalMod, modPercent);
+ AddPct(DoneTotalMod, modPercent);
break;
}
case 7871: // Glyph of Lesser Healing Wave
{
if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0, GetGUID()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
default:
@@ -11212,16 +11285,6 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- // Gift of the Naaru
- if (spellProto->SpellFamilyFlags[2] & 0x80000000 && spellProto->SpellIconID == 329)
- {
- int32 apBonus = int32(std::max(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAttackPowerValue(RANGED_ATTACK)));
- if (apBonus > DoneAdvertisedBenefit)
- DoneTotal += int32(apBonus * 0.22f); // 22% of AP per tick
- else
- DoneTotal += int32(DoneAdvertisedBenefit * 0.377f); // 37.7% of BH per tick
- }
-
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (spellProto->Effects[i].ApplyAuraName)
@@ -11252,15 +11315,15 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
// Healing taken percent
float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if (minval)
- AddPctF(TakenTotalMod, minval);
+ AddPct(TakenTotalMod, minval);
float maxval = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if (maxval)
- AddPctF(TakenTotalMod, maxval);
+ AddPct(TakenTotalMod, maxval);
// Tenacity increase healing % taken
if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
- AddPctN(TakenTotalMod, Tenacity->GetAmount());
+ AddPct(TakenTotalMod, Tenacity->GetAmount());
// Healing Done
int32 TakenTotal = 0;
@@ -11282,11 +11345,11 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
// Healing over time taken percent
float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
if (minval_hot)
- AddPctF(TakenTotalMod, minval_hot);
+ AddPct(TakenTotalMod, minval_hot);
float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
if (maxval_hot)
- AddPctF(TakenTotalMod, maxval_hot);
+ AddPct(TakenTotalMod, maxval_hot);
}
// Check for table values
@@ -11329,7 +11392,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
AuraEffectList const& mHealingGet= GetAuraEffectsByType(SPELL_AURA_MOD_HEALING_RECEIVED);
for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
@@ -11371,14 +11434,14 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
{
// stat used dependent from misc value (stat index)
Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
- AdvertisedBenefit += int32(CalculatePctN(GetStat(usedStat), (*i)->GetAmount()));
+ AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
}
// ... and attack power
AuraEffectList const& mHealingDonebyAP = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER);
for (AuraEffectList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i)
if ((*i)->GetMiscValue() & schoolMask)
- AdvertisedBenefit += int32(CalculatePctN(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
+ AdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
}
return AdvertisedBenefit;
}
@@ -11525,7 +11588,9 @@ bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) cons
SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE];
for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
if (itr->type == aura)
- return true;
+ if (!(spellInfo->AttributesEx3 & SPELL_ATTR3_IGNORE_HIT_RESULT))
+ return true;
+
// Check for immune to application of harmful magical effects
AuraEffectList const& immuneAuraApply = GetAuraEffectsByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
@@ -11607,11 +11672,11 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
{
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
}
}
@@ -11619,13 +11684,13 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
if (creatureTypeMask & uint32((*i)->GetMiscValue()))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// bonus against aurastate
AuraEffectList const& mDamageDoneVersusAurastate = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE);
for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
// done scripted mod (take it from owner)
Unit* owner = GetOwner() ? GetOwner() : this;
@@ -11645,14 +11710,14 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if (!victim->HealthAbovePct(35))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
// Tundra Stalker
else
{
// Frost Fever (target debuff)
if (victim->HasAura(55095))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
}
break;
}
@@ -11660,7 +11725,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
case 7293:
{
if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
- AddPctF(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
+ AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
break;
}
// Marked for Death
@@ -11671,7 +11736,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
case 7602:
{
if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AddPct(DoneTotalMod, (*i)->GetAmount());
break;
}
// Dirty Deeds
@@ -11682,7 +11747,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
{
// effect 0 has expected value but in negative state
int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
- AddPctN(DoneTotalMod, bonus);
+ AddPct(DoneTotalMod, bonus);
}
break;
}
@@ -11698,7 +11763,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 196, 0))
if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
- AddPctN(DoneTotalMod, aurEff->GetAmount());
+ AddPct(DoneTotalMod, aurEff->GetAmount());
break;
}
@@ -11754,7 +11819,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
AuraEffectList const& mOwnerTaken = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
// Mod damage from spell mechanic
uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
@@ -11768,7 +11833,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
AuraEffectList const& mDamageDoneMechanic = GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
if (mechanicMask & uint32(1<<((*i)->GetMiscValue())))
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
}
@@ -11785,7 +11850,7 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
if (GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f);
- AddPctF(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
+ AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
}
break;
}
@@ -11804,13 +11869,13 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
{
AuraEffectList const& mModMeleeDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
else
{
AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
- AddPctN(TakenTotalMod, (*i)->GetAmount());
+ AddPct(TakenTotalMod, (*i)->GetAmount());
}
float tmpDamage = 0.0f;
@@ -11820,12 +11885,12 @@ uint32 Unit::MeleeDamageBonusTaken(Unit* attacker, uint32 pdamage, WeaponAttackT
if (TakenFlatBenefit < 0)
{
if (TakenTotalMod < 1)
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePctF(pdamage, TakenTotalCasterMod));
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) * TakenTotalMod) + CalculatePct(pdamage, TakenTotalCasterMod));
else
- tmpDamage = ((float(CalculatePctF(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePctF(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
+ tmpDamage = ((float(CalculatePct(pdamage, TakenTotalCasterMod) + TakenFlatBenefit) + CalculatePct(pdamage, TakenTotalCasterMod)) * TakenTotalMod);
}
else if (TakenTotalMod < 1)
- tmpDamage = ((CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePctF(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod));
+ tmpDamage = ((CalculatePct(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod) * TakenTotalMod) + CalculatePct(float(pdamage) + TakenFlatBenefit, TakenTotalCasterMod));
}
if (!tmpDamage)
tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
@@ -12230,19 +12295,21 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
if (GetReactionTo(target) == REP_NEUTRAL &&
target->GetReactionTo(this) == REP_NEUTRAL)
{
- if (
- !(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
- !(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT)
- )
+ if (!(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
+ !(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT))
{
Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : ToPlayer();
Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : this;
if (FactionTemplateEntry const* factionTemplate = creature->getFactionTemplateEntry())
- if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
- if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
- if (!(repState->Flags & FACTION_FLAG_AT_WAR))
- return false;
+ {
+ if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
+ if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
+ if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
+ if (!(repState->Flags & FACTION_FLAG_AT_WAR))
+ return false;
+
+ }
}
}
@@ -12380,6 +12447,10 @@ int32 Unit::ModifyHealth(int32 dVal)
if (dVal == 0)
return 0;
+ // Part of Evade mechanics. Only track health lost, not gained.
+ if (dVal < 0 && GetTypeId() != TYPEID_PLAYER && !isPet())
+ SetLastDamagedTime(time(NULL));
+
int32 curHealth = (int32)GetHealth();
int32 val = dVal + curHealth;
@@ -12579,14 +12650,14 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
break;
}
default:
- sLog->outError("Unit::UpdateSpeed: Unsupported move type (%d)", mtype);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::UpdateSpeed: Unsupported move type (%d)", mtype);
return;
}
// now we ready for speed calculation
float speed = std::max(non_stack_bonus, stack_bonus);
if (main_speed_mod)
- AddPctN(speed, main_speed_mod);
+ AddPct(speed, main_speed_mod);
switch (mtype)
{
@@ -12624,7 +12695,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
int32 slow = GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED);
if (slow)
{
- AddPctN(speed, slow);
+ AddPct(speed, slow);
if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
{
float min_speed = minSpeedMod / 100.0f;
@@ -12686,7 +12757,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8+4+2+4+4+4+4+4+4+4);
break;
default:
- sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
return;
}
@@ -12737,7 +12808,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE, 16);
break;
default:
- sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype);
return;
}
data.append(GetPackGUID());
@@ -13006,6 +13077,14 @@ Unit* Creature::SelectVictim()
return target;
}
+ // Case where mob is being kited.
+ // Mob may not be in range to attack or may have dropped target. In any case,
+ // don't evade if damage received within the last 10 seconds
+ // Does not apply to world bosses to prevent kiting to cities
+ if (!isWorldBoss() && !GetInstanceId())
+ if (time(NULL) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
+ return target;
+
// last case when creature must not go to evade mode:
// it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
// for example at owner command to pet attack some far away creature
@@ -13135,7 +13214,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
durationMod = durationMod_always;
if (durationMod != 0)
- AddPctN(duration, durationMod);
+ AddPct(duration, durationMod);
// there are only negative mods currently
durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
@@ -13148,7 +13227,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
durationMod += durationMod_always;
if (durationMod != 0)
- AddPctN(duration, durationMod);
+ AddPct(duration, durationMod);
}
else
{
@@ -13182,13 +13261,13 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
}
break;
case SPELLFAMILY_PALADIN:
- if (spellProto->SpellFamilyFlags[0] & 0x00000002)
+ if ((spellProto->SpellFamilyFlags[0] & 0x00000002) && spellProto->SpellIconID == 298)
{
// Glyph of Blessing of Might
if (AuraEffect* aurEff = GetAuraEffect(57958, 0))
duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
}
- else if (spellProto->SpellFamilyFlags[0] & 0x00010000)
+ else if ((spellProto->SpellFamilyFlags[0] & 0x00010000) && spellProto->SpellIconID == 306)
{
// Glyph of Blessing of Wisdom
if (AuraEffect* aurEff = GetAuraEffect(57979, 0))
@@ -13395,7 +13474,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
{
if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
- sLog->outError("ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
+ sLog->outError(LOG_FILTER_UNITS, "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
return false;
}
@@ -13460,7 +13539,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co
{
if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
{
- sLog->outError("attempt to access non-existing modifier value from UnitMods!");
+ sLog->outError(LOG_FILTER_UNITS, "attempt to access non-existing modifier value from UnitMods!");
return 0.0f;
}
@@ -13490,7 +13569,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const
{
if (unitMod >= UNIT_MOD_END)
{
- sLog->outError("attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
+ sLog->outError(LOG_FILTER_UNITS, "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
return 0.0f;
}
@@ -13592,6 +13671,9 @@ void Unit::SetLevel(uint8 lvl)
// group update
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetGroup())
ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
+
+ if (GetTypeId() == TYPEID_PLAYER)
+ sWorld->UpdateCharacterNameDataLevel(ToPlayer()->GetGUIDLow(), lvl);
}
void Unit::SetHealth(uint32 val)
@@ -13771,7 +13853,7 @@ void Unit::RemoveFromWorld()
if (GetCharmerGUID())
{
- sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u has charmer guid when removed from world", GetEntry());
ASSERT(false);
}
@@ -13779,7 +13861,7 @@ void Unit::RemoveFromWorld()
{
if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
{
- sLog->outCrash("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry());
ASSERT(false);
}
}
@@ -13870,16 +13952,17 @@ void Unit::DeleteCharmInfo()
}
CharmInfo::CharmInfo(Unit* unit)
-: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
- m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false)
+: _unit(unit), _CommandState(COMMAND_FOLLOW), _petnumber(0), _barInit(false),
+ _isCommandAttack(false), _isAtStay(false), _isFollowing(false), _isReturning(false),
+ _stayX(0.0f), _stayY(0.0f), _stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
- m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
+ _charmspells[i].SetActionAndType(0, ACT_DISABLED);
- if (m_unit->GetTypeId() == TYPEID_UNIT)
+ if (_unit->GetTypeId() == TYPEID_UNIT)
{
- m_oldReactState = m_unit->ToCreature()->GetReactState();
- m_unit->ToCreature()->SetReactState(REACT_PASSIVE);
+ _oldReactState = _unit->ToCreature()->GetReactState();
+ _unit->ToCreature()->SetReactState(REACT_PASSIVE);
}
}
@@ -13889,9 +13972,9 @@ CharmInfo::~CharmInfo()
void CharmInfo::RestoreState()
{
- if (m_unit->GetTypeId() == TYPEID_UNIT)
- if (Creature* creature = m_unit->ToCreature())
- creature->SetReactState(m_oldReactState);
+ if (_unit->GetTypeId() == TYPEID_UNIT)
+ if (Creature* creature = _unit->ToCreature())
+ creature->SetReactState(_oldReactState);
}
void CharmInfo::InitPetActionBar()
@@ -13922,16 +14005,16 @@ void CharmInfo::InitEmptyActionBar(bool withAttack)
void CharmInfo::InitPossessCreateSpells()
{
InitEmptyActionBar();
- if (m_unit->GetTypeId() == TYPEID_UNIT)
+ if (_unit->GetTypeId() == TYPEID_UNIT)
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
- uint32 spellId = m_unit->ToCreature()->m_spells[i];
+ uint32 spellId = _unit->ToCreature()->m_spells[i];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo && !(spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD))
{
if (spellInfo->IsPassive())
- m_unit->CastSpell(m_unit, spellInfo, true);
+ _unit->CastSpell(_unit, spellInfo, true);
else
AddSpellToActionBar(spellInfo, ACT_PASSIVE);
}
@@ -13941,7 +14024,7 @@ void CharmInfo::InitPossessCreateSpells()
void CharmInfo::InitCharmCreateSpells()
{
- if (m_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
+ if (_unit->GetTypeId() == TYPEID_PLAYER) // charmed players don't have spells
{
InitEmptyActionBar();
return;
@@ -13951,23 +14034,23 @@ void CharmInfo::InitCharmCreateSpells()
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
{
- uint32 spellId = m_unit->ToCreature()->m_spells[x];
+ uint32 spellId = _unit->ToCreature()->m_spells[x];
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
{
- m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
+ _charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
continue;
}
if (spellInfo->IsPassive())
{
- m_unit->CastSpell(m_unit, spellInfo, true);
- m_charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
+ _unit->CastSpell(_unit, spellInfo, true);
+ _charmspells[x].SetActionAndType(spellId, ACT_PASSIVE);
}
else
{
- m_charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
+ _charmspells[x].SetActionAndType(spellId, ACT_DISABLED);
ActiveStates newstate = ACT_PASSIVE;
@@ -14044,31 +14127,31 @@ void CharmInfo::ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply)
return;
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
- if (spellInfo->Id == m_charmspells[x].GetAction())
- m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
+ if (spellInfo->Id == _charmspells[x].GetAction())
+ _charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED);
}
void CharmInfo::SetPetNumber(uint32 petnumber, bool statwindow)
{
- m_petnumber = petnumber;
+ _petnumber = petnumber;
if (statwindow)
- m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, m_petnumber);
+ _unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, _petnumber);
else
- m_unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
+ _unit->SetUInt32Value(UNIT_FIELD_PETNUMBER, 0);
}
void CharmInfo::LoadPetActionBar(const std::string& data)
{
InitPetActionBar();
- Tokens tokens(data, ' ');
+ Tokenizer tokens(data, ' ');
if (tokens.size() != (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START) * 2)
return; // non critical, will reset to default
- uint8 index;
- Tokens::iterator iter;
- for (iter = tokens.begin(), index = ACTION_BAR_INDEX_START; index < ACTION_BAR_INDEX_END; ++iter, ++index)
+ uint8 index = ACTION_BAR_INDEX_START;
+ Tokenizer::const_iterator iter = tokens.begin();
+ for (; index < ACTION_BAR_INDEX_END; ++iter, ++index)
{
// use unsigned cast to avoid sign negative format use at long-> ActiveStates (int) conversion
ActiveStates type = ActiveStates(atol(*iter));
@@ -14309,10 +14392,17 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
continue;
ProcTriggeredData triggerData(itr->second->GetBase());
// Defensive procs are active on absorbs (so absorption effects are not a hindrance)
- bool active = (damage > 0) || (procExtra & (PROC_EX_ABSORB|PROC_EX_BLOCK) && isVictim);
+ bool active = damage || (procExtra & PROC_EX_BLOCK && isVictim);
if (isVictim)
procExtra &= ~PROC_EX_INTERNAL_REQ_FAMILY;
+
SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
+
+ // only auras that has triggered spell should proc from fully absorbed damage
+ if (procExtra & PROC_EX_ABSORB && isVictim)
+ if (damage || spellProto->Effects[EFFECT_0].TriggerSpell || spellProto->Effects[EFFECT_1].TriggerSpell || spellProto->Effects[EFFECT_2].TriggerSpell)
+ active = true;
+
if (!IsTriggeredAtSpellProcEvent(target, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, active, triggerData.spellProcEvent))
continue;
@@ -14563,7 +14653,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
// Remove charge (aura can be removed by triggers)
if (useCharges && takeCharges)
- i->aura->DropCharge(AURA_REMOVE_BY_EXPIRE);
+ i->aura->DropCharge();
if (spellInfo->AttributesEx3 & SPELL_ATTR3_DISABLE_PROC)
SetCantProc(false);
@@ -14724,11 +14814,11 @@ void Unit::StopMoving()
init.Launch();
}
-void Unit::SendMovementFlagUpdate()
+void Unit::SendMovementFlagUpdate(bool self /* = false */)
{
WorldPacket data;
BuildHeartBeatMsg(&data);
- SendMessageToSet(&data, false);
+ SendMessageToSet(&data, self);
}
bool Unit::IsSitState() const
@@ -15208,7 +15298,7 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id)
if (!pet->InitStatsForLevel(level))
{
- sLog->outError("Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry());
+ sLog->outError(LOG_FILTER_UNITS, "Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry());
return false;
}
@@ -15386,7 +15476,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
damageSpellId = 43594;
break;
default:
- sLog->outError("Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id);
return false;
}
@@ -15517,7 +15607,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// update get killing blow achievements, must be done before setDeathState to be able to require auras on target
// and before Spirit of Redemption as it also removes auras
if (player)
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
// if talent known but not triggered (check priest class for speedup check)
bool spiritOfRedemption = false;
@@ -15548,7 +15638,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (!spiritOfRedemption)
{
- sLog->outStaticDebug("SET JUST_DIED");
+ sLog->outDebug(LOG_FILTER_UNITS, "SET JUST_DIED");
victim->setDeathState(JUST_DIED);
}
@@ -15573,7 +15663,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// only if not player and not controlled by player pet. And not at BG
if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
{
- sLog->outStaticDebug("We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
+ sLog->outDebug(LOG_FILTER_UNITS, "We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false);
// durability lost message
WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);
@@ -15593,7 +15683,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
}
else // creature died
{
- sLog->outStaticDebug("DealDamageNotPlayer");
+ sLog->outDebug(LOG_FILTER_UNITS, "DealDamageNotPlayer");
if (!creature->isPet())
{
@@ -15645,9 +15735,14 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
// handle player kill only if not suicide (spirit of redemption for example)
if (player && this != victim)
+ {
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
pvp->HandleKill(player, victim);
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
+ bf->HandleKill(player, victim);
+ }
+
//if (victim->GetTypeId() == TYPEID_PLAYER)
// if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
// pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
@@ -15668,9 +15763,9 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (victim->GetTypeId() == TYPEID_PLAYER)
{
if (GetTypeId() == TYPEID_UNIT)
- victim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
+ victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, GetEntry());
else if (GetTypeId() == TYPEID_PLAYER && victim != this)
- victim->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, ToPlayer()->GetTeam());
+ victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, 1, ToPlayer()->GetTeam());
}
// Hook for OnPVPKill Event
@@ -15928,7 +16023,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (this == charmer)
{
- sLog->outCrash("Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow());
return false;
}
@@ -15937,14 +16032,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport())
{
- sLog->outCrash("Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow());
return false;
}
// Already charmed
if (GetCharmerGUID())
{
- sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
return false;
}
@@ -15969,7 +16064,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
// StopCastingCharm may remove a possessed pet?
if (!IsInWorld())
{
- sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
+ sLog->outFatal(LOG_FILTER_UNITS, "Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow());
return false;
}
@@ -16069,7 +16164,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
charmer = GetCharmer();
if (charmer != GetCharmer()) // one aura overrides another?
{
-// sLog->outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD,
+// sLog->outFatal(LOG_FILTER_UNITS, "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD,
// GetGUID(), GetCharmerGUID(), charmer->GetGUID());
// ASSERT(false);
return;
@@ -16100,7 +16195,8 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (Creature* creature = ToCreature())
{
- creature->AI()->OnCharmed(false);
+ if (creature->AI())
+ creature->AI()->OnCharmed(false);
if (type != CHARM_TYPE_VEHICLE) // Vehicles' AI is never modified
{
@@ -16130,12 +16226,16 @@ void Unit::RemoveCharmedBy(Unit* charmer)
charmer->ToPlayer()->SetClientControl(charmer, 1);
charmer->ToPlayer()->SetViewpoint(this, false);
charmer->ToPlayer()->SetClientControl(this, 0);
+ if (GetTypeId() == TYPEID_PLAYER)
+ ToPlayer()->SetMover(this);
break;
case CHARM_TYPE_POSSESS:
charmer->ToPlayer()->SetClientControl(charmer, 1);
charmer->ToPlayer()->SetViewpoint(this, false);
charmer->ToPlayer()->SetClientControl(this, 0);
charmer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
+ if (GetTypeId() == TYPEID_PLAYER)
+ ToPlayer()->SetMover(this);
break;
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
@@ -16147,7 +16247,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (GetCharmInfo())
GetCharmInfo()->SetPetNumber(0, true);
else
- sLog->outError("Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
+ sLog->outError(LOG_FILTER_UNITS, "Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
}
}
break;
@@ -16239,6 +16339,13 @@ uint64 Unit::GetTransGUID() const
return 0;
}
+TransportBase* Unit::GetDirectTransport() const
+{
+ if (Vehicle* veh = GetVehicle())
+ return veh;
+ return GetTransport();
+}
+
bool Unit::IsInPartyWith(Unit const* unit) const
{
if (this == unit)
@@ -16600,181 +16707,184 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const
uint32 Unit::GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
{
float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
- return CalculatePctF(damage, percent);
+ return CalculatePct(damage, percent);
}
-uint32 Unit::GetModelForForm(ShapeshiftForm form)
+uint32 Unit::GetModelForForm(ShapeshiftForm form) const
{
- switch (form)
+ if (GetTypeId() == TYPEID_PLAYER)
{
- case FORM_CAT:
- // Based on Hair color
- if (getRace() == RACE_NIGHTELF)
- {
- uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
- switch (hairColor)
+ switch (form)
+ {
+ case FORM_CAT:
+ // Based on Hair color
+ if (getRace() == RACE_NIGHTELF)
{
- case 7: // Violet
- case 8:
- return 29405;
- case 3: // Light Blue
- return 29406;
- case 0: // Green
- case 1: // Light Green
- case 2: // Dark Green
- return 29407;
- case 4: // White
- return 29408;
- default: // original - Dark Blue
- return 892;
+ uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
+ switch (hairColor)
+ {
+ case 7: // Violet
+ case 8:
+ return 29405;
+ case 3: // Light Blue
+ return 29406;
+ case 0: // Green
+ case 1: // Light Green
+ case 2: // Dark Green
+ return 29407;
+ case 4: // White
+ return 29408;
+ default: // original - Dark Blue
+ return 892;
+ }
}
- }
- // Based on Skin color
- else if (getRace() == RACE_TAUREN)
- {
- uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
- // Male
- if (getGender() == GENDER_MALE)
+ // Based on Skin color
+ else if (getRace() == RACE_TAUREN)
{
- switch (skinColor)
+ uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
+ // Male
+ if (getGender() == GENDER_MALE)
+ {
+ switch (skinColor)
+ {
+ case 12: // White
+ case 13:
+ case 14:
+ case 18: // Completly White
+ return 29409;
+ case 9: // Light Brown
+ case 10:
+ case 11:
+ return 29410;
+ case 6: // Brown
+ case 7:
+ case 8:
+ return 29411;
+ case 0: // Dark
+ case 1:
+ case 2:
+ case 3: // Dark Grey
+ case 4:
+ case 5:
+ return 29412;
+ default: // original - Grey
+ return 8571;
+ }
+ }
+ // Female
+ else switch (skinColor)
{
- case 12: // White
- case 13:
- case 14:
- case 18: // Completly White
+ case 10: // White
return 29409;
- case 9: // Light Brown
- case 10:
- case 11:
- return 29410;
- case 6: // Brown
+ case 6: // Light Brown
case 7:
- case 8:
+ return 29410;
+ case 4: // Brown
+ case 5:
return 29411;
case 0: // Dark
case 1:
case 2:
- case 3: // Dark Grey
- case 4:
- case 5:
+ case 3:
return 29412;
default: // original - Grey
return 8571;
}
}
- // Female
- else switch (skinColor)
- {
- case 10: // White
- return 29409;
- case 6: // Light Brown
- case 7:
- return 29410;
- case 4: // Brown
- case 5:
- return 29411;
- case 0: // Dark
- case 1:
- case 2:
- case 3:
- return 29412;
- default: // original - Grey
- return 8571;
- }
- }
- else if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 892;
- else
- return 8571;
- case FORM_DIREBEAR:
- case FORM_BEAR:
- // Based on Hair color
- if (getRace() == RACE_NIGHTELF)
- {
- uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
- switch (hairColor)
+ else if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 892;
+ else
+ return 8571;
+ case FORM_DIREBEAR:
+ case FORM_BEAR:
+ // Based on Hair color
+ if (getRace() == RACE_NIGHTELF)
{
- case 0: // Green
- case 1: // Light Green
- case 2: // Dark Green
- return 29413; // 29415?
- case 6: // Dark Blue
- return 29414;
- case 4: // White
- return 29416;
- case 3: // Light Blue
- return 29417;
- default: // original - Violet
- return 2281;
+ uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
+ switch (hairColor)
+ {
+ case 0: // Green
+ case 1: // Light Green
+ case 2: // Dark Green
+ return 29413; // 29415?
+ case 6: // Dark Blue
+ return 29414;
+ case 4: // White
+ return 29416;
+ case 3: // Light Blue
+ return 29417;
+ default: // original - Violet
+ return 2281;
+ }
}
- }
- // Based on Skin color
- else if (getRace() == RACE_TAUREN)
- {
- uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
- // Male
- if (getGender() == GENDER_MALE)
+ // Based on Skin color
+ else if (getRace() == RACE_TAUREN)
{
- switch (skinColor)
+ uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
+ // Male
+ if (getGender() == GENDER_MALE)
+ {
+ switch (skinColor)
+ {
+ case 0: // Dark (Black)
+ case 1:
+ case 2:
+ return 29418;
+ case 3: // White
+ case 4:
+ case 5:
+ case 12:
+ case 13:
+ case 14:
+ return 29419;
+ case 9: // Light Brown/Grey
+ case 10:
+ case 11:
+ case 15:
+ case 16:
+ case 17:
+ return 29420;
+ case 18: // Completly White
+ return 29421;
+ default: // original - Brown
+ return 2289;
+ }
+ }
+ // Female
+ else switch (skinColor)
{
case 0: // Dark (Black)
case 1:
- case 2:
return 29418;
- case 3: // White
- case 4:
- case 5:
- case 12:
- case 13:
- case 14:
+ case 2: // White
+ case 3:
return 29419;
- case 9: // Light Brown/Grey
- case 10:
- case 11:
- case 15:
- case 16:
- case 17:
+ case 6: // Light Brown/Grey
+ case 7:
+ case 8:
+ case 9:
return 29420;
- case 18: // Completly White
+ case 10: // Completly White
return 29421;
default: // original - Brown
return 2289;
}
}
- // Female
- else switch (skinColor)
- {
- case 0: // Dark (Black)
- case 1:
- return 29418;
- case 2: // White
- case 3:
- return 29419;
- case 6: // Light Brown/Grey
- case 7:
- case 8:
- case 9:
- return 29420;
- case 10: // Completly White
- return 29421;
- default: // original - Brown
- return 2289;
- }
- }
- else if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 2281;
- else
- return 2289;
- case FORM_FLIGHT:
- if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 20857;
- return 20872;
- case FORM_FLIGHT_EPIC:
- if (Player::TeamForRace(getRace()) == ALLIANCE)
- return 21243;
- return 21244;
- default:
- break;
+ else if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 2281;
+ else
+ return 2289;
+ case FORM_FLIGHT:
+ if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 20857;
+ return 20872;
+ case FORM_FLIGHT_EPIC:
+ if (Player::TeamForRace(getRace()) == ALLIANCE)
+ return 21243;
+ return 21244;
+ default:
+ break;
+ }
}
uint32 modelid = 0;
@@ -16890,8 +17000,8 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward)
GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
else
{
- float vcos = cos(angle+GetOrientation());
- float vsin = sin(angle+GetOrientation());
+ float vcos = std::cos(angle+GetOrientation());
+ float vsin = std::sin(angle+GetOrientation());
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
data.append(GetPackGUID());
@@ -16915,19 +17025,20 @@ void Unit::JumpTo(WorldObject* obj, float speedZ)
bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{
+ bool result = false;
uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
//! First check simple relations from clicker to clickee
if (!itr->second.IsFitToRequirements(clicker, this))
- return false;
+ continue;
//! Check database conditions
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
- return false;
+ continue;
Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
@@ -16952,12 +17063,12 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
if (!valid)
{
- sLog->outErrorDb("Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
- return false;
+ sLog->outError(LOG_FILTER_SQL, "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
+ continue;
}
if (IsInMap(caster))
- caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, false, NULL, NULL, origCasterGUID);
+ caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0+i), seatId+1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID);
else // This can happen during Player::_LoadAuras
{
int32 bp0 = seatId;
@@ -16967,22 +17078,27 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
else
{
if (IsInMap(caster))
- caster->CastSpell(target, spellEntry, false, NULL, NULL, origCasterGUID);
+ caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, NULL, NULL, origCasterGUID);
else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, NULL, NULL, origCasterGUID);
}
+
+ result = true;
}
- Creature* creature = ToCreature();
- if (creature && creature->IsAIEnabled)
- creature->AI()->OnSpellClick(clicker);
+ if (result)
+ {
+ Creature* creature = ToCreature();
+ if (creature && creature->IsAIEnabled)
+ creature->AI()->OnSpellClick(clicker);
+ }
- return true;
+ return result;
}
void Unit::EnterVehicle(Unit* base, int8 seatId)
{
- CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, false);
+ CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, seatId+1, base, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
}
void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* aurApp)
@@ -17000,6 +17116,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
sLog->outDebug(LOG_FILTER_VEHICLES, "EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
ChangeSeat(seatId);
}
+
return;
}
else
@@ -17035,6 +17152,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
ASSERT(!m_vehicle);
m_vehicle = vehicle;
+
if (!m_vehicle->AddPassenger(this, seatId))
{
m_vehicle = NULL;
@@ -17087,9 +17205,11 @@ void Unit::_ExitVehicle(Position const* exitPosition)
m_vehicle->RemovePassenger(this);
+ Player* player = ToPlayer();
+
// If player is on mouted duel and exits the mount should immediatly lose the duel
- if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->duel && ToPlayer()->duel->isMounted)
- ToPlayer()->DuelComplete(DUEL_FLED);
+ if (player && player->duel && player->duel->isMounted)
+ player->DuelComplete(DUEL_FLED);
// This should be done before dismiss, because there may be some aura removal
Vehicle* vehicle = m_vehicle;
@@ -17106,8 +17226,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
AddUnitState(UNIT_STATE_MOVE);
- if (GetTypeId() == TYPEID_PLAYER)
- ToPlayer()->SetFallInformation(0, GetPositionZ());
+ if (player)
+ player->SetFallInformation(0, GetPositionZ());
else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
{
WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8);
@@ -17123,7 +17243,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
//GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above)
- if (Player* player = ToPlayer())
+ if (player)
player->ResummonPetTemporaryUnSummonedIfAny();
if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
@@ -17252,7 +17372,7 @@ void Unit::UpdateOrientation(float orientation)
{
SetOrientation(orientation);
if (IsVehicle())
- GetVehicleKit()->RelocatePassengers(GetPositionX(), GetPositionY(), GetPositionZ(), orientation);
+ GetVehicleKit()->RelocatePassengers();
}
//! Only server-side height update, does not broadcast to client
@@ -17260,7 +17380,7 @@ void Unit::UpdateHeight(float newZ)
{
Relocate(GetPositionX(), GetPositionY(), newZ);
if (IsVehicle())
- GetVehicleKit()->RelocatePassengers(GetPositionX(), GetPositionY(), newZ, GetOrientation());
+ GetVehicleKit()->RelocatePassengers();
}
void Unit::SendThreatListUpdate()
@@ -17273,11 +17393,11 @@ void Unit::SendThreatListUpdate()
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data.append(GetPackGUID());
data << uint32(count);
- std::list<HostileReference*>& tlist = getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
+ ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data.appendPackGUID((*itr)->getUnitGuid());
- data << uint32((*itr)->getThreat() * 100);
+ data << uint32((*itr)->getThreat()*100);
}
SendMessageToSet(&data, false);
}
@@ -17294,8 +17414,8 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
data.append(GetPackGUID());
data.appendPackGUID(pHostileReference->getUnitGuid());
data << uint32(count);
- std::list<HostileReference*>& tlist = getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
+ ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data.appendPackGUID((*itr)->getUnitGuid());
data << uint32((*itr)->getThreat());
@@ -17336,7 +17456,7 @@ void Unit::RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
addRage = (damage / rageconversion * 7.5f + weaponSpeedHitFactor) / 2;
// talent who gave more rage on attack
- AddPctN(addRage, GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT));
+ AddPct(addRage, GetTotalAuraModifier(SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT));
}
else
{
@@ -17388,39 +17508,44 @@ void Unit::StopAttackFaction(uint32 faction_id)
void Unit::OutDebugInfo() const
{
- sLog->outError("Unit::OutDebugInfo");
- sLog->outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName());
- sLog->outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
- sLog->outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
+ sLog->outError(LOG_FILTER_UNITS, "Unit::OutDebugInfo");
+ sLog->outInfo(LOG_FILTER_UNITS, "GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str());
+ sLog->outInfo(LOG_FILTER_UNITS, "OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
+ sLog->outInfo(LOG_FILTER_UNITS, "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
if (IsInWorld())
- sLog->outString("Mapid %u", GetMapId());
+ sLog->outInfo(LOG_FILTER_UNITS, "Mapid %u", GetMapId());
- sLog->outStringInLine("Summon Slot: ");
+ std::ostringstream o;
+ o << "Summon Slot: ";
for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
- sLog->outStringInLine(UI64FMTD", ", m_SummonSlot[i]);
- sLog->outString();
+ o << m_SummonSlot[i] << ", ";
- sLog->outStringInLine("Controlled List: ");
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
+ o.str("");
+
+ o << "Controlled List: ";
for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
- sLog->outStringInLine(UI64FMTD", ", (*itr)->GetGUID());
- sLog->outString();
+ o << (*itr)->GetGUID() << ", ";
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
+ o.str("");
- sLog->outStringInLine("Aura List: ");
+ o << "Aura List: ";
for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
- sLog->outStringInLine("%u, ", itr->first);
- sLog->outString();
+ o << itr->first << ", ";
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
+ o.str("");
if (IsVehicle())
{
- sLog->outStringInLine("Passenger List: ");
+ o << "Passenger List: ";
for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger))
- sLog->outStringInLine(UI64FMTD", ", passenger->GetGUID());
- sLog->outString();
+ o << passenger->GetGUID() << ", ";
+ sLog->outInfo(LOG_FILTER_UNITS, "%s", o.str().c_str());
}
if (GetVehicle())
- sLog->outString("On vehicle %u.", GetVehicleBase()->GetEntry());
+ sLog->outInfo(LOG_FILTER_UNITS, "On vehicle %u.", GetVehicleBase()->GetEntry());
}
uint32 Unit::GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex) const
@@ -17458,58 +17583,68 @@ uint32 Unit::GetResistance(SpellSchoolMask mask) const
void CharmInfo::SetIsCommandAttack(bool val)
{
- m_isCommandAttack = val;
+ _isCommandAttack = val;
}
bool CharmInfo::IsCommandAttack()
{
- return m_isCommandAttack;
+ return _isCommandAttack;
+}
+
+void CharmInfo::SetIsCommandFollow(bool val)
+{
+ _isCommandFollow = val;
+}
+
+bool CharmInfo::IsCommandFollow()
+{
+ return _isCommandFollow;
}
void CharmInfo::SaveStayPosition()
{
//! At this point a new spline destination is enabled because of Unit::StopMoving()
- G3D::Vector3 const stayPos = m_unit->movespline->FinalDestination();
- m_stayX = stayPos.x;
- m_stayY = stayPos.y;
- m_stayZ = stayPos.z;
+ G3D::Vector3 const stayPos = _unit->movespline->FinalDestination();
+ _stayX = stayPos.x;
+ _stayY = stayPos.y;
+ _stayZ = stayPos.z;
}
void CharmInfo::GetStayPosition(float &x, float &y, float &z)
{
- x = m_stayX;
- y = m_stayY;
- z = m_stayZ;
+ x = _stayX;
+ y = _stayY;
+ z = _stayZ;
}
void CharmInfo::SetIsAtStay(bool val)
{
- m_isAtStay = val;
+ _isAtStay = val;
}
bool CharmInfo::IsAtStay()
{
- return m_isAtStay;
+ return _isAtStay;
}
void CharmInfo::SetIsFollowing(bool val)
{
- m_isFollowing = val;
+ _isFollowing = val;
}
bool CharmInfo::IsFollowing()
{
- return m_isFollowing;
+ return _isFollowing;
}
void CharmInfo::SetIsReturning(bool val)
{
- m_isReturning = val;
+ _isReturning = val;
}
bool CharmInfo::IsReturning()
{
- return m_isReturning;
+ return _isReturning;
}
void Unit::SetInFront(Unit const* target)
@@ -17653,3 +17788,31 @@ void Unit::SendMovementCanFlyChange()
BuildMovementPacket(&data);
SendMessageToSet(&data, false);
}
+
+void Unit::FocusTarget(Spell const* focusSpell, uint64 target)
+{
+ // already focused
+ if (_focusSpell)
+ return;
+
+ _focusSpell = focusSpell;
+ SetUInt64Value(UNIT_FIELD_TARGET, target);
+ if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
+ AddUnitState(UNIT_STATE_ROTATING);
+}
+
+void Unit::ReleaseFocus(Spell const* focusSpell)
+{
+ // focused to something else
+ if (focusSpell != _focusSpell)
+ return;
+
+ _focusSpell = NULL;
+ if (Unit* victim = getVictim())
+ SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
+ else
+ SetUInt64Value(UNIT_FIELD_TARGET, 0);
+
+ if (focusSpell->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_DONT_TURN_DURING_CAST)
+ ClearUnitState(UNIT_STATE_ROTATING);
+}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 2855b93b0d7..3053d0018d4 100755..100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -19,24 +19,14 @@
#ifndef __UNIT_H
#define __UNIT_H
-#include "Common.h"
-#include "Object.h"
-#include "Opcodes.h"
-#include "SpellAuraDefines.h"
-#include "UpdateFields.h"
-#include "SharedDefines.h"
-#include "ThreatManager.h"
-#include "HostileRefManager.h"
+#include "EventProcessor.h"
#include "FollowerReference.h"
#include "FollowerRefManager.h"
-#include "EventProcessor.h"
+#include "HostileRefManager.h"
#include "MotionMaster.h"
-#include "DBCStructure.h"
-#include "SpellInfo.h"
-#include "Path.h"
-#include "WorldPacket.h"
-#include "Timer.h"
-#include <list>
+#include "Object.h"
+#include "SpellAuraDefines.h"
+#include "ThreatManager.h"
#define WORLD_TRIGGER 12999
@@ -46,7 +36,7 @@ enum SpellInterruptFlags
SPELL_INTERRUPT_FLAG_PUSH_BACK = 0x02, // push back
SPELL_INTERRUPT_FLAG_UNK3 = 0x04, // any info?
SPELL_INTERRUPT_FLAG_INTERRUPT = 0x08, // interrupt
- SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10, // _complete_ interrupt on direct damage
+ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG = 0x10 // _complete_ interrupt on direct damage
//SPELL_INTERRUPT_UNK = 0x20 // unk, 564 of 727 spells having this spell start with "Glyph"
};
@@ -86,7 +76,7 @@ enum SpellAuraInterruptFlags
AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000, // 24 removed by any direct damage
AURA_INTERRUPT_FLAG_LANDING = 0x02000000, // 25 removed by hitting the ground
- AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE),
+ AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE)
};
enum SpellModOp
@@ -133,7 +123,7 @@ enum SpellValueMod
SPELLVALUE_BASE_POINT2,
SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS,
- SPELLVALUE_AURA_STACK,
+ SPELLVALUE_AURA_STACK
};
typedef std::pair<SpellValueMod, int32> CustomSpellValueMod;
@@ -253,7 +243,7 @@ enum UnitPVPStateFlags
enum UnitRename
{
UNIT_CAN_BE_RENAMED = 0x01,
- UNIT_CAN_BE_ABANDONED = 0x02,
+ UNIT_CAN_BE_ABANDONED = 0x02
};
#define CREATURE_MAX_SPELLS 8
@@ -262,6 +252,9 @@ enum UnitRename
#define MAX_SPELL_POSSESS 8
#define MAX_SPELL_CONTROL_BAR 10
+#define MAX_AGGRO_RESET_TIME 10 // in seconds
+#define MAX_AGGRO_RADIUS 45.0f // yards
+
enum Swing
{
NOSWING = 0,
@@ -339,6 +332,8 @@ class UnitAI;
class Totem;
class Transport;
class Vehicle;
+class TransportBase;
+class SpellCastTargets;
typedef std::list<Unit*> UnitList;
typedef std::list< std::pair<Aura*, uint8> > DispelChargesList;
@@ -402,7 +397,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_FULL_MASK = 0xFFFFFFFF,
+ TRIGGERED_FULL_MASK = 0xFFFFFFFF
};
enum UnitMods
@@ -461,11 +456,11 @@ enum BaseModType
enum DeathState
{
- ALIVE = 0,
- JUST_DIED = 1,
- CORPSE = 2,
- DEAD = 3,
- JUST_RESPAWNED = 4,
+ ALIVE = 0,
+ JUST_DIED = 1,
+ CORPSE = 2,
+ DEAD = 3,
+ JUST_RESPAWNED = 4
};
enum UnitState
@@ -618,17 +613,24 @@ enum UnitFlags
// Value masks for UNIT_FIELD_FLAGS_2
enum UnitFlags2
{
- UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
- UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
- UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
- UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
- UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
- UNIT_FLAG2_FORCE_MOVE = 0x00000040,
- UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
- UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
- UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
- UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
- UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
+ UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
+ UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
+ UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
+ UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
+ UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
+ UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
+ UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
+ UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
+ UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
+ UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
+ UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
+ UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
+ UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
+ UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
+ UNIT_FLAG2_DISABLE_TURN = 0x00008000,
+ UNIT_FLAG2_UNK2 = 0x00010000,
+ UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
+ UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000 // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
};
/// Non Player Character flags
@@ -660,7 +662,7 @@ enum NPCFlags
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click)
- UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // players with mounts that have vehicle data should have it set
+ UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000 // players with mounts that have vehicle data should have it set
};
enum MovementFlags
@@ -712,7 +714,7 @@ enum MovementFlags
//! TODO if needed: add more flags to this masks that are exclusive to players
MOVEMENTFLAG_MASK_PLAYER_ONLY =
- MOVEMENTFLAG_FLYING,
+ MOVEMENTFLAG_FLYING
};
enum MovementFlags2
{
@@ -732,7 +734,7 @@ enum MovementFlags2
MOVEMENTFLAG2_INTERPOLATED_PITCHING = 0x00001000,
MOVEMENTFLAG2_UNK14 = 0x00002000,
MOVEMENTFLAG2_UNK15 = 0x00004000,
- MOVEMENTFLAG2_UNK16 = 0x00008000,
+ MOVEMENTFLAG2_UNK16 = 0x00008000
};
enum UnitTypeMask
@@ -747,7 +749,7 @@ enum UnitTypeMask
UNIT_MASK_PUPPET = 0x00000040,
UNIT_MASK_HUNTER_PET = 0x00000080,
UNIT_MASK_CONTROLABLE_GUARDIAN = 0x00000100,
- UNIT_MASK_ACCESSORY = 0x00000200,
+ UNIT_MASK_ACCESSORY = 0x00000200
};
namespace Movement{
@@ -761,7 +763,7 @@ enum DiminishingLevels
DIMINISHING_LEVEL_3 = 2,
DIMINISHING_LEVEL_IMMUNE = 3,
DIMINISHING_LEVEL_4 = 3,
- DIMINISHING_LEVEL_TAUNT_IMMUNE = 4,
+ DIMINISHING_LEVEL_TAUNT_IMMUNE = 4
};
struct DiminishingReturn
@@ -784,21 +786,21 @@ enum MeleeHitOutcome
class DispelInfo
{
-private:
- Unit* const m_dispeller;
- uint32 const m_dispellerSpellId;
- uint8 m_chargesRemoved;
public:
- explicit DispelInfo(Unit* _dispeller, uint32 _dispellerSpellId, uint8 _chargesRemoved) :
- m_dispeller(_dispeller), m_dispellerSpellId(_dispellerSpellId), m_chargesRemoved(_chargesRemoved) {}
+ explicit DispelInfo(Unit* dispeller, uint32 dispellerSpellId, uint8 chargesRemoved) :
+ _dispellerUnit(dispeller), _dispellerSpell(dispellerSpellId), _chargesRemoved(chargesRemoved) {}
- Unit* GetDispeller() { return m_dispeller; }
- uint32 GetDispellerSpellId() const { return m_dispellerSpellId; }
- uint8 GetRemovedCharges() const { return m_chargesRemoved; }
+ Unit* GetDispeller() const { return _dispellerUnit; }
+ uint32 GetDispellerSpellId() const { return _dispellerSpell; }
+ uint8 GetRemovedCharges() const { return _chargesRemoved; }
void SetRemovedCharges(uint8 amount)
{
- m_chargesRemoved = amount;
+ _chargesRemoved = amount;
}
+private:
+ Unit* _dispellerUnit;
+ uint32 _dispellerSpell;
+ uint8 _chargesRemoved;
};
struct CleanDamage
@@ -963,24 +965,6 @@ struct SpellPeriodicAuraLogInfo
uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition);
-enum UnitAnimationState
-{
- ANIMATION_ON_GROUND = 0,
- ANIMATION_SWIMMING = 1,
- ANIMATION_HOVER = 2,
- ANIMATION_FLYING = 3,
-};
-
-struct MonsterMoveData
-{
- MonsterMoveData() : SplineFlag(0), AnimationState(ANIMATION_ON_GROUND), Time(0), SpeedZ(0.0f) {}
- Position DestLocation;
- uint32 SplineFlag;
- UnitAnimationState AnimationState; // Only used with SPLINEFLAG_ANIMATIONTIER
- uint32 Time;
- float SpeedZ; // Only used with SPLINEFLAG_TRAJECTORY
-};
-
#define MAX_DECLINED_NAME_CASES 5
struct DeclinedName
@@ -1090,7 +1074,7 @@ enum CharmType
CHARM_TYPE_CHARM,
CHARM_TYPE_POSSESS,
CHARM_TYPE_VEHICLE,
- CHARM_TYPE_CONVERT,
+ CHARM_TYPE_CONVERT
};
typedef UnitActionBarEntry CharmSpellInfo;
@@ -1100,7 +1084,7 @@ enum ActionBarIndex
ACTION_BAR_INDEX_START = 0,
ACTION_BAR_INDEX_PET_SPELL_START = 3,
ACTION_BAR_INDEX_PET_SPELL_END = 7,
- ACTION_BAR_INDEX_END = 10,
+ ACTION_BAR_INDEX_END = 10
};
#define MAX_UNIT_ACTION_BAR_INDEX (ACTION_BAR_INDEX_END-ACTION_BAR_INDEX_START)
@@ -1111,12 +1095,12 @@ struct CharmInfo
explicit CharmInfo(Unit* unit);
~CharmInfo();
void RestoreState();
- uint32 GetPetNumber() const { return m_petnumber; }
+ uint32 GetPetNumber() const { return _petnumber; }
void SetPetNumber(uint32 petnumber, bool statwindow);
- void SetCommandState(CommandStates st) { m_CommandState = st; }
- CommandStates GetCommandState() const { return m_CommandState; }
- bool HasCommandState(CommandStates state) const { return (m_CommandState == state); }
+ void SetCommandState(CommandStates st) { _CommandState = st; }
+ CommandStates GetCommandState() const { return _CommandState; }
+ bool HasCommandState(CommandStates state) const { return (_CommandState == state); }
void InitPossessCreateSpells();
void InitCharmCreateSpells();
@@ -1137,12 +1121,14 @@ struct CharmInfo
void ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply);
- CharmSpellInfo* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
+ CharmSpellInfo* GetCharmSpell(uint8 index) { return &(_charmspells[index]); }
GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; }
void SetIsCommandAttack(bool val);
bool IsCommandAttack();
+ void SetIsCommandFollow(bool val);
+ bool IsCommandFollow();
void SetIsAtStay(bool val);
bool IsAtStay();
void SetIsFollowing(bool val);
@@ -1154,23 +1140,24 @@ struct CharmInfo
private:
- Unit* m_unit;
+ Unit* _unit;
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX];
- CharmSpellInfo m_charmspells[4];
- CommandStates m_CommandState;
- uint32 m_petnumber;
- bool m_barInit;
+ CharmSpellInfo _charmspells[4];
+ CommandStates _CommandState;
+ uint32 _petnumber;
+ bool _barInit;
//for restoration after charmed
- ReactStates m_oldReactState;
+ ReactStates _oldReactState;
- bool m_isCommandAttack;
- bool m_isAtStay;
- bool m_isFollowing;
- bool m_isReturning;
- float m_stayX;
- float m_stayY;
- float m_stayZ;
+ bool _isCommandAttack;
+ bool _isCommandFollow;
+ bool _isAtStay;
+ bool _isFollowing;
+ bool _isReturning;
+ float _stayX;
+ float _stayY;
+ float _stayZ;
GlobalCooldownMgr m_GlobalCooldownMgr;
};
@@ -1200,7 +1187,7 @@ enum PlayerTotemType
SUMMON_TYPE_TOTEM_FIRE = 63,
SUMMON_TYPE_TOTEM_EARTH = 81,
SUMMON_TYPE_TOTEM_WATER = 82,
- SUMMON_TYPE_TOTEM_AIR = 83,
+ SUMMON_TYPE_TOTEM_AIR = 83
};
// delay time next attack to prevent client attack animation problems
@@ -1342,8 +1329,8 @@ class Unit : public WorldObject
bool HealthAbovePct(int32 pct) const { return GetHealth() > CountPctFromMaxHealth(pct); }
bool HealthAbovePctHealed(int32 pct, uint32 heal) const { return uint64(GetHealth()) + uint64(heal) > CountPctFromMaxHealth(pct); }
float GetHealthPct() const { return GetMaxHealth() ? 100.f * GetHealth() / GetMaxHealth() : 0.0f; }
- uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePctN(GetMaxHealth(), pct); }
- uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePctN(GetHealth(), pct); }
+ uint32 CountPctFromMaxHealth(int32 pct) const { return CalculatePct(GetMaxHealth(), pct); }
+ uint32 CountPctFromCurHealth(int32 pct) const { return CalculatePct(GetHealth(), pct); }
void SetHealth(uint32 val);
void SetMaxHealth(uint32 val);
@@ -1579,13 +1566,14 @@ class Unit : public WorldObject
void CastSpell(SpellCastTargets const& targets, SpellInfo const* spellInfo, CustomSpellValues const* value, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(Unit* victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* victim = NULL, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
Aura* AddAura(uint32 spellId, Unit* target);
Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
@@ -1617,7 +1605,7 @@ class Unit : public WorldObject
void MonsterMoveWithSpeed(float x, float y, float z, float speed);
//void SetFacing(float ori, WorldObject* obj = NULL);
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
- void SendMovementFlagUpdate();
+ void SendMovementFlagUpdate(bool self = false);
/*! These methods send the same packet to the client in apply and unapply case.
The client-side interpretation of this packet depends on the presence of relevant movementflags
@@ -1634,7 +1622,7 @@ class Unit : public WorldObject
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
virtual bool SetWalk(bool enable);
virtual bool SetDisableGravity(bool disable, bool packetOnly = false);
- bool SetHover(bool enable);
+ virtual bool SetHover(bool enable);
void SetInFront(Unit const* target);
void SetFacingTo(float ori);
@@ -1656,6 +1644,7 @@ class Unit : public WorldObject
virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet
uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); }
+ void SetOwnerGUID(uint64 owner);
uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); }
void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); }
uint64 GetMinionGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); }
@@ -2152,7 +2141,7 @@ class Unit : public WorldObject
void AddPetAura(PetAura const* petSpell);
void RemovePetAura(PetAura const* petSpell);
- uint32 GetModelForForm(ShapeshiftForm form);
+ uint32 GetModelForForm(ShapeshiftForm form) const;
uint32 GetModelForTotem(PlayerTotemType totemType);
void SetReducedThreatPercent(uint32 pct, uint64 guid)
@@ -2178,6 +2167,8 @@ class Unit : public WorldObject
uint32 GetTransTime() const { return m_movementInfo.t_time; }
int8 GetTransSeat() const { return m_movementInfo.t_seat; }
uint64 GetTransGUID() const;
+ /// Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
+ TransportBase* GetDirectTransport() const;
bool m_ControlledByPlayer;
@@ -2213,38 +2204,21 @@ class Unit : public WorldObject
void SetTarget(uint64 guid)
{
- if (!_targetLocked)
+ if (!_focusSpell)
SetUInt64Value(UNIT_FIELD_TARGET, guid);
}
- void FocusTarget(Spell const* focusSpell, uint64 target)
- {
- // already focused
- if (_focusSpell)
- return;
-
- _focusSpell = focusSpell;
- _targetLocked = true;
- SetUInt64Value(UNIT_FIELD_TARGET, target);
- }
-
- void ReleaseFocus(Spell const* focusSpell)
- {
- // focused to something else
- if (focusSpell != _focusSpell)
- return;
-
- _focusSpell = NULL;
- _targetLocked = false;
- if (Unit* victim = getVictim())
- SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
- else
- SetUInt64Value(UNIT_FIELD_TARGET, 0);
- }
+ // Handling caster facing during spellcast
+ void FocusTarget(Spell const* focusSpell, uint64 target);
+ void ReleaseFocus(Spell const* focusSpell);
// Movement info
Movement::MoveSpline * movespline;
+ // Part of Evade mechanics
+ time_t GetLastDamagedTime() const { return _lastDamagedTime; }
+ void SetLastDamagedTime(time_t val) { _lastDamagedTime = val; }
+
protected:
explicit Unit (bool isWorldObject);
@@ -2364,8 +2338,10 @@ class Unit : public WorldObject
bool m_cleanupDone; // lock made to not add stuff after cleanup before delete
bool m_duringRemoveFromWorld; // lock made to not add stuff after begining removing from world
- Spell const* _focusSpell;
- bool _targetLocked; // locks the target during spell cast for proper facing
+ Spell const* _focusSpell; ///> Locks the target during spell cast for proper facing
+ bool _isWalkingBeforeCharm; // Are we walking before we were charmed?
+
+ time_t _lastDamagedTime; // Part of Evade mechanics
};
namespace Trinity
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 710821f2f24..c81f9af82ca 100755..100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -29,6 +29,7 @@
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "MoveSplineInit.h"
+#include "TemporarySummon.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry)
{
@@ -323,7 +324,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
ASSERT(!seat->second.Passenger);
}
- sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first);
+ 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())
@@ -347,7 +348,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
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.m_orientation = 0;
+ 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();
@@ -362,9 +363,9 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
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
+ 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);
@@ -397,7 +398,7 @@ 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(), _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())
@@ -437,23 +438,23 @@ void Vehicle::RemovePassenger(Unit* unit)
}
//! Must be called after m_base::Relocate
-void Vehicle::RelocatePassengers(float x, float y, float z, float ang)
+void Vehicle::RelocatePassengers()
{
ASSERT(_me->GetMap());
- // not sure that absolute position calculation is correct, it must depend on vehicle orientation and pitch angle
+ // not sure that absolute position calculation is correct, it must depend on vehicle pitch angle
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
+ {
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger))
{
ASSERT(passenger->IsInWorld());
- float px = x + passenger->m_movementInfo.t_pos.m_positionX;
- float py = y + passenger->m_movementInfo.t_pos.m_positionY;
- float pz = z + passenger->m_movementInfo.t_pos.m_positionZ;
- float po = ang + passenger->m_movementInfo.t_pos.m_orientation;
-
+ float px, py, pz, po;
+ passenger->m_movementInfo.t_pos.GetPosition(px, py, pz, po);
+ CalculatePassengerPosition(px, py, pz, po);
passenger->UpdatePosition(px, py, pz, po);
}
+ }
}
void Vehicle::Dismiss()
@@ -512,3 +513,23 @@ uint8 Vehicle::GetAvailableSeatCount() const
return ret;
}
+
+void Vehicle::CalculatePassengerPosition(float& x, float& y, float& z, float& o)
+{
+ float inx = x, iny = y, inz = z, ino = o;
+ o = GetBase()->GetOrientation() + ino;
+ x = GetBase()->GetPositionX() + inx * std::cos(GetBase()->GetOrientation()) - iny * std::sin(GetBase()->GetOrientation());
+ y = GetBase()->GetPositionY() + iny * std::cos(GetBase()->GetOrientation()) + inx * std::sin(GetBase()->GetOrientation());
+ z = GetBase()->GetPositionZ() + inz;
+}
+
+void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
+{
+ o -= GetBase()->GetOrientation();
+ z -= GetBase()->GetPositionZ();
+ y -= GetBase()->GetPositionY(); // y = searchedY * std::cos(o) + searchedX * std::sin(o)
+ x -= GetBase()->GetPositionX(); // x = searchedX * std::cos(o) + searchedY * std::sin(o + pi)
+ float inx = x, iny = y;
+ 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()));
+}
diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h
index 213be5a21fe..3f1567c74ee 100755..100644
--- a/src/server/game/Entities/Vehicle/Vehicle.h
+++ b/src/server/game/Entities/Vehicle/Vehicle.h
@@ -20,12 +20,16 @@
#define __TRINITY_VEHICLE_H
#include "ObjectDefines.h"
+#include "Object.h"
#include "VehicleDefines.h"
struct VehicleEntry;
+
class Unit;
-class Vehicle
+typedef std::set<uint64> GuidSet;
+
+class Vehicle : public TransportBase
{
public:
explicit Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
@@ -50,11 +54,15 @@ class Vehicle
bool AddPassenger(Unit* passenger, int8 seatId = -1);
void EjectPassenger(Unit* passenger, Unit* controller);
void RemovePassenger(Unit* passenger);
- void RelocatePassengers(float x, float y, float z, float ang);
+ 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; }
+
SeatMap Seats;
VehicleSeatEntry const* GetSeatForPassenger(Unit* passenger);
@@ -63,9 +71,18 @@ class Vehicle
SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger);
void InitMovementInfoForBase();
+ /// This method transforms supplied transport offsets into global coordinates
+ void CalculatePassengerPosition(float& x, float& y, float& z, float& o);
+
+ /// This method transforms supplied global coordinates into local offsets
+ void CalculatePassengerOffset(float& x, float& y, float& z, float& o);
+
Unit* _me;
VehicleEntry const* _vehicleInfo;
+ 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
+
+ Position m_lastShootPos;
};
#endif
diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h
index df34a61d444..cb8a6628b80 100644
--- a/src/server/game/Entities/Vehicle/VehicleDefines.h
+++ b/src/server/game/Entities/Vehicle/VehicleDefines.h
@@ -44,7 +44,7 @@ enum VehicleFlags
VEHICLE_FLAG_FULLSPEEDPITCHING = 0x00000020, // Sets MOVEFLAG2_FULLSPEEDPITCHING
VEHICLE_FLAG_CUSTOM_PITCH = 0x00000040, // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
VEHICLE_FLAG_ADJUST_AIM_ANGLE = 0x00000400, // Lua_IsVehicleAimAngleAdjustable
- VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800, // Lua_IsVehicleAimPowerAdjustable
+ VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800 // Lua_IsVehicleAimPowerAdjustable
};
enum VehicleSpells
@@ -75,4 +75,14 @@ typedef std::vector<VehicleAccessory> VehicleAccessoryList;
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryContainer;
typedef std::map<int8, VehicleSeat> SeatMap;
+class TransportBase
+{
+ public:
+ /// This method transforms supplied transport offsets into global coordinates
+ virtual void CalculatePassengerPosition(float& x, float& y, float& z, float& o) = 0;
+
+ /// This method transforms supplied global coordinates into local offsets
+ virtual void CalculatePassengerOffset(float& x, float& y, float& z, float& o) = 0;
+};
+
#endif
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index d5e85d2cf2f..256864d6a77 100755..100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -205,13 +205,13 @@ void GameEventMgr::LoadFromDB()
{
{
uint32 oldMSTime = getMSTime();
- // 1 2 3 4 5 6 7 8
+ // 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event");
if (!result)
{
mGameEvent.clear();
- sLog->outErrorDb(">> Loaded 0 game events. DB table `game_event` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 game events. DB table `game_event` is empty.");
+
return;
}
@@ -223,7 +223,7 @@ void GameEventMgr::LoadFromDB()
uint8 event_id = fields[0].GetUInt8();
if (event_id == 0)
{
- sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used.");
+ sLog->outError(LOG_FILTER_SQL, "`game_event` game event entry 0 is reserved and can't be used.");
continue;
}
@@ -241,7 +241,7 @@ void GameEventMgr::LoadFromDB()
if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check
{
- sLog->outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id);
continue;
}
@@ -249,7 +249,7 @@ void GameEventMgr::LoadFromDB()
{
if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id))
{
- sLog->outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id);
pGameEvent.holiday_id = HOLIDAY_NONE;
}
}
@@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
- sLog->outString("Loading Game Event Saves Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data...");
{
uint32 oldMSTime = getMSTime();
@@ -273,8 +273,8 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
+
}
else
{
@@ -287,7 +287,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id);
continue;
}
@@ -298,7 +298,7 @@ void GameEventMgr::LoadFromDB()
}
else
{
- sLog->outErrorDb("game_event_save includes event save for non-worldevent id %u", event_id);
+ sLog->outError(LOG_FILTER_SQL, "game_event_save includes event save for non-worldevent id %u", event_id);
continue;
}
@@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
- sLog->outString("Loading Game Event Prerequisite Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data...");
{
uint32 oldMSTime = getMSTime();
@@ -319,8 +319,8 @@ void GameEventMgr::LoadFromDB()
QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite");
if (!result)
{
- sLog->outString(">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
+
}
else
{
@@ -333,7 +333,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -342,14 +342,14 @@ void GameEventMgr::LoadFromDB()
uint16 prerequisite_event = fields[1].GetUInt32();
if (prerequisite_event >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event);
continue;
}
mGameEvent[event_id].prerequisite_events.insert(prerequisite_event);
}
else
{
- sLog->outErrorDb("game_event_prerequisiste includes event entry for non-worldevent id %u", event_id);
+ sLog->outError(LOG_FILTER_SQL, "game_event_prerequisiste includes event entry for non-worldevent id %u", event_id);
continue;
}
@@ -357,23 +357,23 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
- sLog->outString("Loading Game Event Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data...");
{
uint32 oldMSTime = getMSTime();
- // 1 2
+ // 0 1
QueryResult result = WorldDatabase.Query("SELECT creature.guid, game_event_creature.eventEntry FROM creature"
" JOIN game_event_creature ON creature.guid = game_event_creature.guid");
if (!result)
{
- sLog->outString(">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
+
}
else
{
@@ -389,7 +389,7 @@ void GameEventMgr::LoadFromDB()
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size()))
{
- sLog->outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
- sLog->outString("Loading Game Event GO Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data...");
{
uint32 oldMSTime = getMSTime();
@@ -415,8 +415,8 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
+
}
else
{
@@ -432,7 +432,7 @@ void GameEventMgr::LoadFromDB()
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size()))
{
- sLog->outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -443,12 +443,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Model/Equipment Change Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data...");
{
uint32 oldMSTime = getMSTime();
@@ -458,8 +457,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
}
else
{
@@ -473,7 +471,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventModelEquip.size())
{
- sLog->outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -488,7 +486,7 @@ void GameEventMgr::LoadFromDB()
{
if (!sObjectMgr->GetEquipmentInfo(newModelEquipSet.equipment_id))
{
- sLog->outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.",
+ 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);
continue;
}
@@ -500,12 +498,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -514,8 +511,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
}
else
{
@@ -530,7 +526,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventCreatureQuests.size())
{
- sLog->outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -541,12 +537,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event GO Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -555,8 +550,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
}
else
{
@@ -571,7 +565,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventGameObjectQuests.size())
{
- sLog->outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -582,12 +576,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Quest Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -596,8 +589,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
}
else
{
@@ -613,7 +605,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -625,12 +617,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -639,8 +630,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
}
else
{
@@ -654,7 +644,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -667,12 +657,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Condition Save Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data...");
{
uint32 oldMSTime = getMSTime();
@@ -681,8 +670,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
}
else
{
@@ -696,7 +684,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -707,7 +695,7 @@ void GameEventMgr::LoadFromDB()
}
else
{
- sLog->outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition);
+ sLog->outError(LOG_FILTER_SQL, "game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition);
continue;
}
@@ -715,12 +703,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event NPCflag Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data...");
{
uint32 oldMSTime = getMSTime();
@@ -729,8 +716,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
}
else
{
@@ -745,7 +731,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -755,12 +741,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Seasonal Quest Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations...");
{
uint32 oldMSTime = getMSTime();
@@ -769,8 +754,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
}
else
{
@@ -784,13 +768,13 @@ void GameEventMgr::LoadFromDB()
if (!sObjectMgr->GetQuestTemplate(questId))
{
- sLog->outErrorDb("`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId);
continue;
}
if (eventEntry >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry);
continue;
}
@@ -799,12 +783,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Vendor Additions Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data...");
{
uint32 oldMSTime = getMSTime();
@@ -812,10 +795,7 @@ void GameEventMgr::LoadFromDB()
QueryResult result = WorldDatabase.Query("SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC");
if (!result)
- {
- sLog->outString(">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
- sLog->outString();
- }
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
else
{
uint32 count = 0;
@@ -827,7 +807,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEventVendors.size())
{
- sLog->outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -865,12 +845,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Battleground Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data...");
{
uint32 oldMSTime = getMSTime();
@@ -879,8 +858,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty.");
}
else
{
@@ -893,7 +871,7 @@ void GameEventMgr::LoadFromDB()
if (event_id >= mGameEvent.size())
{
- sLog->outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id);
continue;
}
@@ -903,12 +881,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Game Event Pool Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data...");
{
uint32 oldMSTime = getMSTime();
@@ -918,8 +895,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
}
else
{
@@ -935,13 +911,13 @@ void GameEventMgr::LoadFromDB()
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size()))
{
- sLog->outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
+ sLog->outError(LOG_FILTER_SQL, "`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id);
continue;
}
if (!sPoolMgr->CheckPool(entry))
{
- sLog->outErrorDb("Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry);
continue;
}
@@ -952,8 +928,7 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
}
@@ -1015,7 +990,7 @@ void GameEventMgr::StartArenaSeason()
if (!result)
{
- sLog->outError("ArenaSeason (%u) must be an existant Arena Season", season);
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "ArenaSeason (%u) must be an existant Arena Season", season);
return;
}
@@ -1024,13 +999,13 @@ void GameEventMgr::StartArenaSeason()
if (eventId >= mGameEvent.size())
{
- sLog->outError("EventEntry %u for ArenaSeason (%u) does not exists", eventId, season);
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "EventEntry %u for ArenaSeason (%u) does not exists", eventId, season);
return;
}
StartEvent(eventId, true);
- sLog->outString("Arena Season %u started...", season);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Arena Season %u started...", season);
+
}
uint32 GameEventMgr::Update() // return the next event delay in ms
@@ -1043,7 +1018,7 @@ uint32 GameEventMgr::Update() // return the next e
{
// must do the activating first, and after that the deactivating
// so first queue it
- //sLog->outErrorDb("Checking event %u", itr);
+ //sLog->outError(LOG_FILTER_SQL, "Checking event %u", itr);
if (CheckOneGameEvent(itr))
{
// if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so
@@ -1064,14 +1039,14 @@ uint32 GameEventMgr::Update() // return the next e
// changed, save to DB the gameevent state, will be updated in next update cycle
SaveWorldEventStateToDB(itr);
- //sLog->outDebug("GameEvent %u is active", itr->first);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "GameEvent %u is active", itr->first);
// queue for activation
if (!IsActiveEvent(itr))
activate.insert(itr);
}
else
{
- //sLog->outDebug("GameEvent %u is not active", itr->first);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "GameEvent %u is not active", itr->first);
if (IsActiveEvent(itr))
deactivate.insert(itr);
else
@@ -1099,13 +1074,13 @@ uint32 GameEventMgr::Update() // return the next e
nextEventDelay = 0;
for (std::set<uint16>::iterator itr = deactivate.begin(); itr != deactivate.end(); ++itr)
StopEvent(*itr);
- sLog->outDetail("Next game event check in %u seconds.", nextEventDelay + 1);
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Next game event check in %u seconds.", nextEventDelay + 1);
return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call
}
void GameEventMgr::UnApplyEvent(uint16 event_id)
{
- sLog->outDetail("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str());
//! Run SAI scripts with SMART_EVENT_GAME_EVENT_END
RunSmartAIScripts(event_id, false);
// un-spawn positive event tagged objects
@@ -1137,7 +1112,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
break;
}
- sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
+ sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
//! Run SAI scripts with SMART_EVENT_GAME_EVENT_END
RunSmartAIScripts(event_id, true);
@@ -1211,7 +1186,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventCreatureGuids.size());
return;
}
@@ -1229,7 +1204,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
Creature* creature = new Creature;
- //sLog->outDebug("Spawning creature %u", *itr);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Spawning creature %u", *itr);
if (!creature->LoadCreatureFromDB(*itr, map))
delete creature;
}
@@ -1238,7 +1213,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventGameobjectGuids.size());
return;
}
@@ -1256,7 +1231,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY))
{
GameObject* pGameobject = new GameObject;
- //sLog->outDebug("Spawning gameobject %u", *itr);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Spawning gameobject %u", *itr);
//TODO: find out when it is add to map
if (!pGameobject->LoadGameObjectFromDB(*itr, map, false))
delete pGameobject;
@@ -1271,7 +1246,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size()))
{
- sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",
internal_event_id, mGameEventPoolIds.size());
return;
}
@@ -1286,7 +1261,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventCreatureGuids.size());
return;
}
@@ -1308,7 +1283,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size()))
{
- sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SIZEFMTD ")",
internal_event_id, mGameEventGameobjectGuids.size());
return;
}
@@ -1329,7 +1304,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
}
if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size()))
{
- sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size());
+ sLog->outError(LOG_FILTER_GAMEEVENTS, "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")", internal_event_id, mGameEventPoolIds.size());
return;
}
diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h
index d9b5890bfe5..dbc2c7ead10 100755..100644
--- a/src/server/game/Events/GameEventMgr.h
+++ b/src/server/game/Events/GameEventMgr.h
@@ -28,12 +28,12 @@
enum GameEventState
{
- GAMEEVENT_NORMAL = 0, // standard game events
- GAMEEVENT_WORLD_INACTIVE = 1, // not yet started
- GAMEEVENT_WORLD_CONDITIONS = 2, // condition matching phase
- GAMEEVENT_WORLD_NEXTPHASE = 3, // conditions are met, now 'length' timer to start next event
- GAMEEVENT_WORLD_FINISHED = 4, // next events are started, unapply this one
- GAMEEVENT_INTERNAL = 5, // never handled in update
+ GAMEEVENT_NORMAL = 0, // standard game events
+ GAMEEVENT_WORLD_INACTIVE = 1, // not yet started
+ GAMEEVENT_WORLD_CONDITIONS = 2, // condition matching phase
+ GAMEEVENT_WORLD_NEXTPHASE = 3, // conditions are met, now 'length' timer to start next event
+ GAMEEVENT_WORLD_FINISHED = 4, // next events are started, unapply this one
+ GAMEEVENT_INTERNAL = 5 // never handled in update
};
struct GameEventFinishCondition
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index 9a99a28c7aa..cedb20eccf1 100755..100644
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -17,25 +17,25 @@
*/
#include "ObjectAccessor.h"
-#include "ObjectMgr.h"
-
-#include "Player.h"
+#include "CellImpl.h"
+#include "Corpse.h"
#include "Creature.h"
-#include "GameObject.h"
#include "DynamicObject.h"
-#include "Vehicle.h"
-#include "WorldPacket.h"
-#include "Item.h"
-#include "Corpse.h"
+#include "GameObject.h"
#include "GridNotifiers.h"
-#include "MapManager.h"
-#include "Map.h"
-#include "CellImpl.h"
#include "GridNotifiersImpl.h"
-#include "Opcodes.h"
-#include "ObjectDefines.h"
+#include "Item.h"
+#include "Map.h"
#include "MapInstanced.h"
+#include "MapManager.h"
+#include "ObjectDefines.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Pet.h"
+#include "Player.h"
+#include "Vehicle.h"
#include "World.h"
+#include "WorldPacket.h"
#include <cmath>
@@ -47,6 +47,12 @@ ObjectAccessor::~ObjectAccessor()
{
}
+Player* ObjectAccessor::GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/)
+{
+ Player* player = HashMapHolder<Player>::Find(guid);
+ return player && player->IsInWorld() ? player : NULL;
+}
+
WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid)
{
switch (GUID_HIPART(guid))
@@ -163,7 +169,7 @@ Unit* ObjectAccessor::FindUnit(uint64 guid)
return GetObjectInWorld(guid, (Unit*)NULL);
}
-Player* ObjectAccessor::FindPlayerByName(const char* name)
+Player* ObjectAccessor::FindPlayerByName(std::string const& name)
{
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
std::string nameStr = name;
@@ -290,7 +296,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
return NULL;
}
- sLog->outStaticDebug("Deleting Corpse and spawned bones.");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Deleting Corpse and spawned bones.");
// Map can be NULL
Map* map = corpse->FindMap();
diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h
index 92a7a24571e..d2b532c9f94 100755..100644
--- a/src/server/game/Globals/ObjectAccessor.h
+++ b/src/server/game/Globals/ObjectAccessor.h
@@ -28,7 +28,6 @@
#include "GridDefines.h"
#include "Object.h"
-#include "Player.h"
#include <set>
@@ -74,12 +73,11 @@ class HashMapHolder
static LockType* GetLock() { return &i_lock; }
private:
-
//Non instanceable only static
HashMapHolder() {}
static LockType i_lock;
- static MapType m_objectMap;
+ static MapType m_objectMap;
};
class ObjectAccessor
@@ -117,13 +115,7 @@ class ObjectAccessor
}
// Player may be not in world while in ObjectAccessor
- static Player* GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/)
- {
- Player* player = HashMapHolder<Player>::Find(guid);
- if (player && player->IsInWorld())
- return player;
- return NULL;
- }
+ static Player* GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/);
static Unit* GetObjectInWorld(uint64 guid, Unit* /*typeSpecifier*/)
{
@@ -155,14 +147,14 @@ class ObjectAccessor
CellCoord p = Trinity::ComputeCellCoord(x, y);
if (!p.IsCoordValid())
{
- sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
+ sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord);
return NULL;
}
CellCoord q = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!q.IsCoordValid())
{
- sLog->outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
+ sLog->outError(LOG_FILTER_GENERAL, "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord);
return NULL;
}
@@ -191,8 +183,9 @@ class ObjectAccessor
// ACCESS LIKE THAT IS NOT THREAD SAFE
static Pet* FindPet(uint64);
static Player* FindPlayer(uint64);
+ static Creature* FindCreature(uint64);
static Unit* FindUnit(uint64);
- static Player* FindPlayerByName(const char* name);
+ static Player* FindPlayerByName(std::string const& name);
// when using this, you must use the hashmapholder's lock
static HashMapHolder<Player>::MapType const& GetPlayers()
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index eedf84ab41c..74423e2b362 100755..100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -16,38 +16,40 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "AccountMgr.h"
+#include "AchievementMgr.h"
+#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
+#include "Chat.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "DisableMgr.h"
+#include "GameEventMgr.h"
+#include "GossipDef.h"
+#include "GroupMgr.h"
+#include "GuildMgr.h"
+#include "InstanceSaveMgr.h"
+#include "Language.h"
+#include "LFGMgr.h"
#include "Log.h"
#include "MapManager.h"
#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "GuildMgr.h"
-#include "GroupMgr.h"
+#include "Pet.h"
+#include "PoolMgr.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
+#include "SpellAuras.h"
+#include "Spell.h"
#include "SpellMgr.h"
-#include "UpdateMask.h"
-#include "World.h"
-#include "ArenaTeam.h"
+#include "SpellScript.h"
#include "Transport.h"
-#include "Language.h"
-#include "GameEventMgr.h"
-#include "Spell.h"
-#include "Chat.h"
-#include "AccountMgr.h"
-#include "InstanceSaveMgr.h"
-#include "SpellAuras.h"
+#include "UpdateMask.h"
#include "Util.h"
-#include "WaypointManager.h"
-#include "GossipDef.h"
#include "Vehicle.h"
-#include "AchievementMgr.h"
-#include "DisableMgr.h"
-#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "PoolMgr.h"
+#include "WaypointManager.h"
+#include "World.h"
ScriptMapMap sQuestEndScripts;
-ScriptMapMap sQuestStartScripts;
ScriptMapMap sSpellScripts;
ScriptMapMap sGameObjectScripts;
ScriptMapMap sEventScripts;
@@ -59,7 +61,6 @@ std::string GetScriptsTableNameByType(ScriptsType type)
switch (type)
{
case SCRIPTS_QUEST_END: res = "quest_end_scripts"; break;
- case SCRIPTS_QUEST_START: res = "quest_start_scripts";break;
case SCRIPTS_SPELL: res = "spell_scripts"; break;
case SCRIPTS_GAMEOBJECT: res = "gameobject_scripts"; break;
case SCRIPTS_EVENT: res = "event_scripts"; break;
@@ -75,7 +76,6 @@ ScriptMapMap* GetScriptsMapByType(ScriptsType type)
switch (type)
{
case SCRIPTS_QUEST_END: res = &sQuestEndScripts; break;
- case SCRIPTS_QUEST_START: res = &sQuestStartScripts; break;
case SCRIPTS_SPELL: res = &sSpellScripts; break;
case SCRIPTS_GAMEOBJECT: res = &sGameObjectScripts; break;
case SCRIPTS_EVENT: res = &sEventScripts; break;
@@ -226,11 +226,29 @@ bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clicke
return true;
}
-ObjectMgr::ObjectMgr(): _auctionId(1), _equipmentSetGuid(1),
- _itemTextId(1), _mailId(1), _hiPetNumber(1), _hiCharGuid(1),
- _hiCreatureGuid(1), _hiPetGuid(1), _hiVehicleGuid(1), _hiItemGuid(1),
- _hiGoGuid(1), _hiDoGuid(1), _hiCorpseGuid(1), _hiMoTransGuid(1)
-{}
+ObjectMgr::ObjectMgr():
+ _auctionId(1),
+ _equipmentSetGuid(1),
+ _itemTextId(1),
+ _mailId(1),
+ _hiPetNumber(1),
+ _hiCharGuid(1),
+ _hiCreatureGuid(1),
+ _hiPetGuid(1),
+ _hiVehicleGuid(1),
+ _hiItemGuid(1),
+ _hiGoGuid(1),
+ _hiDoGuid(1),
+ _hiCorpseGuid(1),
+ _hiMoTransGuid(1)
+{
+ for (uint8 i = 0; i < MAX_CLASSES; ++i)
+ {
+ _playerClassInfo[i] = NULL;
+ for (uint8 j = 0; j < MAX_RACES; ++j)
+ _playerInfo[j][i] = NULL;
+ }
+}
ObjectMgr::~ObjectMgr()
{
@@ -242,11 +260,21 @@ ObjectMgr::~ObjectMgr()
// free only if loaded
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
- delete[] _playerClassInfo[class_].levelInfo;
+ {
+ if (_playerClassInfo[class_])
+ delete[] _playerClassInfo[class_]->levelInfo;
+ delete _playerClassInfo[class_];
+ }
for (int race = 0; race < MAX_RACES; ++race)
+ {
for (int class_ = 0; class_ < MAX_CLASSES; ++class_)
- delete[] _playerInfo[race][class_].levelInfo;
+ {
+ if (_playerInfo[race][class_])
+ delete[] _playerInfo[race][class_]->levelInfo;
+ delete _playerInfo[race][class_];
+ }
+ }
for (CacheVendorItemContainer::iterator itr = _cacheVendorItemStore.begin(); itr != _cacheVendorItemStore.end(); ++itr)
itr->second.Clear();
@@ -256,6 +284,9 @@ ObjectMgr::~ObjectMgr()
for (DungeonEncounterContainer::iterator itr =_dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr)
for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr)
delete *encounterItr;
+
+ for (AccessRequirementContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
+ delete itr->second;
}
void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data)
@@ -296,8 +327,7 @@ void ObjectMgr::LoadCreatureLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItemsLocales()
@@ -333,8 +363,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointOfInterestLocales()
@@ -360,8 +389,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplates()
@@ -372,24 +400,23 @@ void ObjectMgr::LoadCreatureTemplates()
QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
// 9 10 11 12 13 14 15 16 17 18 19 20 21
"modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, "
- // 22 23 24 25 26 27 28 29 30 31 32
- "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, "
- // 33 34 35 36 37 38 39 40 41 42
+ // 22 23 24 25 26 27 28 29 30 31 32 33
+ "scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, "
+ // 34 35 36 37 38 39 40 41 42 43
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
- // 43 44 45 46 47 48 49 50 51 52 53
+ // 44 45 46 47 48 49 50 51 52 53 54
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
- // 54 55 56 57 58 59 60 61 62 63 64 65 66
+ // 55 56 57 58 59 60 61 62 63 64 65 66 67
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
- // 67 68 69 70 71 72 73 74 75 76 77
+ // 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, "
- // 78 79 80 81 82 83
+ // 79 80 81 82 83 84
" questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
"FROM creature_template;");
if (!result)
{
- sLog->outString(">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
return;
}
@@ -439,49 +466,50 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.rangeattacktime = fields[30].GetUInt32();
creatureTemplate.unit_class = uint32(fields[31].GetUInt8());
creatureTemplate.unit_flags = fields[32].GetUInt32();
- creatureTemplate.dynamicflags = fields[33].GetUInt32();
- creatureTemplate.family = uint32(fields[34].GetUInt8());
- creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
- creatureTemplate.trainer_spell = fields[36].GetUInt32();
- creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
- creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
- creatureTemplate.minrangedmg = fields[39].GetFloat();
- creatureTemplate.maxrangedmg = fields[40].GetFloat();
- creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
- creatureTemplate.type = uint32(fields[42].GetUInt8());
- creatureTemplate.type_flags = fields[43].GetUInt32();
- creatureTemplate.lootid = fields[44].GetUInt32();
- creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
- creatureTemplate.SkinLootId = fields[46].GetUInt32();
+ creatureTemplate.unit_flags2 = fields[33].GetUInt32();
+ creatureTemplate.dynamicflags = fields[34].GetUInt32();
+ creatureTemplate.family = uint32(fields[35].GetUInt8());
+ creatureTemplate.trainer_type = uint32(fields[36].GetUInt8());
+ creatureTemplate.trainer_spell = fields[37].GetUInt32();
+ creatureTemplate.trainer_class = uint32(fields[38].GetUInt8());
+ creatureTemplate.trainer_race = uint32(fields[39].GetUInt8());
+ creatureTemplate.minrangedmg = fields[40].GetFloat();
+ creatureTemplate.maxrangedmg = fields[41].GetFloat();
+ creatureTemplate.rangedattackpower = uint32(fields[42].GetUInt16());
+ creatureTemplate.type = uint32(fields[43].GetUInt8());
+ creatureTemplate.type_flags = fields[44].GetUInt32();
+ creatureTemplate.lootid = fields[45].GetUInt32();
+ creatureTemplate.pickpocketLootId = fields[46].GetUInt32();
+ creatureTemplate.SkinLootId = fields[47].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
+ creatureTemplate.resistance[i] = fields[48 + i -1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
- creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
-
- creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
- creatureTemplate.VehicleId = fields[62].GetUInt32();
- creatureTemplate.mingold = fields[63].GetUInt32();
- creatureTemplate.maxgold = fields[64].GetUInt32();
- creatureTemplate.AIName = fields[65].GetString();
- creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
- creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
- creatureTemplate.HoverHeight = fields[68].GetFloat();
- creatureTemplate.ModHealth = fields[69].GetFloat();
- creatureTemplate.ModMana = fields[70].GetFloat();
- creatureTemplate.ModArmor = fields[71].GetFloat();
- creatureTemplate.RacialLeader = fields[72].GetBool();
+ creatureTemplate.spells[i] = fields[54 + i].GetUInt32();
+
+ creatureTemplate.PetSpellDataId = fields[62].GetUInt32();
+ creatureTemplate.VehicleId = fields[63].GetUInt32();
+ creatureTemplate.mingold = fields[64].GetUInt32();
+ creatureTemplate.maxgold = fields[65].GetUInt32();
+ creatureTemplate.AIName = fields[66].GetString();
+ creatureTemplate.MovementType = uint32(fields[67].GetUInt8());
+ creatureTemplate.InhabitType = uint32(fields[68].GetUInt8());
+ creatureTemplate.HoverHeight = fields[69].GetFloat();
+ creatureTemplate.ModHealth = fields[70].GetFloat();
+ creatureTemplate.ModMana = fields[71].GetFloat();
+ creatureTemplate.ModArmor = fields[72].GetFloat();
+ creatureTemplate.RacialLeader = fields[73].GetBool();
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
- creatureTemplate.questItems[i] = fields[73 + i].GetUInt32();
+ creatureTemplate.questItems[i] = fields[74 + i].GetUInt32();
- creatureTemplate.movementId = fields[79].GetUInt32();
- creatureTemplate.RegenHealth = fields[80].GetBool();
- creatureTemplate.equipmentId = fields[81].GetUInt32();
- creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32();
- creatureTemplate.flags_extra = fields[83].GetUInt32();
- creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
+ 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());
++count;
}
@@ -491,8 +519,7 @@ void ObjectMgr::LoadCreatureTemplates()
for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
CheckCreatureTemplate(&itr->second);
- sLog->outString(">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplateAddons()
@@ -504,8 +531,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (!result)
{
- sLog->outString(">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
return;
}
@@ -518,7 +544,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (!sObjectMgr->GetCreatureTemplate(entry))
{
- sLog->outErrorDb("Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry);
continue;
}
@@ -530,15 +556,15 @@ void ObjectMgr::LoadCreatureTemplateAddons()
creatureAddon.bytes2 = fields[4].GetUInt32();
creatureAddon.emote = fields[5].GetUInt32();
- Tokens tokens(fields[6].GetString(), ' ');
+ Tokenizer tokens(fields[6].GetString(), ' ');
uint8 i = 0;
creatureAddon.auras.resize(tokens.size());
- for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
+ for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr)));
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr)));
continue;
}
creatureAddon.auras[i++] = uint32(atol(*itr));
@@ -548,14 +574,14 @@ void ObjectMgr::LoadCreatureTemplateAddons()
{
if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount);
creatureAddon.mount = 0;
}
}
if (!sEmotesStore.LookupEntry(creatureAddon.emote))
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote);
creatureAddon.emote = 0;
}
@@ -563,8 +589,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
@@ -582,7 +607,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]);
if (!difficultyInfo)
{
- sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]);
continue;
}
@@ -593,20 +618,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
ok2 = false;
if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end())
{
- sLog->outErrorDb("Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.",
cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1);
continue;
}
if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end())
{
- sLog->outErrorDb("Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end())
{
- sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1);
continue;
}
@@ -617,51 +642,51 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
if (cInfo->unit_class != difficultyInfo->unit_class)
{
- sLog->outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).",
cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class);
continue;
}
if (cInfo->npcflag != difficultyInfo->npcflag)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_class != difficultyInfo->trainer_class)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_race != difficultyInfo->trainer_race)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_type != difficultyInfo->trainer_type)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (cInfo->trainer_spell != difficultyInfo->trainer_spell)
{
- sLog->outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (!difficultyInfo->AIName.empty())
{
- sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
if (difficultyInfo->ScriptID)
{
- sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.",
cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]);
continue;
}
@@ -673,11 +698,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_A);
if (!factionTemplate)
- sLog->outErrorDb("Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_A template (%u).", cInfo->Entry, cInfo->faction_A);
factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction_H);
if (!factionTemplate)
- sLog->outErrorDb("Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing faction_H template (%u).", cInfo->Entry, cInfo->faction_H);
// used later for scale
CreatureDisplayInfoEntry const* displayScaleEntry = NULL;
@@ -687,7 +712,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1);
const_cast<CreatureTemplate*>(cInfo)->Modelid1 = 0;
}
else if (!displayScaleEntry)
@@ -695,7 +720,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry);
}
if (cInfo->Modelid2)
@@ -703,7 +728,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2);
const_cast<CreatureTemplate*>(cInfo)->Modelid2 = 0;
}
else if (!displayScaleEntry)
@@ -711,7 +736,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
}
if (cInfo->Modelid3)
@@ -719,7 +744,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3);
const_cast<CreatureTemplate*>(cInfo)->Modelid3 = 0;
}
else if (!displayScaleEntry)
@@ -727,7 +752,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry);
}
if (cInfo->Modelid4)
@@ -735,7 +760,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4);
if (!displayEntry)
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4);
const_cast<CreatureTemplate*>(cInfo)->Modelid4 = 0;
}
else if (!displayScaleEntry)
@@ -743,11 +768,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);
if (!modelInfo)
- sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
}
if (!displayScaleEntry)
- sLog->outErrorDb("Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry);
for (int k = 0; k < MAX_KILL_CREDIT; ++k)
{
@@ -755,7 +780,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
if (!GetCreatureTemplate(cInfo->KillCredit[k]))
{
- sLog->outErrorDb("Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1);
const_cast<CreatureTemplate*>(cInfo)->KillCredit[k] = 0;
}
}
@@ -763,13 +788,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class);
const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR;
}
if (cInfo->dmgschool >= MAX_SPELL_SCHOOL)
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool);
const_cast<CreatureTemplate*>(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL;
}
@@ -780,30 +805,30 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
const_cast<CreatureTemplate*>(cInfo)->rangeattacktime = BASE_ATTACK_TIME;
if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE)
- sLog->outErrorDb("Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type);
if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type))
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type);
const_cast<CreatureTemplate*>(cInfo)->type = CREATURE_TYPE_HUMANOID;
}
// must exist or used hidden but used in data horse case
if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM)
{
- sLog->outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family);
const_cast<CreatureTemplate*>(cInfo)->family = 0;
}
if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType);
const_cast<CreatureTemplate*>(cInfo)->InhabitType = INHABIT_ANYWHERE;
}
if (cInfo->HoverHeight < 0.0f)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight);
const_cast<CreatureTemplate*>(cInfo)->HoverHeight = 1.0f;
}
@@ -812,7 +837,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId);
if (!vehId)
{
- sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId);
const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0;
}
}
@@ -821,21 +846,21 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId);
if (!spellDataId)
- sLog->outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId);
}
for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
{
- sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
}
}
if (cInfo->MovementType >= MAX_DB_MOTION_TYPE)
{
- sLog->outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
+ sLog->outError(LOG_FILTER_SQL, "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType);
const_cast<CreatureTemplate*>(cInfo)->MovementType = IDLE_MOTION_TYPE;
}
@@ -843,7 +868,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
{
if (!GetEquipmentInfo(cInfo->equipmentId))
{
- sLog->outErrorDb("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);
+ 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;
}
}
@@ -859,13 +884,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
if (cInfo->expansion > (MAX_CREATURE_BASE_HP - 1))
{
- sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion);
const_cast<CreatureTemplate*>(cInfo)->expansion = 0;
}
if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
{
- sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
const_cast<CreatureTemplate*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
}
@@ -881,8 +906,7 @@ void ObjectMgr::LoadCreatureAddons()
if (!result)
{
- sLog->outString(">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
return;
}
@@ -896,7 +920,7 @@ void ObjectMgr::LoadCreatureAddons()
CreatureData const* creData = GetCreatureData(guid);
if (!creData)
{
- sLog->outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid);
continue;
}
@@ -906,7 +930,7 @@ void ObjectMgr::LoadCreatureAddons()
if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id)
{
const_cast<CreatureData*>(creData)->movementType = IDLE_MOTION_TYPE;
- sLog->outErrorDb("Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid);
}
creatureAddon.mount = fields[2].GetUInt32();
@@ -914,15 +938,15 @@ void ObjectMgr::LoadCreatureAddons()
creatureAddon.bytes2 = fields[4].GetUInt32();
creatureAddon.emote = fields[5].GetUInt32();
- Tokens tokens(fields[6].GetString(), ' ');
+ Tokenizer tokens(fields[6].GetString(), ' ');
uint8 i = 0;
creatureAddon.auras.resize(tokens.size());
- for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
+ for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
- sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
continue;
}
creatureAddon.auras[i++] = uint32(atol(*itr));
@@ -932,14 +956,14 @@ void ObjectMgr::LoadCreatureAddons()
{
if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount))
{
- sLog->outErrorDb("Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount);
creatureAddon.mount = 0;
}
}
if (!sEmotesStore.LookupEntry(creatureAddon.emote))
{
- sLog->outErrorDb("Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
+ sLog->outError(LOG_FILTER_SQL, "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote);
creatureAddon.emote = 0;
}
@@ -947,8 +971,7 @@ void ObjectMgr::LoadCreatureAddons()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid)
@@ -986,8 +1009,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!result)
{
- sLog->outString(">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
return;
}
@@ -1013,7 +1035,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!dbcItem)
{
- sLog->outErrorDb("Unknown item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u, forced to 0.",
+ 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);
equipmentInfo.ItemEntry[i] = 0;
continue;
@@ -1029,7 +1051,7 @@ void ObjectMgr::LoadEquipmentTemplates()
dbcItem->InventoryType != INVTYPE_THROWN &&
dbcItem->InventoryType != INVTYPE_RANGEDRIGHT)
{
- sLog->outErrorDb("Item (entry=%u) in creature_equip_template.itemEntry%u for entry = %u is not equipable in a hand, forced to 0.",
+ 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);
equipmentInfo.ItemEntry[i] = 0;
}
@@ -1039,8 +1061,7 @@ void ObjectMgr::LoadEquipmentTemplates()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId)
@@ -1097,7 +1118,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display
{
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
if (!minfo_tmp)
- sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
+ sLog->outError(LOG_FILTER_SQL, "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
else
{
// Model ID changed
@@ -1117,8 +1138,7 @@ void ObjectMgr::LoadCreatureModelInfo()
if (!result)
{
- sLog->outString(">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
return;
}
@@ -1141,17 +1161,17 @@ void ObjectMgr::LoadCreatureModelInfo()
// Checks
if (!sCreatureDisplayInfoStore.LookupEntry(modelId))
- sLog->outErrorDb("Table `creature_model_info` has model for not existed display id (%u).", modelId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has model for not existed display id (%u).", modelId);
if (modelInfo.gender > GENDER_NONE)
{
- sLog->outErrorDb("Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId);
modelInfo.gender = GENDER_MALE;
}
if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender))
{
- sLog->outErrorDb("Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
modelInfo.modelid_other_gender = 0;
}
@@ -1162,8 +1182,7 @@ void ObjectMgr::LoadCreatureModelInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadLinkedRespawn()
@@ -1176,8 +1195,8 @@ void ObjectMgr::LoadLinkedRespawn()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty.");
+
return;
}
@@ -1198,7 +1217,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* slave = GetCreatureData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1206,7 +1225,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* master = GetCreatureData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1214,14 +1233,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1235,7 +1254,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* slave = GetCreatureData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1243,7 +1262,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* master = GetGOData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1251,14 +1270,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1272,7 +1291,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* slave = GetGOData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1280,7 +1299,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* master = GetGOData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1288,14 +1307,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1309,7 +1328,7 @@ void ObjectMgr::LoadLinkedRespawn()
const GameObjectData* slave = GetGOData(guidLow);
if (!slave)
{
- sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get gameobject data for GUIDLow %u", guidLow);
error = true;
break;
}
@@ -1317,7 +1336,7 @@ void ObjectMgr::LoadLinkedRespawn()
const CreatureData* master = GetCreatureData(linkedGuidLow);
if (!master)
{
- sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Couldn't get creature data for GUIDLow %u", linkedGuidLow);
error = true;
break;
}
@@ -1325,14 +1344,14 @@ void ObjectMgr::LoadLinkedRespawn()
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
error = true;
break;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
error = true;
break;
}
@@ -1348,8 +1367,7 @@ void ObjectMgr::LoadLinkedRespawn()
}
while (result->NextRow());
- sLog->outString(">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
@@ -1374,13 +1392,13 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
const MapEntry* const map = sMapStore.LookupEntry(master->mapid);
if (!map || !map->Instanceable() || (master->mapid != slave->mapid))
{
- sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow);
return false;
}
if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty)
{
- sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
+ sLog->outError(LOG_FILTER_SQL, "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow);
return false;
}
@@ -1408,8 +1426,8 @@ void ObjectMgr::LoadCreatures()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 creatures. DB table `creature` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures. DB table `creature` is empty.");
+
return;
}
@@ -1433,7 +1451,7 @@ void ObjectMgr::LoadCreatures()
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
- sLog->outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
continue;
}
@@ -1463,19 +1481,19 @@ void ObjectMgr::LoadCreatures()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid);
continue;
}
if (data.spawnMask & ~spawnMasks[data.mapid])
- sLog->outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid);
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end())
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id);
ok = false;
}
@@ -1488,7 +1506,7 @@ void ObjectMgr::LoadCreatures()
{
if (!GetEquipmentInfo(data.equipmentId))
{
- sLog->outErrorDb("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);
+ 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;
}
}
@@ -1496,19 +1514,19 @@ void ObjectMgr::LoadCreatures()
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
{
if (!mapEntry || !mapEntry->IsDungeon())
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id);
}
if (data.spawndist < 0.0f)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
else if (data.movementType == RANDOM_MOTION_TYPE)
{
if (data.spawndist == 0.0f)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `spawndist`=0, replace by idle movement type (0).", guid, data.id);
data.movementType = IDLE_MOTION_TYPE;
}
}
@@ -1516,14 +1534,14 @@ void ObjectMgr::LoadCreatures()
{
if (data.spawndist != 0.0f)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `spawndist`<>0, set to 0.", guid, data.id);
data.spawndist = 0.0f;
}
}
if (data.phaseMask == 0)
{
- sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
@@ -1535,8 +1553,7 @@ void ObjectMgr::LoadCreatures()
} while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
@@ -1606,7 +1623,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float
GameObject* go = new GameObject;
if (!go->LoadGameObjectFromDB(guid, map))
{
- sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry);
+ sLog->outError(LOG_FILTER_GENERAL, "AddGOData: cannot add gameobject entry %u to map", entry);
delete go;
return 0;
}
@@ -1641,7 +1658,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos)
Creature* creature = new Creature;
if (!creature->LoadCreatureFromDB(guid, map))
{
- sLog->outError("AddCreature: cannot add creature entry %u to map", guid);
+ sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", guid);
delete creature;
return false;
}
@@ -1693,7 +1710,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float
Creature* creature = new Creature;
if (!creature->LoadCreatureFromDB(guid, map))
{
- sLog->outError("AddCreature: cannot add creature entry %u to map", entry);
+ sLog->outError(LOG_FILTER_GENERAL, "AddCreature: cannot add creature entry %u to map", entry);
delete creature;
return 0;
}
@@ -1718,8 +1735,8 @@ void ObjectMgr::LoadGameobjects()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty.");
+
return;
}
@@ -1742,7 +1759,7 @@ void ObjectMgr::LoadGameobjects()
GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry);
if (!gInfo)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
continue;
}
@@ -1754,14 +1771,14 @@ void ObjectMgr::LoadGameobjects()
case GAMEOBJECT_TYPE_SPELL_FOCUS:
break;
default:
- sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
break;
}
}
if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
{
- sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId);
continue;
}
@@ -1782,13 +1799,13 @@ void ObjectMgr::LoadGameobjects()
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid);
continue;
}
if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction())
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id);
}
data.animprogress = fields[12].GetUInt8();
@@ -1797,7 +1814,7 @@ void ObjectMgr::LoadGameobjects()
uint32 go_state = fields[13].GetUInt8();
if (go_state >= MAX_GO_STATE)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state);
continue;
}
data.go_state = GOState(go_state);
@@ -1805,7 +1822,7 @@ void ObjectMgr::LoadGameobjects()
data.spawnMask = fields[14].GetUInt8();
if (data.spawnMask & ~spawnMasks[data.mapid])
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid);
data.phaseMask = fields[15].GetUInt16();
int16 gameEvent = fields[16].GetInt8();
@@ -1813,25 +1830,25 @@ void ObjectMgr::LoadGameobjects()
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip", guid, data.id, data.rotation2);
continue;
}
if (data.rotation3 < -1.0f || data.rotation3 > 1.0f)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip", guid, data.id, data.rotation3);
continue;
}
if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation))
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id);
continue;
}
if (data.phaseMask == 0)
{
- sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id);
data.phaseMask = 1;
}
@@ -1840,8 +1857,7 @@ void ObjectMgr::LoadGameobjects()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
@@ -1879,7 +1895,7 @@ Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const
}
// name must be checked to correctness (if received) before call this function
-uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const
+uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const
{
uint64 guid = 0;
@@ -2009,16 +2025,15 @@ void ObjectMgr::LoadItemLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemTemplates()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6 7 8 9 10 11 12
- QueryResult result = WorldDatabase.Query("SELECT entry, class, subclass, unk0, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, "
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12
+ QueryResult result = WorldDatabase.Query("SELECT entry, class, subclass, SoundOverrideSubclass, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, "
// 13 14 15 16 17 18 19 20
"AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, "
// 21 22 23 24 25 26 27 28
@@ -2052,8 +2067,7 @@ void ObjectMgr::LoadItemTemplates()
if (!result)
{
- sLog->outString(">> Loaded 0 item templates. DB table `item_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty.");
return;
}
@@ -2072,7 +2086,7 @@ void ObjectMgr::LoadItemTemplates()
itemTemplate.ItemId = entry;
itemTemplate.Class = uint32(fields[1].GetUInt8());
itemTemplate.SubClass = uint32(fields[2].GetUInt8());
- itemTemplate.Unk0 = fields[3].GetInt32();
+ itemTemplate.SoundOverrideSubclass = int32(fields[3].GetInt8());
itemTemplate.Name1 = fields[4].GetString();
itemTemplate.DisplayInfoID = fields[5].GetUInt32();
itemTemplate.Quality = uint32(fields[6].GetUInt8());
@@ -2183,61 +2197,61 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Class != dbcitem->Class)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct class %u, must be %u .", entry, itemTemplate.Class, dbcitem->Class);
if (enforceDBCAttributes)
itemTemplate.Class = dbcitem->Class;
}
- if (itemTemplate.Unk0 != dbcitem->Unk0)
+ if (itemTemplate.SoundOverrideSubclass != dbcitem->SoundOverrideSubclass)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct Unk0 (%i), must be %i .", entry, itemTemplate.Unk0, dbcitem->Unk0);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct SoundOverrideSubclass (%i), must be %i .", entry, itemTemplate.SoundOverrideSubclass, dbcitem->SoundOverrideSubclass);
if (enforceDBCAttributes)
- itemTemplate.Unk0 = dbcitem->Unk0;
+ itemTemplate.SoundOverrideSubclass = dbcitem->SoundOverrideSubclass;
}
if (itemTemplate.Material != dbcitem->Material)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct material (%i), must be %i .", entry, itemTemplate.Material, dbcitem->Material);
if (enforceDBCAttributes)
itemTemplate.Material = dbcitem->Material;
}
if (itemTemplate.InventoryType != dbcitem->InventoryType)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct inventory type (%u), must be %u .", entry, itemTemplate.InventoryType, dbcitem->InventoryType);
if (enforceDBCAttributes)
itemTemplate.InventoryType = dbcitem->InventoryType;
}
if (itemTemplate.DisplayInfoID != dbcitem->DisplayId)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct display id (%u), must be %u .", entry, itemTemplate.DisplayInfoID, dbcitem->DisplayId);
if (enforceDBCAttributes)
itemTemplate.DisplayInfoID = dbcitem->DisplayId;
}
if (itemTemplate.Sheath != dbcitem->Sheath)
{
- sLog->outErrorDb("Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have a correct sheathid (%u), must be %u .", entry, itemTemplate.Sheath, dbcitem->Sheath);
if (enforceDBCAttributes)
itemTemplate.Sheath = dbcitem->Sheath;
}
}
else
- sLog->outErrorDb("Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in item.dbc! (not correct id?).", entry);
if (itemTemplate.Class >= MAX_ITEM_CLASS)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class);
itemTemplate.Class = ITEM_CLASS_MISC;
}
if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class])
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class);
itemTemplate.SubClass = 0;// exist for all item classes
}
if (itemTemplate.Quality >= MAX_ITEM_QUALITY)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality);
itemTemplate.Quality = ITEM_QUALITY_NORMAL;
}
@@ -2245,36 +2259,36 @@ void ObjectMgr::LoadItemTemplates()
{
if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE))
if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0)
- sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY);
if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY)
- sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.",
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.",
entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY);
}
else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY)
{
if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE))
if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0)
- sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.",
entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY);
}
if (itemTemplate.BuyCount <= 0)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount);
itemTemplate.BuyCount = 1;
}
if (itemTemplate.InventoryType >= MAX_INVTYPE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType);
itemTemplate.InventoryType = INVTYPE_NON_EQUIP;
}
if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill);
itemTemplate.RequiredSkill = 0;
}
@@ -2294,60 +2308,60 @@ void ObjectMgr::LoadItemTemplates()
if (req)
{
if (!(itemTemplate.AllowableClass & CLASSMASK_ALL_PLAYABLE))
- sLog->outErrorDb("Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass);
if (!(itemTemplate.AllowableRace & RACEMASK_ALL_PLAYABLE))
- sLog->outErrorDb("Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace);
}
}
if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell))
{
- sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell);
itemTemplate.RequiredSpell = 0;
}
if (itemTemplate.RequiredReputationRank >= MAX_REPUTATION_RANK)
- sLog->outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank);
if (itemTemplate.RequiredReputationFaction)
{
if (!sFactionStore.LookupEntry(itemTemplate.RequiredReputationFaction))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction);
itemTemplate.RequiredReputationFaction = 0;
}
if (itemTemplate.RequiredReputationRank == MIN_REPUTATION_RANK)
- sLog->outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry);
}
if (itemTemplate.MaxCount < -1)
{
- sLog->outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount);
itemTemplate.MaxCount = -1;
}
if (itemTemplate.Stackable == 0)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable);
itemTemplate.Stackable = 1;
}
else if (itemTemplate.Stackable < -1)
{
- sLog->outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable);
itemTemplate.Stackable = -1;
}
if (itemTemplate.ContainerSlots > MAX_BAG_SIZE)
{
- sLog->outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE);
itemTemplate.ContainerSlots = MAX_BAG_SIZE;
}
if (itemTemplate.StatsCount > MAX_ITEM_PROTO_STATS)
{
- sLog->outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS);
itemTemplate.StatsCount = MAX_ITEM_PROTO_STATS;
}
@@ -2356,7 +2370,7 @@ void ObjectMgr::LoadItemTemplates()
// for ItemStatValue != 0
if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
itemTemplate.ItemStat[j].ItemStatType = 0;
}
@@ -2364,7 +2378,7 @@ void ObjectMgr::LoadItemTemplates()
{
case ITEM_MOD_SPELL_HEALING_DONE:
case ITEM_MOD_SPELL_DAMAGE_DONE:
- sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType);
break;
default:
break;
@@ -2375,7 +2389,7 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType);
itemTemplate.Damage[j].DamageType = 0;
}
}
@@ -2386,7 +2400,7 @@ void ObjectMgr::LoadItemTemplates()
// spell_1
if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
itemTemplate.Spells[1].SpellId = 0;
@@ -2396,14 +2410,14 @@ void ObjectMgr::LoadItemTemplates()
// spell_2 have learning spell
if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
else if (!itemTemplate.Spells[1].SpellId)
{
- sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
@@ -2412,7 +2426,7 @@ void ObjectMgr::LoadItemTemplates()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId);
if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
@@ -2420,7 +2434,7 @@ void ObjectMgr::LoadItemTemplates()
// allowed only in special format
else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884))
{
- sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
itemTemplate.Spells[0].SpellId = 0;
itemTemplate.Spells[1].SpellId = 0;
itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
@@ -2432,13 +2446,13 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
itemTemplate.Spells[j].SpellId = 0;
itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
else if (itemTemplate.Spells[j].SpellId != 0)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId);
itemTemplate.Spells[j].SpellId = 0;
}
}
@@ -2450,7 +2464,7 @@ void ObjectMgr::LoadItemTemplates()
{
if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger);
itemTemplate.Spells[j].SpellId = 0;
itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
@@ -2460,13 +2474,13 @@ void ObjectMgr::LoadItemTemplates()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId);
if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
itemTemplate.Spells[j].SpellId = 0;
}
// allowed only in special format
else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884))
{
- sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
itemTemplate.Spells[j].SpellId = 0;
}
}
@@ -2474,17 +2488,17 @@ void ObjectMgr::LoadItemTemplates()
}
if (itemTemplate.Bonding >= MAX_BIND_TYPE)
- sLog->outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding);
if (itemTemplate.PageText && !GetPageText(itemTemplate.PageText))
- sLog->outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText);
if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID))
- sLog->outErrorDb("Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID);
if (itemTemplate.Sheath >= MAX_SHEATHETYPE)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath);
itemTemplate.Sheath = SHEATHETYPE_NONE;
}
@@ -2496,28 +2510,28 @@ void ObjectMgr::LoadItemTemplates()
else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomProperty)))
{
- sLog->outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty);
itemTemplate.RandomProperty = 0;
}
}
if (itemTemplate.RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomSuffix)))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix);
itemTemplate.RandomSuffix = 0;
}
if (itemTemplate.ItemSet && !sItemSetStore.LookupEntry(itemTemplate.ItemSet))
{
- sLog->outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet);
itemTemplate.ItemSet = 0;
}
if (itemTemplate.Area && !GetAreaEntryByAreaID(itemTemplate.Area))
- sLog->outErrorDb("Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area);
if (itemTemplate.Map && !sMapStore.LookupEntry(itemTemplate.Map))
- sLog->outErrorDb("Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map);
if (itemTemplate.BagFamily)
{
@@ -2531,7 +2545,7 @@ void ObjectMgr::LoadItemTemplates()
ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1);
if (!bf)
{
- sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry);
itemTemplate.BagFamily &= ~mask;
continue;
}
@@ -2541,7 +2555,7 @@ void ObjectMgr::LoadItemTemplates()
CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate.ItemId);
if (!ctEntry)
{
- sLog->outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry);
itemTemplate.BagFamily &= ~mask;
}
}
@@ -2549,41 +2563,41 @@ void ObjectMgr::LoadItemTemplates()
}
if (itemTemplate.TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate.TotemCategory))
- sLog->outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory);
for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j)
{
if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color);
itemTemplate.Socket[j].Color = 0;
}
}
if (itemTemplate.GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate.GemProperties))
- sLog->outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties);
if (itemTemplate.FoodType >= MAX_PET_DIET)
{
- sLog->outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType);
itemTemplate.FoodType = 0;
}
if (itemTemplate.ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate.ItemLimitCategory))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory);
itemTemplate.ItemLimitCategory = 0;
}
if (itemTemplate.HolidayId && !sHolidaysStore.LookupEntry(itemTemplate.HolidayId))
{
- sLog->outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId);
itemTemplate.HolidayId = 0;
}
if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration)
{
- sLog->outErrorDb("Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry);
itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME;
}
@@ -2612,10 +2626,9 @@ void ObjectMgr::LoadItemTemplates()
}
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
- sLog->outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
+ sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
- sLog->outString(">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry)
@@ -2650,8 +2663,7 @@ void ObjectMgr::LoadItemSetNameLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
} while (result->NextRow());
- sLog->outString(">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemSetNames()
@@ -2679,8 +2691,7 @@ void ObjectMgr::LoadItemSetNames()
if (!result)
{
- sLog->outString(">> Loaded 0 item set names. DB table `item_set_names` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty.");
return;
}
@@ -2694,7 +2705,7 @@ void ObjectMgr::LoadItemSetNames()
uint32 entry = fields[0].GetUInt32();
if (itemSetItems.find(entry) == itemSetItems.end())
{
- sLog->outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry);
continue;
}
@@ -2704,7 +2715,7 @@ void ObjectMgr::LoadItemSetNames()
uint32 invType = fields[2].GetUInt8();
if (invType >= MAX_INVTYPE)
{
- sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
+ sLog->outError(LOG_FILTER_SQL, "Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType);
invType = INVTYPE_NON_EQUIP;
}
@@ -2723,19 +2734,18 @@ void ObjectMgr::LoadItemSetNames()
pProto = sObjectMgr->GetItemTemplate(entry);
if (pProto)
{
- sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry);
ItemSetNameEntry &data = _itemSetNameStore[entry];
data.name = pProto->Name1;
data.InventoryType = pProto->InventoryType;
++count;
}
else
- sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry);
}
}
- sLog->outString(">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleTemplateAccessories()
@@ -2751,8 +2761,8 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty.");
+
return;
}
@@ -2769,19 +2779,19 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
if (!sObjectMgr->GetCreatureTemplate(uiEntry))
{
- sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry);
continue;
}
if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
{
- sLog->outErrorDb("Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory);
continue;
}
if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end())
{
- sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry);
continue;
}
@@ -2791,8 +2801,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleAccessories()
@@ -2808,8 +2817,7 @@ void ObjectMgr::LoadVehicleAccessories()
if (!result)
{
- sLog->outString(">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
return;
}
@@ -2826,7 +2834,7 @@ void ObjectMgr::LoadVehicleAccessories()
if (!sObjectMgr->GetCreatureTemplate(uiAccessory))
{
- sLog->outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
+ sLog->outError(LOG_FILTER_SQL, "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory);
continue;
}
@@ -2836,8 +2844,7 @@ void ObjectMgr::LoadVehicleAccessories()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetLevelInfo()
@@ -2849,8 +2856,8 @@ void ObjectMgr::LoadPetLevelInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty.");
+
return;
}
@@ -2863,7 +2870,7 @@ void ObjectMgr::LoadPetLevelInfo()
uint32 creature_id = fields[0].GetUInt32();
if (!sObjectMgr->GetCreatureTemplate(creature_id))
{
- sLog->outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id);
+ sLog->outError(LOG_FILTER_SQL, "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id);
continue;
}
@@ -2871,17 +2878,17 @@ void ObjectMgr::LoadPetLevelInfo()
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog->outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
else
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
continue;
}
else if (current_level < 1)
{
- sLog->outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level);
continue;
}
@@ -2914,7 +2921,7 @@ void ObjectMgr::LoadPetLevelInfo()
// fatal error if no level 1 data
if (!pInfo || pInfo[0].health == 0)
{
- sLog->outErrorDb("Creature %u does not have pet stats data for Level 1!", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Creature %u does not have pet stats data for Level 1!", itr->first);
exit(1);
}
@@ -2923,14 +2930,13 @@ void ObjectMgr::LoadPetLevelInfo()
{
if (pInfo[level].health == 0)
{
- sLog->outErrorDb("Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level+1, level);
pInfo[level] = pInfo[level-1];
}
}
}
- sLog->outString(">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
@@ -2947,12 +2953,15 @@ PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level)
void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count)
{
+ if (!_playerInfo[race_][class_])
+ return;
+
if (count > 0)
- _playerInfo[race_][class_].item.push_back(PlayerCreateInfoItem(itemId, count));
+ _playerInfo[race_][class_]->item.push_back(PlayerCreateInfoItem(itemId, count));
else
{
if (count < -1)
- sLog->outErrorDb("Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
+ sLog->outError(LOG_FILTER_SQL, "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId);
uint32 RaceClass = (race_) | (class_ << 8);
bool doneOne = false;
@@ -2974,7 +2983,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3
}
if (!found)
- sLog->outErrorDb("Item %u specified to be removed from original create info not found in dbc!", itemId);
+ sLog->outError(LOG_FILTER_SQL, "Item %u specified to be removed from original create info not found in dbc!", itemId);
if (!doneOne)
doneOne = true;
@@ -2996,8 +3005,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outString();
- sLog->outErrorDb(">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
+
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty.");
exit(1);
}
else
@@ -3019,65 +3028,63 @@ void ObjectMgr::LoadPlayerInfo()
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
continue;
}
ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race);
if (!rEntry)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo` table, ignoring.", current_race);
continue;
}
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
continue;
}
if (!sChrClassesStore.LookupEntry(current_class))
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo` table, ignoring.", current_class);
continue;
}
// accept DB data only for valid position (and non instanceable)
if (!MapManager::IsValidMapCoord(mapId, positionX, positionY, positionZ, orientation))
{
- sLog->outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
continue;
}
if (sMapStore.LookupEntry(mapId)->Instanceable())
{
- sLog->outErrorDb("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
+ sLog->outError(LOG_FILTER_SQL, "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race);
continue;
}
- PlayerInfo* pInfo = &_playerInfo[current_race][current_class];
-
- pInfo->mapId = mapId;
- pInfo->areaId = areaId;
- pInfo->positionX = positionX;
- pInfo->positionY = positionY;
- pInfo->positionZ = positionZ;
- pInfo->orientation = orientation;
-
- pInfo->displayId_m = rEntry->model_m;
- pInfo->displayId_f = rEntry->model_f;
+ PlayerInfo* info = new PlayerInfo();
+ info->mapId = mapId;
+ info->areaId = areaId;
+ info->positionX = positionX;
+ info->positionY = positionY;
+ info->positionZ = positionZ;
+ info->orientation = orientation;
+ info->displayId_m = rEntry->model_m;
+ info->displayId_f = rEntry->model_f;
+ _playerInfo[current_race][current_class] = info;
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate items
- sLog->outString("Loading Player Create Items Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3
@@ -3085,8 +3092,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outString(">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
}
else
{
@@ -3099,14 +3105,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class);
continue;
}
@@ -3114,7 +3120,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!GetItemTemplate(item_id))
{
- sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
+ sLog->outError(LOG_FILTER_SQL, "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
continue;
}
@@ -3122,7 +3128,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!amount)
{
- sLog->outErrorDb("Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class);
+ sLog->outError(LOG_FILTER_SQL, "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class);
continue;
}
@@ -3143,13 +3149,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate spells
- sLog->outString("Loading Player Create Spell Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3158,8 +3163,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell");
- sLog->outString();
+ 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");
+
}
else
{
@@ -3172,14 +3177,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class);
continue;
}
@@ -3191,22 +3196,27 @@ void ObjectMgr::LoadPlayerInfo()
uint32 max_class = current_class ? current_class + 1 : MAX_CLASSES;
for (uint32 r = min_race; r < max_race; ++r)
for (uint32 c = min_class; c < max_class; ++c)
- _playerInfo[r][c].spell.push_back(fields[2].GetUInt32());
+ if (PlayerInfo * info = _playerInfo[r][c])
+ info->spell.push_back(fields[2].GetUInt32());
}
+ else if (PlayerInfo * info = _playerInfo[current_race][current_class])
+ info->spell.push_back(fields[2].GetUInt32());
else
- _playerInfo[current_race][current_class].spell.push_back(fields[2].GetUInt32());
+ {
+ sLog->outError(LOG_FILTER_SQL, "Wrong race: %u, class: %u combination in `playercreateinfo_spell` table, ignoring.", current_race, current_class);
+ continue;
+ }
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate actions
- sLog->outString("Loading Player Create Action Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3215,8 +3225,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty.");
+
}
else
{
@@ -3229,41 +3239,39 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class);
continue;
}
- PlayerInfo* pInfo = &_playerInfo[current_race][current_class];
- pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16()));
+ if (PlayerInfo* info = _playerInfo[current_race][current_class])
+ info->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16()));
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Loading levels data (class only dependent)
- sLog->outString("Loading Player Create Level HP/Mana Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data...");
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3
+ // 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT class, level, basehp, basemana FROM player_classlevelstats");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty.");
exit(1);
}
@@ -3276,27 +3284,30 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_class = fields[0].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class);
continue;
}
uint8 current_level = fields[1].GetUInt8(); // Can't be > than STRONG_MAX_LEVEL (hardcoded level maximum) due to var type
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
continue;
}
- PlayerClassInfo* pClassInfo = &_playerClassInfo[current_class];
-
- if (!pClassInfo->levelInfo)
- pClassInfo->levelInfo = new PlayerClassLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
+ PlayerClassInfo* info = _playerClassInfo[current_class];
+ if (!info)
+ {
+ info = new PlayerClassInfo();
+ info->levelInfo = new PlayerClassLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
+ _playerClassInfo[current_class] = info;
+ }
- PlayerClassLevelInfo* pClassLevelInfo = &pClassInfo->levelInfo[current_level-1];
+ PlayerClassLevelInfo& levelInfo = info->levelInfo[current_level-1];
- pClassLevelInfo->basehealth = fields[2].GetUInt16();
- pClassLevelInfo->basemana = fields[3].GetUInt16();
+ levelInfo.basehealth = fields[2].GetUInt16();
+ levelInfo.basemana = fields[3].GetUInt16();
++count;
}
@@ -3309,12 +3320,12 @@ void ObjectMgr::LoadPlayerInfo()
if (!sChrClassesStore.LookupEntry(class_))
continue;
- PlayerClassInfo* pClassInfo = &_playerClassInfo[class_];
+ PlayerClassInfo* pClassInfo = _playerClassInfo[class_];
// fatal error if no level 1 data
if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0)
{
- sLog->outErrorDb("Class %i Level 1 does not have health/mana data!", class_);
+ sLog->outError(LOG_FILTER_SQL, "Class %i Level 1 does not have health/mana data!", class_);
exit(1);
}
@@ -3323,18 +3334,17 @@ void ObjectMgr::LoadPlayerInfo()
{
if (pClassInfo->levelInfo[level].basehealth == 0)
{
- sLog->outErrorDb("Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level+1, level);
pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level-1];
}
}
}
- sLog->outString(">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading levels data (class/race dependent)
- sLog->outString("Loading Player Create Level Stats Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3343,8 +3353,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty.");
+
exit(1);
}
@@ -3357,14 +3367,14 @@ void ObjectMgr::LoadPlayerInfo()
uint32 current_race = fields[0].GetUInt8();
if (current_race >= MAX_RACES)
{
- sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race);
+ sLog->outError(LOG_FILTER_SQL, "Wrong race %u in `player_levelstats` table, ignoring.", current_race);
continue;
}
uint32 current_class = fields[1].GetUInt8();
if (current_class >= MAX_CLASSES)
{
- sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class);
+ sLog->outError(LOG_FILTER_SQL, "Wrong class %u in `player_levelstats` table, ignoring.", current_class);
continue;
}
@@ -3372,25 +3382,23 @@ void ObjectMgr::LoadPlayerInfo()
if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog->outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level);
else
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
continue;
}
- PlayerInfo* pInfo = &_playerInfo[current_race][current_class];
-
- if (!pInfo->levelInfo)
- pInfo->levelInfo = new PlayerLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
-
- PlayerLevelInfo* pLevelInfo = &pInfo->levelInfo[current_level-1];
-
- for (int i = 0; i < MAX_STATS; i++)
+ if (PlayerInfo* info = _playerInfo[current_race][current_class])
{
- pLevelInfo->stats[i] = fields[i+3].GetUInt8();
+ if (!info->levelInfo)
+ info->levelInfo = new PlayerLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)];
+
+ PlayerLevelInfo& levelInfo = info->levelInfo[current_level-1];
+ for (int i = 0; i < MAX_STATS; i++)
+ levelInfo.stats[i] = fields[i+3].GetUInt8();
}
++count;
@@ -3410,10 +3418,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!sChrClassesStore.LookupEntry(class_))
continue;
- PlayerInfo* pInfo = &_playerInfo[race][class_];
-
- // skip non loaded combinations
- if (!pInfo->displayId_m || !pInfo->displayId_f)
+ PlayerInfo* info = _playerInfo[race][class_];
+ if (!info)
continue;
// skip expansion races if not playing with expansion
@@ -3425,30 +3431,29 @@ void ObjectMgr::LoadPlayerInfo()
continue;
// fatal error if no level 1 data
- if (!pInfo->levelInfo || pInfo->levelInfo[0].stats[0] == 0)
+ if (!info->levelInfo || info->levelInfo[0].stats[0] == 0)
{
- sLog->outErrorDb("Race %i Class %i Level 1 does not have stats data!", race, class_);
+ sLog->outError(LOG_FILTER_SQL, "Race %i Class %i Level 1 does not have stats data!", race, class_);
exit(1);
}
// fill level gaps
for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level)
{
- if (pInfo->levelInfo[level].stats[0] == 0)
+ if (info->levelInfo[level].stats[0] == 0)
{
- sLog->outErrorDb("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level);
- pInfo->levelInfo[level] = pInfo->levelInfo[level-1];
+ sLog->outError(LOG_FILTER_SQL, "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level+1, level);
+ info->levelInfo[level] = info->levelInfo[level-1];
}
}
}
}
- sLog->outString(">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading xp per level data
- sLog->outString("Loading Player Create XP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3461,8 +3466,8 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty.");
+
exit(1);
}
@@ -3478,10 +3483,10 @@ void ObjectMgr::LoadPlayerInfo()
if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum
- sLog->outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level);
+ sLog->outError(LOG_FILTER_SQL, "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level);
else
{
- sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level);
++count; // make result loading percent "expected" correct in case disabled detail mode for example.
}
continue;
@@ -3497,13 +3502,12 @@ void ObjectMgr::LoadPlayerInfo()
{
if (_playerXPperLevel[level] == 0)
{
- sLog->outErrorDb("Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level);
+ sLog->outError(LOG_FILTER_SQL, "Level %i does not have XP for level data. Using data of level [%i] + 100.", level+1, level);
_playerXPperLevel[level] = _playerXPperLevel[level-1]+100;
}
}
- sLog->outString(">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -3512,7 +3516,7 @@ void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassL
if (level < 1 || class_ >= MAX_CLASSES)
return;
- PlayerClassInfo const* pInfo = &_playerClassInfo[class_];
+ PlayerClassInfo const* pInfo = _playerClassInfo[class_];
if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
@@ -3525,8 +3529,8 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, Play
if (level < 1 || race >= MAX_RACES || class_ >= MAX_CLASSES)
return;
- PlayerInfo const* pInfo = &_playerInfo[race][class_];
- if (pInfo->displayId_m == 0 || pInfo->displayId_f == 0)
+ PlayerInfo const* pInfo = _playerInfo[race][class_];
+ if (!pInfo)
return;
if (level <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
@@ -3538,7 +3542,7 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, Play
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
{
// base data (last known level)
- *info = _playerInfo[race][_class].levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1];
+ *info = _playerInfo[race][_class]->levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1];
// if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32
for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl)
@@ -3655,13 +3659,13 @@ void ObjectMgr::LoadQuests()
"DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, EmoteOnIncomplete, EmoteOnComplete, "
// 136 137 138 139 140 141 142 143
"OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4, "
- // 144 145 146
- "StartScript, CompleteScript, WDBVerified"
+ // 144 145
+ "CompleteScript, WDBVerified"
" FROM quest_template");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quests definitions. DB table `quest_template` is empty.");
+
return;
}
@@ -3690,18 +3694,18 @@ void ObjectMgr::LoadQuests()
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
if (qinfo->GetQuestMethod() >= 3)
- sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
{
- sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
qinfo->GetQuestId(), qinfo->Flags >> 20, QUEST_TRINITY_FLAGS_DB_ALLOWED >> 20);
qinfo->Flags &= QUEST_TRINITY_FLAGS_DB_ALLOWED;
}
if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY)
{
- sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId());
qinfo->Flags &= ~QUEST_FLAGS_DAILY;
}
@@ -3709,7 +3713,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
- sLog->outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
@@ -3718,7 +3722,16 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
- sLog->outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
+ qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
+ }
+ }
+
+ if (qinfo->Flags & QUEST_TRINITY_FLAGS_MONTHLY)
+ {
+ if (!(qinfo->Flags & QUEST_TRINITY_FLAGS_REPEATABLE))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId());
qinfo->Flags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
@@ -3730,7 +3743,7 @@ void ObjectMgr::LoadQuests()
{
if (uint32 id = qinfo->RewardChoiceItemId[j])
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_AUTO_REWARDED.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest ignore this data
}
@@ -3742,7 +3755,7 @@ void ObjectMgr::LoadQuests()
{
if (!GetAreaEntryByAreaID(qinfo->ZoneOrSort))
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.",
qinfo->GetQuestId(), qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client
}
@@ -3753,7 +3766,7 @@ void ObjectMgr::LoadQuests()
QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort));
if (!qSort)
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.",
qinfo->GetQuestId(), qinfo->ZoneOrSort);
// no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check)
}
@@ -3762,7 +3775,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredSkillId != skill_id)
{
- sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).",
qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id);
//override, and force proper value here?
}
@@ -3774,7 +3787,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses);
qinfo->RequiredClasses = 0;
}
}
@@ -3783,7 +3796,7 @@ void ObjectMgr::LoadQuests()
{
if (!(qinfo->RequiredRaces & RACEMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u does not contain any playable races in `RequiredRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->RequiredRaces);
qinfo->RequiredRaces = 0;
}
}
@@ -3792,7 +3805,7 @@ void ObjectMgr::LoadQuests()
{
if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId))
{
- sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSkillId` = %u but this skill does not exist",
qinfo->GetQuestId(), qinfo->RequiredSkillId);
}
}
@@ -3801,7 +3814,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue())
{
- sLog->outErrorDb("Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue());
// no changes, quest can't be done for this requirement
}
@@ -3810,77 +3823,77 @@ void ObjectMgr::LoadQuests()
if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2))
{
- sLog->outErrorDb("Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1))
{
- sLog->outErrorDb("Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction))
{
- sLog->outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction))
{
- sLog->outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap)
{
- sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap);
// no changes, quest can't be done for this requirement
}
if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue)
{
- sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.",
qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue);
// no changes, quest can't be done for this requirement
}
if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredFactionValue1);
// warning
}
if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredFactionValue2);
// warning
}
if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredMinRepValue);
// warning
}
if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0)
{
- sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect",
qinfo->GetQuestId(), qinfo->RequiredMaxRepValue);
// warning
}
if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId))
{
- sLog->outErrorDb("Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.",
qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId());
qinfo->RewardTitleId = 0;
// quest can't reward this title
@@ -3890,20 +3903,20 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(qinfo->SourceItemId))
{
- sLog->outErrorDb("Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->SourceItemId, qinfo->SourceItemId);
qinfo->SourceItemId = 0; // quest can't be done for this requirement
}
else if (qinfo->SourceItemIdCount == 0)
{
- sLog->outErrorDb("Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = %u but `SourceItemIdCount` = 0, set to 1 but need fix in DB.",
qinfo->GetQuestId(), qinfo->SourceItemId);
qinfo->SourceItemIdCount = 1; // update to 1 for allow quest work for backward compatibility with DB
}
}
else if (qinfo->SourceItemIdCount>0)
{
- sLog->outErrorDb("Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceItemId` = 0 but `SourceItemIdCount` = %u, useless value.",
qinfo->GetQuestId(), qinfo->SourceItemIdCount);
qinfo->SourceItemIdCount=0; // no quest work changes in fact
}
@@ -3913,13 +3926,13 @@ void ObjectMgr::LoadQuests()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.",
qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid);
qinfo->SourceSpellid = 0; // quest can't be done for this requirement
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
- sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.",
qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid);
qinfo->SourceSpellid = 0; // quest can't be done for this requirement
}
@@ -3932,7 +3945,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredItemCount[j] == 0)
{
- sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest can't be done for this requirement
}
@@ -3941,14 +3954,14 @@ void ObjectMgr::LoadQuests()
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest
}
}
else if (qinfo->RequiredItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]);
qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest
}
@@ -3961,7 +3974,7 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = %u but item with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
// no changes, quest can't be done for this requirement
}
@@ -3970,7 +3983,7 @@ void ObjectMgr::LoadQuests()
{
if (qinfo->RequiredSourceItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredSourceItemId%d` = 0 but `RequiredSourceItemCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredSourceItemCount[j]);
// no changes, quest ignore this data
}
@@ -3985,7 +3998,7 @@ void ObjectMgr::LoadQuests()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, id);
continue;
}
@@ -4007,7 +4020,7 @@ void ObjectMgr::LoadQuests()
{
if (!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1);
+ sLog->outError(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and RequiredNpcOrGo%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or RequiredNpcOrGo%d must be fixed, quest modified to enable objective.", spellInfo->Id, qinfo->Id, j+1, j+1);
// this will prevent quest completing without objective
const_cast<Quest*>(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -4015,7 +4028,7 @@ void ObjectMgr::LoadQuests()
}
else
{
- sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `ReqSpellCast%d` = %u and RequiredNpcOrGo%d = 0 but spell %u does not have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT effect for this quest, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1, id);
// no changes, quest can't be done for this requirement
}
@@ -4028,14 +4041,14 @@ void ObjectMgr::LoadQuests()
int32 id = qinfo->RequiredNpcOrGo[j];
if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id))
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, uint32(-id));
qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement
}
if (id > 0 && !sObjectMgr->GetCreatureTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.",
qinfo->GetQuestId(), j+1, id, uint32(id));
qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement
}
@@ -4048,14 +4061,14 @@ void ObjectMgr::LoadQuests()
if (!qinfo->RequiredNpcOrGoCount[j])
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest can be incorrectly done, but we already report this
}
}
else if (qinfo->RequiredNpcOrGoCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredNpcOrGoCount[j]);
// no changes, quest ignore this data
}
@@ -4068,21 +4081,21 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(), j+1, id, id);
qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this
}
if (!qinfo->RewardChoiceItemCount[j])
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes, quest can't be done
}
}
else if (qinfo->RewardChoiceItemCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]);
// no changes, quest ignore this data
}
@@ -4095,21 +4108,21 @@ void ObjectMgr::LoadQuests()
{
if (!sObjectMgr->GetItemTemplate(id))
{
- sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.",
qinfo->GetQuestId(), j+1, id, id);
qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item
}
if (!qinfo->RewardItemIdCount[j])
{
- sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.",
qinfo->GetQuestId(), j+1, id, j+1);
// no changes
}
}
else if (qinfo->RewardItemIdCount[j]>0)
{
- sLog->outErrorDb("Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemIdCount[j]);
// no changes, quest ignore this data
}
@@ -4121,18 +4134,18 @@ void ObjectMgr::LoadQuests()
{
if (abs(qinfo->RewardFactionValueId[j]) > 9)
{
- sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]);
}
if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j]))
{
- sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]);
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]);
qinfo->RewardFactionId[j] = 0; // quest will not reward this
}
}
else if (qinfo->RewardFactionValueIdOverride[j] != 0)
{
- sLog->outErrorDb("Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.",
qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionValueIdOverride[j]);
// no changes, quest ignore this data
}
@@ -4144,21 +4157,21 @@ void ObjectMgr::LoadQuests()
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u does not exist, spell removed as display reward.",
qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
qinfo->RewardSpell = 0; // no spell reward will display for this quest
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
qinfo->RewardSpell = 0; // no spell reward will display for this quest
}
else if (GetTalentSpellCost(qinfo->RewardSpell))
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell);
qinfo->RewardSpell = 0; // no spell reward will display for this quest
}
@@ -4170,21 +4183,21 @@ void ObjectMgr::LoadQuests()
if (!spellInfo)
{
- sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u does not exist, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast);
qinfo->RewardSpellCast = 0; // no spell will be casted on player
}
else if (!SpellMgr::IsSpellValid(spellInfo))
{
- sLog->outErrorDb("Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpellCast` = %u but spell %u is broken, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast);
qinfo->RewardSpellCast = 0; // no spell will be casted on player
}
else if (GetTalentSpellCost(qinfo->RewardSpellCast))
{
- sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardSpell` = %u but spell %u is talent, quest will not have a spell reward.",
qinfo->GetQuestId(), qinfo->RewardSpellCast, qinfo->RewardSpellCast);
qinfo->RewardSpellCast = 0; // no spell will be casted on player
}
@@ -4194,7 +4207,7 @@ void ObjectMgr::LoadQuests()
{
if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId))
{
- sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.",
qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId);
qinfo->RewardMailTemplateId = 0; // no mail will send to player
qinfo->RewardMailDelay = 0; // no mail will send to player
@@ -4202,7 +4215,7 @@ void ObjectMgr::LoadQuests()
else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end())
{
std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId);
- sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.",
qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second);
qinfo->RewardMailTemplateId = 0; // no mail will send to player
qinfo->RewardMailDelay = 0; // no mail will send to player
@@ -4216,7 +4229,7 @@ void ObjectMgr::LoadQuests()
QuestMap::iterator qNextItr = _questTemplates.find(qinfo->NextQuestIdChain);
if (qNextItr == _questTemplates.end())
{
- sLog->outErrorDb("Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.",
+ sLog->outError(LOG_FILTER_SQL, "Quest %u has `NextQuestIdChain` = %u but quest %u does not exist, quest chain will not work.",
qinfo->GetQuestId(), qinfo->NextQuestIdChain, qinfo->NextQuestIdChain);
qinfo->NextQuestIdChain = 0;
}
@@ -4229,7 +4242,7 @@ void ObjectMgr::LoadQuests()
{
if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end())
{
- sLog->outErrorDb("Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId());
}
else
{
@@ -4242,7 +4255,7 @@ void ObjectMgr::LoadQuests()
QuestMap::iterator qNextItr = _questTemplates.find(abs(qinfo->GetNextQuestId()));
if (qNextItr == _questTemplates.end())
{
- sLog->outErrorDb("Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
+ sLog->outError(LOG_FILTER_SQL, "Quest %d has NextQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId());
}
else
{
@@ -4281,7 +4294,7 @@ void ObjectMgr::LoadQuests()
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -4289,8 +4302,7 @@ void ObjectMgr::LoadQuests()
}
}
- sLog->outString(">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestLocales()
@@ -4338,8 +4350,7 @@ void ObjectMgr::LoadQuestLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadScripts(ScriptsType type)
@@ -4357,7 +4368,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use.
return;
- sLog->outString("Loading %s...", tableName.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str());
scripts->clear(); // need for reload support
@@ -4367,8 +4378,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (!result)
{
- sLog->outString(">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
return;
}
@@ -4399,19 +4409,19 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
{
- sLog->outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.ChatType, tmp.id);
continue;
}
if (!tmp.Talk.TextID)
{
- sLog->outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.TextID, tmp.id);
continue;
}
if (tmp.Talk.TextID < MIN_DB_SCRIPT_STRING_ID || tmp.Talk.TextID >= MAX_DB_SCRIPT_STRING_ID)
{
- sLog->outErrorDb("Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u",
tableName.c_str(), tmp.Talk.TextID, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id);
continue;
}
@@ -4423,7 +4433,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID))
{
- sLog->outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u",
tableName.c_str(), tmp.Emote.EmoteID, tmp.id);
continue;
}
@@ -4434,14 +4444,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID))
{
- sLog->outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
tableName.c_str(), tmp.TeleportTo.MapID, tmp.id);
continue;
}
if (!Trinity::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation))
{
- sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",
tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id);
continue;
}
@@ -4453,14 +4463,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID);
if (!quest)
{
- sLog->outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
continue;
}
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",
tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id);
// this will prevent quest completing without objective
@@ -4471,21 +4481,21 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
{
- sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u",
tableName.c_str(), tmp.QuestExplored.Distance, tmp.id);
continue;
}
if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE)
{
- sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check",
tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE);
continue;
}
if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) < INTERACTION_DISTANCE)
{
- sLog->outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check",
tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE);
continue;
}
@@ -4497,7 +4507,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry))
{
- sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u",
tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id);
continue;
}
@@ -4509,7 +4519,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid);
if (!data)
{
- sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id);
continue;
}
@@ -4517,7 +4527,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
if (!info)
{
- sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id);
continue;
}
@@ -4528,7 +4538,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
info->type == GAMEOBJECT_TYPE_BUTTON ||
info->type == GAMEOBJECT_TYPE_TRAP)
{
- sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u",
tableName.c_str(), info->entry, tmp.id);
continue;
}
@@ -4539,14 +4549,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!Trinity::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation))
{
- sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id);
continue;
}
if (!GetCreatureTemplate(tmp.TempSummonCreature.CreatureEntry))
{
- sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",
tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id);
continue;
}
@@ -4559,7 +4569,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid);
if (!data)
{
- sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u",
tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
@@ -4567,14 +4577,14 @@ void ObjectMgr::LoadScripts(ScriptsType type)
GameObjectTemplate const* info = GetGameObjectTemplate(data->id);
if (!info)
{
- sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u",
tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
if (info->type != GAMEOBJECT_TYPE_DOOR)
{
- sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has gameobject type (%u) non supported by command %s for script id %u",
tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id);
continue;
}
@@ -4586,13 +4596,13 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID))
{
- sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id);
continue;
}
if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1)
{
- sLog->outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
tableName.c_str(), tmp.RemoveAura.Flags, tmp.id);
continue;
}
@@ -4603,25 +4613,25 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID))
{
- sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.SpellID, tmp.id);
continue;
}
if (tmp.CastSpell.Flags > 4) // targeting type
{
- sLog->outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.Flags, tmp.id);
continue;
}
if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1)
{
- sLog->outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id);
continue;
}
else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry))
{
- sLog->outErrorDb("Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id);
continue;
}
@@ -4632,13 +4642,13 @@ void ObjectMgr::LoadScripts(ScriptsType type)
{
if (!GetItemTemplate(tmp.CreateItem.ItemEntry))
{
- sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u",
tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id);
continue;
}
if (!tmp.CreateItem.Amount)
{
- sLog->outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u",
tableName.c_str(), tmp.CreateItem.Amount, tmp.id);
continue;
}
@@ -4659,8 +4669,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
}
while (result->NextRow());
- sLog->outString(">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameObjectScripts()
@@ -4671,7 +4680,7 @@ void ObjectMgr::LoadGameObjectScripts()
for (ScriptMapMap::const_iterator itr = sGameObjectScripts.begin(); itr != sGameObjectScripts.end(); ++itr)
{
if (!GetGOData(itr->first))
- sLog->outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first);
}
}
@@ -4683,19 +4692,7 @@ void ObjectMgr::LoadQuestEndScripts()
for (ScriptMapMap::const_iterator itr = sQuestEndScripts.begin(); itr != sQuestEndScripts.end(); ++itr)
{
if (!GetQuestTemplate(itr->first))
- sLog->outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first);
- }
-}
-
-void ObjectMgr::LoadQuestStartScripts()
-{
- LoadScripts(SCRIPTS_QUEST_START);
-
- // check ids
- for (ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr)
- {
- if (!GetQuestTemplate(itr->first))
- sLog->outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first);
}
}
@@ -4711,14 +4708,14 @@ void ObjectMgr::LoadSpellScripts()
if (!spellInfo)
{
- sLog->outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId);
continue;
}
uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
//check for correct spellEffect
if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY))
- sLog->outErrorDb("Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
+ sLog->outError(LOG_FILTER_SQL, "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
}
}
@@ -4760,7 +4757,7 @@ void ObjectMgr::LoadEventScripts()
{
std::set<uint32>::const_iterator itr2 = evt_scripts.find(itr->first);
if (itr2 == evt_scripts.end())
- sLog->outErrorDb("Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u",
+ sLog->outError(LOG_FILTER_SQL, "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u",
itr->first, SPELL_EFFECT_SEND_EVENT);
}
}
@@ -4791,7 +4788,7 @@ void ObjectMgr::LoadWaypointScripts()
}
for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr)
- sLog->outErrorDb("There is no waypoint which links to the waypoint script %u", *itr);
+ sLog->outError(LOG_FILTER_SQL, "There is no waypoint which links to the waypoint script %u", *itr);
}
void ObjectMgr::LoadSpellScriptNames()
@@ -4804,8 +4801,7 @@ void ObjectMgr::LoadSpellScriptNames()
if (!result)
{
- sLog->outString(">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
return;
}
@@ -4829,7 +4825,7 @@ void ObjectMgr::LoadSpellScriptNames()
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
+ sLog->outError(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
continue;
}
@@ -4837,7 +4833,7 @@ void ObjectMgr::LoadSpellScriptNames()
{
if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId))
{
- sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
+ sLog->outError(LOG_FILTER_SQL, "Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
while (spellInfo)
@@ -4852,8 +4848,7 @@ void ObjectMgr::LoadSpellScriptNames()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::ValidateSpellScripts()
@@ -4862,8 +4857,7 @@ void ObjectMgr::ValidateSpellScripts()
if (_spellScriptsStore.empty())
{
- sLog->outString(">> Validated 0 scripts.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts.");
return;
}
@@ -4883,7 +4877,7 @@ void ObjectMgr::ValidateSpellScripts()
bool valid = true;
if (!spellScript && !auraScript)
{
- sLog->outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
+ sLog->outError(LOG_FILTER_TSCR, "Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
valid = false;
}
if (spellScript)
@@ -4910,8 +4904,7 @@ void ObjectMgr::ValidateSpellScripts()
++count;
}
- sLog->outString(">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPageTexts()
@@ -4923,8 +4916,7 @@ void ObjectMgr::LoadPageTexts()
if (!result)
{
- sLog->outString(">> Loaded 0 page texts. DB table `page_text` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!");
return;
}
@@ -4948,13 +4940,12 @@ void ObjectMgr::LoadPageTexts()
{
PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPage);
if (itr2 == _pageTextStore.end())
- sLog->outErrorDb("Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage);
+ sLog->outError(LOG_FILTER_SQL, "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage);
}
}
- sLog->outString(">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PageText const* ObjectMgr::GetPageText(uint32 pageEntry)
@@ -4989,8 +4980,7 @@ void ObjectMgr::LoadPageTextLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadInstanceTemplate()
@@ -5002,8 +4992,7 @@ void ObjectMgr::LoadInstanceTemplate()
if (!result)
{
- sLog->outString(">> Loaded 0 instance templates. DB table `page_text` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!");
return;
}
@@ -5016,7 +5005,7 @@ void ObjectMgr::LoadInstanceTemplate()
if (!MapManager::IsValidMAP(mapID, true))
{
- sLog->outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
+ sLog->outError(LOG_FILTER_SQL, "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID);
continue;
}
@@ -5032,8 +5021,7 @@ void ObjectMgr::LoadInstanceTemplate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID)
@@ -5053,8 +5041,8 @@ void ObjectMgr::LoadInstanceEncounters()
QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 instance encounters, table is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 instance encounters, table is empty!");
+
return;
}
@@ -5070,13 +5058,13 @@ void ObjectMgr::LoadInstanceEncounters()
DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
if (!dungeonEncounter)
{
- sLog->outErrorDb("Table `instance_encounters` has an invalid encounter id %u, skipped!", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry);
continue;
}
- if (lastEncounterDungeon && !sLFGDungeonStore.LookupEntry(lastEncounterDungeon))
+ if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeon(lastEncounterDungeon))
{
- sLog->outErrorDb("Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], 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;
}
@@ -5085,7 +5073,7 @@ void ObjectMgr::LoadInstanceEncounters()
{
if (itr != dungeonLastBosses.end())
{
- sLog->outErrorDb("Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]);
continue;
}
@@ -5099,7 +5087,7 @@ void ObjectMgr::LoadInstanceEncounters()
CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry);
if (!creatureInfo)
{
- sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
@@ -5108,12 +5096,12 @@ void ObjectMgr::LoadInstanceEncounters()
case ENCOUNTER_CREDIT_CAST_SPELL:
if (!sSpellMgr->GetSpellInfo(creditEntry))
{
- sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
break;
default:
- sLog->outErrorDb("Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]);
+ sLog->outError(LOG_FILTER_SQL, "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]);
continue;
}
@@ -5122,8 +5110,7 @@ void ObjectMgr::LoadInstanceEncounters()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const
@@ -5143,8 +5130,7 @@ void ObjectMgr::LoadGossipText()
int count = 0;
if (!result)
{
- sLog->outString(">> Loaded %u npc texts", count);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count);
return;
}
_gossipTextStore.rehash(result->GetRowCount());
@@ -5161,7 +5147,7 @@ void ObjectMgr::LoadGossipText()
uint32 Text_ID = fields[cic++].GetUInt32();
if (!Text_ID)
{
- sLog->outErrorDb("Table `npc_text` has record wit reserved id 0, ignore.");
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_text` has record wit reserved id 0, ignore.");
continue;
}
@@ -5183,8 +5169,7 @@ void ObjectMgr::LoadGossipText()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNpcTextLocales()
@@ -5226,8 +5211,7 @@ void ObjectMgr::LoadNpcTextLocales()
}
} while (result->NextRow());
- sLog->outString(">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
//not very fast function but it is called only once a day, or on starting-up
@@ -5238,7 +5222,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
time_t curTime = time(NULL);
tm* lt = localtime(&curTime);
uint64 basetime(curTime);
- sLog->outDetail("Returning mails current time: hour: %d, minute: %d, second: %d ", lt->tm_hour, lt->tm_min, lt->tm_sec);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Returning mails current time: hour: %d, minute: %d, second: %d ", lt->tm_hour, lt->tm_min, lt->tm_sec);
// Delete all old mails without item and without body immediately, if starting server
if (!serverUp)
@@ -5252,8 +5236,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outString(">> No expired mails found.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found.");
return; // any mails need to be returned or deleted
}
@@ -5356,8 +5339,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
}
while (result->NextRow());
- sLog->outString(">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestAreaTriggers()
@@ -5370,8 +5352,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
if (!result)
{
- sLog->outString(">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
return;
}
@@ -5389,7 +5370,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID);
continue;
}
@@ -5397,13 +5378,13 @@ void ObjectMgr::LoadQuestAreaTriggers()
if (!quest)
{
- sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
+ sLog->outError(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID);
continue;
}
if (!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
- sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
+ sLog->outError(LOG_FILTER_SQL, "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
@@ -5415,8 +5396,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
} while (result->NextRow());
- sLog->outString(">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadTavernAreaTriggers()
@@ -5429,8 +5409,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
if (!result)
{
- sLog->outString(">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
return;
}
@@ -5447,15 +5426,14 @@ void ObjectMgr::LoadTavernAreaTriggers()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
_tavernAreaTriggerStore.insert(Trigger_ID);
} while (result->NextRow());
- sLog->outString(">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAreaTriggerScripts()
@@ -5467,8 +5445,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
if (!result)
{
- sLog->outString(">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
return;
}
@@ -5486,14 +5463,13 @@ void ObjectMgr::LoadAreaTriggerScripts()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
_areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName);
} while (result->NextRow());
- sLog->outString(">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team)
@@ -5588,8 +5564,8 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
mount_id = mount_info->GetRandomValidModelId();
if (!mount_id)
{
- sLog->outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
- return false;
+ sLog->outError(LOG_FILTER_SQL, "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
+ return 0;
}
}
}
@@ -5611,8 +5587,7 @@ void ObjectMgr::LoadGraveyardZones()
if (!result)
{
- sLog->outString(">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
return;
}
@@ -5631,43 +5606,42 @@ void ObjectMgr::LoadGraveyardZones()
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(safeLocId);
if (!entry)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", safeLocId);
continue;
}
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
if (!areaEntry)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId);
continue;
}
if (areaEntry->zone != 0)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId);
continue;
}
if (team != 0 && team != HORDE && team != ALLIANCE)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a record for non player faction (%u), skipped.", team);
continue;
}
if (!AddGraveYardLink(safeLocId, zoneId, team, false))
- sLog->outErrorDb("Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
} while (result->NextRow());
- sLog->outString(">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team)
{
enum DefaultGraveyard
{
- HORDE_GRAVEYARD = 10, // Crossroads
- ALLIANCE_GRAVEYARD = 4, // Westfall
+ HORDE_GRAVEYARD = 10, // Crossroads
+ ALLIANCE_GRAVEYARD = 4 // Westfall
};
if (team == HORDE)
@@ -5686,7 +5660,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
{
if (z > -500)
{
- sLog->outError("ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
+ sLog->outError(LOG_FILTER_GENERAL, "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
return GetDefaultGraveYard(team);
}
}
@@ -5705,7 +5679,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
if (graveLow == graveUp && !map->IsBattleArena())
{
- sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
return GetDefaultGraveYard(team);
}
@@ -5731,7 +5705,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(data.safeLocId);
if (!entry)
{
- sLog->outErrorDb("Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId);
+ sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has record for not existing graveyard (WorldSafeLocs.dbc id) %u, skipped.", data.safeLocId);
continue;
}
@@ -5849,7 +5823,7 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
GraveYardContainer::iterator graveUp = GraveYardStore.upper_bound(zoneId);
if (graveLow == graveUp)
{
- //sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
+ //sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
return;
}
@@ -5904,8 +5878,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if (!result)
{
- sLog->outString(">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
return;
}
@@ -5930,20 +5903,20 @@ void ObjectMgr::LoadAreaTriggerTeleports()
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
if (!atEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID);
continue;
}
MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId);
if (!mapEntry)
{
- sLog->outErrorDb("Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId);
continue;
}
if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0)
{
- sLog->outErrorDb("Area trigger (ID:%u) target coordinates not provided.", Trigger_ID);
+ sLog->outError(LOG_FILTER_SQL, "Area trigger (ID:%u) target coordinates not provided.", Trigger_ID);
continue;
}
@@ -5951,22 +5924,26 @@ void ObjectMgr::LoadAreaTriggerTeleports()
} while (result->NextRow());
- sLog->outString(">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAccessRequirements()
{
uint32 oldMSTime = getMSTime();
- _accessRequirementStore.clear(); // need for reload case
+ if (!_accessRequirementStore.empty())
+ {
+ for (AccessRequirementContainer::iterator itr = _accessRequirementStore.begin(); itr != _accessRequirementStore.end(); ++itr)
+ delete itr->second;
+
+ _accessRequirementStore.clear(); // need for reload case
+ }
// 0 1 2 3 4 5 6 7 8 9
QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
if (!result)
{
- sLog->outString(">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
return;
}
@@ -5982,69 +5959,68 @@ void ObjectMgr::LoadAccessRequirements()
uint8 difficulty = fields[1].GetUInt8();
uint32 requirement_ID = MAKE_PAIR32(mapid, difficulty);
- AccessRequirement ar;
+ AccessRequirement* ar = new AccessRequirement();
- ar.levelMin = fields[2].GetUInt8();
- ar.levelMax = fields[3].GetUInt8();
- ar.item = fields[4].GetUInt32();
- ar.item2 = fields[5].GetUInt32();
- ar.quest_A = fields[6].GetUInt32();
- ar.quest_H = fields[7].GetUInt32();
- ar.achievement = fields[8].GetUInt32();
- ar.questFailedText = fields[9].GetString();
+ ar->levelMin = fields[2].GetUInt8();
+ ar->levelMax = fields[3].GetUInt8();
+ ar->item = fields[4].GetUInt32();
+ ar->item2 = fields[5].GetUInt32();
+ ar->quest_A = fields[6].GetUInt32();
+ ar->quest_H = fields[7].GetUInt32();
+ ar->achievement = fields[8].GetUInt32();
+ ar->questFailedText = fields[9].GetString();
- if (ar.item)
+ if (ar->item)
{
- ItemTemplate const* pProto = GetItemTemplate(ar.item);
+ ItemTemplate const* pProto = GetItemTemplate(ar->item);
if (!pProto)
{
- sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty);
- ar.item = 0;
+ sLog->outError(LOG_FILTER_GENERAL, "Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item, mapid, difficulty);
+ ar->item = 0;
}
}
- if (ar.item2)
+ if (ar->item2)
{
- ItemTemplate const* pProto = GetItemTemplate(ar.item2);
+ ItemTemplate const* pProto = GetItemTemplate(ar->item2);
if (!pProto)
{
- sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty);
- ar.item2 = 0;
+ sLog->outError(LOG_FILTER_GENERAL, "Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar->item2, mapid, difficulty);
+ ar->item2 = 0;
}
}
- if (ar.quest_A)
+ if (ar->quest_A)
{
- if (!GetQuestTemplate(ar.quest_A))
+ if (!GetQuestTemplate(ar->quest_A))
{
- sLog->outErrorDb("Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_A, mapid, difficulty);
- ar.quest_A = 0;
+ sLog->outError(LOG_FILTER_SQL, "Required Alliance Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_A, mapid, difficulty);
+ ar->quest_A = 0;
}
}
- if (ar.quest_H)
+ if (ar->quest_H)
{
- if (!GetQuestTemplate(ar.quest_H))
+ if (!GetQuestTemplate(ar->quest_H))
{
- sLog->outErrorDb("Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar.quest_H, mapid, difficulty);
- ar.quest_H = 0;
+ sLog->outError(LOG_FILTER_SQL, "Required Horde Quest %u not exist for map %u difficulty %u, remove quest done requirement.", ar->quest_H, mapid, difficulty);
+ ar->quest_H = 0;
}
}
- if (ar.achievement)
+ if (ar->achievement)
{
- if (!sAchievementStore.LookupEntry(ar.achievement))
+ if (!sAchievementMgr->GetAchievement(ar->achievement))
{
- sLog->outErrorDb("Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar.achievement, mapid, difficulty);
- ar.achievement = 0;
+ sLog->outError(LOG_FILTER_SQL, "Required Achievement %u not exist for map %u difficulty %u, remove quest done requirement.", ar->achievement, mapid, difficulty);
+ ar->achievement = 0;
}
}
_accessRequirementStore[requirement_ID] = ar;
} while (result->NextRow());
- sLog->outString(">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
/*
@@ -6158,7 +6134,7 @@ uint32 ObjectMgr::GenerateAuctionID()
{
if (_auctionId >= 0xFFFFFFFE)
{
- sLog->outError("Auctions ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Auctions ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return _auctionId++;
@@ -6168,7 +6144,7 @@ uint64 ObjectMgr::GenerateEquipmentSetGuid()
{
if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL))
{
- sLog->outError("EquipmentSet guid overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "EquipmentSet guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return _equipmentSetGuid++;
@@ -6178,7 +6154,7 @@ uint32 ObjectMgr::GenerateMailID()
{
if (_mailId >= 0xFFFFFFFE)
{
- sLog->outError("Mail ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Mail ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return _mailId++;
@@ -6268,8 +6244,7 @@ void ObjectMgr::LoadGameObjectLocales()
AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
} while (result->NextRow());
- sLog->outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -6277,7 +6252,7 @@ inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32
if (sLockStore.LookupEntry(dataN))
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId);
}
@@ -6286,7 +6261,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN,
if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN))
{
if (trapInfo->type != GAMEOBJECT_TYPE_TRAP)
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP);
}
}
@@ -6296,7 +6271,7 @@ inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint3
if (sSpellMgr->GetSpellInfo(dataN))
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
goInfo->entry, goInfo->type, N, dataN, dataN);
}
@@ -6305,7 +6280,7 @@ inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo, uint32
if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR))
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
// prevent client and server unexpected work
@@ -6318,7 +6293,7 @@ inline void CheckGONoDamageImmuneId(GameObjectTemplate* goTemplate, uint32 dataN
if (dataN <= 1)
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN);
}
inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -6327,7 +6302,7 @@ inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, ui
if (dataN <= 1)
return;
- sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.",
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.",
goInfo->entry, goInfo->type, N, dataN);
}
@@ -6345,8 +6320,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (!result)
{
- sLog->outString(">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
return;
}
@@ -6430,7 +6404,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (got.spellFocus.focusId)
{
if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId))
- sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId);
}
@@ -6448,7 +6422,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (got.goober.pageId) // pageId
{
if (!GetPageText(got.goober.pageId))
- sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
entry, got.type, got.goober.pageId, got.goober.pageId);
}
CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11);
@@ -6473,7 +6447,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (got.moTransport.taxiPathId)
{
if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty())
- sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
+ sLog->outError(LOG_FILTER_SQL, "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId);
}
break;
@@ -6515,8 +6489,7 @@ void ObjectMgr::LoadGameObjectTemplate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadExplorationBaseXP()
@@ -6527,8 +6500,8 @@ void ObjectMgr::LoadExplorationBaseXP()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty.");
+
return;
}
@@ -6544,8 +6517,7 @@ void ObjectMgr::LoadExplorationBaseXP()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetBaseXP(uint8 level)
@@ -6568,8 +6540,7 @@ void ObjectMgr::LoadPetNames()
if (!result)
{
- sLog->outString(">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
return;
}
@@ -6589,8 +6560,7 @@ void ObjectMgr::LoadPetNames()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetNumber()
@@ -6604,8 +6574,7 @@ void ObjectMgr::LoadPetNumber()
_hiPetNumber = fields[0].GetUInt32()+1;
}
- sLog->outString(">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
}
std::string ObjectMgr::GeneratePetName(uint32 entry)
@@ -6638,8 +6607,7 @@ void ObjectMgr::LoadCorpses()
PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES));
if (!result)
{
- sLog->outString(">> Loaded 0 corpses. DB table `corpse` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty.");
return;
}
@@ -6651,7 +6619,7 @@ void ObjectMgr::LoadCorpses()
CorpseType type = CorpseType(fields[13].GetUInt8());
if (type >= MAX_CORPSE_TYPE)
{
- sLog->outError("Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type);
+ sLog->outError(LOG_FILTER_GENERAL, "Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type);
continue;
}
@@ -6667,8 +6635,7 @@ void ObjectMgr::LoadCorpses()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationRewardRate()
@@ -6677,13 +6644,11 @@ void ObjectMgr::LoadReputationRewardRate()
_repRewardRateStore.clear(); // for reload case
- uint32 count = 0; // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, creature_rate, spell_rate FROM reputation_reward_rate");
-
+ uint32 count = 0; // 0 1 2 3 4 5 6
+ 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->outErrorDb(">> Loaded `reputation_reward_rate`, table is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!");
return;
}
@@ -6691,36 +6656,57 @@ void ObjectMgr::LoadReputationRewardRate()
{
Field* fields = result->Fetch();
- uint32 factionId = fields[0].GetUInt32();
+ uint32 factionId = fields[0].GetUInt32();
RepRewardRate repRate;
- repRate.quest_rate = fields[1].GetFloat();
- repRate.creature_rate = fields[2].GetFloat();
- repRate.spell_rate = fields[3].GetFloat();
+ repRate.questRate = fields[1].GetFloat();
+ repRate.questDailyRate = fields[2].GetFloat();
+ repRate.questWeeklyRate = fields[3].GetFloat();
+ repRate.questMonthlyRate = fields[4].GetFloat();
+ repRate.creatureRate = fields[5].GetFloat();
+ repRate.spellRate = fields[6].GetFloat();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId);
+ continue;
+ }
+
+ if (repRate.questRate < 0.0f)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId);
+ continue;
+ }
+
+ if (repRate.questDailyRate < 0.0f)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId);
+ continue;
+ }
+
+ if (repRate.questWeeklyRate < 0.0f)
+ {
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId);
continue;
}
- if (repRate.quest_rate < 0.0f)
+ if (repRate.questMonthlyRate < 0.0f)
{
- sLog->outErrorDb("Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId);
continue;
}
- if (repRate.creature_rate < 0.0f)
+ if (repRate.creatureRate < 0.0f)
{
- sLog->outErrorDb("Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId);
continue;
}
- if (repRate.spell_rate < 0.0f)
+ if (repRate.spellRate < 0.0f)
{
- sLog->outErrorDb("Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId);
+ sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId);
continue;
}
@@ -6730,8 +6716,7 @@ void ObjectMgr::LoadReputationRewardRate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationOnKill()
@@ -6751,8 +6736,8 @@ void ObjectMgr::LoadReputationOnKill()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty.");
+
return;
}
@@ -6775,7 +6760,7 @@ void ObjectMgr::LoadReputationOnKill()
if (!GetCreatureTemplate(creature_id))
{
- sLog->outErrorDb("Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id);
continue;
}
@@ -6784,7 +6769,7 @@ void ObjectMgr::LoadReputationOnKill()
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1);
if (!factionEntry1)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1);
continue;
}
}
@@ -6794,7 +6779,7 @@ void ObjectMgr::LoadReputationOnKill()
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2);
if (!factionEntry2)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2);
continue;
}
}
@@ -6804,8 +6789,7 @@ void ObjectMgr::LoadReputationOnKill()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationSpilloverTemplate()
@@ -6819,8 +6803,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!result)
{
- sLog->outString(">> Loaded `reputation_spillover_template`, table is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty.");
return;
}
@@ -6849,13 +6832,13 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!factionEntry)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId);
continue;
}
if (factionEntry->team == 0)
{
- sLog->outErrorDb("Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId);
continue;
}
@@ -6867,19 +6850,19 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!factionSpillover)
{
- sLog->outErrorDb("Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId);
+ sLog->outError(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId);
continue;
}
if (factionSpillover->reputationListID < 0)
{
- sLog->outErrorDb("Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
+ sLog->outError(LOG_FILTER_SQL, "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId);
continue;
}
if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK)
{
- sLog->outErrorDb("Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]);
+ sLog->outError(LOG_FILTER_SQL, "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]);
continue;
}
}
@@ -6888,25 +6871,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]);
if (repTemplate.faction[0] && !factionEntry0)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]);
continue;
}
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]);
if (repTemplate.faction[1] && !factionEntry1)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]);
continue;
}
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]);
if (repTemplate.faction[2] && !factionEntry2)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]);
continue;
}
FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]);
if (repTemplate.faction[3] && !factionEntry3)
{
- sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]);
+ sLog->outError(LOG_FILTER_SQL, "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]);
continue;
}
@@ -6916,8 +6899,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointsOfInterest()
@@ -6933,8 +6915,8 @@ void ObjectMgr::LoadPointsOfInterest()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty.");
+
return;
}
@@ -6954,7 +6936,7 @@ void ObjectMgr::LoadPointsOfInterest()
if (!Trinity::IsValidMapCoord(POI.x, POI.y))
{
- sLog->outErrorDb("Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y);
+ sLog->outError(LOG_FILTER_SQL, "Table `points_of_interest` (Entry: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.x, POI.y);
continue;
}
@@ -6963,8 +6945,7 @@ void ObjectMgr::LoadPointsOfInterest()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestPOI()
@@ -6980,8 +6961,8 @@ void ObjectMgr::LoadQuestPOI()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty.");
+
return;
}
@@ -7035,8 +7016,7 @@ void ObjectMgr::LoadQuestPOI()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNPCSpellClickSpells()
@@ -7049,8 +7029,8 @@ void ObjectMgr::LoadNPCSpellClickSpells()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
+
return;
}
@@ -7064,7 +7044,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry);
if (!cInfo)
{
- sLog->outErrorDb("Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
continue;
}
@@ -7072,13 +7052,13 @@ void ObjectMgr::LoadNPCSpellClickSpells()
SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellinfo)
{
- sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
+ sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
continue;
}
uint8 userType = fields[3].GetUInt16();
if (userType >= SPELL_CLICK_USER_MAX)
- sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
+ sLog->outError(LOG_FILTER_SQL, "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
uint8 castFlags = fields[2].GetUInt8();
SpellClickInfo info;
@@ -7098,13 +7078,12 @@ void ObjectMgr::LoadNPCSpellClickSpells()
{
if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end())
{
- sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry);
+ sLog->outError(LOG_FILTER_SQL, "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry);
const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK;
}
}
- sLog->outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::DeleteCreatureData(uint32 guid)
@@ -7141,7 +7120,7 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_
cell_guids.corpses.erase(player_guid);
}
-void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go)
+void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go)
{
uint32 oldMSTime = getMSTime();
@@ -7153,8 +7132,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
return;
}
@@ -7170,7 +7148,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
if (_questTemplates.find(quest) == _questTemplates.end())
{
- sLog->outErrorDb("Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id);
continue;
}
@@ -7182,8 +7160,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameobjectQuestRelations()
@@ -7194,9 +7171,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
{
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
- sLog->outErrorDb("Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
- sLog->outErrorDb("Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_questrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7208,9 +7185,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
{
GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first);
if (!goInfo)
- sLog->outErrorDb("Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second);
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
- sLog->outErrorDb("Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `gameobject_involvedrelation` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7222,9 +7199,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
{
CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
- sLog->outErrorDb("Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_questrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
- sLog->outErrorDb("Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_questrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7236,9 +7213,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
{
CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first);
if (!cInfo)
- sLog->outErrorDb("Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_involvedrelation` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second);
else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER))
- sLog->outErrorDb("Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Table `creature_involvedrelation` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
@@ -7252,8 +7229,7 @@ void ObjectMgr::LoadReservedPlayersNames()
if (!result)
{
- sLog->outString(">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
return;
}
@@ -7268,7 +7244,7 @@ void ObjectMgr::LoadReservedPlayersNames()
std::wstring wstr;
if (!Utf8toWStr (name, wstr))
{
- sLog->outError("Table `reserved_name` have invalid name: %s", name.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Table `reserved_name` have invalid name: %s", name.c_str());
continue;
}
@@ -7279,8 +7255,7 @@ void ObjectMgr::LoadReservedPlayersNames()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::IsReservedName(const std::string& name) const
@@ -7384,6 +7359,11 @@ uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create)
if (!isValidString(wname, strictMask, false, create))
return CHAR_NAME_MIXED_LANGUAGES;
+ wstrToLower(wname);
+ for (size_t i = 2; i < wname.size(); ++i)
+ if (wname[i] == wname[i-1] && wname[i] == wname[i-2])
+ return CHAR_NAME_THREE_CONSECUTIVE;
+
return CHAR_NAME_SUCCESS;
}
@@ -7433,8 +7413,7 @@ void ObjectMgr::LoadGameObjectForQuests()
if (sObjectMgr->GetGameObjectTemplates()->empty())
{
- sLog->outString(">> Loaded 0 GameObjects for quests");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests");
return;
}
@@ -7482,8 +7461,7 @@ void ObjectMgr::LoadGameObjectForQuests()
}
}
- sLog->outString(">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
@@ -7497,7 +7475,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
{
if (end_value >= start_value)
{
- sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
return false;
}
@@ -7510,7 +7488,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
{
if (start_value >= end_value)
{
- sLog->outErrorDb("Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' attempt loaded with invalid range (%d - %d), strings not loaded.", table, min_value, max_value);
return false;
}
}
@@ -7529,10 +7507,10 @@ 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->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
- sLog->outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
+
return false;
}
@@ -7546,12 +7524,12 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (entry == 0)
{
- sLog->outErrorDb("Table `%s` contain reserved entry 0, ignored.", table);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` contain reserved entry 0, ignored.", table);
continue;
}
else if (entry < start_value || entry >= end_value)
{
- sLog->outErrorDb("Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` contain entry %i out of allowed range (%d - %d), ignored.", table, entry, min_value, max_value);
continue;
}
@@ -7559,7 +7537,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (!data.Content.empty())
{
- sLog->outErrorDb("Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry);
continue;
}
@@ -7571,11 +7549,10 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
} while (result->NextRow());
if (min_value == MIN_TRINITY_STRING_ID)
- sLog->outString(">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outString(">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
return true;
}
@@ -7590,9 +7567,9 @@ const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx)
}
if (entry > 0)
- sLog->outErrorDb("Entry %i not found in `trinity_string` table.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Entry %i not found in `trinity_string` table.", entry);
else
- sLog->outErrorDb("Trinity string entry %i not found in DB.", entry);
+ sLog->outError(LOG_FILTER_SQL, "Trinity string entry %i not found in DB.", entry);
return "<error>";
}
@@ -7606,8 +7583,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty.");
+
return;
}
@@ -7622,7 +7599,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
AreaTableEntry const* fArea = GetAreaEntryByAreaID(entry);
if (!fArea)
{
- sLog->outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "AreaId %u defined in `skill_fishing_base_level` does not exist", entry);
continue;
}
@@ -7631,8 +7608,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names)
@@ -7672,6 +7648,27 @@ SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id)
return SpellScriptsBounds(_spellScriptsStore.lower_bound(spell_id), _spellScriptsStore.upper_bound(spell_id));
}
+// this allows calculating base reputations to offline players, just by race and class
+int32 ObjectMgr::GetBaseReputationOff(FactionEntry const* factionEntry, uint8 race, uint8 playerClass)
+{
+ if (!factionEntry)
+ return 0;
+
+ uint32 raceMask = (1 << (race - 1));
+ uint32 classMask = (1 << (playerClass-1));
+
+ for (int i = 0; i < 4; i++)
+ {
+ if ((!factionEntry->BaseRepClassMask[i] ||
+ factionEntry->BaseRepClassMask[i] & classMask) &&
+ (!factionEntry->BaseRepRaceMask[i] ||
+ factionEntry->BaseRepRaceMask[i] & raceMask))
+ return factionEntry->BaseRepValue[i];
+ }
+
+ return 0;
+}
+
SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
{
switch (pSkill->categoryId)
@@ -7715,8 +7712,8 @@ void ObjectMgr::LoadGameTele()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!");
+
return;
}
@@ -7739,13 +7736,13 @@ void ObjectMgr::LoadGameTele()
if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation))
{
- sLog->outErrorDb("Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str());
continue;
}
if (!Utf8toWStr(gt.name, gt.wnameLow))
{
- sLog->outErrorDb("Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id);
+ sLog->outError(LOG_FILTER_SQL, "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id);
continue;
}
@@ -7757,8 +7754,7 @@ void ObjectMgr::LoadGameTele()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@@ -7856,8 +7852,8 @@ void ObjectMgr::LoadMailLevelRewards()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty.");
+
return;
}
@@ -7874,25 +7870,25 @@ void ObjectMgr::LoadMailLevelRewards()
if (level > MAX_LEVEL)
{
- sLog->outErrorDb("Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL);
continue;
}
if (!(raceMask & RACEMASK_ALL_PLAYABLE))
{
- sLog->outErrorDb("Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level);
continue;
}
if (!sMailTemplateStore.LookupEntry(mailTemplateId))
{
- sLog->outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level);
continue;
}
if (!GetCreatureTemplate(senderEntry))
{
- sLog->outErrorDb("Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
+ sLog->outError(LOG_FILTER_SQL, "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level);
continue;
}
@@ -7902,8 +7898,7 @@ void ObjectMgr::LoadMailLevelRewards()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
@@ -7914,32 +7909,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry);
return;
}
if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry);
return;
}
SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell);
if (!spellinfo)
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell);
return;
}
if (!SpellMgr::IsSpellValid(spellinfo))
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell);
return;
}
if (GetTalentSpellCost(spell))
{
- sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell);
return;
}
@@ -7967,7 +7962,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY
&& spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER)
{
- sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
continue;
}
@@ -7991,16 +7986,14 @@ void ObjectMgr::LoadTrainerSpell()
// For reload case
_cacheTrainerSpellStore.clear();
- std::set<uint32> skip_trainers;
-
QueryResult result = WorldDatabase.Query("SELECT b.entry, a.spell, a.spellcost, a.reqskill, a.reqskillvalue, a.reqlevel FROM npc_trainer AS a "
"INNER JOIN npc_trainer AS b ON a.entry = -(b.spell) "
"UNION SELECT * FROM npc_trainer WHERE spell > 0");
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 Trainers. DB table `npc_trainer` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!");
+
return;
}
@@ -8023,8 +8016,7 @@ void ObjectMgr::LoadTrainerSpell()
}
while (result->NextRow());
- sLog->outString(">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors)
@@ -8080,8 +8072,8 @@ void ObjectMgr::LoadVendors()
QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC");
if (!result)
{
- sLog->outString();
- sLog->outErrorDb(">> Loaded 0 Vendors. DB table `npc_vendor` is empty!");
+
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!");
return;
}
@@ -8114,8 +8106,7 @@ void ObjectMgr::LoadVendors()
}
while (result->NextRow());
- sLog->outString(">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenu()
@@ -8128,8 +8119,8 @@ void ObjectMgr::LoadGossipMenu()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!");
+
return;
}
@@ -8146,7 +8137,7 @@ void ObjectMgr::LoadGossipMenu()
if (!GetGossipText(gMenu.text_id))
{
- sLog->outErrorDb("Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id);
continue;
}
@@ -8156,8 +8147,7 @@ void ObjectMgr::LoadGossipMenu()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItems()
@@ -8175,8 +8165,8 @@ void ObjectMgr::LoadGossipMenuItems()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!");
+
return;
}
@@ -8202,16 +8192,16 @@ void ObjectMgr::LoadGossipMenuItems()
if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon);
gMenuItem.OptionIcon = GOSSIP_ICON_CHAT;
}
if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX)
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType);
if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId))
{
- sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
+ sLog->outError(LOG_FILTER_SQL, "Table gossip_menu_option for menu %u, id %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId);
gMenuItem.ActionPoiId = 0;
}
@@ -8220,8 +8210,7 @@ void ObjectMgr::LoadGossipMenuItems()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/)
@@ -8271,9 +8260,9 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (!cInfo)
{
if (player)
- ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
+ ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
return false;
}
@@ -8282,9 +8271,9 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
{
if (player)
- ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
+ ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
if (skip_vendors)
skip_vendors->insert(vendor_entry);
@@ -8295,35 +8284,35 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (!sObjectMgr->GetItemTemplate(item_id))
{
if (player)
- ChatHandler(player).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
return false;
}
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
{
if (player)
- ChatHandler(player).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
return false;
}
if (maxcount > 0 && incrtime == 0)
{
if (player)
- ChatHandler(player).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
+ ChatHandler(player->GetSession()).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
return false;
}
else if (maxcount == 0 && incrtime > 0)
{
if (player)
- ChatHandler(player).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
+ ChatHandler(player->GetSession()).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
else
- sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
return false;
}
@@ -8334,18 +8323,18 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
if (vItems->FindItemCostPair(item_id, ExtendedCost))
{
if (player)
- ChatHandler(player).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
else
- sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
return false;
}
if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
{
if (player)
- ChatHandler(player).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
+ ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
else
- sLog->outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
+ sLog->outError(LOG_FILTER_SQL, "Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
return false;
}
@@ -8384,8 +8373,8 @@ void ObjectMgr::LoadScriptNames()
if (!result)
{
- sLog->outString();
- sLog->outErrorDb(">> Loaded empty set of Script Names!");
+
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!");
return;
}
@@ -8399,8 +8388,7 @@ void ObjectMgr::LoadScriptNames()
while (result->NextRow());
std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end());
- sLog->outString(">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetScriptId(const char *name)
@@ -8432,7 +8420,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
case SCRIPT_COMMAND_TALK:
{
if (!GetTrinityStringLocale (itrM->second.Talk.TextID))
- sLog->outErrorDb("Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first);
+ sLog->outError(LOG_FILTER_SQL, "Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first);
if (ids.find(itrM->second.Talk.TextID) != ids.end())
ids.erase(itrM->second.Talk.TextID);
@@ -8458,7 +8446,7 @@ void ObjectMgr::LoadDbScriptStrings()
CheckScripts(ScriptsType(type), ids);
for (std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr)
- sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr);
+ sLog->outError(LOG_FILTER_SQL, "Table `db_script_string` has unused string id %u", *itr);
}
bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
@@ -8467,7 +8455,7 @@ bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
// start/end reversed for negative values
if (start_value > MAX_DB_SCRIPT_STRING_ID || end_value >= start_value)
{
- sLog->outErrorDb("Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' load attempted with range (%d - %d) reserved by Trinity, strings not loaded.", table, start_value, end_value+1);
return false;
}
@@ -8503,8 +8491,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
if (!result)
{
- sLog->outString(">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
return;
}
@@ -8525,13 +8512,13 @@ void ObjectMgr::LoadCreatureClassLevelStats()
stats.BaseArmor = fields[6].GetInt16();
if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0)
- sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class);
+ sLog->outError(LOG_FILTER_SQL, "Creature base stats for level %u has invalid class %u", Level, Class);
for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i)
{
if (stats.BaseHealth[i] < 1)
{
- sLog->outErrorDb("Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i);
+ sLog->outError(LOG_FILTER_SQL, "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i);
stats.BaseHealth[i] = 1;
}
}
@@ -8548,12 +8535,11 @@ void ObjectMgr::LoadCreatureClassLevelStats()
for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl)
{
if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end())
- sLog->outErrorDb("Missing base stats for creature class %u level %u", itr->second.unit_class, lvl);
+ sLog->outError(LOG_FILTER_SQL, "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl);
}
}
- sLog->outString(">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeAchievements()
@@ -8564,8 +8550,8 @@ void ObjectMgr::LoadFactionChangeAchievements()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty.");
+
return;
}
@@ -8578,10 +8564,10 @@ void ObjectMgr::LoadFactionChangeAchievements()
uint32 alliance = fields[0].GetUInt32();
uint32 horde = fields[1].GetUInt32();
- if (!sAchievementStore.LookupEntry(alliance))
- sLog->outErrorDb("Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance);
- else if (!sAchievementStore.LookupEntry(horde))
- sLog->outErrorDb("Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde);
+ if (!sAchievementMgr->GetAchievement(alliance))
+ sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance);
+ else if (!sAchievementMgr->GetAchievement(horde))
+ sLog->outError(LOG_FILTER_SQL, "Achievement %u referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde);
else
FactionChange_Achievements[alliance] = horde;
@@ -8589,8 +8575,7 @@ void ObjectMgr::LoadFactionChangeAchievements()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeItems()
@@ -8601,8 +8586,7 @@ void ObjectMgr::LoadFactionChangeItems()
if (!result)
{
- sLog->outString(">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
return;
}
@@ -8616,9 +8600,9 @@ void ObjectMgr::LoadFactionChangeItems()
uint32 horde = fields[1].GetUInt32();
if (!GetItemTemplate(alliance))
- sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", alliance);
else if (!GetItemTemplate(horde))
- sLog->outErrorDb("Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Item %u referenced in `player_factionchange_items` does not exist, pair skipped!", horde);
else
FactionChange_Items[alliance] = horde;
@@ -8626,8 +8610,7 @@ void ObjectMgr::LoadFactionChangeItems()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeSpells()
@@ -8638,8 +8621,8 @@ void ObjectMgr::LoadFactionChangeSpells()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty.");
+
return;
}
@@ -8653,9 +8636,9 @@ void ObjectMgr::LoadFactionChangeSpells()
uint32 horde = fields[1].GetUInt32();
if (!sSpellMgr->GetSpellInfo(alliance))
- sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
else if (!sSpellMgr->GetSpellInfo(horde))
- sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
else
FactionChange_Spells[alliance] = horde;
@@ -8663,8 +8646,7 @@ void ObjectMgr::LoadFactionChangeSpells()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeReputations()
@@ -8675,8 +8657,7 @@ void ObjectMgr::LoadFactionChangeReputations()
if (!result)
{
- sLog->outString(">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
return;
}
@@ -8690,9 +8671,9 @@ void ObjectMgr::LoadFactionChangeReputations()
uint32 horde = fields[1].GetUInt32();
if (!sFactionStore.LookupEntry(alliance))
- sLog->outErrorDb("Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance);
+ sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance);
else if (!sFactionStore.LookupEntry(horde))
- sLog->outErrorDb("Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde);
+ sLog->outError(LOG_FILTER_SQL, "Reputation %u referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde);
else
FactionChange_Reputation[alliance] = horde;
@@ -8700,8 +8681,42 @@ void ObjectMgr::LoadFactionChangeReputations()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
+void ObjectMgr::LoadFactionChangeTitles()
+{
+ uint32 oldMSTime = getMSTime();
+
+ QueryResult result = WorldDatabase.Query("SELECT alliance_id, horde_id FROM player_factionchange_titles");
+
+ if (!result)
+ {
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change title pairs. DB table `player_factionchange_title` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint32 alliance = fields[0].GetUInt32();
+ uint32 horde = fields[1].GetUInt32();
+
+ if (!sCharTitlesStore.LookupEntry(alliance))
+ sLog->outError(LOG_FILTER_SQL, "Title %u referenced in `player_factionchange_title` does not exist, pair skipped!", alliance);
+ else if (!sCharTitlesStore.LookupEntry(horde))
+ sLog->outError(LOG_FILTER_SQL, "Title %u referenced in `player_factionchange_title` does not exist, pair skipped!", horde);
+ else
+ FactionChange_Titles[alliance] = horde;
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
@@ -8738,3 +8753,15 @@ VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) con
return &itr->second;
return NULL;
}
+
+PlayerInfo const* ObjectMgr::GetPlayerInfo(uint32 race, uint32 class_) const
+{
+ if (race >= MAX_RACES)
+ return NULL;
+ if (class_ >= MAX_CLASSES)
+ return NULL;
+ PlayerInfo const* info = _playerInfo[race][class_];
+ if (!info)
+ return NULL;
+ return info;
+}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index fcc0315055e..e1df03b97b0 100755..100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -23,7 +23,6 @@
#include "Object.h"
#include "Bag.h"
#include "Creature.h"
-#include "Player.h"
#include "DynamicObject.h"
#include "GameObject.h"
#include "Corpse.h"
@@ -44,6 +43,11 @@
#include <functional>
class Item;
+struct AccessRequirement;
+struct PlayerClassInfo;
+struct PlayerClassLevelInfo;
+struct PlayerInfo;
+struct PlayerLevelInfo;
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
#if defined(__GNUC__)
@@ -65,6 +69,41 @@ struct PageText
#pragma pack(pop)
#endif
+// DB scripting commands
+enum ScriptCommands
+{
+ SCRIPT_COMMAND_TALK = 0, // source/target = Creature, target = any, datalong = talk type (0=say, 1=whisper, 2=yell, 3=emote text, 4=boss emote text), datalong2 & 1 = player talk (instead of creature), dataint = string_id
+ SCRIPT_COMMAND_EMOTE = 1, // source/target = Creature, datalong = emote id, datalong2 = 0: set emote state; > 0: play emote state
+ SCRIPT_COMMAND_FIELD_SET = 2, // source/target = Creature, datalong = field id, datalog2 = value
+ SCRIPT_COMMAND_MOVE_TO = 3, // source/target = Creature, datalong2 = time to reach, x/y/z = destination
+ SCRIPT_COMMAND_FLAG_SET = 4, // source/target = Creature, datalong = field id, datalog2 = bitmask
+ SCRIPT_COMMAND_FLAG_REMOVE = 5, // source/target = Creature, datalong = field id, datalog2 = bitmask
+ SCRIPT_COMMAND_TELEPORT_TO = 6, // source/target = Creature/Player (see datalong2), datalong = map_id, datalong2 = 0: Player; 1: Creature, x/y/z = destination, o = orientation
+ SCRIPT_COMMAND_QUEST_EXPLORED = 7, // target/source = Player, target/source = GO/Creature, datalong = quest id, datalong2 = distance or 0
+ SCRIPT_COMMAND_KILL_CREDIT = 8, // target/source = Player, datalong = creature entry, datalong2 = 0: personal credit, 1: group credit
+ SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = WorldObject (summoner), datalong = GO guid, datalong2 = despawn delay
+ SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = WorldObject (summoner), datalong = creature entry, datalong2 = despawn delay, x/y/z = summon position, o = orientation
+ SCRIPT_COMMAND_OPEN_DOOR = 11, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15)
+ SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15)
+ SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = Unit, target = GO
+ SCRIPT_COMMAND_REMOVE_AURA = 14, // source (datalong2 != 0) or target (datalong2 == 0) = Unit, datalong = spell id
+ SCRIPT_COMMAND_CAST_SPELL = 15, // source and/or target = Unit, datalong2 = cast direction (0: s->t 1: s->s 2: t->t 3: t->s 4: s->creature with dataint entry), dataint & 1 = triggered flag
+ SCRIPT_COMMAND_PLAY_SOUND = 16, // source = WorldObject, target = none/Player, datalong = sound id, datalong2 (bitmask: 0/1=anyone/player, 0/2=without/with distance dependency, so 1|2 = 3 is target with distance dependency)
+ SCRIPT_COMMAND_CREATE_ITEM = 17, // target/source = Player, datalong = item entry, datalong2 = amount
+ SCRIPT_COMMAND_DESPAWN_SELF = 18, // target/source = Creature, datalong = despawn delay
+
+ SCRIPT_COMMAND_LOAD_PATH = 20, // source = Unit, datalong = path id, datalong2 = is repeatable
+ SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT = 21, // source = WorldObject (if present used as a search center), datalong = script id, datalong2 = unit lowguid, dataint = script table to use (see ScriptsType)
+ SCRIPT_COMMAND_KILL = 22, // source/target = Creature, dataint = remove corpse attribute
+
+ // TrinityCore only
+ SCRIPT_COMMAND_ORIENTATION = 30, // source = Unit, target (datalong > 0) = Unit, datalong = > 0 turn source to face target, o = orientation
+ SCRIPT_COMMAND_EQUIP = 31, // soucre = Creature, datalong = equipment id
+ SCRIPT_COMMAND_MODEL = 32, // source = Creature, datalong = model id
+ SCRIPT_COMMAND_CLOSE_GOSSIP = 33, // source = Player
+ SCRIPT_COMMAND_PLAYMOVIE = 34 // source = Player, datalong = movie id
+};
+
// Benchmarked: Faster than UNORDERED_MAP (insert/find)
typedef std::map<uint32, PageText> PageTextContainer;
@@ -89,7 +128,6 @@ enum ScriptsType
SCRIPTS_FIRST = 1,
SCRIPTS_QUEST_END = SCRIPTS_FIRST,
- SCRIPTS_QUEST_START,
SCRIPTS_SPELL,
SCRIPTS_GAMEOBJECT,
SCRIPTS_EVENT,
@@ -128,7 +166,7 @@ enum eScriptFlags
SF_PLAYSOUND_DISTANCE_SOUND = 0x2,
// Orientation flags
- SF_ORIENTATION_FACE_TARGET = 0x1,
+ SF_ORIENTATION_FACE_TARGET = 0x1
};
struct ScriptInfo
@@ -324,7 +362,6 @@ typedef std::map<uint32, ScriptMap > ScriptMapMap;
typedef std::multimap<uint32, uint32> SpellScriptsContainer;
typedef std::pair<SpellScriptsContainer::iterator, SpellScriptsContainer::iterator> SpellScriptsBounds;
extern ScriptMapMap sQuestEndScripts;
-extern ScriptMapMap sQuestStartScripts;
extern ScriptMapMap sSpellScripts;
extern ScriptMapMap sGameObjectScripts;
extern ScriptMapMap sEventScripts;
@@ -426,9 +463,12 @@ typedef UNORDERED_MAP<uint8, MailLevelRewardList> MailLevelRewardContainer;
// We assume the rate is in general the same for all three types below, but chose to keep three for scalability and customization
struct RepRewardRate
{
- float quest_rate; // We allow rate = 0.0 in database. For this case, it means that
- float creature_rate; // no reputation are given at all for this faction/rate type.
- float spell_rate;
+ float questRate; // We allow rate = 0.0 in database. For this case, it means that
+ float questDailyRate;
+ float questWeeklyRate;
+ float questMonthlyRate;
+ float creatureRate; // no reputation are given at all for this faction/rate type.
+ float spellRate;
};
struct ReputationOnKillEntry
@@ -536,7 +576,7 @@ enum SkillRangeType
SKILL_RANGE_LEVEL, // 1..max skill for level
SKILL_RANGE_MONO, // 1..1, grey monolite bar
SKILL_RANGE_RANK, // 1..skill for known rank
- SKILL_RANGE_NONE, // 0..0 always
+ SKILL_RANGE_NONE // 0..0 always
};
SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial);
@@ -561,7 +601,7 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang);
enum EncounterCreditType
{
ENCOUNTER_CREDIT_KILL_CREATURE = 0,
- ENCOUNTER_CREDIT_CAST_SPELL = 1,
+ ENCOUNTER_CREDIT_CAST_SPELL = 1
};
struct DungeonEncounter
@@ -598,7 +638,7 @@ class ObjectMgr
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptContainer;
- typedef UNORDERED_MAP<uint32, AccessRequirement> AccessRequirementContainer;
+ typedef UNORDERED_MAP<uint32, AccessRequirement*> AccessRequirementContainer;
typedef UNORDERED_MAP<uint32, RepRewardRate > RepRewardRateContainer;
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillContainer;
@@ -647,29 +687,19 @@ class ObjectMgr
{
if (class_ >= MAX_CLASSES)
return NULL;
- return &_playerClassInfo[class_];
+ return _playerClassInfo[class_];
}
void GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassLevelInfo* info) const;
- PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
- {
- if (race >= MAX_RACES)
- return NULL;
- if (class_ >= MAX_CLASSES)
- return NULL;
- PlayerInfo const* info = &_playerInfo[race][class_];
- if (info->displayId_m == 0 || info->displayId_f == 0)
- return NULL;
- return info;
- }
+ PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const;
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const;
- uint64 GetPlayerGUIDByName(std::string name) const;
+ uint64 GetPlayerGUIDByName(std::string const& name) const;
bool GetPlayerNameByGUID(uint64 guid, std::string &name) const;
uint32 GetPlayerTeamByGUID(uint64 guid) const;
uint32 GetPlayerAccountIdByGUID(uint64 guid) const;
- uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const;
+ uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const;
uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team);
void GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost);
@@ -722,7 +752,7 @@ class ObjectMgr
{
AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR32(mapid, difficulty));
if (itr != _accessRequirementStore.end())
- return &itr->second;
+ return itr->second;
return NULL;
}
@@ -749,6 +779,8 @@ class ObjectMgr
return NULL;
}
+ int32 GetBaseReputationOff(FactionEntry const* factionEntry, uint8 race, uint8 playerClass);
+
RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const
{
RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId);
@@ -787,13 +819,13 @@ class ObjectMgr
void LoadQuests();
void LoadQuestRelations()
{
- sLog->outString("Loading GO Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data...");
LoadGameobjectQuestRelations();
- sLog->outString("Loading GO End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data...");
LoadGameobjectInvolvedRelations();
- sLog->outString("Loading Creature Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data...");
LoadCreatureQuestRelations();
- sLog->outString("Loading Creature End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data...");
LoadCreatureInvolvedRelations();
}
void LoadGameobjectQuestRelations();
@@ -833,7 +865,6 @@ class ObjectMgr
void LoadGameObjectScripts();
void LoadQuestEndScripts();
- void LoadQuestStartScripts();
void LoadEventScripts();
void LoadSpellScripts();
void LoadWaypointScripts();
@@ -1055,12 +1086,12 @@ class ObjectMgr
// reserved names
void LoadReservedPlayersNames();
- bool IsReservedName(const std::string& name) const;
+ bool IsReservedName(std::string const& name) const;
// name with valid structure and symbols
- static uint8 CheckPlayerName(const std::string& name, bool create = false);
- static PetNameInvalidReason CheckPetName(const std::string& name);
- static bool IsValidCharterName(const std::string& name);
+ static uint8 CheckPlayerName(std::string const& name, bool create = false);
+ static PetNameInvalidReason CheckPetName(std::string const& name);
+ static bool IsValidCharterName(std::string const& name);
static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names);
@@ -1070,10 +1101,10 @@ class ObjectMgr
if (itr == _gameTeleStore.end()) return NULL;
return &itr->second;
}
- GameTele const* GetGameTele(const std::string& name) const;
+ GameTele const* GetGameTele(std::string const& name) const;
GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
bool AddGameTele(GameTele& data);
- bool DeleteGameTele(const std::string& name);
+ bool DeleteGameTele(std::string const& name);
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
{
@@ -1128,7 +1159,7 @@ class ObjectMgr
// for wintergrasp only
GraveYardContainer GraveYardStore;
- static void AddLocaleString(const std::string& s, LocaleConstant locale, StringVector& data);
+ static void AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data);
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
{
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
@@ -1139,11 +1170,13 @@ class ObjectMgr
CharacterConversionMap FactionChange_Items;
CharacterConversionMap FactionChange_Spells;
CharacterConversionMap FactionChange_Reputation;
+ CharacterConversionMap FactionChange_Titles;
void LoadFactionChangeAchievements();
void LoadFactionChangeItems();
void LoadFactionChangeSpells();
void LoadFactionChangeReputations();
+ void LoadFactionChangeTitles();
private:
// first free id for selected id type
@@ -1218,7 +1251,7 @@ class ObjectMgr
private:
void LoadScripts(ScriptsType type);
void CheckScripts(ScriptsType type, std::set<int32>& ids);
- void LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go);
+ void LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go);
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count);
MailLevelRewardContainer _mailLevelRewardStore;
@@ -1229,11 +1262,11 @@ class ObjectMgr
// PetLevelInfoContainer[creature_id][level]
PetLevelInfoContainer _petInfoStore; // [creature_id][level]
- PlayerClassInfo _playerClassInfo[MAX_CLASSES];
+ PlayerClassInfo* _playerClassInfo[MAX_CLASSES];
void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo* plinfo) const;
- PlayerInfo _playerInfo[MAX_RACES][MAX_CLASSES];
+ PlayerInfo* _playerInfo[MAX_RACES][MAX_CLASSES];
typedef std::vector<uint32> PlayerXPperLevel; // [level]
PlayerXPperLevel _playerXPperLevel;
@@ -1285,7 +1318,7 @@ class ObjectMgr
CREATURE_TO_CREATURE,
CREATURE_TO_GO, // Creature is dependant on GO
GO_TO_GO,
- GO_TO_CREATURE, // GO is dependant on creature
+ GO_TO_CREATURE // GO is dependant on creature
};
};
diff --git a/src/server/game/Grids/Cells/Cell.h b/src/server/game/Grids/Cells/Cell.h
index 67b862845b9..67b862845b9 100755..100644
--- a/src/server/game/Grids/Cells/Cell.h
+++ b/src/server/game/Grids/Cells/Cell.h
diff --git a/src/server/game/Grids/Grid.h b/src/server/game/Grids/Grid.h
index d9350e9e897..d9350e9e897 100755..100644
--- a/src/server/game/Grids/Grid.h
+++ b/src/server/game/Grids/Grid.h
diff --git a/src/server/game/Grids/GridLoader.h b/src/server/game/Grids/GridLoader.h
index 85393872eb9..85393872eb9 100755..100644
--- a/src/server/game/Grids/GridLoader.h
+++ b/src/server/game/Grids/GridLoader.h
diff --git a/src/server/game/Grids/GridRefManager.h b/src/server/game/Grids/GridRefManager.h
index 66b6313c997..66b6313c997 100755..100644
--- a/src/server/game/Grids/GridRefManager.h
+++ b/src/server/game/Grids/GridRefManager.h
diff --git a/src/server/game/Grids/GridReference.h b/src/server/game/Grids/GridReference.h
index 107bddf04eb..107bddf04eb 100755..100644
--- a/src/server/game/Grids/GridReference.h
+++ b/src/server/game/Grids/GridReference.h
diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp
index c2f66bc3e8a..c2f66bc3e8a 100755..100644
--- a/src/server/game/Grids/GridStates.cpp
+++ b/src/server/game/Grids/GridStates.cpp
diff --git a/src/server/game/Grids/GridStates.h b/src/server/game/Grids/GridStates.h
index cf649f8d896..ad888b26dd3 100755..100644
--- a/src/server/game/Grids/GridStates.h
+++ b/src/server/game/Grids/GridStates.h
@@ -32,7 +32,7 @@ class GridState
{
if (i_Magic != MAGIC_TESTVAL)
{
- sLog->outError("!!! GridState: Magic value gone !!!");
+ sLog->outError(LOG_FILTER_GENERAL, "!!! GridState: Magic value gone !!!");
return false;
}
return true;
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h
index b5701a7a590..0ef885703be 100755..100644
--- a/src/server/game/Grids/NGrid.h
+++ b/src/server/game/Grids/NGrid.h
@@ -79,9 +79,13 @@ class NGrid
public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> GridType;
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true)
- : i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false)
+ : i_gridId(id)
+ , i_GridInfo(GridInfo(expiry, unload))
+ , i_x(x)
+ , i_y(y)
+ , i_cellstate(GRID_STATE_INVALID)
+ , i_GridObjectDataLoaded(false)
{
- i_GridInfo = GridInfo(expiry, unload);
}
GridType& GetGridType(const uint32 x, const uint32 y)
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index a02c18ca008..1cd442e48f9 100755..100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -81,18 +81,22 @@ void VisibleChangesNotifier::Visit(PlayerMapType &m)
iter->getSource()->UpdateVisibilityOf(&i_object);
- if (!iter->getSource()->GetSharedVisionList().empty())
+ if (iter->getSource()->HasSharedVision())
+ {
for (SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
i != iter->getSource()->GetSharedVisionList().end(); ++i)
+ {
if ((*i)->m_seer == iter->getSource())
(*i)->UpdateVisibilityOf(&i_object);
+ }
+ }
}
}
void VisibleChangesNotifier::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
- if (!iter->getSource()->GetSharedVisionList().empty())
+ if (iter->getSource()->HasSharedVision())
for (SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin();
i != iter->getSource()->GetSharedVisionList().end(); ++i)
if ((*i)->m_seer == iter->getSource())
@@ -154,7 +158,7 @@ void PlayerRelocationNotifier::Visit(CreatureMapType &m)
void CreatureRelocationNotifier::Visit(PlayerMapType &m)
{
- for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
+ for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Player* player = iter->getSource();
@@ -170,7 +174,7 @@ void CreatureRelocationNotifier::Visit(CreatureMapType &m)
if (!i_creature.isAlive())
return;
- for (CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
+ for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Creature* c = iter->getSource();
CreatureUnitRelocationWorker(&i_creature, c);
@@ -249,7 +253,7 @@ void MessageDistDeliverer::Visit(PlayerMapType &m)
continue;
// Send packet to all who are sharing the player's vision
- if (!target->GetSharedVisionList().empty())
+ if (target->HasSharedVision())
{
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
for (; i != target->GetSharedVisionList().end(); ++i)
@@ -274,7 +278,7 @@ void MessageDistDeliverer::Visit(CreatureMapType &m)
continue;
// Send packet to all who are sharing the creature's vision
- if (!target->GetSharedVisionList().empty())
+ if (target->HasSharedVision())
{
SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
for (; i != target->GetSharedVisionList().end(); ++i)
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 072db578220..24d2a45c4f2 100755..100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -31,6 +31,7 @@
#include "Unit.h"
#include "CreatureAI.h"
#include "Spell.h"
+#include "WorldSession.h"
class Player;
//class Map;
@@ -694,6 +695,30 @@ namespace Trinity
NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck const&);
};
+ // Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO with a certain type)
+ class NearestGameObjectTypeInObjectRangeCheck
+ {
+ public:
+ NearestGameObjectTypeInObjectRangeCheck(WorldObject const& obj, GameobjectTypes type, float range) : i_obj(obj), i_type(type), i_range(range) {}
+ bool operator()(GameObject* go)
+ {
+ if (go->GetGoType() == i_type && i_obj.IsWithinDistInMap(go, i_range))
+ {
+ i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
+ return true;
+ }
+ return false;
+ }
+ float GetLastRange() const { return i_range; }
+ private:
+ WorldObject const& i_obj;
+ GameobjectTypes i_type;
+ float i_range;
+
+ // prevent clone this object
+ NearestGameObjectTypeInObjectRangeCheck(NearestGameObjectTypeInObjectRangeCheck const&);
+ };
+
class GameObjectWithDbGUIDCheck
{
public:
@@ -1062,6 +1087,35 @@ namespace Trinity
NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const&);
};
+ class NearestHostileUnitInAggroRangeCheck
+ {
+ public:
+ explicit NearestHostileUnitInAggroRangeCheck(Creature const* creature, bool useLOS = false) : _me(creature), _useLOS(useLOS)
+ {
+ }
+ bool operator()(Unit* u)
+ {
+ if (!u->IsHostileTo(_me))
+ return false;
+
+ if (!u->IsWithinDistInMap(_me, _me->GetAggroRange(u)))
+ return false;
+
+ if (!_me->IsValidAttackTarget(u))
+ return false;
+
+ if (_useLOS && !u->IsWithinLOSInMap(_me))
+ return false;
+
+ return true;
+ }
+
+ private:
+ Creature const* _me;
+ bool _useLOS;
+ NearestHostileUnitInAggroRangeCheck(NearestHostileUnitInAggroRangeCheck const&);
+ };
+
class AnyAssistCreatureInRangeCheck
{
public:
diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
index e3cda4dd76d..2d60678d4ff 100755..100644
--- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
@@ -26,6 +26,7 @@
#include "UpdateData.h"
#include "CreatureAI.h"
#include "SpellAuras.h"
+#include "Opcodes.h"
template<class T>
inline void Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 519a53ad184..3b2d59dd998 100755..100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -94,7 +94,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
{
T* obj = new T;
uint32 guid = *i_guid;
- //sLog->outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
+ //sLog->outInfo(LOG_FILTER_GENERAL, "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid);
if (!obj->LoadFromDB(guid, map))
{
delete obj;
diff --git a/src/server/game/Grids/ObjectGridLoader.h b/src/server/game/Grids/ObjectGridLoader.h
index f768bd0826b..f768bd0826b 100755..100644
--- a/src/server/game/Grids/ObjectGridLoader.h
+++ b/src/server/game/Grids/ObjectGridLoader.h
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index f9d609150ef..13c656a4aa3 100755..100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -34,6 +34,7 @@
#include "MapInstanced.h"
#include "Util.h"
#include "LFGMgr.h"
+#include "UpdateFieldFlags.h"
Roll::Roll(uint64 _guid, LootItem const& li) : itemGUID(_guid), itemid(li.itemid),
itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
@@ -58,7 +59,7 @@ Loot* Roll::getLoot()
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
-m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
+m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -72,7 +73,7 @@ Group::~Group()
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Group::~Group: battleground group being deleted.");
if (m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
else if (m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
- else sLog->outError("Group::~Group: battleground group is not linked to the correct battleground.");
+ else sLog->outError(LOG_FILTER_GENERAL, "Group::~Group: battleground group is not linked to the correct battleground.");
}
Rolls::iterator itr;
while (!RollId.empty())
@@ -103,19 +104,22 @@ bool Group::Create(Player* leader)
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
- m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
+ if (isBGGroup() || isBFGroup())
+ m_groupType = GROUPTYPE_BGRAID;
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
- m_lootMethod = GROUP_LOOT;
+ if (!isLFGGroup())
+ m_lootMethod = GROUP_LOOT;
+
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_looterGuid = leaderGuid;
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -218,20 +222,14 @@ void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup,
SubGroupCounterIncrease(subgroup);
- if (isLFGGroup())
- {
- LfgDungeonSet Dungeons;
- Dungeons.insert(sLFGMgr->GetDungeon(GetGUID()));
- sLFGMgr->SetSelectedDungeons(member.guid, Dungeons);
- sLFGMgr->SetState(member.guid, sLFGMgr->GetState(GetGUID()));
- }
+ sLFGMgr->SetupGroupMember(member.guid, GetGUID());
}
void Group::ConvertToLFG()
{
m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1);
m_lootMethod = NEED_BEFORE_GREED;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -250,7 +248,7 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -273,7 +271,7 @@ bool Group::AddInvite(Player* player)
if (!player || player->GetGroupInvite())
return false;
Group* group = player->GetGroup();
- if (group && group->isBGGroup())
+ if (group && (group->isBGGroup() || group->isBFGroup()))
group = player->GetOriginalGroup();
if (group)
return false;
@@ -370,10 +368,13 @@ bool Group::AddMember(Player* player)
if (player)
{
player->SetGroupInvite(NULL);
- if (player->GetGroup() && isBGGroup()) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
- player->SetBattlegroundRaid(this, subGroup);
- else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
- player->SetOriginalGroup(this, subGroup);
+ if (player->GetGroup())
+ {
+ if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
+ player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
+ else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
+ player->SetOriginalGroup(this, subGroup);
+ }
else //if player is not in group, then call set group
player->SetGroup(this, subGroup);
@@ -390,7 +391,7 @@ bool Group::AddMember(Player* player)
}
// insert into the table if we're not a battleground group
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER);
@@ -409,7 +410,7 @@ bool Group::AddMember(Player* player)
if (player)
{
- if (!IsLeader(player->GetGUID()) && !isBGGroup())
+ if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
@@ -437,6 +438,51 @@ bool Group::AddMember(Player* player)
if (isRaidGroup())
player->UpdateForQuestWorldObjects();
+ {
+ // Broadcast new player group member fields to rest of the group
+ player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+
+ UpdateData groupData;
+ WorldPacket groupDataPacket;
+
+ // Broadcast group members' fields to player
+ for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ if (itr->getSource() == player)
+ continue;
+
+ if (Player* member = itr->getSource())
+ {
+ if (player->HaveAtClient(member))
+ {
+ member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ member->BuildValuesUpdateBlockForPlayer(&groupData, player);
+ member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ }
+
+ if (member->HaveAtClient(player))
+ {
+ UpdateData newData;
+ WorldPacket newDataPacket;
+ player->BuildValuesUpdateBlockForPlayer(&newData, member);
+ if (newData.HasData())
+ {
+ newData.BuildPacket(&newDataPacket);
+ member->SendDirectMessage(&newDataPacket);
+ }
+ }
+ }
+ }
+
+ if (groupData.HasData())
+ {
+ groupData.BuildPacket(&groupDataPacket);
+ player->SendDirectMessage(&groupDataPacket);
+ }
+
+ player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ }
+
if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING);
}
@@ -454,15 +500,15 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
return m_memberSlots.size();
- // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
- if (GetMembersCount() > ((isBGGroup() || isLFGGroup()) ? 1u : 2u))
+ // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
+ if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (player)
{
// Battleground group handling
- if (isBGGroup())
- player->RemoveFromBattlegroundRaid();
+ if (isBGGroup() || isBFGroup())
+ player->RemoveFromBattlegroundOrBattlefieldRaid();
else
// Regular group
{
@@ -477,7 +523,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
WorldPacket data;
- if (method == GROUP_REMOVEMETHOD_KICK)
+ if (method == GROUP_REMOVEMETHOD_KICK || method == GROUP_REMOVEMETHOD_KICK_LFG)
{
data.Initialize(SMSG_GROUP_UNINVITE, 0);
player->GetSession()->SendPacket(&data);
@@ -493,13 +539,13 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
// Remove player from group in DB
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
-
- stmt->setUInt32(0, GUID_LOPART(guid));
-
- CharacterDatabase.Execute(stmt);
-
- DelinkMember(guid);
+ if (!isBGGroup() && !isBFGroup())
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
+ stmt->setUInt32(0, GUID_LOPART(guid));
+ CharacterDatabase.Execute(stmt);
+ DelinkMember(guid);
+ }
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player)
@@ -553,9 +599,9 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
if (isLFGGroup() && GetMembersCount() == 1)
{
- Player* Leader = ObjectAccessor::FindPlayer(GetLeaderGUID());
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(sLFGMgr->GetDungeon(GetGUID()));
- if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != uint32(dungeon->map)) || !dungeon)
+ Player* leader = ObjectAccessor::FindPlayer(GetLeaderGUID());
+ uint32 mapId = sLFGMgr->GetDungeonMapId(GetGUID());
+ if (!mapId || !leader || (leader->isAlive() && leader->GetMapId() != mapId))
{
Disband();
return false;
@@ -590,7 +636,7 @@ void Group::ChangeLeader(uint64 guid)
sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid);
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
// Remove the groups permanent instance bindings
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
@@ -650,8 +696,8 @@ void Group::Disband(bool hideDestroy /* = false */)
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
- if (isBGGroup())
- player->RemoveFromBattlegroundRaid();
+ if (isBGGroup() || isBFGroup())
+ player->RemoveFromBattlegroundOrBattlefieldRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -695,7 +741,7 @@ void Group::Disband(bool hideDestroy /* = false */)
RemoveAllInvites();
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -727,7 +773,7 @@ void Group::Disband(bool hideDestroy /* = false */)
/*** LOOT SYSTEM ***/
/*********************************************************/
-void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
+void Group::SendLootStartRoll(uint32 countDown, uint32 mapid, const Roll &r)
{
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4+1));
data << uint64(r.itemGUID); // guid of rolled item
@@ -737,7 +783,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r)
data << uint32(r.itemRandomSuffix); // randomSuffix
data << uint32(r.itemRandomPropId); // item random property ID
data << uint32(r.itemCount); // items in stack
- data << uint32(CountDown); // the countdown time to choose "need" or "greed"
+ data << uint32(countDown); // the countdown time to choose "need" or "greed"
data << uint8(r.rollVoteMask); // roll type mask
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
@@ -871,7 +917,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
item = sObjectMgr->GetItemTemplate(i->itemid);
if (!item)
{
- //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
continue;
}
@@ -958,7 +1004,7 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
item = sObjectMgr->GetItemTemplate(i->itemid);
if (!item)
{
- //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
+ //sLog->outDebug(LOG_FILTER_GENERAL, "Group::GroupLoot: missing item prototype for item with id: %d", i->itemid);
continue;
}
@@ -1155,12 +1201,12 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject)
void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330)");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Group::MasterLoot (SMSG_LOOT_MASTER_LIST)");
uint32 real_count = 0;
- WorldPacket data(SMSG_LOOT_MASTER_LIST, 330);
- data << (uint8)GetMembersCount();
+ WorldPacket data(SMSG_LOOT_MASTER_LIST, 1 + GetMembersCount() * 8);
+ data << uint8(GetMembersCount());
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -1280,7 +1326,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
if (player && player->GetSession())
{
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul);
ItemPosCountVec dest;
LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
@@ -1330,7 +1376,7 @@ void Group::CountTheRoll(Rolls::iterator rollI)
if (player && player->GetSession())
{
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul);
LootItem* item = &(roll->itemSlot >= roll->getLoot()->items.size() ? roll->getLoot()->quest_items[roll->itemSlot - roll->getLoot()->items.size()] : roll->getLoot()->items[roll->itemSlot]);
@@ -1464,8 +1510,8 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
Player* member = ObjectAccessor::FindPlayer(citr->guid);
- uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
- onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
+ uint8 onlineState = member ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
+ onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr->name;
data << uint64(citr->guid); // guid
@@ -1556,7 +1602,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
SubGroupCounterIncrease(group);
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1607,7 +1653,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
SubGroupCounterDecrease(prevSubGroup);
// Preserve new sub group in database for non-raid groups
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1802,7 +1848,7 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
@@ -1826,7 +1872,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
- if (!isBGGroup())
+ if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
@@ -1862,7 +1908,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
- if (isBGGroup())
+ if (isBGGroup() || isBFGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -1977,7 +2023,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, bool load)
{
- if (!save || isBGGroup())
+ if (!save || isBGGroup() || isBFGroup())
return NULL;
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
@@ -2045,7 +2091,7 @@ void Group::BroadcastGroupUpdate(void)
{
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2);
pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE);
- sLog->outStaticDebug("-- Forced group value update for '%s'", pp->GetName());
+ sLog->outDebug(LOG_FILTER_GENERAL, "-- Forced group value update for '%s'", pp->GetName().c_str());
}
}
}
@@ -2053,12 +2099,12 @@ void Group::BroadcastGroupUpdate(void)
void Group::ResetMaxEnchantingLevel()
{
m_maxEnchantingLevel = 0;
- Player* pMember = NULL;
+ Player* member = NULL;
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
{
- pMember = ObjectAccessor::FindPlayer(citr->guid);
- if (pMember && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING))
- m_maxEnchantingLevel = pMember->GetSkillValue(SKILL_ENCHANTING);
+ member = ObjectAccessor::FindPlayer(citr->guid);
+ if (member && m_maxEnchantingLevel < member->GetSkillValue(SKILL_ENCHANTING))
+ m_maxEnchantingLevel = member->GetSkillValue(SKILL_ENCHANTING);
}
}
@@ -2107,6 +2153,11 @@ bool Group::isBGGroup() const
return m_bgGroup != NULL;
}
+bool Group::isBFGroup() const
+{
+ return m_bfGroup != NULL;
+}
+
bool Group::IsCreated() const
{
return GetMembersCount() > 0;
@@ -2208,6 +2259,11 @@ void Group::SetBattlegroundGroup(Battleground* bg)
m_bgGroup = bg;
}
+void Group::SetBattlefieldGroup(Battlefield *bg)
+{
+ m_bfGroup = bg;
+}
+
void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index e5f174c4230..3421e12a9a4 100755..100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -19,14 +19,14 @@
#ifndef TRINITYCORE_GROUP_H
#define TRINITYCORE_GROUP_H
-#include "Battleground.h"
#include "DBCEnums.h"
#include "GroupRefManager.h"
#include "LootMgr.h"
#include "QueryResult.h"
#include "SharedDefines.h"
-#include "Player.h"
+class Battlefield;
+class Battleground;
class Creature;
class GroupReference;
class InstanceSave;
@@ -64,20 +64,20 @@ enum GroupMemberOnlineStatus
MEMBER_STATUS_PVP_FFA = 0x0010, // Lua_UnitIsPVPFreeForAll
MEMBER_STATUS_UNK3 = 0x0020, // used in calls from Lua_GetPlayerMapPosition/Lua_GetBattlefieldFlagPosition
MEMBER_STATUS_AFK = 0x0040, // Lua_UnitIsAFK
- MEMBER_STATUS_DND = 0x0080, // Lua_UnitIsDND
+ MEMBER_STATUS_DND = 0x0080 // Lua_UnitIsDND
};
enum GroupMemberFlags
{
MEMBER_FLAG_ASSISTANT = 0x01,
MEMBER_FLAG_MAINTANK = 0x02,
- MEMBER_FLAG_MAINASSIST = 0x04,
+ MEMBER_FLAG_MAINASSIST = 0x04
};
enum GroupMemberAssignment
{
GROUP_ASSIGN_MAINTANK = 0,
- GROUP_ASSIGN_MAINASSIST = 1,
+ GROUP_ASSIGN_MAINASSIST = 1
};
enum GroupType
@@ -87,7 +87,7 @@ enum GroupType
GROUPTYPE_RAID = 0x02,
GROUPTYPE_BGRAID = GROUPTYPE_BG | GROUPTYPE_RAID, // mask
GROUPTYPE_UNK1 = 0x04,
- GROUPTYPE_LFG = 0x08,
+ GROUPTYPE_LFG = 0x08
// 0x10, leave/change group?, I saw this flag when leaving group and after leaving BG while in group
};
@@ -115,7 +115,7 @@ enum GroupUpdateFlags
GROUP_UPDATE_FLAG_PET_AURAS = 0x00040000, // uint64 mask, for each bit set uint32 spellid + uint8 unk, pet auras...
GROUP_UPDATE_FLAG_VEHICLE_SEAT = 0x00080000, // uint32 vehicle_seat_id (index from VehicleSeat.dbc)
GROUP_UPDATE_PET = 0x0007FC00, // all pet flags
- GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags
+ GROUP_UPDATE_FULL = 0x0007FFFF // all known flags
};
#define GROUP_UPDATE_FLAGS_COUNT 20
@@ -205,6 +205,7 @@ class Group
bool isLFGGroup() const;
bool isRaidGroup() const;
bool isBGGroup() const;
+ bool isBFGroup() const;
bool IsCreated() const;
uint64 GetLeaderGUID() const;
uint64 GetGUID() const;
@@ -241,6 +242,7 @@ class Group
void ConvertToRaid();
void SetBattlegroundGroup(Battleground* bg);
+ void SetBattlefieldGroup(Battlefield* bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(uint64 guid, uint8 group);
@@ -265,7 +267,7 @@ class Group
void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL);
void UpdatePlayerOutOfRange(Player* player);
// ignore: GUID of player that will be ignored
- void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0);
+ void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
void BroadcastReadyCheck(WorldPacket* packet);
void OfflineReadyCheck();
@@ -324,6 +326,7 @@ class Group
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battleground* m_bgGroup;
+ Battlefield* m_bfGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index f372f08c941..8283075a226 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -18,6 +18,8 @@
#include "Common.h"
#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
+#include "World.h"
+#include "DBCStores.h"
GroupMgr::GroupMgr()
{
@@ -46,7 +48,7 @@ uint32 GroupMgr::GenerateNewGroupDbStoreId()
if (newStorageId == NextGroupDbStoreId)
{
- sLog->outError("Group storage ID overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Group storage ID overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
@@ -84,7 +86,7 @@ uint32 GroupMgr::GenerateGroupId()
{
if (NextGroupId >= 0xFFFFFFFE)
{
- sLog->outError("Group guid overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GENERAL, "Group guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return NextGroupId++;
@@ -125,8 +127,7 @@ void GroupMgr::LoadGroups()
", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
if (!result)
{
- sLog->outString(">> Loaded 0 group definitions. DB table `groups` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!");
return;
}
@@ -151,11 +152,10 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outString("Loading Group members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group members...");
{
uint32 oldMSTime = getMSTime();
@@ -169,8 +169,7 @@ void GroupMgr::LoadGroups()
QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
if (!result)
{
- sLog->outString(">> Loaded 0 group members. DB table `group_member` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!");
return;
}
@@ -184,17 +183,16 @@ void GroupMgr::LoadGroups()
if (group)
group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8());
else
- sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32());
+ sLog->outError(LOG_FILTER_GENERAL, "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32());
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outString("Loading Group instance saves...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
@@ -203,8 +201,7 @@ void GroupMgr::LoadGroups()
"LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid");
if (!result)
{
- sLog->outString(">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
return;
}
@@ -218,14 +215,14 @@ void GroupMgr::LoadGroups()
MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt16());
if (!mapEntry || !mapEntry->IsDungeon())
{
- sLog->outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16());
+ sLog->outError(LOG_FILTER_SQL, "Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt16());
continue;
}
uint32 diff = fields[4].GetUInt8();
if (diff >= uint32(mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
- sLog->outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
+ sLog->outError(LOG_FILTER_SQL, "Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
diff = 0; // default for both difficaly types
}
@@ -235,7 +232,6 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Groups/GroupRefManager.h b/src/server/game/Groups/GroupRefManager.h
index d9fef8611de..d9fef8611de 100755..100644
--- a/src/server/game/Groups/GroupRefManager.h
+++ b/src/server/game/Groups/GroupRefManager.h
diff --git a/src/server/game/Groups/GroupReference.cpp b/src/server/game/Groups/GroupReference.cpp
index 68d85c5bce9..68d85c5bce9 100755..100644
--- a/src/server/game/Groups/GroupReference.cpp
+++ b/src/server/game/Groups/GroupReference.cpp
diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h
index 7960dd21035..7960dd21035 100755..100644
--- a/src/server/game/Groups/GroupReference.h
+++ b/src/server/game/Groups/GroupReference.h
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 889174420c6..8609e1a7735 100755..100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -16,19 +16,72 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "AccountMgr.h"
+#include "CalendarMgr.h"
+#include "Chat.h"
+#include "Config.h"
#include "DatabaseEnv.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Language.h"
+#include "Log.h"
#include "ScriptMgr.h"
-#include "Chat.h"
-#include "Config.h"
#include "SocialMgr.h"
-#include "Log.h"
-#include "AccountMgr.h"
+#include "Opcodes.h"
#define MAX_GUILD_BANK_TAB_TEXT_LEN 500
#define EMBLEM_PRICE 10 * GOLD
+std::string _GetGuildEventString(GuildEvents event)
+{
+ switch (event)
+ {
+ case GE_PROMOTION:
+ return "Member promotion";
+ case GE_DEMOTION:
+ return "Member demotion";
+ case GE_MOTD:
+ return "Guild MOTD";
+ case GE_JOINED:
+ return "Member joined";
+ case GE_LEFT:
+ return "Member left";
+ case GE_REMOVED:
+ return "Member removed";
+ case GE_LEADER_IS:
+ return "Leader is";
+ case GE_LEADER_CHANGED:
+ return "Leader changed";
+ case GE_DISBANDED:
+ return "Guild disbanded";
+ case GE_TABARDCHANGE:
+ return "Tabard change";
+ case GE_RANK_UPDATED:
+ return "Rank updated";
+ case GE_RANK_DELETED:
+ return "Rank deleted";
+ case GE_SIGNED_ON:
+ return "Member signed on";
+ case GE_SIGNED_OFF:
+ return "Member signed off";
+ case GE_GUILDBANKBAGSLOTS_CHANGED:
+ return "Bank bag slots changed";
+ case GE_BANK_TAB_PURCHASED:
+ return "Bank tab purchased";
+ case GE_BANK_TAB_UPDATED:
+ return "Bank tab updated";
+ case GE_BANK_MONEY_SET:
+ return "Bank money set";
+ case GE_BANK_MONEY_CHANGED:
+ return "Bank money changed";
+ case GE_BANK_TEXT_CHANGED:
+ return "Bank tab text changed";
+ default:
+ break;
+ }
+ return "<None>";
+}
+
inline uint32 _GetGuildBankTabPrice(uint8 tabId)
{
switch (tabId)
@@ -43,7 +96,7 @@ inline uint32 _GetGuildBankTabPrice(uint8 tabId)
}
}
-void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, const std::string& param)
+void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, std::string const& param)
{
WorldPacket data(SMSG_GUILD_COMMAND_RESULT, 8 + param.size() + 1);
data << uint32(type);
@@ -51,7 +104,8 @@ void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, Guil
data << uint32(errCode);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)");
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_COMMAND_RESULT [%s]: Type: %u, code: %u, param: %s"
+ , session->GetPlayerInfo().c_str(), type, errCode, param.c_str());
}
void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode)
@@ -60,10 +114,9 @@ void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode
data << uint32(errCode);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (MSG_SAVE_GUILD_EMBLEM)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s] Code: %u", session->GetPlayerInfo().c_str(), errCode);
}
-///////////////////////////////////////////////////////////////////////////////
// LogHolder
Guild::LogHolder::~LogHolder()
{
@@ -116,13 +169,10 @@ inline uint32 Guild::LogHolder::GetNextGUID()
return m_nextGUID;
}
-///////////////////////////////////////////////////////////////////////////////
// EventLogEntry
void Guild::EventLogEntry::SaveToDB(SQLTransaction& trans) const
{
- PreparedStatement* stmt = NULL;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG);
stmt->setUInt32(0, m_guildId);
stmt->setUInt32(1, m_guid);
CharacterDatabase.ExecuteOrAppend(trans, stmt);
@@ -155,14 +205,12 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data) const
data << uint32(::time(NULL) - m_timestamp);
}
-///////////////////////////////////////////////////////////////////////////////
// BankEventLogEntry
void Guild::BankEventLogEntry::SaveToDB(SQLTransaction& trans) const
{
- PreparedStatement* stmt = NULL;
uint8 index = 0;
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG);
stmt->setUInt32( index, m_guildId);
stmt->setUInt32(++index, m_guid);
stmt->setUInt8 (++index, m_bankTabId);
@@ -186,19 +234,27 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data) const
{
data << uint8(m_eventType);
data << uint64(MAKE_NEW_GUID(m_playerGuid, 0, HIGHGUID_PLAYER));
- data << uint32(m_itemOrMoney);
- // if ( m_eventType != 4 || m_eventType != 5 || m_eventType != 6 || m_eventType != 8 || m_eventType != 9 )
- if (m_eventType < GUILD_BANK_LOG_DEPOSIT_MONEY)
- {
- data << uint32(m_itemStackCount);
- if (m_eventType == GUILD_BANK_LOG_MOVE_ITEM || m_eventType == GUILD_BANK_LOG_MOVE_ITEM2)
+
+ switch(m_eventType)
+ {
+ case GUILD_BANK_LOG_DEPOSIT_ITEM:
+ case GUILD_BANK_LOG_WITHDRAW_ITEM:
+ data << uint32(m_itemOrMoney);
+ data << uint32(m_itemStackCount);
+ break;
+ case GUILD_BANK_LOG_MOVE_ITEM:
+ case GUILD_BANK_LOG_MOVE_ITEM2:
+ data << uint32(m_itemOrMoney);
+ data << uint32(m_itemStackCount);
data << uint8(m_destTabId);
+ break;
+ default:
+ data << uint32(m_itemOrMoney);
}
data << uint32(time(NULL) - m_timestamp);
}
-///////////////////////////////////////////////////////////////////////////////
// RankInfo
void Guild::RankInfo::LoadFromDB(Field* fields)
{
@@ -220,18 +276,46 @@ void Guild::RankInfo::SaveToDB(SQLTransaction& trans) const
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
+void Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 tabs, SQLTransaction& trans, bool logOnCreate /* = false */)
+{
+ for (uint8 i = 0; i < tabs; ++i)
+ {
+ GuildBankRightsAndSlots& rightsAndSlots = m_bankTabRightsAndSlots[i];
+ if (rightsAndSlots.GetTabId() == i)
+ continue;
+
+ rightsAndSlots.SetTabId(i);
+ if (m_rankId == GR_GUILDMASTER)
+ rightsAndSlots.SetGuildMasterValues();
+
+ if (logOnCreate)
+ sLog->outError(LOG_FILTER_GUILD, "Guild %u has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT);
+ stmt->setUInt32(0, m_guildId);
+ stmt->setUInt8(1, i);
+ stmt->setUInt8(2, m_rankId);
+ stmt->setUInt8(3, rightsAndSlots.GetRights());
+ stmt->setUInt32(4, rightsAndSlots.GetSlots());
+ trans->Append(stmt);
+ }
+}
+
void Guild::RankInfo::WritePacket(WorldPacket& data) const
{
data << uint32(m_rights);
- data << uint32(m_bankMoneyPerDay); // In game set in gold, in packet set in bronze.
+ if (m_bankMoneyPerDay == GUILD_WITHDRAW_MONEY_UNLIMITED)
+ data << uint32(GUILD_WITHDRAW_MONEY_UNLIMITED);
+ else
+ data << uint32(m_bankMoneyPerDay);
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
- data << uint32(m_bankTabRightsAndSlots[i].rights);
- data << uint32(m_bankTabRightsAndSlots[i].slots);
+ data << uint32(m_bankTabRightsAndSlots[i].GetRights());
+ data << uint32(m_bankTabRightsAndSlots[i].GetSlots());
}
}
-void Guild::RankInfo::SetName(const std::string& name)
+void Guild::RankInfo::SetName(std::string const& name)
{
if (m_name == name)
return;
@@ -272,62 +356,39 @@ void Guild::RankInfo::SetBankMoneyPerDay(uint32 money)
m_bankMoneyPerDay = money;
- PreparedStatement* stmt = NULL;
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_RANK_BANK_MONEY);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_RANK_BANK_MONEY);
stmt->setUInt32(0, money);
stmt->setUInt8 (1, m_rankId);
stmt->setUInt32(2, m_guildId);
CharacterDatabase.Execute(stmt);
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_RANK_BANK_RESET_TIME);
- stmt->setUInt32(0, m_guildId);
- stmt->setUInt8 (1, m_rankId);
- CharacterDatabase.Execute(stmt);
}
-void Guild::RankInfo::SetBankTabSlotsAndRights(uint8 tabId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB)
+void Guild::RankInfo::SetBankTabSlotsAndRights(GuildBankRightsAndSlots rightsAndSlots, bool saveToDB)
{
if (m_rankId == GR_GUILDMASTER) // Prevent loss of leader rights
rightsAndSlots.SetGuildMasterValues();
- if (m_bankTabRightsAndSlots[tabId].IsEqual(rightsAndSlots))
- return;
-
- m_bankTabRightsAndSlots[tabId] = rightsAndSlots;
+ GuildBankRightsAndSlots& guildBR = m_bankTabRightsAndSlots[rightsAndSlots.GetTabId()];
+ guildBR = rightsAndSlots;
if (saveToDB)
{
- PreparedStatement* stmt = NULL;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_RIGHT);
- stmt->setUInt32(0, m_guildId);
- stmt->setUInt8 (1, tabId);
- stmt->setUInt8 (2, m_rankId);
- CharacterDatabase.Execute(stmt);
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT);
stmt->setUInt32(0, m_guildId);
- stmt->setUInt8 (1, tabId);
+ stmt->setUInt8 (1, guildBR.GetTabId());
stmt->setUInt8 (2, m_rankId);
- stmt->setUInt8 (3, m_bankTabRightsAndSlots[tabId].rights);
- stmt->setUInt32(4, m_bankTabRightsAndSlots[tabId].slots);
- CharacterDatabase.Execute(stmt);
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_RANK_BANK_TIME0 + tabId);
- stmt->setUInt32(0, m_guildId);
- stmt->setUInt8 (1, m_rankId);
+ stmt->setUInt8 (3, guildBR.GetRights());
+ stmt->setUInt32(4, guildBR.GetSlots());
CharacterDatabase.Execute(stmt);
}
}
-///////////////////////////////////////////////////////////////////////////////
// BankTab
-bool Guild::BankTab::LoadFromDB(Field* fields)
+void Guild::BankTab::LoadFromDB(Field* fields)
{
m_name = fields[2].GetString();
m_icon = fields[3].GetString();
m_text = fields[4].GetString();
- return true;
}
bool Guild::BankTab::LoadItemFromDB(Field* fields)
@@ -337,23 +398,23 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields)
uint32 itemEntry = fields[15].GetUInt32();
if (slotId >= GUILD_BANK_MAX_SLOTS)
{
- sLog->outError("Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_GUILD, "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
return false;
}
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- sLog->outError("Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_GUILD, "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry);
return false;
}
Item* pItem = NewItemOrBag(proto);
if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry))
{
- sLog->outError("Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);
+ sLog->outError(LOG_FILTER_GUILD, "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry);
- PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM);
stmt->setUInt32(0, m_guildId);
stmt->setUInt8 (1, m_tabId);
stmt->setUInt8 (2, slotId);
@@ -384,26 +445,41 @@ void Guild::BankTab::Delete(SQLTransaction& trans, bool removeItemsFromDB)
inline void Guild::BankTab::WritePacket(WorldPacket& data) const
{
- data << uint8(GUILD_BANK_MAX_SLOTS);
+ uint8 count = 0;
+
+ size_t pos = data.wpos();
+ data << uint8(0);
+
for (uint8 slotId = 0; slotId < GUILD_BANK_MAX_SLOTS; ++slotId)
- WriteSlotPacket(data, slotId);
+ if (WriteSlotPacket(data, slotId))
+ ++count;
+
+ data.put<uint8>(pos, count);
}
// Writes information about contents of specified slot into packet.
-void Guild::BankTab::WriteSlotPacket(WorldPacket& data, uint8 slotId) const
+bool Guild::BankTab::WriteSlotPacket(WorldPacket& data, uint8 slotId, bool ignoreEmpty /* = true */) const
{
Item* pItem = GetItem(slotId);
uint32 itemEntry = pItem ? pItem->GetEntry() : 0;
+ if (!itemEntry && ignoreEmpty)
+ return false;
+
data << uint8(slotId);
data << uint32(itemEntry);
if (itemEntry)
{
data << uint32(0); // 3.3.0 (0x00018020, 0x00018000)
- data << uint32(pItem->GetItemRandomPropertyId()); // Random item property id
- if (pItem->GetItemRandomPropertyId())
+
+ if (uint32 random = pItem->GetItemRandomPropertyId())
+ {
+ data << uint32(random); // Random item property id
data << uint32(pItem->GetItemSuffixFactor()); // SuffixFactor
+ }
+ else
+ data << uint32(0);
data << uint32(pItem->GetCount()); // ITEM_FIELD_STACK_COUNT
data << uint32(0);
@@ -422,9 +498,10 @@ void Guild::BankTab::WriteSlotPacket(WorldPacket& data, uint8 slotId) const
}
data.put<uint8>(enchCountPos, enchCount);
}
+ return true;
}
-void Guild::BankTab::SetInfo(const std::string& name, const std::string& icon)
+void Guild::BankTab::SetInfo(std::string const& name, std::string const& icon)
{
if (m_name == name && m_icon == icon)
return;
@@ -440,7 +517,7 @@ void Guild::BankTab::SetInfo(const std::string& name, const std::string& icon)
CharacterDatabase.Execute(stmt);
}
-void Guild::BankTab::SetText(const std::string& text)
+void Guild::BankTab::SetText(std::string const& text)
{
if (m_text == text)
return;
@@ -457,51 +534,55 @@ void Guild::BankTab::SetText(const std::string& text)
// Sets/removes contents of specified slot.
// If pItem == NULL contents are removed.
-bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem)
+bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* item)
{
if (slotId >= GUILD_BANK_MAX_SLOTS)
return false;
- m_items[slotId] = pItem;
-
- PreparedStatement* stmt = NULL;
+ m_items[slotId] = item;
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_ITEM);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_ITEM);
stmt->setUInt32(0, m_guildId);
stmt->setUInt8 (1, m_tabId);
stmt->setUInt8 (2, slotId);
CharacterDatabase.ExecuteOrAppend(trans, stmt);
- if (pItem)
+ if (item)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_ITEM);
stmt->setUInt32(0, m_guildId);
stmt->setUInt8 (1, m_tabId);
stmt->setUInt8 (2, slotId);
- stmt->setUInt32(3, pItem->GetGUIDLow());
+ stmt->setUInt32(3, item->GetGUIDLow());
CharacterDatabase.ExecuteOrAppend(trans, stmt);
- pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
- pItem->SetUInt64Value(ITEM_FIELD_OWNER, 0);
- pItem->FSetState(ITEM_NEW);
- pItem->SaveToDB(trans); // Not in inventory and can be saved standalone
+ item->SetUInt64Value(ITEM_FIELD_CONTAINED, 0);
+ item->SetUInt64Value(ITEM_FIELD_OWNER, 0);
+ item->FSetState(ITEM_NEW);
+ item->SaveToDB(trans); // Not in inventory and can be saved standalone
}
return true;
}
-void Guild::BankTab::SendText(const Guild* guild, WorldSession* session) const
+void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const
{
WorldPacket data(MSG_QUERY_GUILD_BANK_TEXT, 1 + m_text.size() + 1);
data << uint8(m_tabId);
data << m_text;
if (session)
+ {
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [%s]: Tabid: %u, Text: %s"
+ , session->GetPlayerInfo().c_str(), m_tabId, m_text.c_str());
session->SendPacket(&data);
+ }
else
+ {
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [Broadcast]: Tabid: %u, Text: %s", m_tabId, m_text.c_str());
guild->BroadcastPacket(&data);
+ }
}
-///////////////////////////////////////////////////////////////////////////////
// Member
void Guild::Member::SetStats(Player* player)
{
@@ -512,7 +593,7 @@ void Guild::Member::SetStats(Player* player)
m_accountId = player->GetSession()->GetAccountId();
}
-void Guild::Member::SetStats(const std::string& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId)
+void Guild::Member::SetStats(std::string const& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId)
{
m_name = name;
m_level = level;
@@ -521,7 +602,7 @@ void Guild::Member::SetStats(const std::string& name, uint8 level, uint8 _class,
m_accountId = accountId;
}
-void Guild::Member::SetPublicNote(const std::string& publicNote)
+void Guild::Member::SetPublicNote(std::string const& publicNote)
{
if (m_publicNote == publicNote)
return;
@@ -534,7 +615,7 @@ void Guild::Member::SetPublicNote(const std::string& publicNote)
CharacterDatabase.Execute(stmt);
}
-void Guild::Member::SetOfficerNote(const std::string& officerNote)
+void Guild::Member::SetOfficerNote(std::string const& officerNote)
{
if (m_officerNote == officerNote)
return;
@@ -577,31 +658,28 @@ void Guild::Member::SaveToDB(SQLTransaction& trans) const
// In this case member has to be removed from guild.
bool Guild::Member::LoadFromDB(Field* fields)
{
- m_publicNote = fields[3].GetString();
- m_officerNote = fields[4].GetString();
- m_bankRemaining[GUILD_BANK_MAX_TABS].resetTime = fields[5].GetUInt32();
- m_bankRemaining[GUILD_BANK_MAX_TABS].value = fields[6].GetUInt32();
- for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
- {
- m_bankRemaining[i].resetTime = fields[7 + i * 2].GetUInt32();
- m_bankRemaining[i].value = fields[8 + i * 2].GetUInt32();
- }
+ m_publicNote = fields[3].GetString();
+ m_officerNote = fields[4].GetString();
+
+ for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS; ++i)
+ m_bankWithdraw[i] = fields[5 + i].GetUInt32();
- SetStats(fields[19].GetString(),
- fields[20].GetUInt8(), // characters.level
- fields[21].GetUInt8(), // characters.class
- fields[22].GetUInt16(), // characters.zone
- fields[23].GetUInt32()); // characters.account
- m_logoutTime = fields[24].GetUInt32(); // characters.logout_time
+ SetStats(fields[12].GetString(),
+ fields[13].GetUInt8(), // characters.level
+ fields[14].GetUInt8(), // characters.class
+ fields[15].GetUInt16(), // characters.zone
+ fields[16].GetUInt32()); // characters.account
+ m_logoutTime = fields[17].GetUInt32(); // characters.logout_time
if (!CheckStats())
return false;
if (!m_zoneId)
{
- sLog->outError("Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid));
+ sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid));
m_zoneId = Player::GetZoneIdFromDB(m_guid);
}
+ ResetFlags();
return true;
}
@@ -610,12 +688,13 @@ bool Guild::Member::CheckStats() const
{
if (m_level < 1)
{
- sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid));
+ sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid));
return false;
}
+
if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES)
{
- sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid));
+ sLog->outError(LOG_FILTER_GUILD, "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid));
return false;
}
return true;
@@ -623,100 +702,64 @@ bool Guild::Member::CheckStats() const
void Guild::Member::WritePacket(WorldPacket& data) const
{
- if (Player* player = FindPlayer())
- {
- data << uint64(player->GetGUID());
- data << uint8(1);
- data << player->GetName();
- data << uint32(m_rankId);
- data << uint8(player->getLevel());
- data << uint8(player->getClass());
- data << uint8(0); // new 2.4.0
- data << uint32(player->GetZoneId());
- }
- else
- {
- data << m_guid;
- data << uint8(0);
- data << m_name;
- data << uint32(m_rankId);
- data << uint8(m_level);
- data << uint8(m_class);
- data << uint8(0); // new 2.4.0
- data << uint32(m_zoneId);
+ data << uint64(m_guid)
+ << uint8(m_flags)
+ << m_name
+ << uint32(m_rankId)
+ << uint8(m_level)
+ << uint8(m_class)
+ << uint8(0)
+ << uint32(m_zoneId);
+
+ if (!m_flags)
data << float(float(::time(NULL) - m_logoutTime) / DAY);
- }
- data << m_publicNote;
- data << m_officerNote;
+
+ data << m_publicNote
+ << m_officerNote;
}
// Decreases amount of money/slots left for today.
// If (tabId == GUILD_BANK_MAX_TABS) decrease money amount.
// Otherwise decrease remaining items amount for specified tab.
-void Guild::Member::DecreaseBankRemainingValue(SQLTransaction& trans, uint8 tabId, uint32 amount)
+void Guild::Member::UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, uint32 amount)
{
- m_bankRemaining[tabId].value -= amount;
+ m_bankWithdraw[tabId] += amount;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW);
+ stmt->setUInt32(0, GUID_LOPART(m_guid));
+ for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;)
+ {
+ uint32 withdraw = m_bankWithdraw[i++];
+ stmt->setUInt32(i, withdraw);
+ }
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(
- tabId == GUILD_BANK_MAX_TABS ?
- CHAR_UPD_GUILD_MEMBER_BANK_REM_MONEY :
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS0 + tabId);
- stmt->setUInt32(0, m_bankRemaining[tabId].value);
- stmt->setUInt32(1, m_guildId);
- stmt->setUInt32(2, GUID_LOPART(m_guid));
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
+void Guild::Member::ResetValues()
+{
+ for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
+ m_bankWithdraw[tabId] = 0;
+}
+
// Get amount of money/slots left for today.
// If (tabId == GUILD_BANK_MAX_TABS) return money amount.
// Otherwise return remaining items amount for specified tab.
-// If reset time was more than 24 hours ago, renew reset time and reset amount to maximum value.
-uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* guild) const
+int32 Guild::Member::GetBankWithdrawValue(uint8 tabId) const
{
// Guild master has unlimited amount.
if (IsRank(GR_GUILDMASTER))
return tabId == GUILD_BANK_MAX_TABS ? GUILD_WITHDRAW_MONEY_UNLIMITED : GUILD_WITHDRAW_SLOT_UNLIMITED;
- // Check rights for non-money tab.
- if (tabId != GUILD_BANK_MAX_TABS)
- if ((guild->_GetRankBankTabRights(m_rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
- return 0;
-
- uint32 curTime = uint32(::time(NULL) / MINUTE); // minutes
- if (curTime > m_bankRemaining[tabId].resetTime + 24 * HOUR / MINUTE)
- {
- RemainingValue& rv = const_cast <RemainingValue&> (m_bankRemaining[tabId]);
- rv.resetTime = curTime;
- rv.value = tabId == GUILD_BANK_MAX_TABS ?
- guild->_GetRankBankMoneyPerDay(m_rankId) :
- guild->_GetRankBankTabSlotsPerDay(m_rankId, tabId);
-
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(
- tabId == GUILD_BANK_MAX_TABS ?
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_MONEY :
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS0 + tabId);
- stmt->setUInt32(0, m_bankRemaining[tabId].resetTime);
- stmt->setUInt32(1, m_bankRemaining[tabId].value);
- stmt->setUInt32(2, m_guildId);
- stmt->setUInt32(3, GUID_LOPART(m_guid));
- CharacterDatabase.Execute(stmt);
- }
- return m_bankRemaining[tabId].value;
-}
-
-inline void Guild::Member::ResetTabTimes()
-{
- for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
- m_bankRemaining[tabId].resetTime = 0;
+ return m_bankWithdraw[tabId];
}
-inline void Guild::Member::ResetMoneyTime()
+// EmblemInfo
+void EmblemInfo::ReadPacket(WorldPacket& recv)
{
- m_bankRemaining[GUILD_BANK_MAX_TABS].resetTime = 0;
+ recv >> m_style >> m_color >> m_borderStyle >> m_borderColor >> m_backgroundColor;
}
-///////////////////////////////////////////////////////////////////////////////
-// EmblemInfo
void EmblemInfo::LoadFromDB(Field* fields)
{
m_style = fields[3].GetUInt8();
@@ -747,7 +790,6 @@ void EmblemInfo::SaveToDB(uint32 guildId) const
CharacterDatabase.Execute(stmt);
}
-///////////////////////////////////////////////////////////////////////////////
// MoveItemData
bool Guild::MoveItemData::CheckItem(uint32& splitedAmount)
{
@@ -795,7 +837,6 @@ inline void Guild::MoveItemData::CopySlots(SlotIds& ids) const
ids.insert(uint8(itr->pos));
}
-///////////////////////////////////////////////////////////////////////////////
// PlayerMoveItemData
bool Guild::PlayerMoveItemData::InitItem()
{
@@ -855,7 +896,6 @@ inline InventoryResult Guild::PlayerMoveItemData::CanStore(Item* pItem, bool swa
return m_pPlayer->CanStoreItem(m_container, m_slotId, m_vec, pItem, swap);
}
-///////////////////////////////////////////////////////////////////////////////
// BankMoveItemData
bool Guild::BankMoveItemData::InitItem()
{
@@ -878,7 +918,12 @@ bool Guild::BankMoveItemData::HasWithdrawRights(MoveItemData* pOther) const
// Do not check rights if item is being swapped within the same bank tab
if (pOther->IsBank() && pOther->GetContainer() == m_container)
return true;
- return (m_pGuild->_GetMemberRemainingSlots(m_pPlayer->GetGUID(), m_container) != 0);
+
+ int32 slots = 0;
+ if (Member const* member = m_pGuild->GetMember(m_pPlayer->GetGUID()))
+ slots = m_pGuild->_GetMemberRemainingSlots(member, m_container);
+
+ return slots != 0;
}
void Guild::BankMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* pOther, uint32 splitedAmount)
@@ -897,7 +942,7 @@ void Guild::BankMoveItemData::RemoveItem(SQLTransaction& trans, MoveItemData* pO
}
// Decrease amount of player's remaining items (if item is moved to different tab or to player)
if (!pOther->IsBank() || pOther->GetContainer() != m_container)
- m_pGuild->_DecreaseMemberRemainingSlots(trans, m_pPlayer->GetGUID(), m_container);
+ m_pGuild->_UpdateMemberWithdrawSlots(trans, m_pPlayer->GetGUID(), m_container);
}
Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem)
@@ -941,7 +986,7 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const
if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && !AccountMgr::IsPlayerAccount(m_pPlayer->GetSession()->GetSecurity())) // TODO: move to scripts
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(), m_pPlayer->GetSession()->GetAccountId(),
+ m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(),
pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(),
m_pGuild->GetId());
}
@@ -1068,9 +1113,14 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap)
return EQUIP_ERR_BANK_FULL;
}
-///////////////////////////////////////////////////////////////////////////////
// Guild
-Guild::Guild() : m_id(0), m_leaderGuid(0), m_createdDate(0), m_accountsNumber(0), m_bankMoney(0), m_eventLog(NULL)
+Guild::Guild():
+ m_id(0),
+ m_leaderGuid(0),
+ m_createdDate(0),
+ m_accountsNumber(0),
+ m_bankMoney(0),
+ m_eventLog(NULL)
{
memset(&m_bankEventLog, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(LogHolder*));
}
@@ -1081,17 +1131,24 @@ Guild::~Guild()
_DeleteBankItems(temp);
// Cleanup
- if (m_eventLog)
- delete m_eventLog;
+ delete m_eventLog;
+ m_eventLog = NULL;
+
for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId)
- if (m_bankEventLog[tabId])
- delete m_bankEventLog[tabId];
+ {
+ delete m_bankEventLog[tabId];
+ m_bankEventLog[tabId] = NULL;
+ }
+
for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
+ {
delete itr->second;
+ itr->second = NULL;
+ }
}
// Creates new guild with default data and saves it to database.
-bool Guild::Create(Player* pLeader, const std::string& name)
+bool Guild::Create(Player* pLeader, std::string const& name)
{
// Check if guild with such name already exists
if (sGuildMgr->GetGuildByName(name))
@@ -1111,12 +1168,11 @@ bool Guild::Create(Player* pLeader, const std::string& name)
_CreateLogHolders();
sLog->outDebug(LOG_FILTER_GUILD, "GUILD: creating guild [%s] for leader %s (%u)",
- name.c_str(), pLeader->GetName(), GUID_LOPART(m_leaderGuid));
+ name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid));
- PreparedStatement* stmt = NULL;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBERS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBERS);
stmt->setUInt32(0, m_id);
trans->Append(stmt);
@@ -1137,12 +1193,10 @@ bool Guild::Create(Player* pLeader, const std::string& name)
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
- // Create default ranks
- _CreateDefaultGuildRanks(pLeaderSession->GetSessionDbLocaleIndex());
- // Add guildmaster
- bool ret = AddMember(m_leaderGuid, GR_GUILDMASTER);
+ _CreateDefaultGuildRanks(pLeaderSession->GetSessionDbLocaleIndex()); // Create default ranks
+ bool ret = AddMember(m_leaderGuid, GR_GUILDMASTER); // Add guildmaster
+
if (ret)
- // Call scripts on successful create
sScriptMgr->OnGuildCreate(this, pLeader, name);
return ret;
@@ -1162,9 +1216,9 @@ void Guild::Disband()
DeleteMember(itr->second->GetGUID(), true);
}
- PreparedStatement* stmt = NULL;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD);
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD);
stmt->setUInt32(0, m_id);
trans->Append(stmt);
@@ -1199,8 +1253,36 @@ void Guild::Disband()
sGuildMgr->RemoveGuild(m_id);
}
-///////////////////////////////////////////////////////////////////////////////
-// HANDLE CLIENT COMMANDS
+void Guild::UpdateMemberData(Player* player, uint8 dataid, uint32 value)
+{
+ if (Member* member = GetMember(player->GetGUID()))
+ {
+ switch (dataid)
+ {
+ case GUILD_MEMBER_DATA_ZONEID:
+ member->SetZoneID(value);
+ break;
+ case GUILD_MEMBER_DATA_LEVEL:
+ member->SetLevel(value);
+ break;
+ default:
+ sLog->outError(LOG_FILTER_GUILD, "Guild::UpdateMemberData: Called with incorrect DATAID %u (value %u)", dataid, value);
+ return;
+ }
+ //HandleRoster();
+ }
+}
+
+void Guild::OnPlayerStatusChange(Player* player, uint32 flag, bool state)
+{
+ if (Member* member = GetMember(player->GetGUID()))
+ {
+ if (state)
+ member->AddFlag(flag);
+ else member->RemFlag(flag);
+ }
+}
+
void Guild::HandleRoster(WorldSession* session /*= NULL*/)
{
// Guess size
@@ -1217,20 +1299,25 @@ void Guild::HandleRoster(WorldSession* session /*= NULL*/)
itr->second->WritePacket(data);
if (session)
+ {
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str());
session->SendPacket(&data);
+ }
else
+ {
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_ROSTER [Broadcast]");
BroadcastPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_ROSTER)");
+ }
}
void Guild::HandleQuery(WorldSession* session)
{
WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, 8 * 32 + 200); // Guess size
-
data << uint32(m_id);
data << m_name;
- for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks
+ // Rank name
+ for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Always show 10 ranks
{
if (i < _GetRanksSize())
data << m_ranks[i].GetName();
@@ -1239,20 +1326,20 @@ void Guild::HandleQuery(WorldSession* session)
}
m_emblemInfo.WritePacket(data);
- data << uint32(0); // Something new in WotLK
+ data << uint32(_GetRanksSize()); // Number of ranks used
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_QUERY_RESPONSE)");
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str());
}
-void Guild::HandleSetMOTD(WorldSession* session, const std::string& motd)
+void Guild::HandleSetMOTD(WorldSession* session, std::string const& motd)
{
if (m_motd == motd)
return;
// Player must have rights to set MOTD
if (!_HasRankRight(session->GetPlayer(), GR_RIGHT_SETMOTD))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
+ SendCommandResult(session, GUILD_COMMAND_EDIT_MOTD, ERR_GUILD_PERMISSIONS);
else
{
m_motd = motd;
@@ -1268,15 +1355,13 @@ void Guild::HandleSetMOTD(WorldSession* session, const std::string& motd)
}
}
-void Guild::HandleSetInfo(WorldSession* session, const std::string& info)
+void Guild::HandleSetInfo(WorldSession* session, std::string const& info)
{
if (m_info == info)
return;
// Player must have rights to set guild's info
- if (!_HasRankRight(session->GetPlayer(), GR_RIGHT_MODIFY_GUILD_INFO))
- SendCommandResult(session, GUILD_CREATE_S, ERR_GUILD_PERMISSIONS);
- else
+ if (_HasRankRight(session->GetPlayer(), GR_RIGHT_MODIFY_GUILD_INFO))
{
m_info = info;
@@ -1293,11 +1378,9 @@ void Guild::HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo)
{
Player* player = session->GetPlayer();
if (!_IsLeader(player))
- // "Only guild leaders can create emblems."
- SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTGUILDMASTER);
+ SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTGUILDMASTER); // "Only guild leaders can create emblems."
else if (!player->HasEnoughMoney(EMBLEM_PRICE))
- // "You can't afford to do that."
- SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTENOUGHMONEY);
+ SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTENOUGHMONEY); // "You can't afford to do that."
else
{
player->ModifyMoney(-int32(EMBLEM_PRICE));
@@ -1305,84 +1388,99 @@ void Guild::HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo)
m_emblemInfo = emblemInfo;
m_emblemInfo.SaveToDB(m_id);
- // "Guild Emblem saved."
- SendSaveEmblemResult(session, ERR_GUILDEMBLEM_SUCCESS);
+ SendSaveEmblemResult(session, ERR_GUILDEMBLEM_SUCCESS); // "Guild Emblem saved."
HandleQuery(session);
}
}
-void Guild::HandleSetLeader(WorldSession* session, const std::string& name)
+void Guild::HandleSetLeader(WorldSession* session, std::string const& name)
{
Player* player = session->GetPlayer();
// Only leader can assign new leader
if (!_IsLeader(player))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
+ SendCommandResult(session, GUILD_COMMAND_CHANGE_LEADER, ERR_GUILD_PERMISSIONS);
// Old leader must be a member of guild
else if (Member* pOldLeader = GetMember(player->GetGUID()))
{
// New leader must be a member of guild
- if (Member* pNewLeader = GetMember(session, name))
+ if (Member* pNewLeader = GetMember(name))
{
_SetLeaderGUID(pNewLeader);
pOldLeader->ChangeRank(GR_OFFICER);
- _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName(), name.c_str());
+ _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName().c_str(), name.c_str());
}
}
- else
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
}
-void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, const std::string& name, const std::string& icon)
+void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon)
{
- if (BankTab* pTab = GetBankTab(tabId))
+ BankTab* tab = GetBankTab(tabId);
+ if (!tab)
{
- pTab->SetInfo(name, icon);
- SendBankTabsInfo(session);
- _SendBankContent(session, tabId);
+ sLog->outError(LOG_FILTER_GUILD, "Guild::HandleSetBankTabInfo: Player %s trying to change bank tab info from unexisting tab %d.",
+ session->GetPlayerInfo().c_str(), tabId);
+ return;
}
+
+ char aux[2];
+ sprintf(aux, "%u", tabId);
+
+ tab->SetInfo(name, icon);
+ _BroadcastEvent(GE_BANK_TAB_UPDATED, 0, aux, name.c_str(), icon.c_str());
}
-void Guild::HandleSetMemberNote(WorldSession* session, const std::string& name, const std::string& note, bool officer)
+void Guild::HandleSetMemberNote(WorldSession* session, std::string const& name, std::string const& note, bool isPublic)
{
// Player must have rights to set public/officer note
- if (!_HasRankRight(session->GetPlayer(), officer ? GR_RIGHT_EOFFNOTE : GR_RIGHT_EPNOTE))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
- // Noted player must be a member of guild
- else if (Member* member = GetMember(session, name))
+ if (!_HasRankRight(session->GetPlayer(), isPublic ? GR_RIGHT_EPNOTE : GR_RIGHT_EOFFNOTE))
+ SendCommandResult(session, GUILD_COMMAND_PUBLIC_NOTE, ERR_GUILD_PERMISSIONS);
+ else if (Member* member = GetMember(name))
{
- if (officer)
- member->SetOfficerNote(note);
- else
+ if (isPublic)
member->SetPublicNote(note);
+ else
+ member->SetOfficerNote(note);
+
HandleRoster(session);
}
}
-void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, const std::string& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots)
+void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots)
{
// Only leader can modify ranks
if (!_IsLeader(session->GetPlayer()))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
+ SendCommandResult(session, GUILD_COMMAND_CHANGE_RANK, ERR_GUILD_PERMISSIONS);
else if (RankInfo* rankInfo = GetRankInfo(rankId))
{
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights);
+ sLog->outDebug(LOG_FILTER_GUILD, "Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights);
rankInfo->SetName(name);
rankInfo->SetRights(rights);
_SetRankBankMoneyPerDay(rankId, moneyPerDay);
- uint8 tabId = 0;
for (GuildBankRightsAndSlotsVec::const_iterator itr = rightsAndSlots.begin(); itr != rightsAndSlots.end(); ++itr)
- _SetRankBankTabRightsAndSlots(rankId, tabId++, *itr);
+ _SetRankBankTabRightsAndSlots(rankId, *itr);
- HandleQuery(session);
- HandleRoster(); // Broadcast for tab rights update
+ char aux[2];
+ sprintf(aux, "%u", rankId);
+ _BroadcastEvent(GE_RANK_UPDATED, 0, aux, name.c_str());
}
}
void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId)
{
+ Player* player = session->GetPlayer();
+ if (!player)
+ return;
+
+ Member const* member = GetMember(player->GetGUID());
+ if (!member)
+ return;
+
+ if (_GetPurchasedTabsSize() >= GUILD_BANK_MAX_TABS)
+ return;
+
if (tabId != _GetPurchasedTabsSize())
return;
@@ -1390,26 +1488,22 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId)
if (!tabCost)
return;
- Player* player = session->GetPlayer();
if (!player->HasEnoughMoney(tabCost)) // Should not happen, this is checked by client
return;
- if (!_CreateNewBankTab())
- return;
-
player->ModifyMoney(-int32(tabCost));
- _SetRankBankMoneyPerDay(player->GetRank(), uint32(GUILD_WITHDRAW_MONEY_UNLIMITED));
- _SetRankBankTabRightsAndSlots(player->GetRank(), tabId, GuildBankRightsAndSlots(GUILD_BANK_RIGHT_FULL, uint32(GUILD_WITHDRAW_SLOT_UNLIMITED)));
- HandleRoster(); // Broadcast for tab rights update
- SendBankTabsInfo(session);
+
+ _CreateNewBankTab();
+ _BroadcastEvent(GE_BANK_TAB_PURCHASED, 0);
+ SendPermissions(session); /// Hack to force client to update permissions
}
-void Guild::HandleInviteMember(WorldSession* session, const std::string& name)
+void Guild::HandleInviteMember(WorldSession* session, std::string const& name)
{
- Player* pInvitee = sObjectAccessor->FindPlayerByName(name.c_str());
+ Player* pInvitee = sObjectAccessor->FindPlayerByName(name);
if (!pInvitee)
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PLAYER_NOT_FOUND_S, name);
+ SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_PLAYER_NOT_FOUND_S, name);
return;
}
@@ -1417,31 +1511,34 @@ void Guild::HandleInviteMember(WorldSession* session, const std::string& name)
// Do not show invitations from ignored players
if (pInvitee->GetSocial()->HasIgnore(player->GetGUIDLow()))
return;
+
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeam() != player->GetTeam())
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_NOT_ALLIED, name);
+ SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_NOT_ALLIED, name);
return;
}
// Invited player cannot be in another guild
if (pInvitee->GetGuildId())
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, name);
+ SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_ALREADY_IN_GUILD_S, name);
return;
}
// Invited player cannot be invited
if (pInvitee->GetGuildIdInvited())
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, name);
+ SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_ALREADY_INVITED_TO_GUILD_S, name);
return;
}
// Inviting player must have rights to invite
if (!_HasRankRight(player, GR_RIGHT_INVITE))
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
+ SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_PERMISSIONS);
return;
}
- sLog->outDebug(LOG_FILTER_GUILD, "Player %s invited %s to join his Guild", player->GetName(), name.c_str());
+ SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_COMMAND_SUCCESS, name);
+
+ sLog->outDebug(LOG_FILTER_GUILD, "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str());
pInvitee->SetGuildIdInvited(m_id);
_LogEvent(GUILD_EVENT_LOG_INVITE_PLAYER, player->GetGUIDLow(), pInvitee->GetGUIDLow());
@@ -1450,8 +1547,7 @@ void Guild::HandleInviteMember(WorldSession* session, const std::string& name)
data << player->GetName();
data << m_name;
pInvitee->GetSession()->SendPacket(&data);
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INVITE)");
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str());
}
void Guild::HandleAcceptMember(WorldSession* session)
@@ -1461,11 +1557,7 @@ void Guild::HandleAcceptMember(WorldSession* session)
player->GetTeam() != sObjectMgr->GetPlayerTeamByGUID(GetLeaderGUID()))
return;
- if (AddMember(player->GetGUID()))
- {
- _LogEvent(GUILD_EVENT_LOG_JOIN_GUILD, player->GetGUIDLow());
- _BroadcastEvent(GE_JOINED, player->GetGUID(), player->GetName());
- }
+ AddMember(player->GetGUID());
}
void Guild::HandleLeaveMember(WorldSession* session)
@@ -1476,7 +1568,7 @@ void Guild::HandleLeaveMember(WorldSession* session)
{
if (m_members.size() > 1)
// Leader cannot leave if he is not the last member
- SendCommandResult(session, GUILD_QUIT_S, ERR_GUILD_LEADER_LEAVE);
+ SendCommandResult(session, GUILD_COMMAND_QUIT, ERR_GUILD_LEADER_LEAVE);
else
// Guild is disbanded if leader leaves.
Disband();
@@ -1486,132 +1578,136 @@ void Guild::HandleLeaveMember(WorldSession* session)
DeleteMember(player->GetGUID(), false, false);
_LogEvent(GUILD_EVENT_LOG_LEAVE_GUILD, player->GetGUIDLow());
- _BroadcastEvent(GE_LEFT, player->GetGUID(), player->GetName());
+ _BroadcastEvent(GE_LEFT, player->GetGUID(), player->GetName().c_str());
- SendCommandResult(session, GUILD_QUIT_S, ERR_PLAYER_NO_MORE_IN_GUILD, m_name);
+ SendCommandResult(session, GUILD_COMMAND_QUIT, ERR_GUILD_COMMAND_SUCCESS, m_name);
}
+
+ sCalendarMgr->RemovePlayerGuildEventsAndSignups(player->GetGUID(), GetId());
}
-void Guild::HandleRemoveMember(WorldSession* session, const std::string& name)
+void Guild::HandleRemoveMember(WorldSession* session, std::string const& name)
{
Player* player = session->GetPlayer();
// Player must have rights to remove members
if (!_HasRankRight(player, GR_RIGHT_REMOVE))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
- // Removed player must be a member of guild
- else if (Member* member = GetMember(session, name))
+ SendCommandResult(session, GUILD_COMMAND_REMOVE, ERR_GUILD_PERMISSIONS);
+ else if (Member* member = GetMember(name))
{
- // Leader cannot be removed
+ // Guild masters cannot be removed
if (member->IsRank(GR_GUILDMASTER))
- SendCommandResult(session, GUILD_QUIT_S, ERR_GUILD_LEADER_LEAVE);
+ SendCommandResult(session, GUILD_COMMAND_REMOVE, ERR_GUILD_LEADER_LEAVE);
// Do not allow to remove player with the same rank or higher
- else if (member->IsRankNotLower(player->GetRank()))
- SendCommandResult(session, GUILD_QUIT_S, ERR_GUILD_RANK_TOO_HIGH_S, name);
else
{
- uint64 guid = member->GetGUID();
- // After call to DeleteMember pointer to member becomes invalid
- DeleteMember(guid, false, true);
- _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid));
- _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName());
+ Member const* memberMe = GetMember(player->GetGUID());
+ if (!memberMe || member->IsRankNotLower(memberMe->GetRankId()))
+ SendCommandResult(session, GUILD_COMMAND_REMOVE, ERR_GUILD_RANK_TOO_HIGH_S, name);
+ else
+ {
+ uint64 guid = member->GetGUID();
+ // After call to DeleteMember pointer to member becomes invalid
+ DeleteMember(guid, false, true);
+ _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid));
+ _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName().c_str());
+ }
}
}
}
-void Guild::HandleUpdateMemberRank(WorldSession* session, const std::string& name, bool demote)
+void Guild::HandleUpdateMemberRank(WorldSession* session, std::string const& name, bool demote)
{
Player* player = session->GetPlayer();
+ GuildCommandType type = demote ? GUILD_COMMAND_DEMOTE : GUILD_COMMAND_PROMOTE;
// Player must have rights to promote
if (!_HasRankRight(player, demote ? GR_RIGHT_DEMOTE : GR_RIGHT_PROMOTE))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
+ SendCommandResult(session, type, ERR_GUILD_PERMISSIONS);
// Promoted player must be a member of guild
- else if (Member* member = GetMember(session, name))
+ else if (Member* member = GetMember(name))
{
// Player cannot promote himself
if (member->IsSamePlayer(player->GetGUID()))
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_NAME_INVALID);
+ SendCommandResult(session, type, ERR_GUILD_NAME_INVALID);
return;
}
+ Member const* memberMe = GetMember(player->GetGUID());
+ uint8 rankId = memberMe->GetRankId();
if (demote)
{
// Player can demote only lower rank members
- if (member->IsRankNotLower(player->GetRank()))
+ if (member->IsRankNotLower(rankId))
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_RANK_TOO_HIGH_S, name);
+ SendCommandResult(session, type, ERR_GUILD_RANK_TOO_HIGH_S, name);
return;
}
// Lowest rank cannot be demoted
if (member->GetRankId() >= _GetLowestRankId())
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_RANK_TOO_LOW_S, name);
+ SendCommandResult(session, type, ERR_GUILD_RANK_TOO_LOW_S, name);
return;
}
}
else
{
// Allow to promote only to lower rank than member's rank
- // member->GetRank() + 1 is the highest rank that current player can promote to
- if (member->IsRankNotLower(player->GetRank() + 1))
+ // member->GetRankId() + 1 is the highest rank that current player can promote to
+ if (member->IsRankNotLower(rankId + 1))
{
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_RANK_TOO_HIGH_S, name);
+ SendCommandResult(session, type, ERR_GUILD_RANK_TOO_HIGH_S, name);
return;
}
}
- // When promoting player, rank is decreased, when demoting - increased
uint32 newRankId = member->GetRankId() + (demote ? 1 : -1);
member->ChangeRank(newRankId);
_LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(member->GetGUID()), newRankId);
- _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName(), name.c_str(), _GetRankName(newRankId).c_str());
+ _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str());
}
}
-void Guild::HandleAddNewRank(WorldSession* session, const std::string& name)
+void Guild::HandleAddNewRank(WorldSession* session, std::string const& name)
{
- if (_GetRanksSize() >= GUILD_RANKS_MAX_COUNT)
+ uint8 size = _GetRanksSize();
+ if (size >= GUILD_RANKS_MAX_COUNT)
return;
// Only leader can add new rank
- if (!_IsLeader(session->GetPlayer()))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
- else
- {
- _CreateRank(name, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
- HandleQuery(session);
- HandleRoster(); // Broadcast for tab rights update
- }
+ if (_IsLeader(session->GetPlayer()))
+ if (_CreateRank(name, GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK))
+ {
+ char aux[2];
+ sprintf(aux, "%u", size);
+ _BroadcastEvent(GE_RANK_UPDATED, 0, aux, name.c_str());
+ }
}
void Guild::HandleRemoveLowestRank(WorldSession* session)
{
- // Cannot remove rank if total count is minimum allowed by the client
- if (_GetRanksSize() <= GUILD_RANKS_MIN_COUNT)
+ HandleRemoveRank(session, _GetLowestRankId());
+}
+
+void Guild::HandleRemoveRank(WorldSession* session, uint8 rankId)
+{
+ // Cannot remove rank if total count is minimum allowed by the client or is not leader
+ if (_GetRanksSize() <= GUILD_RANKS_MIN_COUNT || rankId >= _GetRanksSize() || !_IsLeader(session->GetPlayer()))
return;
- // Only leader can delete ranks
- if (!_IsLeader(session->GetPlayer()))
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
- else
- {
- uint8 rankId = _GetLowestRankId();
- // Delete bank rights for rank
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_RIGHTS_FOR_RANK);
- stmt->setUInt32(0, m_id);
- stmt->setUInt8 (1, rankId);
- CharacterDatabase.Execute(stmt);
- // Delete rank
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_LOWEST_RANK);
- stmt->setUInt32(0, m_id);
- stmt->setUInt8 (1, rankId);
- CharacterDatabase.Execute(stmt);
+ // Delete bank rights for rank
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_RIGHTS_FOR_RANK);
+ stmt->setUInt32(0, m_id);
+ stmt->setUInt8(1, rankId);
+ CharacterDatabase.Execute(stmt);
+ // Delete rank
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_LOWEST_RANK);
+ stmt->setUInt32(0, m_id);
+ stmt->setUInt8(1, rankId);
+ CharacterDatabase.Execute(stmt);
- m_ranks.pop_back();
+ m_ranks.pop_back();
- HandleQuery(session);
- HandleRoster(); // Broadcast for tab rights update
- }
+ _BroadcastEvent(GE_RANK_DELETED, 0);
}
void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
@@ -1622,26 +1718,23 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
sScriptMgr->OnGuildMemberDepositMoney(this, player, amount);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- // Add money to bank
_ModifyBankMoney(trans, amount, true);
- // Remove money from player
+
player->ModifyMoney(-int32(amount));
player->SaveGoldToDB(trans);
- // Log GM action (TODO: move to scripts)
+ _LogBankEvent(trans, GUILD_BANK_LOG_DEPOSIT_MONEY, uint8(0), player->GetGUIDLow(), amount);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ 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))
{
sLog->outCommand(player->GetSession()->GetAccountId(),
"GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)",
- player->GetName(), player->GetSession()->GetAccountId(), amount, m_id);
+ player->GetName().c_str(), player->GetSession()->GetAccountId(), amount, m_id);
}
- // Log guild bank event
- _LogBankEvent(trans, GUILD_BANK_LOG_DEPOSIT_MONEY, uint8(0), player->GetGUIDLow(), amount);
-
- CharacterDatabase.CommitTransaction(trans);
-
- SendBankTabsInfo(session);
- _SendBankContent(session, 0);
- _SendBankMoneyUpdate(session);
}
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair)
@@ -1650,24 +1743,20 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool
return false;
Player* player = session->GetPlayer();
- if (!_HasRankRight(player, repair ? GR_RIGHT_WITHDRAW_REPAIR : GR_RIGHT_WITHDRAW_GOLD))
- return false;
- uint32 remainingMoney = _GetMemberRemainingMoney(player->GetGUID());
- if (!remainingMoney)
+ Member* member = GetMember(player->GetGUID());
+ if (!member)
return false;
- if (remainingMoney < amount)
- return false;
+ if (uint32(_GetMemberRemainingMoney(member)) < amount) // Check if we have enough slot/money today
+ return false;
// Call script after validation and before money transfer.
sScriptMgr->OnGuildMemberWitdrawMoney(this, player, amount, repair);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
// Update remaining money amount
- if (remainingMoney < uint32(GUILD_WITHDRAW_MONEY_UNLIMITED))
- if (Member* member = GetMember(player->GetGUID()))
- member->DecreaseBankRemainingValue(trans, GUILD_BANK_MAX_TABS, amount);
+ member->UpdateBankWithdrawValue(trans, GUILD_BANK_MAX_TABS, amount);
// Remove money from bank
_ModifyBankMoney(trans, amount, false);
// Add money to player (if required)
@@ -1680,13 +1769,8 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool
_LogBankEvent(trans, repair ? GUILD_BANK_LOG_REPAIR_MONEY : GUILD_BANK_LOG_WITHDRAW_MONEY, uint8(0), player->GetGUIDLow(), amount);
CharacterDatabase.CommitTransaction(trans);
- SendMoneyInfo(session);
- if (!repair)
- {
- SendBankTabsInfo(session);
- _SendBankContent(session, 0);
- _SendBankMoneyUpdate(session);
- }
+ std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&amount), 8, true);
+ _BroadcastEvent(GE_BANK_MONEY_CHANGED, 0, aux.c_str());
return true;
}
@@ -1697,34 +1781,32 @@ void Guild::HandleMemberLogout(WorldSession* session)
{
member->SetStats(player);
member->UpdateLogoutTime();
+ member->ResetFlags();
}
- _BroadcastEvent(GE_SIGNED_OFF, player->GetGUID(), player->GetName());
+ _BroadcastEvent(GE_SIGNED_OFF, player->GetGUID(), player->GetName().c_str());
}
void Guild::HandleDisband(WorldSession* session)
{
// Only leader can disband guild
- if (!_IsLeader(session->GetPlayer()))
- Guild::SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PERMISSIONS);
- else
+ if (_IsLeader(session->GetPlayer()))
{
Disband();
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Guild Successfully Disbanded");
+ sLog->outDebug(LOG_FILTER_GUILD, "Guild Successfully Disbanded");
}
}
-///////////////////////////////////////////////////////////////////////////////
// Send data to client
void Guild::SendInfo(WorldSession* session) const
{
WorldPacket data(SMSG_GUILD_INFO, m_name.size() + 4 + 4 + 4);
data << m_name;
- data << secsToTimeBitFields(m_createdDate); // 3.x (prev. year + month + day)
+ data.AppendPackedTime(m_createdDate); // 3.x (prev. year + month + day)
data << uint32(m_members.size()); // Number of members
data << m_accountsNumber; // Number of accounts
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INFO)");
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_INFO [%s]", session->GetPlayerInfo().c_str());
}
void Guild::SendEventLog(WorldSession* session) const
@@ -1732,7 +1814,7 @@ void Guild::SendEventLog(WorldSession* session) const
WorldPacket data(MSG_GUILD_EVENT_LOG_QUERY, 1 + m_eventLog->GetSize() * (1 + 8 + 4));
m_eventLog->WritePacket(data);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_GUILD_EVENT_LOG_QUERY)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_EVENT_LOG_QUERY [%s]", session->GetPlayerInfo().c_str());
}
void Guild::SendBankLog(WorldSession* session, uint8 tabId) const
@@ -1745,87 +1827,87 @@ void Guild::SendBankLog(WorldSession* session, uint8 tabId) const
data << uint8(tabId);
pLog->WritePacket(data);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_GUILD_BANK_LOG_QUERY)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_LOG_QUERY [%s]", session->GetPlayerInfo().c_str());
}
}
void Guild::SendBankTabData(WorldSession* session, uint8 tabId) const
{
if (tabId < _GetPurchasedTabsSize())
- {
- SendMoneyInfo(session);
_SendBankContent(session, tabId);
- }
}
-void Guild::SendBankTabsInfo(WorldSession* session) const
+void Guild::SendBankTabsInfo(WorldSession* session, bool sendAllSlots /*= false*/) const
{
- WorldPacket data(SMSG_GUILD_BANK_LIST, 500);
-
- data << uint64(m_bankMoney);
- data << uint8(0); // TabInfo packet must be for tabId 0
- data << uint32(_GetMemberRemainingSlots(session->GetPlayer()->GetGUID(), 0));
- data << uint8(1); // Tell client that this packet includes tab info
-
- data << uint8(_GetPurchasedTabsSize()); // Number of tabs
- for (uint8 i = 0; i < _GetPurchasedTabsSize(); ++i)
- m_bankTabs[i]->WriteInfoPacket(data);
-
- data << uint8(0); // Do not send tab content
- session->SendPacket(&data);
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
+ _SendBankList(session, 0, sendAllSlots);
}
void Guild::SendBankTabText(WorldSession* session, uint8 tabId) const
{
- if (const BankTab* pTab = GetBankTab(tabId))
- pTab->SendText(this, session);
+ if (BankTab const* tab = GetBankTab(tabId))
+ tab->SendText(this, session);
}
void Guild::SendPermissions(WorldSession* session) const
{
- uint64 guid = session->GetPlayer()->GetGUID();
- uint8 rankId = session->GetPlayer()->GetRank();
+ Member const* member = GetMember(session->GetPlayer()->GetGUID());
+ if (!member)
+ return;
+
+ uint8 rankId = member->GetRankId();
WorldPacket data(MSG_GUILD_PERMISSIONS, 4 * 15 + 1);
data << uint32(rankId);
data << uint32(_GetRankRights(rankId));
- data << uint32(_GetMemberRemainingMoney(guid));
- data << uint8 (_GetPurchasedTabsSize());
- // Why sending all info when not all tabs are purchased???
+ data << uint32(_GetMemberRemainingMoney(member));
+ data << uint8(_GetPurchasedTabsSize());
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
{
data << uint32(_GetRankBankTabRights(rankId, tabId));
- data << uint32(_GetMemberRemainingSlots(guid, tabId));
+ data << uint32(_GetMemberRemainingSlots(member, tabId));
}
+
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_GUILD_PERMISSIONS)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_PERMISSIONS [%s] Rank: %u", session->GetPlayerInfo().c_str(), rankId);
}
void Guild::SendMoneyInfo(WorldSession* session) const
{
+ Member const* member = GetMember(session->GetPlayer()->GetGUID());
+ if (!member)
+ return;
+
+ int32 amount = _GetMemberRemainingMoney(member);
WorldPacket data(MSG_GUILD_BANK_MONEY_WITHDRAWN, 4);
- data << uint32(_GetMemberRemainingMoney(session->GetPlayer()->GetGUID()));
+ data << int32(amount);
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent MSG_GUILD_BANK_MONEY_WITHDRAWN");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount);
}
-void Guild::SendLoginInfo(WorldSession* session) const
+void Guild::SendLoginInfo(WorldSession* session)
{
WorldPacket data(SMSG_GUILD_EVENT, 1 + 1 + m_motd.size() + 1);
data << uint8(GE_MOTD);
data << uint8(1);
data << m_motd;
session->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent guild MOTD (SMSG_GUILD_EVENT)");
+
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [%s] MOTD", session->GetPlayerInfo().c_str());
SendBankTabsInfo(session);
- _BroadcastEvent(GE_SIGNED_ON, session->GetPlayer()->GetGUID(), session->GetPlayer()->GetName());
+ Player* player = session->GetPlayer();
+
+ HandleRoster(session);
+ _BroadcastEvent(GE_SIGNED_ON, player->GetGUID(), player->GetName().c_str());
+
+ if (Member* member = GetMember(player->GetGUID()))
+ {
+ member->SetStats(player);
+ member->AddFlag(GUILDMEMBER_STATUS_ONLINE);
+ }
}
-///////////////////////////////////////////////////////////////////////////////
// Loading methods
bool Guild::LoadFromDB(Field* fields)
{
@@ -1875,10 +1957,10 @@ bool Guild::LoadMemberFromDB(Field* fields)
void Guild::LoadBankRightFromDB(Field* fields)
{
- // rights slots
- GuildBankRightsAndSlots rightsAndSlots(fields[3].GetUInt8(), fields[4].GetUInt32());
- // rankId tabId
- _SetRankBankTabRightsAndSlots(fields[2].GetUInt8(), fields[1].GetUInt8(), rightsAndSlots, false);
+ // tabId rights slots
+ GuildBankRightsAndSlots rightsAndSlots(fields[1].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt32());
+ // rankId
+ _SetRankBankTabRightsAndSlots(fields[2].GetUInt8(), rightsAndSlots, false);
}
bool Guild::LoadEventLogFromDB(Field* fields)
@@ -1914,13 +1996,13 @@ bool Guild::LoadBankEventLogFromDB(Field* fields)
{
if (!isMoneyTab)
{
- sLog->outError("GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId);
+ sLog->outError(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId);
return false;
}
}
else if (isMoneyTab)
{
- sLog->outError("GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id);
+ sLog->outError(LOG_FILTER_GUILD, "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id);
return false;
}
pLog->LoadEvent(new BankEventLogEntry(
@@ -1938,15 +2020,13 @@ bool Guild::LoadBankEventLogFromDB(Field* fields)
return true;
}
-bool Guild::LoadBankTabFromDB(Field* fields)
+void Guild::LoadBankTabFromDB(Field* fields)
{
uint8 tabId = fields[1].GetUInt8();
if (tabId >= _GetPurchasedTabsSize())
- {
- sLog->outError("Invalid tab (tabId: %u) in guild bank, skipped.", tabId);
- return false;
- }
- return m_bankTabs[tabId]->LoadFromDB(fields);
+ sLog->outError(LOG_FILTER_GUILD, "Invalid tab (tabId: %u) in guild bank, skipped.", tabId);
+ else
+ m_bankTabs[tabId]->LoadFromDB(fields);
}
bool Guild::LoadBankItemFromDB(Field* fields)
@@ -1954,7 +2034,7 @@ bool Guild::LoadBankItemFromDB(Field* fields)
uint8 tabId = fields[12].GetUInt8();
if (tabId >= _GetPurchasedTabsSize())
{
- sLog->outError("Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.",
+ sLog->outError(LOG_FILTER_GUILD, "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.",
fields[14].GetUInt32(), fields[15].GetUInt32());
return false;
}
@@ -1970,21 +2050,28 @@ bool Guild::Validate()
// Between ranks in sequence cannot be gaps - so 0, 1, 2, 4 is impossible
// Min ranks count is 5 and max is 10.
bool broken_ranks = false;
- if (_GetRanksSize() < GUILD_RANKS_MIN_COUNT || _GetRanksSize() > GUILD_RANKS_MAX_COUNT)
+ uint8 ranks = _GetRanksSize();
+ if (ranks < GUILD_RANKS_MIN_COUNT || ranks > GUILD_RANKS_MAX_COUNT)
{
- sLog->outError("Guild %u has invalid number of ranks, creating new...", m_id);
+ sLog->outError(LOG_FILTER_GUILD, "Guild %u has invalid number of ranks, creating new...", m_id);
broken_ranks = true;
}
else
{
- for (uint8 rankId = 0; rankId < _GetRanksSize(); ++rankId)
+ for (uint8 rankId = 0; rankId < ranks; ++rankId)
{
RankInfo* rankInfo = GetRankInfo(rankId);
if (rankInfo->GetId() != rankId)
{
- sLog->outError("Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId);
+ sLog->outError(LOG_FILTER_GUILD, "Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId);
broken_ranks = true;
}
+ else
+ {
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ rankInfo->CreateMissingTabsIfNeeded(_GetPurchasedTabsSize(), trans, true);
+ CharacterDatabase.CommitTransaction(trans);
+ }
}
}
@@ -2026,9 +2113,8 @@ bool Guild::Validate()
return true;
}
-///////////////////////////////////////////////////////////////////////////////
// Broadcasts
-void Guild::BroadcastToGuild(WorldSession* session, bool officerOnly, const std::string& msg, uint32 language) const
+void Guild::BroadcastToGuild(WorldSession* session, bool officerOnly, std::string const& msg, uint32 language) const
{
if (session && session->GetPlayer() && _HasRankRight(session->GetPlayer(), officerOnly ? GR_RIGHT_OFFCHATSPEAK : GR_RIGHT_GCHATSPEAK))
{
@@ -2057,7 +2143,39 @@ void Guild::BroadcastPacket(WorldPacket* packet) const
player->GetSession()->SendPacket(packet);
}
-///////////////////////////////////////////////////////////////////////////////
+void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 maxLevel, uint32 minRank)
+{
+ uint32 count = 0;
+
+ WorldPacket data(SMSG_CALENDAR_FILTER_GUILD);
+ data << uint32(count); // count placeholder
+
+ for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
+ {
+ // not sure if needed, maybe client checks it as well
+ if (count >= CALENDAR_MAX_INVITES)
+ {
+ if (Player* player = session->GetPlayer())
+ sCalendarMgr->SendCalendarCommandResult(player->GetGUID(), CALENDAR_ERROR_INVITES_EXCEEDED);
+ return;
+ }
+
+ Member* member = itr->second;
+ uint32 level = Player::GetLevelFromDB(member->GetGUID());
+
+ if (member->GetGUID() != session->GetPlayer()->GetGUID() && level >= minLevel && level <= maxLevel && member->IsRankNotLower(minRank))
+ {
+ data.appendPackGUID(member->GetGUID());
+ data << uint8(0); // unk
+ ++count;
+ }
+ }
+
+ data.put<uint32>(0, count);
+
+ session->SendPacket(&data);
+}
+
// Members handling
bool Guild::AddMember(uint64 guid, uint8 rankId)
{
@@ -2077,15 +2195,26 @@ bool Guild::AddMember(uint64 guid, uint8 rankId)
uint32 lowguid = GUID_LOPART(guid);
- // If rank was not passed, assing lowest possible rank
+ // If rank was not passed, assign lowest possible rank
if (rankId == GUILD_RANK_NONE)
rankId = _GetLowestRankId();
Member* member = new Member(m_id, guid, rankId);
+ std::string name;
if (player)
+ {
+ m_members[lowguid] = member;
+ player->SetInGuild(m_id);
+ player->SetGuildIdInvited(0);
+ player->SetRank(rankId);
member->SetStats(player);
+ SendLoginInfo(player->GetSession());
+ name = player->GetName();
+ }
else
{
+ member->ResetFlags();
+
bool ok = false;
// Player must exist
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DATA_FOR_GUILD);
@@ -2093,8 +2222,9 @@ bool Guild::AddMember(uint64 guid, uint8 rankId)
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
+ name = fields[0].GetString();
member->SetStats(
- fields[0].GetString(),
+ name,
fields[1].GetUInt8(),
fields[2].GetUInt8(),
fields[3].GetUInt16(),
@@ -2107,20 +2237,15 @@ bool Guild::AddMember(uint64 guid, uint8 rankId)
delete member;
return false;
}
+ m_members[lowguid] = member;
}
- m_members[lowguid] = member;
SQLTransaction trans(NULL);
member->SaveToDB(trans);
- // If player not in game data in will be loaded from guild tables, so no need to update it!
- if (player)
- {
- player->SetInGuild(m_id);
- player->SetRank(rankId);
- player->SetGuildIdInvited(0);
- }
_UpdateAccountsNumber();
+ _LogEvent(GUILD_EVENT_LOG_JOIN_GUILD, lowguid);
+ _BroadcastEvent(GE_JOINED, guid, name.c_str());
// Call scripts if member was succesfully added (and stored to database)
sScriptMgr->OnGuildAddMember(this, player, rankId);
@@ -2146,6 +2271,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked)
else if (!newLeader || newLeader->GetRankId() > i->second->GetRankId())
newLeader = i->second;
}
+
if (!newLeader)
{
Disband();
@@ -2165,7 +2291,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked)
_BroadcastEvent(GE_LEFT, guid, oldLeader->GetName().c_str());
}
}
- // Call script on remove before member is acutally removed from guild (and database)
+ // Call script on remove before member is actually removed from guild (and database)
sScriptMgr->OnGuildRemoveMember(this, player, isDisbanding, isKicked);
if (Member* member = GetMember(guid))
@@ -2195,7 +2321,6 @@ bool Guild::ChangeMemberRank(uint64 guid, uint8 newRank)
return false;
}
-///////////////////////////////////////////////////////////////////////////////
// Bank (items move)
void Guild::SwapItems(Player* player, uint8 tabId, uint8 slotId, uint8 destTabId, uint8 destSlotId, uint32 splitedAmount)
{
@@ -2224,9 +2349,8 @@ void Guild::SwapItemsWithInventory(Player* player, bool toChar, uint8 tabId, uin
_MoveItems(&charData, &bankData, splitedAmount);
}
-///////////////////////////////////////////////////////////////////////////////
// Bank tabs
-void Guild::SetBankTabText(uint8 tabId, const std::string& text)
+void Guild::SetBankTabText(uint8 tabId, std::string const& text)
{
if (BankTab* pTab = GetBankTab(tabId))
{
@@ -2235,7 +2359,6 @@ void Guild::SetBankTabText(uint8 tabId, const std::string& text)
}
}
-///////////////////////////////////////////////////////////////////////////////
// Private methods
void Guild::_CreateLogHolders()
{
@@ -2244,18 +2367,14 @@ void Guild::_CreateLogHolders()
m_bankEventLog[tabId] = new LogHolder(m_id, sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT));
}
-bool Guild::_CreateNewBankTab()
+void Guild::_CreateNewBankTab()
{
- if (_GetPurchasedTabsSize() >= GUILD_BANK_MAX_TABS)
- return false;
-
uint8 tabId = _GetPurchasedTabsSize(); // Next free id
m_bankTabs.push_back(new BankTab(m_id, tabId));
- PreparedStatement* stmt = NULL;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_TAB);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_TAB);
stmt->setUInt32(0, m_id);
stmt->setUInt8 (1, tabId);
trans->Append(stmt);
@@ -2265,15 +2384,16 @@ bool Guild::_CreateNewBankTab()
stmt->setUInt8 (1, tabId);
trans->Append(stmt);
+ ++tabId;
+ for (Ranks::iterator itr = m_ranks.begin(); itr != m_ranks.end(); ++itr)
+ (*itr).CreateMissingTabsIfNeeded(tabId, trans, false);
+
CharacterDatabase.CommitTransaction(trans);
- return true;
}
void Guild::_CreateDefaultGuildRanks(LocaleConstant loc)
{
- PreparedStatement* stmt = NULL;
-
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_RANKS);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_RANKS);
stmt->setUInt32(0, m_id);
CharacterDatabase.Execute(stmt);
@@ -2288,29 +2408,22 @@ void Guild::_CreateDefaultGuildRanks(LocaleConstant loc)
_CreateRank(sObjectMgr->GetTrinityString(LANG_GUILD_INITIATE, loc), GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
}
-void Guild::_CreateRank(const std::string& name, uint32 rights)
+bool Guild::_CreateRank(std::string const& name, uint32 rights)
{
- if (_GetRanksSize() >= GUILD_RANKS_MAX_COUNT)
- return;
-
- // Ranks represent sequence 0, 1, 2, ... where 0 means guildmaster
uint8 newRankId = _GetRanksSize();
+ if (newRankId >= GUILD_RANKS_MAX_COUNT)
+ return false;
+ // Ranks represent sequence 0, 1, 2, ... where 0 means guildmaster
RankInfo info(m_id, newRankId, name, rights, 0);
m_ranks.push_back(info);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
- for (uint8 i = 0; i < _GetPurchasedTabsSize(); ++i)
- {
- // Create bank rights with default values
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT_DEFAULT);
- stmt->setUInt32(0, m_id);
- stmt->setUInt8 (1, i);
- stmt->setUInt8 (2, newRankId);
- trans->Append(stmt);
- }
+ info.CreateMissingTabsIfNeeded(_GetPurchasedTabsSize(), trans);
info.SaveToDB(trans);
CharacterDatabase.CommitTransaction(trans);
+
+ return true;
}
// Updates the number of accounts that are in the guild
@@ -2384,28 +2497,16 @@ void Guild::_SetLeaderGUID(Member* pLeader)
void Guild::_SetRankBankMoneyPerDay(uint8 rankId, uint32 moneyPerDay)
{
if (RankInfo* rankInfo = GetRankInfo(rankId))
- {
- for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
- if (itr->second->IsRank(rankId))
- itr->second->ResetMoneyTime();
-
rankInfo->SetBankMoneyPerDay(moneyPerDay);
- }
}
-void Guild::_SetRankBankTabRightsAndSlots(uint8 rankId, uint8 tabId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB)
+void Guild::_SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB)
{
- if (tabId >= _GetPurchasedTabsSize())
+ if (rightsAndSlots.GetTabId() >= _GetPurchasedTabsSize())
return;
if (RankInfo* rankInfo = GetRankInfo(rankId))
- {
- for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
- if (itr->second->IsRank(rankId))
- itr->second->ResetTabTimes();
-
- rankInfo->SetBankTabSlotsAndRights(tabId, rightsAndSlots, saveToDB);
- }
+ rankInfo->SetBankTabSlotsAndRights(rightsAndSlots, saveToDB);
}
inline std::string Guild::_GetRankName(uint8 rankId) const
@@ -2422,14 +2523,14 @@ inline uint32 Guild::_GetRankRights(uint8 rankId) const
return 0;
}
-inline uint32 Guild::_GetRankBankMoneyPerDay(uint8 rankId) const
+inline int32 Guild::_GetRankBankMoneyPerDay(uint8 rankId) const
{
if (const RankInfo* rankInfo = GetRankInfo(rankId))
return rankInfo->GetBankMoneyPerDay();
return 0;
}
-inline uint32 Guild::_GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const
+inline int32 Guild::_GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const
{
if (tabId < _GetPurchasedTabsSize())
if (const RankInfo* rankInfo = GetRankInfo(rankId))
@@ -2437,35 +2538,57 @@ inline uint32 Guild::_GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const
return 0;
}
-inline uint8 Guild::_GetRankBankTabRights(uint8 rankId, uint8 tabId) const
+inline int8 Guild::_GetRankBankTabRights(uint8 rankId, uint8 tabId) const
{
if (const RankInfo* rankInfo = GetRankInfo(rankId))
return rankInfo->GetBankTabRights(tabId);
return 0;
}
-inline uint32 Guild::_GetMemberRemainingSlots(uint64 guid, uint8 tabId) const
+inline int32 Guild::_GetMemberRemainingSlots(Member const* member, uint8 tabId) const
{
- if (const Member* member = GetMember(guid))
- return member->GetBankRemainingValue(tabId, this);
+ if (member)
+ {
+ uint8 rankId = member->GetRankId();
+ if (rankId == GR_GUILDMASTER)
+ return GUILD_WITHDRAW_SLOT_UNLIMITED;
+ if ((_GetRankBankTabRights(rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GR_RIGHT_EMPTY)
+ {
+ int32 remaining = _GetRankBankTabSlotsPerDay(rankId, tabId) - member->GetBankWithdrawValue(tabId);
+ if (remaining > 0)
+ return remaining;
+ }
+ }
return 0;
}
-inline uint32 Guild::_GetMemberRemainingMoney(uint64 guid) const
+inline int32 Guild::_GetMemberRemainingMoney(Member const* member) const
{
- if (const Member* member = GetMember(guid))
- return member->GetBankRemainingValue(GUILD_BANK_MAX_TABS, this);
+ if (member)
+ {
+ uint8 rankId = member->GetRankId();
+ if (rankId == GR_GUILDMASTER)
+ return GUILD_WITHDRAW_MONEY_UNLIMITED;
+
+ if ((_GetRankRights(rankId) & (GR_RIGHT_WITHDRAW_REPAIR | GR_RIGHT_WITHDRAW_GOLD)) != GR_RIGHT_EMPTY)
+ {
+ int32 remaining = _GetRankBankMoneyPerDay(rankId) - member->GetBankWithdrawValue(GUILD_BANK_MAX_TABS);
+ if (remaining > 0)
+ return remaining;
+ }
+ }
return 0;
}
-inline void Guild::_DecreaseMemberRemainingSlots(SQLTransaction& trans, uint64 guid, uint8 tabId)
+inline void Guild::_UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId)
{
- // Remaining slots must be more then 0
- if (uint32 remainingSlots = _GetMemberRemainingSlots(guid, tabId))
- // Ignore guild master
- if (remainingSlots < uint32(GUILD_WITHDRAW_SLOT_UNLIMITED))
- if (Member* member = GetMember(guid))
- member->DecreaseBankRemainingValue(trans, tabId, 1);
+ if (Member* member = GetMember(guid))
+ {
+ uint8 rankId = member->GetRankId();
+ if (rankId != GR_GUILDMASTER
+ && member->GetBankWithdrawValue(tabId) < _GetRankBankTabSlotsPerDay(rankId, tabId))
+ member->UpdateBankWithdrawValue(trans, tabId, 1);
+ }
}
inline bool Guild::_MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const
@@ -2496,6 +2619,10 @@ void Guild::_LogBankEvent(SQLTransaction& trans, GuildBankEventLogTypes eventTyp
if (tabId > GUILD_BANK_MAX_TABS)
return;
+ // not logging moves within the same tab
+ if (eventType == GUILD_BANK_LOG_MOVE_ITEM && tabId == destTabId)
+ return;
+
uint8 dbTabId = tabId;
if (BankEventLogEntry::IsMoneyEvent(eventType))
{
@@ -2533,7 +2660,7 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm
/*
if (pItemSrc->GetCount() == 0)
{
- sLog->outCrash("Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!",
+ sLog->outFatal(LOG_FILTER_GUILD, "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!",
player->GetName(), player->GetGUIDLow(), pItemSrc->GetEntry(), tabId, slotId, destTabId, destSlotId, pItemSrc->GetEntry());
//return; // Commented out for now, uncomment when it's verified that this causes a crash!!
}
@@ -2629,36 +2756,15 @@ bool Guild::_DoItemsMove(MoveItemData* pSrc, MoveItemData* pDest, bool sendError
void Guild::_SendBankContent(WorldSession* session, uint8 tabId) const
{
uint64 guid = session->GetPlayer()->GetGUID();
- if (_MemberHasTabRights(guid, tabId, GUILD_BANK_RIGHT_VIEW_TAB))
- if (const BankTab* pTab = GetBankTab(tabId))
- {
- WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
-
- data << uint64(m_bankMoney);
- data << uint8(tabId);
- data << uint32(_GetMemberRemainingSlots(guid, tabId));
- data << uint8(0); // Tell client that there's no tab info in this packet
-
- pTab->WritePacket(data);
-
- session->SendPacket(&data);
+ if (!_MemberHasTabRights(guid, tabId, GUILD_BANK_RIGHT_VIEW_TAB))
+ return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
- }
+ _SendBankList(session, tabId, true);
}
void Guild::_SendBankMoneyUpdate(WorldSession* session) const
{
- WorldPacket data(SMSG_GUILD_BANK_LIST, 8 + 1 + 4 + 1 + 1);
-
- data << uint64(m_bankMoney);
- data << uint8(0); // tabId, default 0
- data << uint32(_GetMemberRemainingSlots(session->GetPlayer()->GetGUID(), 0));
- data << uint8(0); // Tell that there's no tab info in this packet
- data << uint8(0); // No items
- BroadcastPacket(&data);
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
+ _SendBankList(session);
}
void Guild::_SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const
@@ -2689,37 +2795,13 @@ void Guild::_SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) cons
tabId = pDest->GetContainer();
pDest->CopySlots(slots);
}
+
_SendBankContentUpdate(tabId, slots);
}
void Guild::_SendBankContentUpdate(uint8 tabId, SlotIds slots) const
{
- if (const BankTab* pTab = GetBankTab(tabId))
- {
- WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
-
- data << uint64(m_bankMoney);
- data << uint8(tabId);
-
- size_t rempos = data.wpos();
- data << uint32(0); // Item withdraw amount, will be filled later
- data << uint8(0); // Tell client that there's no tab info in this packet
-
- data << uint8(slots.size());
- for (uint8 slotId = 0; slotId < GUILD_BANK_MAX_SLOTS; ++slotId)
- if (slots.find(slotId) != slots.end())
- pTab->WriteSlotPacket(data, slotId);
-
- for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
- if (_MemberHasTabRights(itr->second->GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
- if (Player* player = itr->second->FindPlayer())
- {
- data.put<uint32>(rempos, uint32(_GetMemberRemainingSlots(player->GetGUID(), tabId)));
- player->GetSession()->SendPacket(&data);
- }
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)");
- }
+ _SendBankList(NULL, tabId, false, &slots);
}
void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1, const char* param2, const char* param3) const
@@ -2742,5 +2824,74 @@ void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* par
BroadcastPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GUILD_EVENT");
+ if (sLog->ShouldLog(LOG_FILTER_GUILD, LOG_LEVEL_DEBUG))
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [Broadcast] Event: %s (%u)", _GetGuildEventString(guildEvent).c_str(), guildEvent);
+}
+
+void Guild::_SendBankList(WorldSession* session /* = NULL*/, uint8 tabId /*= 0*/, bool sendAllSlots /*= false*/, SlotIds *slots /*= NULL*/) const
+{
+ WorldPacket data(SMSG_GUILD_BANK_LIST, 500);
+ data << uint64(m_bankMoney);
+ data << uint8(tabId);
+ size_t rempos = data.wpos();
+ data << uint32(0);
+ data << uint8(sendAllSlots);
+
+ if (sendAllSlots && !tabId)
+ {
+ data << uint8(_GetPurchasedTabsSize()); // Number of tabs
+ for (uint8 i = 0; i < _GetPurchasedTabsSize(); ++i)
+ m_bankTabs[i]->WriteInfoPacket(data);
+ }
+
+ BankTab const* tab = GetBankTab(tabId);
+ if (!tab)
+ data << uint8(0);
+ else if (sendAllSlots)
+ tab->WritePacket(data);
+ else if (slots && !slots->empty())
+ {
+ data << uint8(slots->size());
+ for (SlotIds::const_iterator itr = slots->begin(); itr != slots->end(); ++itr)
+ tab->WriteSlotPacket(data, *itr, false);
+ }
+ else
+ data << uint8(0);
+
+ if (session)
+ {
+ int32 numSlots = 0;
+ if (Member const* member = GetMember(session->GetPlayer()->GetGUID()))
+ numSlots = _GetMemberRemainingSlots(member, tabId);
+ data.put<uint32>(rempos, numSlots);
+ session->SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %d",
+ session->GetPlayerInfo().c_str(), tabId, sendAllSlots, numSlots);
+ }
+ else // TODO - Probably this is just sent to session + those that have sent CMSG_GUILD_BANKER_ACTIVATE
+ {
+ for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
+ {
+ if (!_MemberHasTabRights(itr->second->GetGUID(), tabId, GUILD_BANK_RIGHT_VIEW_TAB))
+ continue;
+ Player* player = itr->second->FindPlayer();
+ if (!player)
+ continue;
+
+ uint32 numSlots = _GetMemberRemainingSlots(itr->second, tabId);
+ data.put<uint32>(rempos, numSlots);
+ player->GetSession()->SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %u"
+ , player->GetName().c_str(), tabId, sendAllSlots, numSlots);
+ }
+ }
+}
+
+void Guild::ResetTimes()
+{
+ for (Members::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
+ itr->second->ResetValues();
+
+ // Hack... way to force client to ask for money/slots
+ _BroadcastEvent(GE_RANK_UPDATED, 0, "0", GetRankInfo(0)->GetName().c_str());
}
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index e18e62e51b7..2f43245159b 100755..100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -38,6 +38,13 @@ enum GuildMisc
GUILD_WITHDRAW_MONEY_UNLIMITED = 0xFFFFFFFF,
GUILD_WITHDRAW_SLOT_UNLIMITED = 0xFFFFFFFF,
GUILD_EVENT_LOG_GUID_UNDEFINED = 0xFFFFFFFF,
+ TAB_UNDEFINED = 0xFF,
+};
+
+enum GuildMemberData
+{
+ GUILD_MEMBER_DATA_ZONEID,
+ GUILD_MEMBER_DATA_LEVEL,
};
enum GuildDefaultRanks
@@ -47,143 +54,153 @@ enum GuildDefaultRanks
GR_OFFICER = 1,
GR_VETERAN = 2,
GR_MEMBER = 3,
- GR_INITIATE = 4,
+ GR_INITIATE = 4
// When promoting member server does: rank--
// When demoting member server does: rank++
};
enum GuildRankRights
{
- GR_RIGHT_EMPTY = 0x00000040,
- GR_RIGHT_GCHATLISTEN = GR_RIGHT_EMPTY | 0x00000001,
- GR_RIGHT_GCHATSPEAK = GR_RIGHT_EMPTY | 0x00000002,
- GR_RIGHT_OFFCHATLISTEN = GR_RIGHT_EMPTY | 0x00000004,
- GR_RIGHT_OFFCHATSPEAK = GR_RIGHT_EMPTY | 0x00000008,
- GR_RIGHT_INVITE = GR_RIGHT_EMPTY | 0x00000010,
- GR_RIGHT_REMOVE = GR_RIGHT_EMPTY | 0x00000020,
- GR_RIGHT_PROMOTE = GR_RIGHT_EMPTY | 0x00000080,
- GR_RIGHT_DEMOTE = GR_RIGHT_EMPTY | 0x00000100,
- GR_RIGHT_SETMOTD = GR_RIGHT_EMPTY | 0x00001000,
- GR_RIGHT_EPNOTE = GR_RIGHT_EMPTY | 0x00002000,
- GR_RIGHT_VIEWOFFNOTE = GR_RIGHT_EMPTY | 0x00004000,
- GR_RIGHT_EOFFNOTE = GR_RIGHT_EMPTY | 0x00008000,
- GR_RIGHT_MODIFY_GUILD_INFO = GR_RIGHT_EMPTY | 0x00010000,
- GR_RIGHT_WITHDRAW_GOLD_LOCK = 0x00020000, // remove money withdraw capacity
- GR_RIGHT_WITHDRAW_REPAIR = 0x00040000, // withdraw for repair
- GR_RIGHT_WITHDRAW_GOLD = 0x00080000, // withdraw gold
- GR_RIGHT_CREATE_GUILD_EVENT = 0x00100000, // wotlk
- GR_RIGHT_ALL = 0x001DF1FF
+ GR_RIGHT_EMPTY = 0x00000040,
+ GR_RIGHT_GCHATLISTEN = GR_RIGHT_EMPTY | 0x00000001,
+ GR_RIGHT_GCHATSPEAK = GR_RIGHT_EMPTY | 0x00000002,
+ GR_RIGHT_OFFCHATLISTEN = GR_RIGHT_EMPTY | 0x00000004,
+ GR_RIGHT_OFFCHATSPEAK = GR_RIGHT_EMPTY | 0x00000008,
+ GR_RIGHT_INVITE = GR_RIGHT_EMPTY | 0x00000010,
+ GR_RIGHT_REMOVE = GR_RIGHT_EMPTY | 0x00000020,
+ GR_RIGHT_PROMOTE = GR_RIGHT_EMPTY | 0x00000080,
+ GR_RIGHT_DEMOTE = GR_RIGHT_EMPTY | 0x00000100,
+ GR_RIGHT_SETMOTD = GR_RIGHT_EMPTY | 0x00001000,
+ GR_RIGHT_EPNOTE = GR_RIGHT_EMPTY | 0x00002000,
+ GR_RIGHT_VIEWOFFNOTE = GR_RIGHT_EMPTY | 0x00004000,
+ GR_RIGHT_EOFFNOTE = GR_RIGHT_EMPTY | 0x00008000,
+ GR_RIGHT_MODIFY_GUILD_INFO = GR_RIGHT_EMPTY | 0x00010000,
+ GR_RIGHT_WITHDRAW_GOLD_LOCK = 0x00020000, // remove money withdraw capacity
+ GR_RIGHT_WITHDRAW_REPAIR = 0x00040000, // withdraw for repair
+ GR_RIGHT_WITHDRAW_GOLD = 0x00080000, // withdraw gold
+ GR_RIGHT_CREATE_GUILD_EVENT = 0x00100000, // wotlk
+ GR_RIGHT_ALL = 0x001DF1FF
};
enum GuildCommandType
{
- GUILD_CREATE_S = 0x00,
- GUILD_INVITE_S = 0x01,
- GUILD_QUIT_S = 0x03,
- GUILD_FOUNDER_S = 0x0E,
- GUILD_UNK1 = 0x13,
- GUILD_UNK2 = 0x14
+ GUILD_COMMAND_CREATE = 0,
+ GUILD_COMMAND_INVITE = 1,
+ GUILD_COMMAND_QUIT = 3,
+ GUILD_COMMAND_ROSTER = 5,
+ GUILD_COMMAND_PROMOTE = 6,
+ GUILD_COMMAND_DEMOTE = 7,
+ GUILD_COMMAND_REMOVE = 8,
+ GUILD_COMMAND_CHANGE_LEADER = 10,
+ GUILD_COMMAND_EDIT_MOTD = 11,
+ GUILD_COMMAND_GUILD_CHAT = 13,
+ GUILD_COMMAND_FOUNDER = 14,
+ GUILD_COMMAND_CHANGE_RANK = 16,
+ GUILD_COMMAND_PUBLIC_NOTE = 19,
+ GUILD_COMMAND_VIEW_TAB = 21,
+ GUILD_COMMAND_MOVE_ITEM = 22,
+ GUILD_COMMAND_REPAIR = 25,
};
enum GuildCommandError
{
- ERR_PLAYER_NO_MORE_IN_GUILD = 0x00,
- ERR_GUILD_INTERNAL = 0x01,
- ERR_ALREADY_IN_GUILD = 0x02,
- ERR_ALREADY_IN_GUILD_S = 0x03,
- ERR_INVITED_TO_GUILD = 0x04,
- ERR_ALREADY_INVITED_TO_GUILD_S = 0x05,
- ERR_GUILD_NAME_INVALID = 0x06,
- ERR_GUILD_NAME_EXISTS_S = 0x07,
- ERR_GUILD_LEADER_LEAVE = 0x08,
- ERR_GUILD_PERMISSIONS = 0x08,
- ERR_GUILD_PLAYER_NOT_IN_GUILD = 0x09,
- ERR_GUILD_PLAYER_NOT_IN_GUILD_S = 0x0A,
- ERR_GUILD_PLAYER_NOT_FOUND_S = 0x0B,
- ERR_GUILD_NOT_ALLIED = 0x0C,
- ERR_GUILD_RANK_TOO_HIGH_S = 0x0D,
- ERR_GUILD_RANK_TOO_LOW_S = 0x0E,
- ERR_GUILD_RANKS_LOCKED = 0x11,
- ERR_GUILD_RANK_IN_USE = 0x12,
- ERR_GUILD_IGNORING_YOU_S = 0x13,
- ERR_GUILD_UNK1 = 0x14,
- ERR_GUILD_WITHDRAW_LIMIT = 0x19,
- ERR_GUILD_NOT_ENOUGH_MONEY = 0x1A,
- ERR_GUILD_BANK_FULL = 0x1C,
- ERR_GUILD_ITEM_NOT_FOUND = 0x1D
+ ERR_GUILD_COMMAND_SUCCESS = 0,
+ ERR_GUILD_INTERNAL = 1,
+ ERR_ALREADY_IN_GUILD = 2,
+ ERR_ALREADY_IN_GUILD_S = 3,
+ ERR_INVITED_TO_GUILD = 4,
+ ERR_ALREADY_INVITED_TO_GUILD_S = 5,
+ ERR_GUILD_NAME_INVALID = 6,
+ ERR_GUILD_NAME_EXISTS_S = 7,
+ ERR_GUILD_LEADER_LEAVE = 8,
+ ERR_GUILD_PERMISSIONS = 8,
+ ERR_GUILD_PLAYER_NOT_IN_GUILD = 9,
+ ERR_GUILD_PLAYER_NOT_IN_GUILD_S = 10,
+ ERR_GUILD_PLAYER_NOT_FOUND_S = 11,
+ ERR_GUILD_NOT_ALLIED = 12,
+ ERR_GUILD_RANK_TOO_HIGH_S = 13,
+ ERR_GUILD_RANK_TOO_LOW_S = 14,
+ ERR_GUILD_RANKS_LOCKED = 17,
+ ERR_GUILD_RANK_IN_USE = 18,
+ ERR_GUILD_IGNORING_YOU_S = 19,
+ ERR_GUILD_UNK1 = 20, // Forces roster update
+ ERR_GUILD_WITHDRAW_LIMIT = 25,
+ ERR_GUILD_NOT_ENOUGH_MONEY = 26,
+ ERR_GUILD_BANK_FULL = 28,
+ ERR_GUILD_ITEM_NOT_FOUND = 29,
};
enum GuildEvents
{
- GE_PROMOTION = 0x00,
- GE_DEMOTION = 0x01,
- GE_MOTD = 0x02,
- GE_JOINED = 0x03,
- GE_LEFT = 0x04,
- GE_REMOVED = 0x05,
- GE_LEADER_IS = 0x06,
- GE_LEADER_CHANGED = 0x07,
- GE_DISBANDED = 0x08,
- GE_TABARDCHANGE = 0x09,
- GE_UNK1 = 0x0A, // string, string EVENT_GUILD_ROSTER_UPDATE tab content change?
- GE_UNK2 = 0x0B, // EVENT_GUILD_ROSTER_UPDATE
- GE_SIGNED_ON = 0x0C, // ERR_FRIEND_ONLINE_SS
- GE_SIGNED_OFF = 0x0D, // ERR_FRIEND_OFFLINE_S
- GE_GUILDBANK_BAGSLOTS_CHANGED = 0x0E, // EVENT_GUILDBANK_BAGSLOTS_CHANGED
- GE_GUILDBANK_TAB_PURCHASED = 0x0F, // EVENT_GUILDBANK_UPDATE_TABS
- GE_UNK5 = 0x10, // EVENT_GUILDBANK_UPDATE_TABS
- GE_GUILDBANK_MONEY_UPDATE = 0x11, // EVENT_GUILDBANK_UPDATE_MONEY, string 0000000000002710 is 1 gold
- GE_GUILDBANK_MONEY_WITHDRAWN = 0x12, // MSG_GUILD_BANK_MONEY_WITHDRAWN
- GE_GUILDBANK_TEXT_CHANGED = 0x13 // EVENT_GUILDBANK_TEXT_CHANGED
+ GE_PROMOTION = 0,
+ GE_DEMOTION = 1,
+ GE_MOTD = 2,
+ GE_JOINED = 3,
+ GE_LEFT = 4,
+ GE_REMOVED = 5,
+ GE_LEADER_IS = 6,
+ GE_LEADER_CHANGED = 7,
+ GE_DISBANDED = 8,
+ GE_TABARDCHANGE = 9,
+ GE_RANK_UPDATED = 10,
+ GE_RANK_DELETED = 11,
+ GE_SIGNED_ON = 12,
+ GE_SIGNED_OFF = 13,
+ GE_GUILDBANKBAGSLOTS_CHANGED = 14,
+ GE_BANK_TAB_PURCHASED = 15,
+ GE_BANK_TAB_UPDATED = 16,
+ GE_BANK_MONEY_SET = 17,
+ GE_BANK_MONEY_CHANGED = 18,
+ GE_BANK_TEXT_CHANGED = 19,
};
enum PetitionTurns
{
PETITION_TURN_OK = 0,
PETITION_TURN_ALREADY_IN_GUILD = 2,
- PETITION_TURN_NEED_MORE_SIGNATURES = 4,
+ PETITION_TURN_NEED_MORE_SIGNATURES = 4
};
enum PetitionSigns
{
- PETITION_SIGN_OK = 0,
- PETITION_SIGN_ALREADY_SIGNED = 1,
- PETITION_SIGN_ALREADY_IN_GUILD = 2,
- PETITION_SIGN_CANT_SIGN_OWN = 3,
- PETITION_SIGN_NOT_SERVER = 4,
+ PETITION_SIGN_OK = 0,
+ PETITION_SIGN_ALREADY_SIGNED = 1,
+ PETITION_SIGN_ALREADY_IN_GUILD = 2,
+ PETITION_SIGN_CANT_SIGN_OWN = 3,
+ PETITION_SIGN_NOT_SERVER = 4
};
enum GuildBankRights
{
- GUILD_BANK_RIGHT_VIEW_TAB = 0x01,
- GUILD_BANK_RIGHT_PUT_ITEM = 0x02,
- GUILD_BANK_RIGHT_UPDATE_TEXT = 0x04,
+ GUILD_BANK_RIGHT_VIEW_TAB = 0x01,
+ GUILD_BANK_RIGHT_PUT_ITEM = 0x02,
+ GUILD_BANK_RIGHT_UPDATE_TEXT = 0x04,
- GUILD_BANK_RIGHT_DEPOSIT_ITEM = GUILD_BANK_RIGHT_VIEW_TAB | GUILD_BANK_RIGHT_PUT_ITEM,
- GUILD_BANK_RIGHT_FULL = 0xFF,
+ GUILD_BANK_RIGHT_DEPOSIT_ITEM = GUILD_BANK_RIGHT_VIEW_TAB | GUILD_BANK_RIGHT_PUT_ITEM,
+ GUILD_BANK_RIGHT_FULL = 0xFF
};
enum GuildBankEventLogTypes
{
- GUILD_BANK_LOG_DEPOSIT_ITEM = 1,
- GUILD_BANK_LOG_WITHDRAW_ITEM = 2,
- GUILD_BANK_LOG_MOVE_ITEM = 3,
- GUILD_BANK_LOG_DEPOSIT_MONEY = 4,
- GUILD_BANK_LOG_WITHDRAW_MONEY = 5,
- GUILD_BANK_LOG_REPAIR_MONEY = 6,
- GUILD_BANK_LOG_MOVE_ITEM2 = 7,
- GUILD_BANK_LOG_UNK1 = 8,
- GUILD_BANK_LOG_UNK2 = 9,
+ GUILD_BANK_LOG_DEPOSIT_ITEM = 1,
+ GUILD_BANK_LOG_WITHDRAW_ITEM = 2,
+ GUILD_BANK_LOG_MOVE_ITEM = 3,
+ GUILD_BANK_LOG_DEPOSIT_MONEY = 4,
+ GUILD_BANK_LOG_WITHDRAW_MONEY = 5,
+ GUILD_BANK_LOG_REPAIR_MONEY = 6,
+ GUILD_BANK_LOG_MOVE_ITEM2 = 7,
+ GUILD_BANK_LOG_UNK1 = 8,
+ GUILD_BANK_LOG_BUY_SLOT = 9
};
enum GuildEventLogTypes
{
- GUILD_EVENT_LOG_INVITE_PLAYER = 1,
- GUILD_EVENT_LOG_JOIN_GUILD = 2,
- GUILD_EVENT_LOG_PROMOTE_PLAYER = 3,
- GUILD_EVENT_LOG_DEMOTE_PLAYER = 4,
- GUILD_EVENT_LOG_UNINVITE_PLAYER = 5,
- GUILD_EVENT_LOG_LEAVE_GUILD = 6,
+ GUILD_EVENT_LOG_INVITE_PLAYER = 1,
+ GUILD_EVENT_LOG_JOIN_GUILD = 2,
+ GUILD_EVENT_LOG_PROMOTE_PLAYER = 3,
+ GUILD_EVENT_LOG_DEMOTE_PLAYER = 4,
+ GUILD_EVENT_LOG_UNINVITE_PLAYER = 5,
+ GUILD_EVENT_LOG_LEAVE_GUILD = 6
};
enum GuildEmblemError
@@ -196,7 +213,15 @@ enum GuildEmblemError
ERR_GUILDEMBLEM_INVALIDVENDOR = 5
};
-////////////////////////////////////////////////////////////////////////////////////////////
+enum GuildMemberFlags
+{
+ GUILDMEMBER_STATUS_NONE = 0x0000,
+ GUILDMEMBER_STATUS_ONLINE = 0x0001,
+ GUILDMEMBER_STATUS_AFK = 0x0002,
+ GUILDMEMBER_STATUS_DND = 0x0004,
+ GUILDMEMBER_STATUS_MOBILE = 0x0008, // remote chat from mobile app
+};
+
// Emblem info
class EmblemInfo
{
@@ -205,7 +230,7 @@ public:
void LoadFromDB(Field* fields);
void SaveToDB(uint32 guildId) const;
- void ReadPacket(WorldPacket& recv) { recv >> m_style >> m_color >> m_borderStyle >> m_borderColor >> m_backgroundColor; }
+ void ReadPacket(WorldPacket& recv);
void WritePacket(WorldPacket& data) const;
uint32 GetStyle() const { return m_style; }
@@ -223,21 +248,33 @@ private:
};
// Structure for storing guild bank rights and remaining slots together.
-struct GuildBankRightsAndSlots
+class GuildBankRightsAndSlots
{
- GuildBankRightsAndSlots() : rights(0), slots(0) { }
- GuildBankRightsAndSlots(uint8 _rights, uint32 _slots) : rights(_rights), slots(_slots) { }
+public:
+ GuildBankRightsAndSlots() : tabId(TAB_UNDEFINED), rights(0), slots(0) { }
+ GuildBankRightsAndSlots(uint8 _tabId) : tabId(_tabId), rights(0), slots(0) { }
+ GuildBankRightsAndSlots(uint8 _tabId, uint8 _rights, uint32 _slots) : tabId(_tabId), rights(_rights), slots(_slots) { }
- inline bool IsEqual(GuildBankRightsAndSlots const& rhs) const { return rights == rhs.rights && slots == rhs.slots; }
void SetGuildMasterValues()
{
rights = GUILD_BANK_RIGHT_FULL;
slots = uint32(GUILD_WITHDRAW_SLOT_UNLIMITED);
}
+ void SetTabId(uint8 _tabId) { tabId = _tabId; }
+ void SetSlots(uint32 _slots) { slots = _slots; }
+ void SetRights(uint8 _rights) { rights = _rights; }
+
+ int8 GetTabId() const { return tabId; }
+ int32 GetSlots() const { return slots; }
+ int8 GetRights() const { return rights; }
+
+private:
+ uint8 tabId;
uint8 rights;
uint32 slots;
};
+
typedef std::vector <GuildBankRightsAndSlots> GuildBankRightsAndSlotsVec;
typedef std::set <uint8> SlotIds;
@@ -248,32 +285,49 @@ private:
// Class representing guild member
class Member
{
- struct RemainingValue
- {
- RemainingValue() : value(0), resetTime(0) { }
-
- uint32 value;
- uint32 resetTime;
- };
-
public:
- Member(uint32 guildId, uint64 guid, uint8 rankId) : m_guildId(guildId), m_guid(guid), m_logoutTime(::time(NULL)), m_rankId(rankId) { }
+ Member(uint32 guildId, uint64 guid, uint8 rankId):
+ m_guildId(guildId),
+ m_guid(guid),
+ m_zoneId(0),
+ m_level(0),
+ m_class(0),
+ m_logoutTime(::time(NULL)),
+ m_accountId(0),
+ m_rankId(rankId)
+ {
+ memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(int32));
+ }
void SetStats(Player* player);
- void SetStats(const std::string& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId);
+ void SetStats(std::string const& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId);
bool CheckStats() const;
- void SetPublicNote(const std::string& publicNote);
- void SetOfficerNote(const std::string& officerNote);
+ void SetPublicNote(std::string const& publicNote);
+ void SetOfficerNote(std::string const& officerNote);
+ void SetZoneID(uint32 id) { m_zoneId = id; }
+ void SetLevel(uint8 var) { m_level = var; }
+
+ void AddFlag(uint8 var) { m_flags |= var; }
+ void RemFlag(uint8 var) { m_flags &= ~var; }
+ void ResetFlags() { m_flags = GUILDMEMBER_STATUS_NONE; }
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
void WritePacket(WorldPacket& data) const;
uint64 GetGUID() const { return m_guid; }
- std::string GetName() const { return m_name; }
+ std::string const& GetName() const { return m_name; }
uint32 GetAccountId() const { return m_accountId; }
uint8 GetRankId() const { return m_rankId; }
+ uint64 GetLogoutTime() const { return m_logoutTime; }
+ std::string GetPublicNote() const { return m_publicNote; }
+ std::string GetOfficerNote() const { return m_officerNote; }
+ uint8 GetClass() const { return m_class; }
+ uint8 GetLevel() const { return m_level; }
+ uint8 GetFlags() const { return m_flags; }
+ uint32 GetZoneId() const { return m_zoneId; }
+ bool IsOnline() { return (m_flags & GUILDMEMBER_STATUS_ONLINE); }
void ChangeRank(uint8 newRank);
@@ -282,11 +336,9 @@ private:
inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; }
inline bool IsSamePlayer(uint64 guid) const { return m_guid == guid; }
- void DecreaseBankRemainingValue(SQLTransaction& trans, uint8 tabId, uint32 amount);
- uint32 GetBankRemainingValue(uint8 tabId, const Guild* guild) const;
-
- void ResetTabTimes();
- void ResetMoneyTime();
+ void UpdateBankWithdrawValue(SQLTransaction& trans, uint8 tabId, uint32 amount);
+ int32 GetBankWithdrawValue(uint8 tabId) const;
+ void ResetValues();
inline Player* FindPlayer() const { return ObjectAccessor::FindPlayer(m_guid); }
@@ -296,16 +348,17 @@ private:
uint64 m_guid;
std::string m_name;
uint32 m_zoneId;
- uint8 m_level;
- uint8 m_class;
+ uint8 m_level;
+ uint8 m_class;
+ uint8 m_flags;
uint64 m_logoutTime;
uint32 m_accountId;
// Fields from guild_member table
- uint8 m_rankId;
+ uint8 m_rankId;
std::string m_publicNote;
std::string m_officerNote;
- RemainingValue m_bankRemaining[GUILD_BANK_MAX_TABS + 1];
+ int32 m_bankWithdraw[GUILD_BANK_MAX_TABS + 1];
};
// Base class for event entries
@@ -317,6 +370,7 @@ private:
virtual ~LogEntry() { }
uint32 GetGUID() const { return m_guid; }
+ uint64 GetTimestamp() const { return m_timestamp; }
virtual void SaveToDB(SQLTransaction& trans) const = 0;
virtual void WritePacket(WorldPacket& data) const = 0;
@@ -384,6 +438,8 @@ private:
};
// Class encapsulating work with events collection
+ typedef std::list<LogEntry*> GuildLog;
+
class LogHolder
{
public:
@@ -402,19 +458,19 @@ private:
uint32 GetNextGUID();
private:
- typedef std::list<LogEntry*> GuildLog;
GuildLog m_log;
uint32 m_guildId;
uint32 m_maxRecords;
uint32 m_nextGUID;
};
- // Class incapsulating guild rank data
+ // Class encapsulating guild rank data
class RankInfo
{
public:
+ RankInfo(): m_guildId(0), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { }
RankInfo(uint32 guildId) : m_guildId(guildId), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { }
- RankInfo(uint32 guildId, uint8 rankId, const std::string& name, uint32 rights, uint32 money) :
+ RankInfo(uint32 guildId, uint8 rankId, std::string const& name, uint32 rights, uint32 money) :
m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights), m_bankMoneyPerDay(money) { }
void LoadFromDB(Field* fields);
@@ -423,23 +479,28 @@ private:
uint8 GetId() const { return m_rankId; }
- std::string GetName() const { return m_name; }
- void SetName(const std::string& name);
+ std::string const& GetName() const { return m_name; }
+ void SetName(std::string const& name);
uint32 GetRights() const { return m_rights; }
void SetRights(uint32 rights);
- uint32 GetBankMoneyPerDay() const { return m_rankId == GR_GUILDMASTER ? GUILD_WITHDRAW_MONEY_UNLIMITED : m_bankMoneyPerDay; }
+ int32 GetBankMoneyPerDay() const { return m_bankMoneyPerDay; }
+
void SetBankMoneyPerDay(uint32 money);
- inline uint8 GetBankTabRights(uint8 tabId) const { return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].rights : 0; }
- inline uint32 GetBankTabSlotsPerDay(uint8 tabId) const
+ inline int8 GetBankTabRights(uint8 tabId) const
+ {
+ return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].GetRights() : 0;
+ }
+
+ inline int32 GetBankTabSlotsPerDay(uint8 tabId) const
{
- if (tabId < GUILD_BANK_MAX_TABS)
- return m_rankId == GR_GUILDMASTER ? GUILD_WITHDRAW_SLOT_UNLIMITED : m_bankTabRightsAndSlots[tabId].slots;
- return 0;
+ return tabId < GUILD_BANK_MAX_TABS ? m_bankTabRightsAndSlots[tabId].GetSlots() : 0;
}
- void SetBankTabSlotsAndRights(uint8 tabId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB);
+
+ void SetBankTabSlotsAndRights(GuildBankRightsAndSlots rightsAndSlots, bool saveToDB);
+ void CreateMissingTabsIfNeeded(uint8 ranks, SQLTransaction& trans, bool logOnCreate = false);
private:
uint32 m_guildId;
@@ -459,20 +520,20 @@ private:
memset(m_items, 0, GUILD_BANK_MAX_SLOTS * sizeof(Item*));
}
- bool LoadFromDB(Field* fields);
+ void LoadFromDB(Field* fields);
bool LoadItemFromDB(Field* fields);
void Delete(SQLTransaction& trans, bool removeItemsFromDB = false);
void WritePacket(WorldPacket& data) const;
- void WriteSlotPacket(WorldPacket& data, uint8 slotId) const;
+ bool WriteSlotPacket(WorldPacket& data, uint8 slotId, bool ignoreEmpty = true) const;
void WriteInfoPacket(WorldPacket& data) const
{
data << m_name;
data << m_icon;
}
- void SetInfo(const std::string& name, const std::string& icon);
- void SetText(const std::string& text);
+ void SetInfo(std::string const& name, std::string const& icon);
+ void SetText(std::string const& text);
void SendText(const Guild* guild, WorldSession* session) const;
inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; }
@@ -523,6 +584,7 @@ private:
Item* GetItem(bool isCloned = false) const { return isCloned ? m_pClonedItem : m_pItem; }
uint8 GetContainer() const { return m_container; }
uint8 GetSlotId() const { return m_slotId; }
+
protected:
virtual InventoryResult CanStore(Item* pItem, bool swap) = 0;
@@ -579,55 +641,59 @@ private:
typedef std::vector<BankTab*> BankTabs;
public:
- static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, const std::string& param = "");
+ static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, std::string const& param = "");
static void SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode);
Guild();
~Guild();
- bool Create(Player* pLeader, const std::string& name);
+ bool Create(Player* pLeader, std::string const& name);
void Disband();
// Getters
uint32 GetId() const { return m_id; }
uint64 GetLeaderGUID() const { return m_leaderGuid; }
- const std::string& GetName() const { return m_name; }
- const std::string& GetMOTD() const { return m_motd; }
- const std::string& GetInfo() const { return m_info; }
+ std::string const& GetName() const { return m_name; }
+ std::string const& GetMOTD() const { return m_motd; }
+ std::string const& GetInfo() const { return m_info; }
// Handle client commands
void HandleRoster(WorldSession* session = NULL); // NULL = broadcast
void HandleQuery(WorldSession* session);
- void HandleSetMOTD(WorldSession* session, const std::string& motd);
- void HandleSetInfo(WorldSession* session, const std::string& info);
+ void HandleSetMOTD(WorldSession* session, std::string const& motd);
+ void HandleSetInfo(WorldSession* session, std::string const& info);
void HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo);
- void HandleSetLeader(WorldSession* session, const std::string& name);
- void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, const std::string& name, const std::string& icon);
- void HandleSetMemberNote(WorldSession* session, const std::string& name, const std::string& note, bool officer);
- void HandleSetRankInfo(WorldSession* session, uint8 rankId, const std::string& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots);
+ void HandleSetLeader(WorldSession* session, std::string const& name);
+ void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon);
+ void HandleSetMemberNote(WorldSession* session, std::string const& name, std::string const& note, bool officer);
+ void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots);
void HandleBuyBankTab(WorldSession* session, uint8 tabId);
- void HandleInviteMember(WorldSession* session, const std::string& name);
+ void HandleInviteMember(WorldSession* session, std::string const& name);
void HandleAcceptMember(WorldSession* session);
void HandleLeaveMember(WorldSession* session);
- void HandleRemoveMember(WorldSession* session, const std::string& name);
- void HandleUpdateMemberRank(WorldSession* session, const std::string& name, bool demote);
- void HandleAddNewRank(WorldSession* session, const std::string& name);
+ void HandleRemoveMember(WorldSession* session, std::string const& name);
+ void HandleUpdateMemberRank(WorldSession* session, std::string const& name, bool demote);
+ void HandleAddNewRank(WorldSession* session, std::string const& name);
+ void HandleRemoveRank(WorldSession* session, uint8 rankId);
void HandleRemoveLowestRank(WorldSession* session);
void HandleMemberDepositMoney(WorldSession* session, uint32 amount);
bool HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair = false);
void HandleMemberLogout(WorldSession* session);
void HandleDisband(WorldSession* session);
+ void UpdateMemberData(Player* player, uint8 dataid, uint32 value);
+ void OnPlayerStatusChange(Player* player, uint32 flag, bool state);
+
// Send info to client
void SendInfo(WorldSession* session) const;
void SendEventLog(WorldSession* session) const;
void SendBankLog(WorldSession* session, uint8 tabId) const;
- void SendBankTabsInfo(WorldSession* session) const;
+ void SendBankTabsInfo(WorldSession* session, bool showTabs = false) const;
void SendBankTabData(WorldSession* session, uint8 tabId) const;
void SendBankTabText(WorldSession* session, uint8 tabId) const;
void SendPermissions(WorldSession* session) const;
void SendMoneyInfo(WorldSession* session) const;
- void SendLoginInfo(WorldSession* session) const;
+ void SendLoginInfo(WorldSession* session);
// Load from DB
bool LoadFromDB(Field* fields);
@@ -635,16 +701,18 @@ public:
bool LoadMemberFromDB(Field* fields);
bool LoadEventLogFromDB(Field* fields);
void LoadBankRightFromDB(Field* fields);
- bool LoadBankTabFromDB(Field* fields);
+ void LoadBankTabFromDB(Field* fields);
bool LoadBankEventLogFromDB(Field* fields);
bool LoadBankItemFromDB(Field* fields);
bool Validate();
// Broadcasts
- void BroadcastToGuild(WorldSession* session, bool officerOnly, const std::string& msg, uint32 language = LANG_UNIVERSAL) const;
+ void BroadcastToGuild(WorldSession* session, bool officerOnly, std::string const& msg, uint32 language = LANG_UNIVERSAL) const;
void BroadcastPacketToRank(WorldPacket* packet, uint8 rankId) const;
void BroadcastPacket(WorldPacket* packet) const;
+ void MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 maxLevel, uint32 minRank);
+
template<class Do>
void BroadcastWorker(Do& _do, Player* except = NULL)
{
@@ -665,7 +733,9 @@ public:
void SwapItemsWithInventory(Player* player, bool toChar, uint8 tabId, uint8 slotId, uint8 playerBag, uint8 playerSlotId, uint32 splitedAmount);
// Bank tabs
- void SetBankTabText(uint8 tabId, const std::string& text);
+ void SetBankTabText(uint8 tabId, std::string const& text);
+
+ void ResetTimes();
protected:
uint32 m_id;
@@ -691,7 +761,14 @@ private:
inline uint8 _GetRanksSize() const { return uint8(m_ranks.size()); }
inline const RankInfo* GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
inline RankInfo* GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
- inline bool _HasRankRight(Player* player, uint32 right) const { return (_GetRankRights(player->GetRank()) & right) != GR_RIGHT_EMPTY; }
+ inline bool _HasRankRight(Player* player, uint32 right) const
+ {
+ if (player)
+ if (Member const* member = GetMember(player->GetGUID()))
+ return (_GetRankRights(member->GetRankId()) & right) != GR_RIGHT_EMPTY;
+ return false;
+ }
+
inline uint8 _GetLowestRankId() const { return uint8(m_ranks.size() - 1); }
inline uint8 _GetPurchasedTabsSize() const { return uint8(m_bankTabs.size()); }
@@ -703,20 +780,22 @@ private:
Members::const_iterator itr = m_members.find(GUID_LOPART(guid));
return itr != m_members.end() ? itr->second : NULL;
}
+
inline Member* GetMember(uint64 guid)
{
Members::iterator itr = m_members.find(GUID_LOPART(guid));
return itr != m_members.end() ? itr->second : NULL;
}
- inline Member* GetMember(WorldSession* session, const std::string& name)
+
+ inline Member* GetMember(std::string const& name)
{
for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if (itr->second->GetName() == name)
return itr->second;
- SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD_S, name);
return NULL;
}
+
inline void _DeleteMemberFromDB(uint32 lowguid) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBER);
@@ -727,11 +806,11 @@ private:
// Creates log holders (either when loading or when creating guild)
void _CreateLogHolders();
// Tries to create new bank tab
- bool _CreateNewBankTab();
+ void _CreateNewBankTab();
// Creates default guild ranks with names in given locale
void _CreateDefaultGuildRanks(LocaleConstant loc);
// Creates new rank
- void _CreateRank(const std::string& name, uint32 rights);
+ bool _CreateRank(std::string const& name, uint32 rights);
// Update account number when member added/removed from guild
void _UpdateAccountsNumber();
bool _IsLeader(Player* player) const;
@@ -740,16 +819,16 @@ private:
void _SetLeaderGUID(Member* pLeader);
void _SetRankBankMoneyPerDay(uint8 rankId, uint32 moneyPerDay);
- void _SetRankBankTabRightsAndSlots(uint8 rankId, uint8 tabId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB = true);
- uint8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const;
+ void _SetRankBankTabRightsAndSlots(uint8 rankId, GuildBankRightsAndSlots rightsAndSlots, bool saveToDB = true);
+ int8 _GetRankBankTabRights(uint8 rankId, uint8 tabId) const;
uint32 _GetRankRights(uint8 rankId) const;
- uint32 _GetRankBankMoneyPerDay(uint8 rankId) const;
- uint32 _GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const;
+ int32 _GetRankBankMoneyPerDay(uint8 rankId) const;
+ int32 _GetRankBankTabSlotsPerDay(uint8 rankId, uint8 tabId) const;
std::string _GetRankName(uint8 rankId) const;
- uint32 _GetMemberRemainingSlots(uint64 guid, uint8 tabId) const;
- uint32 _GetMemberRemainingMoney(uint64 guid) const;
- void _DecreaseMemberRemainingSlots(SQLTransaction& trans, uint64 guid, uint8 tabId);
+ int32 _GetMemberRemainingSlots(Member const* member, uint8 tabId) const;
+ int32 _GetMemberRemainingMoney(Member const* member) const;
+ void _UpdateMemberWithdrawSlots(SQLTransaction& trans, uint64 guid, uint8 tabId);
bool _MemberHasTabRights(uint64 guid, uint8 tabId, uint32 rights) const;
void _LogEvent(GuildEventLogTypes eventType, uint32 playerGuid1, uint32 playerGuid2 = 0, uint8 newRank = 0);
@@ -764,6 +843,7 @@ private:
void _SendBankMoneyUpdate(WorldSession* session) const;
void _SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const;
void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const;
+ void _SendBankList(WorldSession* session = NULL, uint8 tabId = 0, bool sendFullSlots = false, SlotIds *slots = NULL) const;
void _BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* param1 = NULL, const char* param2 = NULL, const char* param3 = NULL) const;
};
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index 106be2a605d..0a1eb415ee6 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -18,10 +18,8 @@
#include "Common.h"
#include "GuildMgr.h"
-GuildMgr::GuildMgr()
-{
- NextGuildId = 1;
-}
+GuildMgr::GuildMgr() : NextGuildId(1)
+{ }
GuildMgr::~GuildMgr()
{
@@ -43,7 +41,7 @@ uint32 GuildMgr::GenerateGuildId()
{
if (NextGuildId >= 0xFFFFFFFE)
{
- sLog->outError("Guild ids overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_GUILD, "Guild ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return NextGuildId++;
@@ -93,7 +91,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const
void GuildMgr::LoadGuilds()
{
// 1. Load all guilds
- sLog->outString("Loading guilds definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions...");
{
uint32 oldMSTime = getMSTime();
@@ -105,8 +103,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild definitions. DB table `guild` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty.");
return;
}
else
@@ -122,19 +119,19 @@ void GuildMgr::LoadGuilds()
delete guild;
continue;
}
+
AddGuild(guild);
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 2. Load all guild ranks
- sLog->outString("Loading guild ranks...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild ranks...");
{
uint32 oldMSTime = getMSTime();
@@ -146,8 +143,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
}
else
{
@@ -164,34 +160,29 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 3. Load all guild members
- sLog->outString("Loading guild members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild members...");
{
uint32 oldMSTime = getMSTime();
// Delete orphaned guild member entries before loading the valid ones
CharacterDatabase.DirectExecute("DELETE gm FROM guild_member gm LEFT JOIN guild g ON gm.guildId = g.guildId WHERE g.guildId IS NULL");
+ CharacterDatabase.DirectExecute("DELETE gm FROM guild_member_withdraw gm LEFT JOIN guild_member g ON gm.guid = g.guid WHERE g.guid IS NULL");
- // 0 1 2 3 4 5 6
- QueryResult result = CharacterDatabase.Query("SELECT guildid, gm.guid, rank, pnote, offnote, BankResetTimeMoney, BankRemMoney, "
- // 7 8 9 10 11 12
- "BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2, "
- // 13 14 15 16 17 18
- "BankResetTimeTab3, BankRemSlotsTab3, BankResetTimeTab4, BankRemSlotsTab4, BankResetTimeTab5, BankRemSlotsTab5, "
- // 19 20 21 22 23 24
- "c.name, c.level, c.class, c.zone, c.account, c.logout_time "
- "FROM guild_member gm LEFT JOIN characters c ON c.guid = gm.guid ORDER BY guildid ASC");
+ // 0 1 2 3 4 5 6 7 8 9 10
+ QueryResult result = CharacterDatabase.Query("SELECT guildid, gm.guid, rank, pnote, offnote, w.tab0, w.tab1, w.tab2, w.tab3, w.tab4, w.tab5, "
+ // 11 12 13 14 15 16 17
+ "w.money, c.name, c.level, c.class, c.zone, c.account, c.logout_time "
+ "FROM guild_member gm "
+ "LEFT JOIN guild_member_withdraw w ON gm.guid = w.guid "
+ "LEFT JOIN characters c ON c.guid = gm.guid ORDER BY guildid ASC");
if (!result)
- {
- sLog->outString(">> Loaded 0 guild members. DB table `guild_member` is empty.");
- sLog->outString();
- }
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty.");
else
{
uint32 count = 0;
@@ -208,26 +199,24 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 4. Load all guild bank tab rights
- sLog->outString("Loading bank tab rights...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights...");
{
uint32 oldMSTime = getMSTime();
// Delete orphaned guild bank right entries before loading the valid ones
CharacterDatabase.DirectExecute("DELETE gbr FROM guild_bank_right gbr LEFT JOIN guild g ON gbr.guildId = g.guildId WHERE g.guildId IS NULL");
- // 0 1 2 3 4
+ // 0 1 2 3 4
QueryResult result = CharacterDatabase.Query("SELECT guildid, TabId, rid, gbright, SlotPerDay FROM guild_bank_right ORDER BY guildid ASC, TabId ASC");
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
}
else
{
@@ -244,13 +233,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 5. Load all event logs
- sLog->outString("Loading guild event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -261,8 +249,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
}
else
{
@@ -279,13 +266,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 6. Load all bank event logs
- sLog->outString("Loading guild bank event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -297,8 +283,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
}
else
{
@@ -315,13 +300,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 7. Load all guild bank tabs
- sLog->outString("Loading guild bank tabs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs...");
{
uint32 oldMSTime = getMSTime();
@@ -333,8 +317,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
}
else
{
@@ -351,13 +334,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 8. Fill all guild bank tabs
- sLog->outString("Filling bank tabs with items...");
+ sLog->outInfo(LOG_FILTER_GUILD, "Filling bank tabs with items...");
{
uint32 oldMSTime = getMSTime();
@@ -371,8 +353,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outString(">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
}
else
{
@@ -389,30 +370,39 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 9. Validate loaded guild data
- sLog->outString("Validating data of loaded guilds...");
+ sLog->outInfo(LOG_FILTER_GUILD, "Validating data of loaded guilds...");
{
uint32 oldMSTime = getMSTime();
+ std::set<Guild*> rm; // temporary storage to avoid modifying GuildStore with RemoveGuild() while iterating
for (GuildContainer::iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
{
Guild* guild = itr->second;
- if (guild)
- {
- if (!guild->Validate())
- {
- RemoveGuild(guild->GetId());
- delete guild;
- }
- }
+ if (guild && !guild->Validate())
+ rm.insert(guild);
+ }
+
+ for (std::set<Guild*>::iterator itr = rm.begin(); itr != rm.end(); ++itr)
+ {
+ Guild* guild = *itr;
+ RemoveGuild(guild->GetId());
+ delete guild;
}
- sLog->outString(">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
}
+
+void GuildMgr::ResetTimes()
+{
+ for (GuildContainer::const_iterator itr = GuildStore.begin(); itr != GuildStore.end(); ++itr)
+ if (Guild* guild = itr->second)
+ guild->ResetTimes();
+
+ CharacterDatabase.DirectExecute("TRUNCATE guild_member_withdraw");
+} \ No newline at end of file
diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h
index 9654fced227..f5fa4680039 100644
--- a/src/server/game/Guilds/GuildMgr.h
+++ b/src/server/game/Guilds/GuildMgr.h
@@ -23,16 +23,15 @@
class GuildMgr
{
friend class ACE_Singleton<GuildMgr, ACE_Null_Mutex>;
+
private:
GuildMgr();
~GuildMgr();
public:
- typedef UNORDERED_MAP<uint32, Guild*> GuildContainer;
-
Guild* GetGuildByLeader(uint64 guid) const;
Guild* GetGuildById(uint32 guildId) const;
- Guild* GetGuildByName(const std::string& guildName) const;
+ Guild* GetGuildByName(std::string const& guildName) const;
std::string GetGuildNameById(uint32 guildId) const;
void LoadGuilds();
@@ -42,7 +41,9 @@ public:
uint32 GenerateGuildId();
void SetNextGuildId(uint32 Id) { NextGuildId = Id; }
+ void ResetTimes();
protected:
+ typedef UNORDERED_MAP<uint32, Guild*> GuildContainer;
uint32 NextGuildId;
GuildContainer GuildStore;
};
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index ef537cb6198..c3ffeace3fb 100755..100644
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
@@ -37,26 +37,6 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint32 CurrentPosition;
uint32 TempValue;
- unsigned char tdata[256] =
- {
- 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
- 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
- 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
- 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
- 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
- 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
- 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
- 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
- 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
- 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
- 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
- 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
- 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
- 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
- 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
- };
-
// broken addon packet, can't be received from real client
if (Source->rpos() + 4 > Source->size())
return false;
@@ -110,7 +90,28 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
*Target << uint8(unk);
if (unk)
+ {
+ unsigned char tdata[256] =
+ {
+ 0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
+ 0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
+ 0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
+ 0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
+ 0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
+ 0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
+ 0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
+ 0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
+ 0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
+ 0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
+ 0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
+ 0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
+ 0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
+ 0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
+ 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 << uint32(0);
}
@@ -135,7 +136,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
}
else
{
- sLog->outError("Addon packet uncompress error :(");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Addon packet uncompress error :(");
return false;
}
return true;
diff --git a/src/server/game/Handlers/AddonHandler.h b/src/server/game/Handlers/AddonHandler.h
index 36cb19e5698..36cb19e5698 100755..100644
--- a/src/server/game/Handlers/AddonHandler.h
+++ b/src/server/game/Handlers/AddonHandler.h
diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index 8fb820713ce..e3ccee35b47 100755..100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -27,8 +27,9 @@
#include "ObjectMgr.h"
#include "SocialMgr.h"
#include "ArenaTeamMgr.h"
+#include "Opcodes.h"
-void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
+void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_ARENA_TEAMS");
@@ -49,7 +50,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_QUERY");
@@ -63,7 +64,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_ROSTER");
@@ -74,7 +75,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recvData)
arenaTeam->Roster(this);
}
-void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_INVITE");
@@ -90,7 +91,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
if (!normalizePlayerName(invitedName))
return;
- player = sObjectAccessor->FindPlayerByName(invitedName.c_str());
+ player = sObjectAccessor->FindPlayerByName(invitedName);
}
if (!player)
@@ -140,7 +141,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
return;
}
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName(), invitedName.c_str());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName().c_str(), invitedName.c_str());
player->SetArenaTeamIdInvited(arenaTeam->GetId());
@@ -152,7 +153,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_INVITE");
}
-void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
@@ -185,7 +186,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/)
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName(), arenaTeam->GetName(), "");
}
-void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DECLINE"); // empty opcode
@@ -193,7 +194,7 @@ void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/)
_player->SetArenaTeamIdInvited(0);
}
-void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");
@@ -235,7 +236,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
}
-void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DISBAND");
@@ -257,7 +258,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recvData)
}
}
-void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE");
@@ -303,7 +304,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
}
-void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recvData)
+void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER");
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 3aee9ff0b00..3c38ff8460e 100755..100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -24,6 +24,7 @@
#include "AuctionHouseMgr.h"
#include "Log.h"
+#include "Language.h"
#include "Opcodes.h"
#include "UpdateMask.h"
#include "Util.h"
@@ -33,10 +34,10 @@
//post-incrementation is always slower than pre-incrementation !
//void called when player click on auctioneer npc
-void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
{
uint64 guid; //NPC guid
- recv_data >> guid;
+ recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!unit)
@@ -85,7 +86,7 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin
}
//this function sends notification, if bidder is online
-void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
+void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
{
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
data << uint32(location);
@@ -93,7 +94,7 @@ void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auction
data << uint64(bidder);
data << uint32(bidSum);
data << uint32(diff);
- data << uint32(item_template);
+ data << uint32(itemEntry);
data << uint32(0);
SendPacket(&data);
}
@@ -106,41 +107,41 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
data << uint32(auction->bid);
data << uint32(0); //unk
data << uint64(0); //unk (bidder guid?)
- data << uint32(auction->item_template);
+ data << uint32(auction->itemEntry);
data << uint32(0); //unk
data << float(0); //unk (time?)
SendPacket(&data);
}
//this void creates new auction and adds auction to some auctionhouse
-void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
+void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
{
uint64 auctioneer;
uint32 itemsCount, etime, bid, buyout;
- recv_data >> auctioneer;
- recv_data >> itemsCount;
+ recvData >> auctioneer;
+ recvData >> itemsCount;
uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
uint32 count[MAX_AUCTION_ITEMS];
if (itemsCount > MAX_AUCTION_ITEMS)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
for (uint32 i = 0; i < itemsCount; ++i)
{
- recv_data >> itemGUIDs[i];
- recv_data >> count[i];
+ recvData >> itemGUIDs[i];
+ recvData >> count[i];
if (!itemGUIDs[i] || !count[i] || count[i] > 1000 )
return;
}
- recv_data >> bid;
- recv_data >> buyout;
- recv_data >> etime;
+ recvData >> bid;
+ recvData >> buyout;
+ recvData >> etime;
if (!bid || !etime)
return;
@@ -184,7 +185,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (!item)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_ITEM_NOT_FOUND);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_ITEM_NOT_FOUND);
return;
}
@@ -192,7 +193,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
item->GetCount() < count[i])
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -202,7 +203,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (!finalCount)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -212,7 +213,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (item->GetMaxStackCount() < finalCount)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
}
@@ -227,7 +228,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
if (!_player->HasEnoughMoney(deposit))
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY);
return;
}
@@ -247,11 +248,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
}
- AH->item_guidlow = item->GetGUIDLow();
- AH->item_template = item->GetEntry();
+ AH->itemGUIDLow = item->GetGUIDLow();
+ AH->itemEntry = item->GetEntry();
+ AH->itemCount = item->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
AH->bidder = 0;
@@ -261,7 +263,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- sLog->outDetail("CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(item);
auctionHouse->AddAuction(AH);
@@ -274,9 +276,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
- SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
+ SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_OK);
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
return;
}
else // Required stack size of auction does not match to current item stack size, clone item and set correct stack size
@@ -284,19 +286,20 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
Item* newItem = item->CloneItem(finalCount, _player);
if (!newItem)
{
- sLog->outError("CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry());
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry());
+ SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)",
- GetPlayerName(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
+ GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
}
- AH->item_guidlow = newItem->GetGUIDLow();
- AH->item_template = newItem->GetEntry();
+ AH->itemGUIDLow = newItem->GetGUIDLow();
+ AH->itemEntry = newItem->GetEntry();
+ AH->itemCount = newItem->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
AH->bidder = 0;
@@ -306,7 +309,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
AH->deposit = deposit;
AH->auctionHouseEntry = auctionHouseEntry;
- sLog->outDetail("CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
sAuctionMgr->AddAItem(newItem);
auctionHouse->AddAuction(AH);
@@ -343,24 +346,24 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
- SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
+ SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_OK);
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
return;
}
}
}
//this function is called when client bids or buys out auction
-void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
+void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_PLACE_BID");
uint64 auctioneer;
uint32 auctionId;
uint32 price;
- recv_data >> auctioneer;
- recv_data >> auctionId >> price;
+ recvData >> auctioneer;
+ recvData >> auctionId >> price;
if (!auctionId || !price)
return; //check for cheaters
@@ -384,7 +387,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
if (!auction || auction->owner == player->GetGUIDLow())
{
//you cannot bid your own auction:
- SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
+ SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
}
@@ -393,7 +396,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
- SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
+ SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
}
@@ -436,7 +439,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
auction->bidder = player->GetGUIDLow();
auction->bid = price;
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_AUCTION_BID);
stmt->setUInt32(0, auction->bidder);
@@ -444,7 +447,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
stmt->setUInt32(2, auction->Id);
trans->Append(stmt);
- SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0);
+ SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK, 0);
}
else
{
@@ -459,34 +462,34 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
}
auction->bidder = player->GetGUIDLow();
auction->bid = auction->buyout;
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
//- Mails must be under transaction control too to prevent data loss
sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
sAuctionMgr->SendAuctionWonMail(auction, trans);
- SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK);
+ SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK);
auction->DeleteFromDB(trans);
- uint32 item_template = auction->item_template;
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
- auctionHouse->RemoveAuction(auction, item_template);
+ uint32 itemEntry = auction->itemEntry;
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ auctionHouse->RemoveAuction(auction, itemEntry);
}
player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
//this void is called when auction_owner cancels his auction
-void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
+void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
uint64 auctioneer;
uint32 auctionId;
- recv_data >> auctioneer;
- recv_data >> auctionId;
+ recvData >> auctioneer;
+ recvData >> auctionId;
//sLog->outDebug("Cancel AUCTION AuctionID: %u", auctionId);
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
@@ -508,7 +511,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
if (auction && auction->owner == player->GetGUIDLow())
{
- Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
+ Item* pItem = sAuctionMgr->GetAItem(auction->itemGUIDLow);
if (pItem)
{
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
@@ -520,32 +523,29 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
player->ModifyMoney(-int32(auctionCut));
}
- // Return the item by mail
- std::ostringstream msgAuctionCanceledOwner;
- msgAuctionCanceledOwner << auction->item_template << ":0:" << AUCTION_CANCELED << ":0:0";
// item will deleted or added to received mail list
- MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
+ MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
.AddItem(pItem)
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
}
else
{
- sLog->outError("Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
- SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->itemGUIDLow);
+ SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
return;
}
}
else
{
- SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
//this code isn't possible ... maybe there should be assert
- sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
return;
}
//inform player, that auction is removed
- SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, AUCTION_OK);
+ SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, ERR_AUCTION_OK);
// Now remove the auction
@@ -553,13 +553,13 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
- uint32 item_template = auction->item_template;
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
- auctionHouse->RemoveAuction(auction, item_template);
+ uint32 itemEntry = auction->itemEntry;
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ auctionHouse->RemoveAuction(auction, itemEntry);
}
//called when player lists his bids
-void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
+void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
@@ -567,12 +567,12 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
- recv_data >> guid;
- recv_data >> listfrom; // not used in fact (this list not have page control in client)
- recv_data >> outbiddedCount;
- if (recv_data.size() != (16 + outbiddedCount * 4))
+ recvData >> guid;
+ recvData >> listfrom; // not used in fact (this list not have page control in client)
+ recvData >> outbiddedCount;
+ if (recvData.size() != (16 + outbiddedCount * 4))
{
- sLog->outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recv_data.size(), (16 + outbiddedCount * 4));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4));
outbiddedCount = 0;
}
@@ -580,7 +580,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
if (!creature)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
- recv_data.rfinish();
+ recvData.rfinish();
return;
}
@@ -599,7 +599,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
{
--outbiddedCount;
uint32 outbiddedAuctionId;
- recv_data >> outbiddedAuctionId;
+ recvData >> outbiddedAuctionId;
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
if (auction && auction->BuildAuctionInfo(data))
{
@@ -616,15 +616,15 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
}
//this void sends player info about his auctions
-void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
+void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
uint32 listfrom;
uint64 guid;
- recv_data >> guid;
- recv_data >> listfrom; // not used in fact (this list not have page control in client)
+ recvData >> guid;
+ recvData >> listfrom; // not used in fact (this list not have page control in client)
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
@@ -653,7 +653,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data)
}
//this void is called when player clicks on search button
-void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
+void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_ITEMS");
@@ -662,23 +662,23 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
uint64 guid;
- recv_data >> guid;
- recv_data >> listfrom; // start, used for page control listing by 50 elements
- recv_data >> searchedname;
+ recvData >> guid;
+ recvData >> listfrom; // start, used for page control listing by 50 elements
+ recvData >> searchedname;
- recv_data >> levelmin >> levelmax;
- recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
- recv_data >> quality >> usable;
+ recvData >> levelmin >> levelmax;
+ recvData >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
+ recvData >> quality >> usable;
- recv_data.read_skip<uint8>(); // unk
+ recvData.read_skip<uint8>(); // unk
// this block looks like it uses some lame byte packing or similar...
uint8 unkCnt;
- recv_data >> unkCnt;
+ recvData >> unkCnt;
for (uint8 i = 0; i < unkCnt; i++)
{
- recv_data.read_skip<uint8>();
- recv_data.read_skip<uint8>();
+ recvData.read_skip<uint8>();
+ recvData.read_skip<uint8>();
}
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
@@ -720,11 +720,11 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandleAuctionListPendingSales(WorldPacket & recv_data)
+void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES");
- recv_data.read_skip<uint64>();
+ recvData.read_skip<uint64>();
uint32 count = 0;
diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp
index 49027bdf497..49027bdf497 100755..100644
--- a/src/server/game/Handlers/AuthHandler.cpp
+++ b/src/server/game/Handlers/AuthHandler.cpp
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index a0c5268136b..12f4e6ffa82 100755..100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -35,10 +35,10 @@
#include "DisableMgr.h"
#include "Group.h"
-void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
@@ -70,7 +70,7 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId
SendPacket(&data);
}
-void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 bgTypeId_;
@@ -79,14 +79,14 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
bool isPremade = false;
Group* grp = NULL;
- recv_data >> guid; // battlemaster guid
- recv_data >> bgTypeId_; // battleground type id (DBC id)
- recv_data >> instanceId; // instance id, 0 if First Available selected
- recv_data >> joinAsGroup; // join as group
+ recvData >> guid; // battlemaster guid
+ recvData >> bgTypeId_; // battleground type id (DBC id)
+ recvData >> instanceId; // instance id, 0 if First Available selected
+ recvData >> joinAsGroup; // join as group
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
- sLog->outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: invalid bgtype (%u) received. possible cheater? player guid %u", bgTypeId_, _player->GetGUIDLow());
return;
}
@@ -148,7 +148,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
if (_player->GetBattlegroundQueueIndex(bgQueueTypeIdRandom) < PLAYER_MAX_BATTLEGROUND_QUEUES)
{
- //player is already in random queue
+ // player is already in random queue
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_RANDOM_BG);
_player->GetSession()->SendPacket(&data);
@@ -157,7 +157,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
if (_player->InBattlegroundQueue() && bgTypeId == BATTLEGROUND_RB)
{
- //player is already in queue, can't start random queue
+ // player is already in queue, can't start random queue
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, ERR_IN_NON_RANDOM_BG);
_player->GetSession()->SendPacket(&data);
@@ -166,7 +166,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
// check if already in queue
if (_player->GetBattlegroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
- //player is already in this queue
+ // player is already in this queue
return;
// check if has free queue slots
@@ -178,7 +178,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
return;
}
- BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
+ BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0);
uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId());
@@ -189,7 +189,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
SendPacket(&data);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",
+ bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str());
}
else
{
@@ -202,7 +203,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
- BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
+ BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
GroupQueueInfo* ginfo = NULL;
uint32 avgTime = 0;
@@ -236,15 +237,15 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
member->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",
+ bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str());
}
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: group end");
-
}
sBattlegroundMgr->ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
-void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message");
@@ -252,45 +253,50 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_
if (!bg) // can't be received if player not in battleground
return;
- uint32 count = 0;
- Player* aplr = NULL;
- Player* hplr = NULL;
+ uint32 flagCarrierCount = 0;
+ Player* allianceFlagCarrier = NULL;
+ Player* hordeFlagCarrier = NULL;
- if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE))
+ if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
{
- aplr = ObjectAccessor::FindPlayer(guid);
- if (aplr)
- ++count;
+ allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
+ if (allianceFlagCarrier)
+ ++flagCarrierCount;
}
- if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
+ if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
{
- hplr = ObjectAccessor::FindPlayer(guid);
- if (hplr)
- ++count;
+ hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
+ if (hordeFlagCarrier)
+ ++flagCarrierCount;
}
- WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count);
- data << 0;
- data << count;
- if (aplr)
+ WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * flagCarrierCount);
+ // Used to send several player positions (found used in AV)
+ data << 0; // CGBattlefieldInfo__m_numPlayerPositions
+ /*
+ for (CGBattlefieldInfo__m_numPlayerPositions)
+ data << guid << posx << posy;
+ */
+ data << flagCarrierCount;
+ if (allianceFlagCarrier)
{
- data << uint64(aplr->GetGUID());
- data << float(aplr->GetPositionX());
- data << float(aplr->GetPositionY());
+ data << uint64(allianceFlagCarrier->GetGUID());
+ data << float(allianceFlagCarrier->GetPositionX());
+ data << float(allianceFlagCarrier->GetPositionY());
}
- if (hplr)
+ if (hordeFlagCarrier)
{
- data << uint64(hplr->GetGUID());
- data << float(hplr->GetPositionX());
- data << float(hplr->GetPositionY());
+ data << uint64(hordeFlagCarrier->GetGUID());
+ data << float(hordeFlagCarrier->GetPositionX());
+ data << float(hordeFlagCarrier->GetPositionY());
}
SendPacket(&data);
}
-void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_PVP_LOG_DATA Message");
@@ -309,23 +315,23 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_PVP_LOG_DATA Message");
}
-void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recv_data)
+void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message");
uint32 bgTypeId;
- recv_data >> bgTypeId; // id from DBC
+ recvData >> bgTypeId; // id from DBC
uint8 fromWhere;
- recv_data >> fromWhere; // 0 - battlemaster (lua: ShowBattlefieldList), 1 - UI (lua: RequestBattlegroundInstanceInfo)
+ recvData >> fromWhere; // 0 - battlemaster (lua: ShowBattlefieldList), 1 - UI (lua: RequestBattlegroundInstanceInfo)
- uint8 unk1;
- recv_data >> unk1; // Unknown 3.2.2
+ uint8 canGainXP;
+ recvData >> canGainXP; // players with locked xp have their own bg queue on retail
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (!bl)
{
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId, _player->GetName(), _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId, _player->GetName().c_str(), _player->GetGUIDLow());
return;
}
@@ -334,59 +340,70 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recv_data)
SendPacket(&data);
}
-void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
+void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_PORT Message");
-
uint8 type; // arenatype if arena
uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1
uint32 bgTypeId_; // type id from dbc
uint16 unk; // 0x1F90 constant?
uint8 action; // enter battle 0x1, leave queue 0x0
- recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;
-
+ recvData >> type >> unk2 >> bgTypeId_ >> unk >> action;
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId_, _player->GetName(), _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Invalid BgType!",
+ GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action);
return;
}
if (!_player->InBattlegroundQueue())
{
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (Name: %s, GUID: %u), he is not in bg_queue.", _player->GetName(), _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player not in queue!",
+ GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action);
return;
}
//get GroupQueueInfo from BattlegroundQueue
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, type);
- BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
+ BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
//we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattlegroundQueue::RemovePlayer() function
GroupQueueInfo ginfo;
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
{
- sLog->outError("BattlegroundHandler: itrplayerstatus not found.");
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player not in queue (No player Group Info)!",
+ GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action);
return;
}
// if action == 1, then instanceId is required
if (!ginfo.IsInvitedToBGInstanceGUID && action == 1)
{
- sLog->outError("BattlegroundHandler: instance not found.");
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Player is not invited to any bg!",
+ GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action);
return;
}
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
-
- // bg template might and must be used in case of leaving queue, when instance is not created yet
- if (!bg && action == 0)
- bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
if (!bg)
{
- sLog->outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId);
- return;
+ if (action)
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u. Cant find BG with id %u!",
+ GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action, ginfo.IsInvitedToBGInstanceGUID);
+ return;
+ }
+
+ bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId);
+ if (!bg)
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "BattlegroundHandler: bg_template not found for type id %u.", bgTypeId);
+ return;
+ }
}
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "CMSG_BATTLEFIELD_PORT %s ArenaType: %u, Unk: %u, BgType: %u, Action: %u.",
+ GetPlayerInfo().c_str(), type, unk2, bgTypeId_, action);
+
// expected bracket entry
PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), _player->getLevel());
if (!bracketEntry)
@@ -403,94 +420,93 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS);
_player->GetSession()->SendPacket(&data2);
action = 0;
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName().c_str(), _player->GetGUIDLow());
}
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
if (_player->getLevel() > bg->GetMaxLevel())
{
- sLog->outError("Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
- _player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!",
+ _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID());
action = 0;
}
}
uint32 queueSlot = _player->GetBattlegroundQueueIndex(bgQueueTypeId);
WorldPacket data;
- switch (action)
+ if (action)
{
- case 1: // port to battleground
- if (!_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId))
- return; // cheating?
+ if (!_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId))
+ return; // cheating?
- if (!_player->InBattleground())
- _player->SetBattlegroundEntryPoint();
+ if (!_player->InBattleground())
+ _player->SetBattlegroundEntryPoint();
- // resurrect the player
- if (!_player->isAlive())
- {
- _player->ResurrectPlayer(1.0f);
- _player->SpawnCorpseBones();
- }
- // stop taxi flight at port
- if (_player->isInFlight())
- {
- _player->GetMotionMaster()->MovementExpired();
- _player->CleanupAfterTaxiFlight();
- }
+ // resurrect the player
+ if (!_player->isAlive())
+ {
+ _player->ResurrectPlayer(1.0f);
+ _player->SpawnCorpseBones();
+ }
+ // stop taxi flight at port
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
- _player->GetSession()->SendPacket(&data);
- // remove battleground queue status from BGmgr
- bgQueue.RemovePlayer(_player->GetGUID(), false);
- // this is still needed here if battleground "jumping" shouldn't add deserter debuff
- // also this is required to prevent stuck at old battleground after SetBattlegroundId set to new
- if (Battleground* currentBg = _player->GetBattleground())
- currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
-
- // set the destination instance id
- _player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId);
- // set the destination team
- _player->SetBGTeam(ginfo.Team);
- // bg->HandleBeforeTeleportToBattleground(_player);
- sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
- // add only in HandleMoveWorldPortAck()
- // bg->AddPlayer(_player, team);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId);
- break;
- case 0: // leave queue
- // if player leaves rated arena match before match start, it is counted as he played but he lost
- if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType());
+ _player->GetSession()->SendPacket(&data);
+ // remove battleground queue status from BGmgr
+ bgQueue.RemovePlayer(_player->GetGUID(), false);
+ // this is still needed here if battleground "jumping" shouldn't add deserter debuff
+ // also this is required to prevent stuck at old battleground after SetBattlegroundId set to new
+ if (Battleground* currentBg = _player->GetBattleground())
+ currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
+
+ // set the destination instance id
+ _player->SetBattlegroundId(bg->GetInstanceID(), bgTypeId);
+ // set the destination team
+ _player->SetBGTeam(ginfo.Team);
+ // bg->HandleBeforeTeleportToBattleground(_player);
+ sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
+ // add only in HandleMoveWorldPortAck()
+ // bg->AddPlayer(_player, team);
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId);
+ }
+ else // leave queue
+ {
+ if (bg->isArena() && bg->GetStatus() > STATUS_WAIT_QUEUE)
+ return;
+
+ // if player leaves rated arena match before match start, it is counted as he played but he lost
+ if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
+ {
+ ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team);
+ if (at)
{
- ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team);
- if (at)
- {
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
- at->MemberLost(_player, ginfo.OpponentsMatchmakerRating);
- at->SaveToDB();
- }
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
+ at->MemberLost(_player, ginfo.OpponentsMatchmakerRating);
+ at->SaveToDB();
}
- _player->RemoveBattlegroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
- sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
- bgQueue.RemovePlayer(_player->GetGUID(), true);
- // player left queue, we should update it - do not update Arena Queue
- if (!ginfo.ArenaType)
- sBattlegroundMgr->ScheduleQueueUpdate(ginfo.ArenaMatchmakerRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
- SendPacket(&data);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
- break;
- default:
- sLog->outError("Battleground port: unknown action %u", action);
- break;
+ }
+ _player->RemoveBattlegroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs
+ sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
+ bgQueue.RemovePlayer(_player->GetGUID(), true);
+ // player left queue, we should update it - do not update Arena Queue
+ if (!ginfo.ArenaType)
+ sBattlegroundMgr->ScheduleQueueUpdate(ginfo.ArenaMatchmakerRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
+ SendPacket(&data);
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
}
}
-void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message");
- recv_data.read_skip<uint8>(); // unk1
- recv_data.read_skip<uint8>(); // unk2
- recv_data.read_skip<uint32>(); // BattlegroundTypeId
- recv_data.read_skip<uint16>(); // unk3
+ recvData.read_skip<uint8>(); // unk1
+ recvData.read_skip<uint8>(); // unk2
+ recvData.read_skip<uint32>(); // BattlegroundTypeId
+ recvData.read_skip<uint16>(); // unk3
// not allow leave battleground in combat
if (_player->isInCombat())
@@ -501,7 +517,7 @@ void WorldSession::HandleLeaveBattlefieldOpcode(WorldPacket& recv_data)
_player->LeaveBattleground();
}
-void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
{
// empty opcode
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Battleground status");
@@ -532,7 +548,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
}
//we are sending update to player about queue - he can be invited there!
//get GroupQueueInfo for queue status
- BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
+ BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
GroupQueueInfo ginfo;
if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo))
continue;
@@ -565,47 +581,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/)
}
}
-void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
-{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
-
- Battleground* bg = _player->GetBattleground();
-
- uint64 guid;
- recv_data >> guid;
-
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
- if (!unit)
- return;
-
- if (!unit->isSpiritService()) // it's not spirit service
- return;
-
- if (bg)
- sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
-}
-
-void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
-{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
-
- Battleground* bg = _player->GetBattleground();
-
- uint64 guid;
- recv_data >> guid;
-
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
- if (!unit)
- return;
-
- if (!unit->isSpiritService()) // it's not spirit service
- return;
-
- if (bg)
- bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
-}
-
-void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
+void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
@@ -615,7 +591,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
uint8 isRated; // isRated
Group* grp = NULL;
- recv_data >> guid >> arenaslot >> asGroup >> isRated;
+ recvData >> guid >> arenaslot >> asGroup >> isRated;
// ignore if we already in BG or BG queue
if (_player->InBattleground())
@@ -644,7 +620,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
arenatype = ARENA_TYPE_5v5;
break;
default:
- sLog->outError("Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot);
return;
}
@@ -652,7 +628,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(BATTLEGROUND_AA);
if (!bg)
{
- sLog->outError("Battleground: template bg (all arenas) not found");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: template bg (all arenas) not found");
return;
}
@@ -712,7 +688,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
arenaRating = 1;
}
- BattlegroundQueue &bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId];
+ BattlegroundQueue &bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
if (asGroup)
{
uint32 avgTime = 0;
@@ -722,7 +698,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena join as group start");
if (isRated)
{
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName(), matchmakerRating, arenatype);
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName().c_str(), matchmakerRating, arenatype);
bg->SetRated(true);
}
else
@@ -755,7 +731,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
member->GetSession()->SendPacket(&data);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
member->GetSession()->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str());
}
}
else
@@ -768,15 +744,15 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
// send status packet (in queue)
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
SendPacket(&data);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str());
}
sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId());
}
-void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data)
+void WorldSession::HandleReportPvPAFK(WorldPacket& recvData)
{
uint64 playerGuid;
- recv_data >> playerGuid;
+ recvData >> playerGuid;
Player* reportedPlayer = ObjectAccessor::FindPlayer(playerGuid);
if (!reportedPlayer)
@@ -785,7 +761,7 @@ void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data)
return;
}
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName(), reportedPlayer->GetName());
+ sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName().c_str(), reportedPlayer->GetName().c_str());
reportedPlayer->ReportedAfkBy(_player);
}
diff --git a/src/server/game/Handlers/BattlefieldHandler.cpp b/src/server/game/Handlers/BattlefieldHandler.cpp
new file mode 100644
index 00000000000..c4225551311
--- /dev/null
+++ b/src/server/game/Handlers/BattlefieldHandler.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Common.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
+
+//This send to player windows for invite player to join the war
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(time) Time in second that the player have for accept
+void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
+{
+ //Send packet
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint32((time(NULL) + p_time));
+
+ //Sending the packet to player
+ SendPacket(&data);
+}
+
+//This send invitation to player to join the queue
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
+
+ data << uint32(BattleId);
+ data << uint8(1); //warmup ? used ?
+
+ //Sending packet to player
+ SendPacket(&data);
+}
+
+//This send packet for inform player that he join queue
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(CanQueue) if able to queue
+//Param4:(Full) on log in is full
+void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
+ data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
+ data << uint8(1); //Warmup
+ SendPacket(&data);
+}
+
+//This is call when player accept to join war
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfEntered(uint32 BattleId)
+{
+// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
+ data << uint32(BattleId);
+ data << uint8(1); //unk
+ data << uint8(1); //unk
+ data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK
+ SendPacket(&data);
+}
+
+void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
+ data << uint32(BattleId);
+ data << uint8(reason);//byte Reason
+ data << uint8(2);//byte BattleStatus
+ data << uint8(0);//bool Relocated
+ SendPacket(&data);
+}
+
+//Send by client when he click on accept for queue
+void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recvData >> BattleId >> Accepted;
+ sLog->outDebug(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToQueue(_player);
+ }
+}
+
+//Send by client on clicking in accept or refuse of invitation windows for join game
+void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recvData >> BattleId >> Accepted;
+ sLog->outDebug(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ //If player accept invitation
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToWar(_player);
+ }
+ else
+ {
+ if (_player->GetZoneId() == Bf->GetZoneId())
+ Bf->KickPlayerFromBattlefield(_player->GetGUID());
+ }
+}
+
+void WorldSession::HandleBfExitRequest(WorldPacket & recvData)
+{
+ uint32 BattleId;
+
+ recvData >> BattleId;
+ sLog->outDebug(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ Bf->AskToLeaveQueue(_player);
+}
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 298c742fc3a..876a0fc4463 100755..100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -19,131 +19,116 @@
/*
----- Opcodes Not Used yet -----
-SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction()
-SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save)
-
------ Opcodes without Sniffs -----
-SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ]
-SMSG_CALENDAR_ARENA_TEAM [ for (... uint32(count) { packguid(???), uint8(???) } ]
-CMSG_CALENDAR_EVENT_INVITE_NOTES [ packguid(Invitee), uint64(inviteId), string(Text), Boolean(Unk) ]
-SMSG_CALENDAR_EVENT_INVITE_NOTES [ uint32(unk1), uint32(unk2), uint32(unk3), uint32(unk4), uint32(unk5) ]
+SMSG_CALENDAR_EVENT_INVITE_NOTES [ packguid(Invitee), uint64(inviteId), string(Text), Boolean(Unk) ]
+?CMSG_CALENDAR_EVENT_INVITE_NOTES [ uint32(unk1), uint32(unk2), uint32(unk3), uint32(unk4), uint32(unk5) ]
SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT [ uint64(inviteId), string(Text) ]
-SMSG_CALENDAR_EVENT_INVITE_STATUS_ALERT [ Structure unkown ]
+SMSG_CALENDAR_EVENT_INVITE_STATUS_ALERT [ uint64(eventId), uint32(eventTime), uint32(unkFlag), uint8(deletePending) ]
+SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save)
-*/
+----- TODO -----
-#include "Common.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
+Finish complains' handling - what to do with received complains and how to respond?
+Find out what to do with all "not used yet" opcodes
+Correct errors sending (event/invite not found, invites exceeded, event already passed, permissions etc.)
+Fix locked events to be displayed properly and response time shouldn't be shown for people that haven't respond yet
+Copied events should probably have a new owner
+
+*/
#include "InstanceSaveMgr.h"
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
+#include "SocialMgr.h"
#include "CalendarMgr.h"
#include "ObjectMgr.h"
#include "ObjectAccessor.h"
#include "DatabaseEnv.h"
+#include "GuildMgr.h"
+#include "ArenaTeamMgr.h"
+#include "WorldSession.h"
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
- time_t cur_time = time_t(time(NULL));
+ time_t currTime = time(NULL);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid);
- WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Impossible to get the correct size without doing a double iteration of some elements
+ WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
- CalendarInviteIdList const& invites = sCalendarMgr->GetPlayerInvites(guid);
+ std::vector<CalendarInvite*> invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size());
- for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
+ for (std::vector<CalendarInvite*>::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
- CalendarInvite* invite = sCalendarMgr->GetInvite(*it);
- CalendarEvent* calendarEvent = invite ? sCalendarMgr->GetEvent(invite->GetEventId()) : NULL;
+ data << uint64((*itr)->GetEventId());
+ data << uint64((*itr)->GetInviteId());
+ data << uint8((*itr)->GetStatus());
+ data << uint8((*itr)->GetRank());
- if (calendarEvent)
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
{
- data << uint64(invite->GetEventId());
- data << uint64(invite->GetInviteId());
- data << uint8(invite->GetStatus());
- data << uint8(invite->GetRank());
- data << uint8(calendarEvent->GetGuildId() != 0);
+ data << uint8(calendarEvent->IsGuildEvent());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
- sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it);
- data << uint64(0);
- data << uint64(0);
- data << uint8(0);
data << uint8(0);
- data << uint8(0);
- data.appendPackGUID(0);
+ data.appendPackGUID((*itr)->GetSenderGUID());
}
}
- CalendarEventIdList const& events = sCalendarMgr->GetPlayerEvents(guid);
- data << uint32(events.size());
- for (CalendarEventIdList::const_iterator it = events.begin(); it != events.end(); ++it)
+ CalendarEventStore playerEvents = sCalendarMgr->GetPlayerEvents(guid);
+ data << uint32(playerEvents.size());
+ for (CalendarEventStore::const_iterator itr = playerEvents.begin(); itr != playerEvents.end(); ++itr)
{
- if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(*it))
- {
- data << uint64(*it);
- data << calendarEvent->GetTitle().c_str();
- data << uint32(calendarEvent->GetType());
- data << uint32(calendarEvent->GetTime());
- data << uint32(calendarEvent->GetFlags());
- data << uint32(calendarEvent->GetDungeonId());
- data.appendPackGUID(calendarEvent->GetCreatorGUID());
- }
- else
- {
- sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it);
- data << uint64(0);
- data << uint8(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data << uint32(0);
- data.appendPackGUID(0);
- }
+ CalendarEvent* calendarEvent = *itr;
+
+ data << uint64(calendarEvent->GetEventId());
+ data << calendarEvent->GetTitle();
+ data << uint32(calendarEvent->GetType());
+ data.AppendPackedTime(calendarEvent->GetEventTime());
+ data << uint32(calendarEvent->GetFlags());
+ data << int32(calendarEvent->GetDungeonId());
+ data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
- data << uint32(cur_time); // server time
- data << uint32(secsToTimeBitFields(cur_time)); // server time
-
- uint32 counter = 0;
- size_t p_counter = data.wpos();
- data << uint32(counter); // instance save count
+ data << uint32(currTime); // server time
+ data.AppendPackedTime(currTime); // zone time
+ ByteBuffer dataBuffer;
+ uint32 boundCounter = 0;
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
- for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr)
+ {
+ Player::BoundInstancesMap boundInstances = _player->GetBoundInstances(Difficulty(i));
+ for (Player::BoundInstancesMap::const_iterator itr = boundInstances.begin(); itr != boundInstances.end(); ++itr)
+ {
if (itr->second.perm)
{
InstanceSave const* save = itr->second.save;
- data << uint32(save->GetMapId());
- data << uint32(save->GetDifficulty());
- data << uint32(save->GetResetTime() - cur_time);
- data << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
- ++counter;
+ dataBuffer << uint32(save->GetMapId());
+ dataBuffer << uint32(save->GetDifficulty());
+ dataBuffer << uint32(save->GetResetTime() - currTime);
+ dataBuffer << uint64(save->GetInstanceId()); // instance save id as unique instance copy id
+ ++boundCounter;
}
+ }
+ }
- data.put<uint32>(p_counter, counter);
-
- data << uint32(1135753200); // unk (28.12.2005 07:00)
+ data << uint32(boundCounter);
+ data.append(dataBuffer);
- counter = 0;
- p_counter = data.wpos();
- data << uint32(counter); // raid reset count
+ data << uint32(1135753200); // Constant date, unk (28.12.2005 07:00)
+ // Reuse variables
+ boundCounter = 0;
std::set<uint32> sentMaps;
+ dataBuffer.clear();
ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap();
for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr)
{
uint32 mapId = PAIR32_LOPART(itr->first);
-
if (sentMaps.find(mapId) != sentMaps.end())
continue;
@@ -153,12 +138,14 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
sentMaps.insert(mapId);
- data << uint32(mapId);
- data << uint32(itr->second - cur_time);
- data << uint32(mapEntry->unk_time);
- ++counter;
+ dataBuffer << int32(mapId);
+ dataBuffer << int32(itr->second - currTime);
+ dataBuffer << int32(0); // Never seen anything else in sniffs - still unknown
+ ++boundCounter;
}
- data.put<uint32>(p_counter, counter);
+
+ data << uint32(boundCounter);
+ data.append(dataBuffer);
// TODO: Fix this, how we do know how many and what holidays to send?
uint32 holidayCount = 0;
@@ -174,7 +161,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
data << uint32(holiday->CalendarFilterType); // m_calendarFilterType
for (uint8 j = 0; j < MAX_HOLIDAY_DATES; ++j)
- data << uint32(holiday->Date[j]); // 26 * m_date
+ data << uint32(holiday->Date[j]); // 26 * m_date -- WritePackedTime ?
for (uint8 j = 0; j < MAX_HOLIDAY_DURATIONS; ++j)
data << uint32(holiday->Duration[j]); // 10 * m_duration
@@ -193,176 +180,153 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
uint64 eventId;
recvData >> eventId;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Event: ["
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Player ["
UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
- SendCalendarEvent(*calendarEvent, CALENDAR_SENDTYPE_GET);
+ sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET);
+ else
+ sCalendarMgr->SendCalendarCommandResult(_player->GetGUID(), CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID());
- int32 unk1, unk2, unk3;
- recvData >> unk1;
- recvData >> unk2;
- recvData >> unk3;
+ uint32 minLevel;
+ uint32 maxLevel;
+ uint32 minRank;
+
+ recvData >> minLevel >> maxLevel >> minRank;
+
+ if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
+ guild->MassInviteToEvent(this, minLevel, maxLevel, minRank);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Calendar: CMSG_CALENDAR_GUILD_FILTER - unk1: %d unk2: %d unk3: %d", unk1, unk2, unk3);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER: Min level [%d], Max level [%d], Min rank [%d]", minLevel, maxLevel, minRank);
}
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID());
- int32 unk1;
- recvData >> unk1;
+ uint32 arenaTeamId;
+ recvData >> arenaTeamId;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Calendar: CMSG_CALENDAR_ARENA_TEAM - unk1: %d", unk1);
+ if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenaTeamId))
+ team->MassInviteToEvent(this);
}
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
uint64 guid = _player->GetGUID();
+
std::string title;
std::string description;
uint8 type;
- bool repeatable;
+ uint8 repeatable;
uint32 maxInvites;
int32 dungeonId;
uint32 eventPackedTime;
uint32 unkPackedTime;
uint32 flags;
- uint64 inviteId = 0;
- uint64 invitee = 0;
- uint8 status;
- uint8 rank;
- recvData >> title >> description >> type >> repeatable >> maxInvites;
- recvData >> dungeonId >> eventPackedTime >> unkPackedTime >> flags;
+ recvData >> title >> description >> type >> repeatable >> maxInvites >> dungeonId;
+ recvData.ReadPackedTime(eventPackedTime);
+ recvData.ReadPackedTime(unkPackedTime);
+ recvData >> flags;
+
+ CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
+ time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
- if (!(flags & CALENDAR_FLAG_WITHOUT_INVITES))
+ if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
+ if (Player* creator = ObjectAccessor::FindPlayer(guid))
+ calendarEvent->SetGuildId(creator->GetGuildId());
+
+ if (calendarEvent->IsGuildAnnouncement())
+ {
+ // 946684800 is 01/01/2000 00:00:00 - default response time
+ CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
+ sCalendarMgr->AddInvite(calendarEvent, invite);
+ }
+ else
{
uint32 inviteCount;
recvData >> inviteCount;
- recvData.readPackGUID(invitee);
- recvData >> status >> rank;
- if (inviteCount != 1 || invitee != guid)
+ for (uint32 i = 0; i < inviteCount; ++i)
{
- sLog->outError("HandleCalendarAddEvent: [" UI64FMTD
- "]: More than one invite (%d) or Invitee [" UI64FMTD
- "] differs", guid, inviteCount, invitee);
- return;
+ uint64 invitee = 0;
+ uint8 status = 0;
+ uint8 rank = 0;
+ recvData.readPackGUID(invitee);
+ recvData >> status >> rank;
+
+ // 946684800 is 01/01/2000 00:00:00 - default response time
+ CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEvent->GetEventId(), invitee, guid, 946684800, CalendarInviteStatus(status), CalendarModerationRank(rank), "");
+ sCalendarMgr->AddInvite(calendarEvent, invite);
}
-
- inviteId = sCalendarMgr->GetFreeInviteId();
- }
- else
- {
- inviteId = 0;
- status = CALENDAR_STATUS_NO_OWNER;
- rank = CALENDAR_RANK_PLAYER;
}
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ADD_EVENT: [" UI64FMTD "] "
- "Title %s, Description %s, type %u, Repeatable %u, MaxInvites %u, "
- "Dungeon ID %d, Time %u, Time2 %u, Flags %u, Invitee [" UI64FMTD "] "
- "Status %d, Rank %d", guid, title.c_str(), description.c_str(),
- type, repeatable, maxInvites, dungeonId, eventPackedTime,
- unkPackedTime, flags, invitee, status, rank);
-
- CalendarAction action;
-
- action.SetAction(CALENDAR_ACTION_ADD_EVENT);
- action.SetPlayer(_player);
- action.Event.SetEventId(sCalendarMgr->GetFreeEventId());
- action.Event.SetCreatorGUID(guid);
- action.Event.SetType((CalendarEventType) type);
- action.Event.SetFlags(flags);
- action.Event.SetTime(eventPackedTime);
- action.Event.SetTimeZoneTime(unkPackedTime);
- action.Event.SetRepeatable(repeatable);
- action.Event.SetMaxInvites(maxInvites);
- action.Event.SetDungeonId(dungeonId);
- action.Event.SetGuildId((flags & CALENDAR_FLAG_GUILD_ONLY) ? GetPlayer()->GetGuildId() : 0);
- action.Event.SetTitle(title);
- action.Event.SetDescription(description);
- action.Event.AddInvite(inviteId);
- action.Invite.SetEventId(action.Event.GetEventId());
- action.Invite.SetInviteId(inviteId);
- action.Invite.SetInvitee(invitee);
- action.Invite.SetStatus((CalendarInviteStatus) status);
- action.Invite.SetRank((CalendarModerationRank) rank);
- action.Invite.SetSenderGUID(guid);
-
- sCalendarMgr->AddAction(action);
+ sCalendarMgr->AddEvent(calendarEvent, CALENDAR_SENDTYPE_ADD);
}
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
uint64 guid = _player->GetGUID();
+ time_t oldEventTime;
+
uint64 eventId;
uint64 inviteId;
std::string title;
std::string description;
uint8 type;
- bool repeatable;
+ uint8 repetitionType;
uint32 maxInvites;
int32 dungeonId;
uint32 eventPackedTime;
uint32 timeZoneTime;
uint32 flags;
- recvData >> eventId >> inviteId >> title >> description >> type;
- recvData >> repeatable >> maxInvites >> dungeonId;
- recvData >> eventPackedTime >> timeZoneTime >> flags;
+ recvData >> eventId >> inviteId >> title >> description >> type >> repetitionType >> maxInvites >> dungeonId;
+ recvData.ReadPackedTime(eventPackedTime);
+ recvData.ReadPackedTime(timeZoneTime);
+ recvData >> flags;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
"Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
- description.c_str(), type, repeatable, maxInvites, dungeonId,
+ description.c_str(), type, repetitionType, maxInvites, dungeonId,
eventPackedTime, timeZoneTime, flags);
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_MODIFY_EVENT);
- action.SetPlayer(_player);
- action.SetInviteId(inviteId);
- action.Event.SetEventId(eventId);
- action.Event.SetType((CalendarEventType) type);
- action.Event.SetFlags((CalendarFlags) flags);
- action.Event.SetTime(eventPackedTime);
- action.Event.SetTimeZoneTime(timeZoneTime);
- action.Event.SetRepeatable(repeatable);
- action.Event.SetDungeonId(dungeonId);
- action.Event.SetTitle(title);
- action.Event.SetDescription(description);
- action.Event.SetMaxInvites(maxInvites);
-
- sCalendarMgr->AddAction(action);
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ oldEventTime = calendarEvent->GetEventTime();
+
+ calendarEvent->SetType(CalendarEventType(type));
+ calendarEvent->SetFlags(flags);
+ calendarEvent->SetEventTime(time_t(eventPackedTime));
+ calendarEvent->SetTimeZoneTime(time_t(timeZoneTime)); // Not sure, seems constant from the little sniffs we have
+ calendarEvent->SetDungeonId(dungeonId);
+ calendarEvent->SetTitle(title);
+ calendarEvent->SetDescription(description);
+
+ sCalendarMgr->UpdateEvent(calendarEvent);
+ sCalendarMgr->SendCalendarEventUpdateAlert(*calendarEvent, oldEventTime);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
{
uint64 guid = _player->GetGUID();
uint64 eventId;
- uint64 inviteId;
- uint32 flags;
- recvData >> eventId >> inviteId >> flags;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_REMOVE_EVENT [" UI64FMTD "], EventId [" UI64FMTD
- "] inviteId [" UI64FMTD "] Flags?: %u", guid, eventId, inviteId, flags);
-
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_REMOVE_EVENT);
- action.SetPlayer(_player);
- action.SetInviteId(inviteId);
- action.Event.SetEventId(eventId);
- action.Event.SetFlags((CalendarFlags) flags);
+ recvData >> eventId;
+ recvData.rfinish(); // Skip flags & invite ID, we don't use them
- sCalendarMgr->AddAction(action);
+ sCalendarMgr->RemoveEvent(eventId, guid);
}
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
@@ -372,98 +336,145 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
uint64 inviteId;
uint32 time;
- recvData >> eventId >> inviteId >> time;
+ recvData >> eventId >> inviteId;
+ recvData.ReadPackedTime(time);
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
"] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time);
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_COPY_EVENT);
- action.SetPlayer(_player);
- action.SetInviteId(inviteId);
- action.Event.SetEventId(eventId);
- action.Event.SetTime(time);
+ if (CalendarEvent* oldEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ CalendarEvent* newEvent = new CalendarEvent(*oldEvent, sCalendarMgr->GetFreeEventId());
+ newEvent->SetEventTime(time_t(time));
+ sCalendarMgr->AddEvent(newEvent, CALENDAR_SENDTYPE_COPY);
+
+ std::vector<CalendarInvite*> invites = sCalendarMgr->GetEventInvites(eventId);
+
+ for (std::vector<CalendarInvite*>::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
+ sCalendarMgr->AddInvite(newEvent, new CalendarInvite(**itr, sCalendarMgr->GetFreeInviteId(), newEvent->GetEventId()));
- sCalendarMgr->AddAction(action);
+ // should we change owner when somebody makes a copy of event owned by another person?
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_INVITE");
+
+ uint64 playerGuid = _player->GetGUID();
+
uint64 eventId;
uint64 inviteId;
std::string name;
- uint8 status;
- uint8 rank;
- uint64 invitee = 0;
- uint32 team = 0;
+ bool isPreInvite;
+ bool isGuildEvent;
+
+ uint64 inviteeGuid = 0;
+ uint32 inviteeTeam = 0;
+ uint32 inviteeGuildId = 0;
+
+ recvData >> eventId >> inviteId >> name >> isPreInvite >> isGuildEvent;
- recvData >> eventId >> inviteId >> name >> status >> rank;
if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
{
- invitee = player->GetGUID();
- team = player->GetTeam();
+ // Invitee is online
+ inviteeGuid = player->GetGUID();
+ inviteeTeam = player->GetTeam();
+ inviteeGuildId = player->GetGuildId();
}
else
{
+ // Invitee offline, get data from database
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME);
stmt->setString(0, name);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
- invitee = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
- team = Player::TeamForRace(fields[1].GetUInt8());
+ inviteeGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
+ inviteeTeam = Player::TeamForRace(fields[1].GetUInt8());
+ inviteeGuildId = Player::GetGuildIdFromDB(inviteeGuid);
}
}
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_INVITE [" UI64FMTD "], EventId ["
- UI64FMTD "] InviteId [" UI64FMTD "] Name %s ([" UI64FMTD "]), status %u, "
- "Rank %u", guid, eventId, inviteId, name.c_str(), invitee, status, rank);
-
- if (!invitee)
+ if (!inviteeGuid)
{
- SendCalendarCommandResult(CALENDAR_ERROR_PLAYER_NOT_FOUND);
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_PLAYER_NOT_FOUND);
return;
}
- if (_player->GetTeam() != team)
+ if (_player->GetTeam() != inviteeTeam && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR))
{
- SendCalendarCommandResult(CALENDAR_ERROR_NOT_ALLIED);
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NOT_ALLIED);
return;
}
- // TODO: Check ignore, even if offline (db query)
+ if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = " UI64FMTD " AND friend = " UI64FMTD, inviteeGuid, playerGuid))
+ {
+ Field* fields = result->Fetch();
+ if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED)
+ {
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_IGNORING_YOU_S, name.c_str());
+ return;
+ }
+ }
+
+ if (!isPreInvite)
+ {
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() == inviteeGuildId)
+ {
+ // we can't invite guild members to guild events
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NO_GUILD_INVITES);
+ return;
+ }
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_ADD_EVENT_INVITE);
- action.SetPlayer(_player);
- action.SetInviteId(inviteId);
- action.Invite.SetEventId(eventId);
- action.Invite.SetInviteId(sCalendarMgr->GetFreeInviteId());
- action.Invite.SetSenderGUID(_player->GetGUID());
- action.Invite.SetInvitee(invitee);
- action.Invite.SetRank((CalendarModerationRank) rank);
- action.Invite.SetStatus((CalendarInviteStatus) status);
+ // 946684800 is 01/01/2000 00:00:00 - default response time
+ CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, inviteeGuid, playerGuid, 946684800, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, "");
+ sCalendarMgr->AddInvite(calendarEvent, invite);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_EVENT_INVALID);
+ }
+ else
+ {
+ if (isGuildEvent && inviteeGuildId == _player->GetGuildId())
+ {
+ sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NO_GUILD_INVITES);
+ return;
+ }
- sCalendarMgr->AddAction(action);
+ // 946684800 is 01/01/2000 00:00:00 - default response time
+ CalendarInvite* invite = new CalendarInvite(inviteId, 0, inviteeGuid, playerGuid, 946684800, CALENDAR_STATUS_INVITED, CALENDAR_RANK_PLAYER, "");
+ sCalendarMgr->SendCalendarEventInvite(*invite);
+ }
}
void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
{
uint64 guid = _player->GetGUID();
uint64 eventId;
- uint8 status;
+ bool tentative;
+
+ recvData >> eventId >> tentative;
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative);
- recvData >> eventId >> status;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId ["
- UI64FMTD "] Status %u", guid, eventId, status);
-
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_SIGNUP_TO_EVENT);
- action.SetPlayer(_player);
- action.SetExtraData(GetPlayer()->GetGuildId());
- action.Event.SetEventId(eventId);
- action.Invite.SetStatus((CalendarInviteStatus) status);
- sCalendarMgr->AddAction(action);
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ if (calendarEvent->IsGuildEvent() && calendarEvent->GetGuildId() != _player->GetGuildId())
+ {
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD);
+ return;
+ }
+
+ CalendarInviteStatus status = tentative ? CALENDAR_STATUS_TENTATIVE : CALENDAR_STATUS_SIGNED_UP;
+ CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, time(NULL), status, CALENDAR_RANK_PLAYER, "");
+ sCalendarMgr->AddInvite(calendarEvent, invite);
+ sCalendarMgr->SendCalendarClearPendingAction(guid);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
@@ -471,22 +482,36 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
- uint8 status;
+ uint32 status;
recvData >> eventId >> inviteId >> status;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId ["
UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId,
inviteId, status);
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_MODIFY_EVENT_INVITE);
- action.SetPlayer(_player);
- action.SetInviteId(inviteId);
- action.Invite.SetInviteId(inviteId);
- action.Invite.SetEventId(eventId);
- action.Invite.SetStatus((CalendarInviteStatus) status);
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ // i think we still should be able to remove self from locked events
+ if (status != CALENDAR_STATUS_REMOVED && calendarEvent->GetFlags() & CALENDAR_FLAG_INVITES_LOCKED)
+ {
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_LOCKED);
+ return;
+ }
+
+ if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
+ {
+ invite->SetStatus(CalendarInviteStatus(status));
+ invite->SetStatusTime(time(NULL));
- sCalendarMgr->AddAction(action);
+ sCalendarMgr->UpdateInvite(invite);
+ sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
+ sCalendarMgr->SendCalendarClearPendingAction(guid);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_NO_INVITE); // correct?
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
@@ -494,26 +519,29 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
uint64 guid = _player->GetGUID();
uint64 invitee;
uint64 eventId;
- uint64 owninviteId;
+ uint64 ownerInviteId; // isn't it sender's inviteId?
uint64 inviteId;
recvData.readPackGUID(invitee);
- recvData >> inviteId >> owninviteId >> eventId;
+ recvData >> inviteId >> ownerInviteId >> eventId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
- UI64FMTD "] EventId [" UI64FMTD "], OwnInviteId ["
+ UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId ["
UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
- guid, eventId, owninviteId, invitee, inviteId);
+ guid, eventId, ownerInviteId, invitee, inviteId);
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_REMOVE_EVENT_INVITE);
- action.SetPlayer(_player);
- action.SetInviteId(owninviteId);
- action.Invite.SetInviteId(inviteId);
- action.Invite.SetEventId(eventId);
- action.Invite.SetInvitee(invitee);
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ if (calendarEvent->GetCreatorGUID() == invitee)
+ {
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_DELETE_CREATOR_FAILED);
+ return;
+ }
- sCalendarMgr->AddAction(action);
+ sCalendarMgr->RemoveInvite(inviteId, eventId, guid);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_NO_INVITE);
}
void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
@@ -522,25 +550,32 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
uint64 invitee;
uint64 eventId;
uint64 inviteId;
- uint64 owninviteId;
+ uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 status;
recvData.readPackGUID(invitee);
- recvData >> eventId >> inviteId >> owninviteId >> status;
+ recvData >> eventId >> inviteId >> ownerInviteId >> status;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId ["
- UI64FMTD "] OwnInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
- UI64FMTD "], status %u", guid, eventId, owninviteId, invitee, inviteId, status);
-
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_MODIFY_EVENT_INVITE);
- action.SetPlayer(_player);
- action.SetInviteId(owninviteId);
- action.Invite.SetInviteId(inviteId);
- action.Invite.SetEventId(eventId);
- action.Invite.SetInvitee(invitee);
- action.Invite.SetStatus((CalendarInviteStatus) status);
-
- sCalendarMgr->AddAction(action);
+ UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
+ UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status);
+
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
+ {
+ invite->SetStatus((CalendarInviteStatus)status);
+ // not sure if we should set response time when moderator changes invite status
+ //invite->SetStatusTime(time(NULL));
+
+ sCalendarMgr->UpdateInvite(invite);
+ sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
+ sCalendarMgr->SendCalendarClearPendingAction(invitee);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_NO_INVITE); // correct?
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
@@ -549,25 +584,28 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
uint64 invitee;
uint64 eventId;
uint64 inviteId;
- uint64 owninviteId;
- uint8 status;
+ uint64 ownerInviteId; // isn't it sender's inviteId?
+ uint8 rank;
recvData.readPackGUID(invitee);
- recvData >> eventId >> inviteId >> owninviteId >> status;
+ recvData >> eventId >> inviteId >> ownerInviteId >> rank;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId ["
- UI64FMTD "] OwnInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
- UI64FMTD "], status %u", guid, eventId, owninviteId, invitee, inviteId, status);
-
- CalendarAction action;
- action.SetAction(CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE);
- action.SetPlayer(_player);
- action.SetInviteId(owninviteId);
- action.Invite.SetInviteId(inviteId);
- action.Invite.SetEventId(eventId);
- action.Invite.SetInvitee(invitee);
- action.Invite.SetStatus((CalendarInviteStatus) status);
-
- sCalendarMgr->AddAction(action);
+ UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
+ UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank);
+
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ {
+ if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
+ {
+ invite->SetRank(CalendarModerationRank(rank));
+ sCalendarMgr->UpdateInvite(invite);
+ sCalendarMgr->SendCalendarEventModeratorStatusAlert(*calendarEvent, *invite);
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_NO_INVITE); // correct?
+ }
+ else
+ sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
@@ -579,6 +617,8 @@ void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
recvData >> eventId >> complainGUID;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId ["
UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID);
+
+ // what to do with complains?
}
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
@@ -594,279 +634,25 @@ void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
SendPacket(&data);
}
-// ----------------------------------- SEND ------------------------------------
-
-void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType)
-{
- uint64 eventId = calendarEvent.GetEventId();
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_EVENT [" UI64FMTD "] EventId ["
- UI64FMTD "] SendType %u", _player->GetGUID(), eventId, sendEventType);
-
- WorldPacket data(SMSG_CALENDAR_SEND_EVENT);
- data << uint8(sendEventType);
- data.appendPackGUID(calendarEvent.GetCreatorGUID());
- data << uint64(eventId);
- data << calendarEvent.GetTitle().c_str();
- data << calendarEvent.GetDescription().c_str();
- data << uint8(calendarEvent.GetType());
- data << uint8(calendarEvent.GetRepeatable());
- data << uint32(calendarEvent.GetMaxInvites());
- data << int32(calendarEvent.GetDungeonId());
- data << uint32(calendarEvent.GetFlags());
- data << uint32(calendarEvent.GetTime());
- data << uint32(calendarEvent.GetTimeZoneTime());
- data << uint32(calendarEvent.GetGuildId());
-
- CalendarInviteIdList const& invites = calendarEvent.GetInviteIdList();
- data << uint32(invites.size());
- for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
- {
- if (CalendarInvite* invite = sCalendarMgr->GetInvite(*it))
- {
- uint64 guid = invite->GetInvitee();
- Player* player = ObjectAccessor::FindPlayer(guid);
- uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(guid);
-
- data.appendPackGUID(guid);
- data << uint8(level);
- data << uint8(invite->GetStatus());
- data << uint8(invite->GetRank());
- data << uint8(calendarEvent.GetGuildId() != 0);
- data << uint64(invite->GetInviteId());
- data << uint32(invite->GetStatusTime());
- data << invite->GetText().c_str();
- }
- else
- {
- data.appendPackGUID(_player->GetGUID());
- data << uint8(0) << uint8(0) << uint8(0) << uint8(0)
- << uint64(0) << uint32(0) << uint8(0);
-
- sLog->outError("SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it);
- }
- }
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventInvite(CalendarInvite const& invite, bool pending)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = invite.GetEventId();
- uint64 inviteId = invite.GetInviteId();
- uint64 invitee = invite.GetInvitee();
- uint8 status = invite.GetStatus();
- uint32 statusTime = invite.GetStatusTime();
- Player* player = ObjectAccessor::FindPlayer(invitee);
- uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE [" UI64FMTD "] EventId ["
- UI64FMTD "] InviteId [" UI64FMTD "] Invitee [" UI64FMTD "] "
- " Level %u, Status %u, StatusTime %u" , guid, eventId, inviteId,
- invitee, level, status, statusTime);
-
- WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
- data.appendPackGUID(invitee);
- data << uint64(eventId);
- data << uint64(inviteId);
- data << uint8(level);
- data << uint8(status);
- if (statusTime)
- data << uint8(1) << uint32(statusTime);
- else
- data << uint8(0);
- data << uint8(pending);
-
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = calendarEvent.GetEventId();
- uint64 inviteId = invite.GetInviteId();
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_ALERT [" UI64FMTD "] EventId ["
- UI64FMTD "] InviteId [" UI64FMTD "]", guid, eventId, inviteId);
-
- WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
- data << uint64(eventId);
- data << calendarEvent.GetTitle().c_str();
- data << uint32(calendarEvent.GetTime());
- data << uint32(calendarEvent.GetFlags());
- data << uint32(calendarEvent.GetType());
- data << uint32(calendarEvent.GetDungeonId());
- data << uint64(inviteId);
- data << uint8(invite.GetStatus());
- data << uint8(invite.GetRank());
- data.appendPackGUID(calendarEvent.GetCreatorGUID());
- data.appendPackGUID(invite.GetSenderGUID());
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType)
+void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
{
- uint64 guid = _player->GetGUID();
- uint64 eventId = calendarEvent.GetEventId();
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_UPDATED_ALERT ["
- UI64FMTD "] EventId [" UI64FMTD "]", guid, eventId);
-
-
- WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 +
- calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
- data << uint8(sendEventType);
- data << uint64(eventId);
- data << uint32(calendarEvent.GetTime());
- data << uint32(calendarEvent.GetFlags());
- data << uint32(calendarEvent.GetTime());
- data << uint8(calendarEvent.GetType());
- data << uint32(calendarEvent.GetDungeonId());
- data << calendarEvent.GetTitle().c_str();
- data << calendarEvent.GetDescription().c_str();
- data << uint8(calendarEvent.GetRepeatable());
- data << uint32(calendarEvent.GetMaxInvites());
- data << uint32(0); // FIXME
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = calendarEvent.GetEventId();
- uint32 eventTime = (calendarEvent.GetTime());
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_REMOVED_ALERT [" UI64FMTD "] EventId ["
- UI64FMTD "] Time %u", guid, eventId, eventTime);
-
- WorldPacket data(SMSG_CALENDAR_EVENT_REMOVED_ALERT, 1 + 8 + 1);
- data << uint8(1); // FIXME: If true does not SignalEvent(EVENT_CALENDAR_ACTION_PENDING)
- data << uint64(eventId);
- data << uint32(eventTime);
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = calendarEvent.GetEventId();
- uint64 inviteId = invite.GetInviteId();
- uint64 invitee = invite.GetInvitee();
- uint32 eventTime = (calendarEvent.GetTime());
- uint32 flags = calendarEvent.GetFlags();
- uint8 status = invite.GetStatus();
- uint8 rank = invite.GetRank();
- uint32 statusTime = secsToTimeBitFields(invite.GetStatusTime());
-
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_STATUS [" UI64FMTD "] EventId ["
- UI64FMTD "] InviteId [" UI64FMTD "] Invitee [" UI64FMTD "] Time %u "
- "Flags %u, Status %u, Rank %u, StatusTime %u",
- guid, eventId, inviteId, invitee, eventTime, flags, status, rank,
- statusTime);
-
- WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
- data.appendPackGUID(invitee);
- data << uint64(eventId);
- data << uint32(eventTime);
- data << uint32(flags);
- data << uint8(status);
- data << uint8(rank);
- data << uint32(statusTime);
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = invite.GetEventId();
- uint64 invitee = invite.GetInvitee();
- uint8 status = invite.GetStatus();
-
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT [" UI64FMTD
- "] Invitee [" UI64FMTD "] EventId [" UI64FMTD "] Status %u ", guid,
- invitee, eventId, status);
-
-
- WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1);
- data.appendPackGUID(invitee);
- data << uint64(eventId);
- data << uint8(status);
- data << uint8(1); // FIXME
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = calendarEvent.GetEventId();
- uint32 eventTime = (calendarEvent.GetTime());
- uint32 flags = calendarEvent.GetFlags();
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT ["
- UI64FMTD "] EventId [" UI64FMTD "] Time %u, Flags %u, Status %u",
- guid, eventId, eventTime, flags, status);
-
- WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT, 8 + 4 + 4 + 1);
- data << uint64(eventId);
- data << uint32(eventTime);
- data << uint32(flags);
- data << uint8(status);
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags)
-{
- uint64 guid = _player->GetGUID();
- uint64 eventId = invite.GetEventId();
- uint64 invitee = invite.GetInvitee();
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED ["
- UI64FMTD "] Invitee [" UI64FMTD "] EventId [" UI64FMTD
- "] Flags %u", guid, invitee, eventId, flags);
-
- WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
- data.appendPackGUID(invitee);
- data << uint32(eventId);
- data << uint32(flags);
- data << uint8(1); // FIXME
- SendPacket(&data);
-}
-
-void WorldSession::SendCalendarClearPendingAction()
-{
- uint64 guid = _player->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_CLEAR_PENDING_ACTION [" UI64FMTD "]", guid);
+ uint32 mapId, difficulty;
+ uint8 toggleExtend;
+ recvData >> mapId >> difficulty>> toggleExtend;
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, Difficulty: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ? "On" : "Off");
+
+ /*
+ InstancePlayerBind* instanceBind = _player->GetBoundInstance(mapId, Difficulty(difficulty));
+ if (!instanceBind || !instanceBind->save)
+ return;
- WorldPacket data(SMSG_CALENDAR_CLEAR_PENDING_ACTION, 0);
- SendPacket(&data);
+ InstanceSave* save = instanceBind->save;
+ // http://www.wowwiki.com/Instance_Lock_Extension
+ // SendCalendarRaidLockoutUpdated(save);
+ */
}
-void WorldSession::SendCalendarCommandResult(CalendarError err, char const* param /*= NULL*/)
-{
- uint64 guid = _player->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_COMMAND_RESULT [" UI64FMTD "] Value: %u", guid, err);
-
- WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
- data << uint32(0);
- data << uint8(0);
- switch (err)
- {
- case CALENDAR_ERROR_OTHER_INVITES_EXCEEDED:
- case CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S:
- case CALENDAR_ERROR_IGNORING_YOU_S:
- data << param;
- break;
- default:
- data << uint8(0);
- break;
- }
-
- data << uint32(err);
-
- SendPacket(&data);
-}
+// ----------------------------------- SEND ------------------------------------
void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
{
@@ -877,7 +663,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
if (add)
{
data.SetOpcode(SMSG_CALENDAR_RAID_LOCKOUT_ADDED);
- data << uint32(secsToTimeBitFields(currTime));
+ data.AppendPackedTime(currTime);
}
data << uint32(save->GetMapId());
@@ -896,13 +682,13 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
"] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
- time_t cur_time = time_t(time(NULL));
+ time_t currTime = time(NULL);
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
- data << secsToTimeBitFields(cur_time);
+ data.AppendPackedTime(currTime);
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(0); // Amount of seconds that has changed to the reset time
- data << uint32(save->GetResetTime() - cur_time);
+ data << uint32(save->GetResetTime() - currTime);
SendPacket(&data);
}
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp
index 9b749fa8005..462bc7fff0b 100755..100644
--- a/src/server/game/Handlers/ChannelHandler.cpp
+++ b/src/server/game/Handlers/ChannelHandler.cpp
@@ -18,252 +18,256 @@
#include "ObjectMgr.h" // for normalizePlayerName
#include "ChannelMgr.h"
+#include "Player.h"
void WorldSession::HandleJoinChannel(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
- uint32 channel_id;
+ uint32 channelId;
uint8 unknown1, unknown2;
- std::string channelname, pass;
+ std::string channelName, password;
+
+ recvPacket >> channelId >> unknown1 >> unknown2 >> channelName >> password;
- recvPacket >> channel_id;
- recvPacket >> unknown1 >> unknown2;
- recvPacket >> channelname;
- recvPacket >> pass;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s",
+ GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str());
- if (channel_id)
+ if (channelId)
{
- ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channel_id);
+ ChatChannelsEntry const* channel = sChatChannelsStore.LookupEntry(channelId);
if (!channel)
return;
- AreaTableEntry const* current_zone = GetAreaEntryByAreaID(_player->GetZoneId());
- if (!current_zone)
- return;
-
- if (!_player->CanJoinConstantChannelInZone(channel, current_zone))
+ AreaTableEntry const* zone = GetAreaEntryByAreaID(GetPlayer()->GetZoneId());
+ if (!zone || !GetPlayer()->CanJoinConstantChannelInZone(channel, zone))
return;
}
- if (channelname.empty())
+ if (channelName.empty())
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
- cMgr->team = _player->GetTeam();
- if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id))
- chn->Join(_player->GetGUID(), pass.c_str());
+ cMgr->setTeam(GetPlayer()->GetTeam());
+ if (Channel* channel = cMgr->GetJoinChannel(channelName, channelId))
+ channel->JoinChannel(GetPlayer(), password);
}
}
void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
uint32 unk;
- std::string channelname;
- recvPacket >> unk; // channel id?
- recvPacket >> channelname;
+ std::string channelName;
+ recvPacket >> unk >> channelName;
- if (channelname.empty())
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u",
+ GetPlayerInfo().c_str(), channelName.c_str(), unk);
+
+ if (channelName.empty())
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Leave(_player->GetGUID(), true);
- cMgr->LeftChannel(channelname);
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->LeaveChannel(GetPlayer(), true);
+ cMgr->LeftChannel(channelName);
}
}
void WorldSession::HandleChannelList(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
+ std::string channelName;
+ recvPacket >> channelName;
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "%s %s Channel: %s",
+ recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST",
+ GetPlayerInfo().c_str(), channelName.c_str());
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->List(_player);
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->List(GetPlayer());
}
void WorldSession::HandleChannelPassword(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, pass;
- recvPacket >> channelname;
+ std::string channelName, password;
+ recvPacket >> channelName >> password;
- recvPacket >> pass;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), password.c_str());
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Password(_player->GetGUID(), pass.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Password(GetPlayer(), password);
}
void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, newp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> newp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(newp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SetOwner(_player->GetGUID(), newp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SetOwner(GetPlayer(), targetName);
}
void WorldSession::HandleChannelOwner(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SendWhoOwner(_player->GetGUID());
+ std::string channelName;
+ recvPacket >> channelName;
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
+
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SendWhoOwner(GetPlayer()->GetGUID());
}
void WorldSession::HandleChannelModerator(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SetModerator(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SetModerator(GetPlayer(), targetName);
}
void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->UnsetModerator(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->UnsetModerator(GetPlayer(), targetName);
}
void WorldSession::HandleChannelMute(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->SetMute(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->SetMute(GetPlayer(), targetName);
}
void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->UnsetMute(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->UnsetMute(GetPlayer(), targetName);
}
void WorldSession::HandleChannelInvite(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Invite(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Invite(GetPlayer(), targetName);
}
void WorldSession::HandleChannelKick(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
- if (!normalizePlayerName(otp))
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
+
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Kick(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Kick(GetPlayer(), targetName);
}
void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Ban(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Ban(GetPlayer(), targetName);
}
void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
-
- std::string channelname, otp;
- recvPacket >> channelname;
+ std::string channelName, targetName;
+ recvPacket >> channelName >> targetName;
- recvPacket >> otp;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s",
+ GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
- if (!normalizePlayerName(otp))
+ if (!normalizePlayerName(targetName))
return;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->UnBan(_player->GetGUID(), otp.c_str());
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->UnBan(GetPlayer(), targetName);
}
void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->Announce(_player->GetGUID());
+ std::string channelName;
+ recvPacket >> channelName;
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
+
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->Announce(GetPlayer());
}
void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
@@ -274,17 +278,23 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ std::string channelName;
+ recvPacket >> channelName;
+
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
+
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam()))
{
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
{
- WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4);
- data << chn->GetName();
- data << uint8(chn->GetFlags());
- data << uint32(chn->GetNumPlayers());
+ sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u",
+ GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers());
+
+ WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, channel->GetName().size() + 1 + 4);
+ data << channel->GetName();
+ data << uint8(channel->GetFlags());
+ data << uint32(channel->GetNumPlayers());
SendPacket(&data);
}
}
@@ -292,11 +302,15 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
- std::string channelname;
- recvPacket >> channelname;
- /*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
- if (Channel* chn = cMgr->GetChannel(channelname, _player))
- chn->JoinNotify(_player->GetGUID());*/
-}
+ std::string channelName;
+ recvPacket >> channelName;
+ sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_SET_CHANNEL_WATCH %s Channel: %s",
+ GetPlayerInfo().c_str(), channelName.c_str());
+
+ /*
+ if (ChannelMgr* cMgr = channelMgr(GetPlayer()->GetTeam()))
+ if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
+ channel->JoinNotify(GetPlayer());
+ */
+}
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 29ee2b5cb41..0e9ad902d8f 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -16,34 +16,37 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "ObjectAccessor.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "GuildMgr.h"
-#include "SystemConfig.h"
-#include "World.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "DatabaseEnv.h"
-
+#include "AccountMgr.h"
#include "ArenaTeam.h"
+#include "ArenaTeamMgr.h"
+#include "Battleground.h"
+#include "CalendarMgr.h"
#include "Chat.h"
+#include "Common.h"
+#include "DatabaseEnv.h"
#include "Group.h"
#include "Guild.h"
+#include "GuildMgr.h"
#include "Language.h"
+#include "LFGMgr.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
-#include "Player.h"
+#include "Pet.h"
#include "PlayerDump.h"
+#include "Player.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
#include "SharedDefines.h"
#include "SocialMgr.h"
+#include "SystemConfig.h"
#include "UpdateMask.h"
#include "Util.h"
-#include "ScriptMgr.h"
-#include "Battleground.h"
-#include "AccountMgr.h"
-#include "LFGMgr.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
+
class LoginQueryHolder : public SQLQueryHolder
{
@@ -68,135 +71,139 @@ bool LoginQueryHolder::Initialize()
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADFROM, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_FROM, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGROUP, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GROUP, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_INSTANCE);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURAS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADAURAS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AURAS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SPELL);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SPELLS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADWEEKLYQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS, stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MONTHLYQUESTSTATUS);
+ stmt->setUInt32(0, lowGuid);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSEASONALQUESTSTATUS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_REPUTATION);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_REPUTATION, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_INVENTORY);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INVENTORY, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACTIONS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACTIONS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT);
stmt->setUInt32(0, lowGuid);
stmt->setUInt64(1, uint64(time(NULL)));
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_DATE, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SOCIALLIST);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_HOMEBIND);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SPELLCOOLDOWNS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS, stmt);
if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DECLINEDNAMES);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES, stmt);
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGUILD, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GUILD, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ARENAINFO);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADARENAINFO, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACHIEVEMENTS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_CRITERIAPROGRESS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_EQUIPMENTSETS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_BGDATA);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BG_DATA, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GLYPHS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADGLYPHS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GLYPHS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_TALENTS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADTALENTS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_TALENTS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ACCOUNT_DATA);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SKILLS);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SKILLS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_RANDOMBG);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADRANDOMBG, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_BANNED);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADBANNED, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BANNED, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUSREW);
stmt->setUInt32(0, lowGuid);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUSREW, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES);
stmt->setUInt32(0, m_accountId);
- res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES, stmt);
+ res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, stmt);
return res;
}
@@ -215,7 +222,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
do
{
uint32 guidlow = (*result)[0].GetUInt32();
- sLog->outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId());
if (Player::BuildEnumData(result, &data))
{
_allowedCharsToLogin.insert(guidlow);
@@ -230,7 +237,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
SendPacket(&data);
}
-void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/)
{
// remove expired bans
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
@@ -249,20 +256,20 @@ void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recv_data*/)
_charEnumCallback = CharacterDatabase.AsyncQuery(stmt);
}
-void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
{
std::string name;
uint8 race_, class_;
- recv_data >> name;
+ recvData >> name;
- recv_data >> race_;
- recv_data >> class_;
+ recvData >> race_;
+ recvData >> class_;
// extract other data required for player creating
uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
- recv_data >> gender >> skin >> face;
- recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
+ recvData >> gender >> skin >> face;
+ recvData >> hairStyle >> hairColor >> facialHair >> outfitId;
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
@@ -293,7 +300,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket(&data);
- sLog->outError("Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId());
+ 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;
}
@@ -302,7 +309,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
{
data << (uint8)CHAR_CREATE_FAILED;
SendPacket(&data);
- sLog->outError("Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId());
+ 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;
}
@@ -310,7 +317,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
if (raceEntry->expansion > Expansion())
{
data << (uint8)CHAR_CREATE_EXPANSION;
- sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_);
+ 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;
}
@@ -319,7 +326,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
if (classEntry->expansion > Expansion())
{
data << (uint8)CHAR_CREATE_EXPANSION_CLASS;
- sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->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;
}
@@ -348,7 +355,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
{
data << (uint8)CHAR_NAME_NO_NAME;
SendPacket(&data);
- sLog->outError("Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account:[%d] but tried to Create character with empty [name] ", GetAccountId());
return;
}
@@ -387,7 +394,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
}
delete _charCreateCallback.GetParam(); // Delete existing if any, to make the callback chain reset to stage 0
- _charCreateCallback.SetParam(new CharacterCreateInfo(name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId, recv_data));
+ _charCreateCallback.SetParam(new CharacterCreateInfo(name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId, recvData));
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME);
stmt->setString(0, name);
_charCreateCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
@@ -658,10 +665,9 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
SendPacket(&data);
std::string IP_str = GetRemoteAddress();
- sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
- sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
- sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass());
+ sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel());
newChar.CleanupsBeforeDelete();
delete createInfo;
@@ -671,23 +677,24 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
}
}
-void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
+void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// can't delete loaded character
if (ObjectAccessor::FindPlayer(guid))
return;
uint32 accountId = 0;
+ uint8 level = 0;
std::string name;
// is guild leader
if (sGuildMgr->GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
+ data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER);
SendPacket(&data);
return;
}
@@ -696,22 +703,20 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
+ data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN);
SendPacket(&data);
return;
}
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID);
-
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DATA_BY_GUID);
stmt->setUInt32(0, GUID_LOPART(guid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (result)
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
- accountId = fields[0].GetUInt32();
- name = fields[1].GetString();
+ accountId = fields[0].GetUInt32();
+ name = fields[1].GetString();
+ level = fields[2].GetUInt8();
}
// prevent deleting other players' characters using cheating tools
@@ -719,43 +724,43 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
return;
std::string IP_str = GetRemoteAddress();
- sLog->outDetail("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
- sLog->outChar("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
+ 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));
- if (sLog->IsOutCharDump()) // optimize GetPlayerDump call
+ if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ sLog->outCharDump(dump.c_str(), accountId, GUID_LOPART(guid), name.c_str());
}
- Player::DeleteFromDB(guid, GetAccountId());
+ sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid);
+ Player::DeleteFromDB(guid, accountId);
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_SUCCESS;
+ data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
}
-void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
{
if (PlayerLoading() || GetPlayer() != NULL)
{
- sLog->outError("Player tryes to login again, AccountId = %d", GetAccountId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player tryes to login again, AccountId = %d", GetAccountId());
return;
}
m_playerLoading = true;
uint64 playerGuid = 0;
- sLog->outStaticDebug("WORLD: Recvd Player Logon Message");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message");
- recv_data >> playerGuid;
+ recvData >> playerGuid;
if (!CharCanLogin(GUID_LOPART(playerGuid)))
{
- sLog->outError("Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
KickPlayer();
return;
}
@@ -777,7 +782,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
Player* pCurrChar = new Player(this);
// for send server info and strings (config)
- ChatHandler chH = ChatHandler(pCurrChar);
+ ChatHandler chH = ChatHandler(pCurrChar->GetSession());
// "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
@@ -802,7 +807,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendPacket(&data);
// load player specific part before send times
- LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACCOUNTDATA), PER_CHARACTER_CACHE_MASK);
+ LoadAccountData(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA), PER_CHARACTER_CACHE_MASK);
SendAccountDataTimes(PER_CHARACTER_CACHE_MASK);
data.Initialize(SMSG_FEATURE_SYSTEM_STATUS, 2); // added in 2.2.0
@@ -839,17 +844,17 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
data.put(0, linecount);
SendPacket(&data);
- sLog->outStaticDebug("WORLD: Sent motd (SMSG_MOTD)");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_MOTD)");
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(_FULLVERSION);
- sLog->outStaticDebug("WORLD: Sent server info");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent server info");
}
//QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow());
- if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGUILD))
+ if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GUILD))
{
Field* fields = resultGuild->Fetch();
pCurrChar->SetInGuild(fields[0].GetUInt32());
@@ -868,7 +873,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
else
{
// remove wrong guild data
- sLog->outError("Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId());
pCurrChar->SetInGuild(0);
}
}
@@ -898,17 +903,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
}
- if (Group* group = pCurrChar->GetGroup())
- {
- if (group->isLFGGroup())
- {
- LfgDungeonSet Dungeons;
- Dungeons.insert(sLFGMgr->GetDungeon(group->GetGUID()));
- sLFGMgr->SetSelectedDungeons(pCurrChar->GetGUID(), Dungeons);
- sLFGMgr->SetState(pCurrChar->GetGUID(), sLFGMgr->GetState(group->GetGUID()));
- }
- }
-
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
{
AreaTrigger const* at = sObjectMgr->GetGoBackTrigger(pCurrChar->GetMapId());
@@ -919,7 +913,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
sObjectAccessor->AddObject(pCurrChar);
- //sLog->outDebug("Player %s added to Map.", pCurrChar->GetName());
+ //sLog->outDebug("Player %s added to Map.", pCurrChar->GetName().c_str());
pCurrChar->SendInitialPacketsAfterAddToMap();
@@ -1006,8 +1000,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
- sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
- GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
+ GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
@@ -1018,30 +1012,30 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
delete holder;
}
-void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data)
+void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
{
- sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_ATWAR");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR");
uint32 repListID;
uint8 flag;
- recv_data >> repListID;
- recv_data >> flag;
+ recvData >> repListID;
+ recvData >> flag;
GetPlayer()->GetReputationMgr().SetAtWar(repListID, flag);
}
//I think this function is never used :/ I dunno, but i guess this opcode not exists
-void WorldSession::HandleSetFactionCheat(WorldPacket & /*recv_data*/)
+void WorldSession::HandleSetFactionCheat(WorldPacket & /*recvData*/)
{
- sLog->outError("WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
GetPlayer()->GetReputationMgr().SendStates();
}
-void WorldSession::HandleTutorialFlag(WorldPacket & recv_data)
+void WorldSession::HandleTutorialFlag(WorldPacket& recvData)
{
uint32 data;
- recv_data >> data;
+ recvData >> data;
uint8 index = uint8(data / 32);
if (index >= MAX_ACCOUNT_TUTORIAL_VALUES)
@@ -1054,57 +1048,57 @@ void WorldSession::HandleTutorialFlag(WorldPacket & recv_data)
SetTutorialInt(index, flag);
}
-void WorldSession::HandleTutorialClear(WorldPacket & /*recv_data*/)
+void WorldSession::HandleTutorialClear(WorldPacket & /*recvData*/)
{
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
SetTutorialInt(i, 0xFFFFFFFF);
}
-void WorldSession::HandleTutorialReset(WorldPacket & /*recv_data*/)
+void WorldSession::HandleTutorialReset(WorldPacket & /*recvData*/)
{
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
SetTutorialInt(i, 0x00000000);
}
-void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
{
- sLog->outStaticDebug("WORLD: Received CMSG_SET_WATCHED_FACTION");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION");
uint32 fact;
- recv_data >> fact;
+ recvData >> fact;
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
}
-void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
{
- sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_INACTIVE");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE");
uint32 replistid;
uint8 inactive;
- recv_data >> replistid >> inactive;
+ recvData >> replistid >> inactive;
_player->GetReputationMgr().SetInactive(replistid, inactive);
}
-void WorldSession::HandleShowingHelmOpcode(WorldPacket& recv_data)
+void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData)
{
- sLog->outStaticDebug("CMSG_SHOWING_HELM for %s", _player->GetName());
- recv_data.read_skip<uint8>(); // unknown, bool?
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName().c_str());
+ recvData.read_skip<uint8>(); // unknown, bool?
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
}
-void WorldSession::HandleShowingCloakOpcode(WorldPacket& recv_data)
+void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
{
- sLog->outStaticDebug("CMSG_SHOWING_CLOAK for %s", _player->GetName());
- recv_data.read_skip<uint8>(); // unknown, bool?
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str());
+ recvData.read_skip<uint8>(); // unknown, bool?
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
}
-void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
+void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
{
uint64 guid;
std::string newName;
- recv_data >> guid;
- recv_data >> newName;
+ recvData >> guid;
+ recvData >> newName;
// prevent character rename to invalid name
if (!normalizePlayerName(newName))
@@ -1150,7 +1144,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
_charRenameCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
-void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string newName)
+void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName)
{
if (!result)
{
@@ -1183,7 +1177,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
CharacterDatabase.Execute(stmt);
- sLog->outChar("Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(RESPONSE_SUCCESS);
@@ -1194,11 +1188,11 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
sWorld->UpdateCharacterNameData(guidLow, newName);
}
-void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
+void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// not accept declined names for unsupported languages
std::string name;
@@ -1233,7 +1227,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
std::string name2;
DeclinedName declinedname;
- recv_data >> name2;
+ recvData >> name2;
if (name2 != name) // character have different name
{
@@ -1246,7 +1240,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
- recv_data >> declinedname.name[i];
+ recvData >> declinedname.name[i];
if (!normalizePlayerName(declinedname.name[i]))
{
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
@@ -1291,12 +1285,12 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
+void WorldSession::HandleAlterAppearance(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE");
uint32 Hair, Color, FacialHair, SkinColor;
- recv_data >> Hair >> Color >> FacialHair >> SkinColor;
+ recvData >> Hair >> Color >> FacialHair >> SkinColor;
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
@@ -1313,12 +1307,29 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
if (bs_skinColor && (bs_skinColor->type != 3 || bs_skinColor->race != _player->getRace() || bs_skinColor->gender != _player->getGender()))
return;
- uint32 Cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
+ GameObject* go = _player->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_BARBER_CHAIR, 5.0f);
+ if (!go)
+ {
+ WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
+ data << uint32(2);
+ SendPacket(&data);
+ return;
+ }
+
+ if (_player->getStandState() != UNIT_STAND_STATE_SIT_LOW_CHAIR + go->GetGOInfo()->barberChair.chairheight)
+ {
+ WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
+ data << uint32(2);
+ SendPacket(&data);
+ return;
+ }
+
+ uint32 cost = _player->GetBarberShopCost(bs_hair->hair_id, Color, bs_facialHair->hair_id, bs_skinColor);
// 0 - ok
// 1, 3 - not enough money
// 2 - you have to seat on barber chair
- if (!_player->HasEnoughMoney(Cost))
+ if (!_player->HasEnoughMoney(cost))
{
WorldPacket data(SMSG_BARBER_SHOP_RESULT, 4);
data << uint32(1); // no money
@@ -1332,8 +1343,8 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
SendPacket(&data);
}
- _player->ModifyMoney(-int32(Cost)); // it isn't free
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, Cost);
+ _player->ModifyMoney(-int32(cost)); // it isn't free
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, cost);
_player->SetByteValue(PLAYER_BYTES, 2, uint8(bs_hair->hair_id));
_player->SetByteValue(PLAYER_BYTES, 3, uint8(Color));
@@ -1341,15 +1352,15 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
if (bs_skinColor)
_player->SetByteValue(PLAYER_BYTES, 0, uint8(bs_skinColor->hair_id));
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1);
_player->SetStandState(0); // stand up
}
-void WorldSession::HandleRemoveGlyph(WorldPacket & recv_data)
+void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
{
uint32 slot;
- recv_data >> slot;
+ recvData >> slot;
if (slot >= MAX_GLYPH_SLOT_INDEX)
{
@@ -1368,16 +1379,16 @@ void WorldSession::HandleRemoveGlyph(WorldPacket & recv_data)
}
}
-void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
+void WorldSession::HandleCharCustomize(WorldPacket& recvData)
{
uint64 guid;
std::string newName;
- recv_data >> guid;
- recv_data >> newName;
+ recvData >> guid;
+ recvData >> newName;
uint8 gender, skin, face, hairStyle, hairColor, facialHair;
- recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face;
+ recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
@@ -1450,7 +1461,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
if (result)
{
std::string oldname = result->Fetch()[0].GetString();
- sLog->outChar("Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
@@ -1484,23 +1495,23 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
+void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE");
uint64 setGuid;
- recv_data.readPackGUID(setGuid);
+ recvData.readPackGUID(setGuid);
uint32 index;
- recv_data >> index;
+ recvData >> index;
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
return;
std::string name;
- recv_data >> name;
+ recvData >> name;
std::string iconName;
- recv_data >> iconName;
+ recvData >> iconName;
EquipmentSet eqSet;
@@ -1512,7 +1523,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
- recv_data.readPackGUID(itemGuid);
+ recvData.readPackGUID(itemGuid);
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
if (itemGuid == 1)
@@ -1536,17 +1547,17 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
_player->SetEquipmentSet(index, eqSet);
}
-void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
+void WorldSession::HandleEquipmentSetDelete(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE");
uint64 setGuid;
- recv_data.readPackGUID(setGuid);
+ recvData.readPackGUID(setGuid);
_player->DeleteEquipmentSet(setGuid);
}
-void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
+void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
{
if (_player->isInCombat())
return;
@@ -1556,10 +1567,10 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
uint64 itemGuid;
- recv_data.readPackGUID(itemGuid);
+ recvData.readPackGUID(itemGuid);
uint8 srcbag, srcslot;
- recv_data >> srcbag >> srcslot;
+ recvData >> srcbag >> srcslot;
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
@@ -1601,22 +1612,25 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
SendPacket(&data);
}
-void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
+void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
{
- // TODO: Move queries to prepared statements
uint64 guid;
std::string newname;
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
- recv_data >> guid;
- recv_data >> newname;
- recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
+ recvData >> guid;
+ recvData >> newname;
+ recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
uint32 lowGuid = GUID_LOPART(guid);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN);
+ // get the players old (at this moment current) race
+ CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid);
+ uint8 oldRace = nameData->m_race;
+ uint8 playerClass = nameData->m_class;
+ uint8 level = nameData->m_level;
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_AT_LOGIN_TITLES);
stmt->setUInt32(0, lowGuid);
-
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -1628,10 +1642,9 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
}
Field* fields = result->Fetch();
- uint32 playerClass = uint32(fields[0].GetUInt8());
- uint32 level = uint32(fields[1].GetUInt8());
- uint32 at_loginFlags = fields[2].GetUInt16();
- uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION);
+ uint32 at_loginFlags = fields[0].GetUInt16();
+ char const* knownTitlesStr = fields[1].GetCString();
+ uint32 used_loginFlag = ((recvData.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION);
if (!sObjectMgr->GetPlayerInfo(race, playerClass))
{
@@ -1717,297 +1730,395 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
- BattlegroundTeamId team = BG_TEAM_ALLIANCE;
-
- // Search each faction is targeted
- switch (race)
+ if (oldRace != race)
{
- case RACE_ORC:
- case RACE_TAUREN:
- case RACE_UNDEAD_PLAYER:
- case RACE_TROLL:
- case RACE_BLOODELF:
- team = BG_TEAM_HORDE;
- break;
- default:
- break;
- }
-
- // Switch Languages
- // delete all languages first
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_LANGUAGES);
- stmt->setUInt32(0, lowGuid);
- trans->Append(stmt);
-
- // Now add them back
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
- stmt->setUInt32(0, lowGuid);
-
- // Faction specific languages
- if (team == BG_TEAM_HORDE)
- stmt->setUInt16(1, 109);
- else
- stmt->setUInt16(1, 98);
-
- trans->Append(stmt);
-
- // Race specific languages
- if (race != RACE_ORC && race != RACE_HUMAN)
- {
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
- stmt->setUInt32(0, lowGuid);
+ TeamId team = TEAM_ALLIANCE;
+ // Search each faction is targeted
switch (race)
{
- case RACE_DWARF:
- stmt->setUInt16(1, 111);
- break;
- case RACE_DRAENEI:
- stmt->setUInt16(1, 759);
- break;
- case RACE_GNOME:
- stmt->setUInt16(1, 313);
- break;
- case RACE_NIGHTELF:
- stmt->setUInt16(1, 113);
- break;
- case RACE_UNDEAD_PLAYER:
- stmt->setUInt16(1, 673);
- break;
+ case RACE_ORC:
case RACE_TAUREN:
- stmt->setUInt16(1, 115);
- break;
+ case RACE_UNDEAD_PLAYER:
case RACE_TROLL:
- stmt->setUInt16(1, 315);
- break;
case RACE_BLOODELF:
- stmt->setUInt16(1, 137);
+ team = TEAM_HORDE;
+ break;
+ default:
break;
}
+ // Switch Languages
+ // delete all languages first
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_LANGUAGES);
+ stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
- }
- if (recv_data.GetOpcode() == CMSG_CHAR_FACTION_CHANGE)
- {
- // Delete all Flypaths
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH);
+ // Now add them back
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
stmt->setUInt32(0, lowGuid);
+
+ // Faction specific languages
+ if (team == TEAM_HORDE)
+ stmt->setUInt16(1, 109);
+ else
+ stmt->setUInt16(1, 98);
+
trans->Append(stmt);
- if (level > 7)
+ // Race specific languages
+ if (race != RACE_ORC && race != RACE_HUMAN)
{
- // Update Taxi path
- // this doesn't seem to be 100% blizzlike... but it can't really be helped.
- std::ostringstream taximaskstream;
- uint32 numFullTaximasks = level / 7;
- if (numFullTaximasks > 11)
- numFullTaximasks = 11;
- if (team == BG_TEAM_ALLIANCE)
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE);
+ stmt->setUInt32(0, lowGuid);
+
+ switch (race)
{
- if (playerClass != CLASS_DEATH_KNIGHT)
- {
- for (uint8 i = 0; i < numFullTaximasks; ++i)
- taximaskstream << uint32(sAllianceTaxiNodesMask[i]) << ' ';
- }
- else
- {
- for (uint8 i = 0; i < numFullTaximasks; ++i)
- taximaskstream << uint32(sAllianceTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << ' ';
- }
+ case RACE_DWARF:
+ stmt->setUInt16(1, 111);
+ break;
+ case RACE_DRAENEI:
+ stmt->setUInt16(1, 759);
+ break;
+ case RACE_GNOME:
+ stmt->setUInt16(1, 313);
+ break;
+ case RACE_NIGHTELF:
+ stmt->setUInt16(1, 113);
+ break;
+ case RACE_UNDEAD_PLAYER:
+ stmt->setUInt16(1, 673);
+ break;
+ case RACE_TAUREN:
+ stmt->setUInt16(1, 115);
+ break;
+ case RACE_TROLL:
+ stmt->setUInt16(1, 315);
+ break;
+ case RACE_BLOODELF:
+ stmt->setUInt16(1, 137);
+ break;
}
- else
+
+ trans->Append(stmt);
+ }
+
+ if (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE)
+ {
+ // Delete all Flypaths
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH);
+ stmt->setUInt32(0, lowGuid);
+ trans->Append(stmt);
+
+ if (level > 7)
{
- if (playerClass != CLASS_DEATH_KNIGHT)
+ // Update Taxi path
+ // this doesn't seem to be 100% blizzlike... but it can't really be helped.
+ std::ostringstream taximaskstream;
+ uint32 numFullTaximasks = level / 7;
+ if (numFullTaximasks > 11)
+ numFullTaximasks = 11;
+ if (team == TEAM_ALLIANCE)
{
- for (uint8 i = 0; i < numFullTaximasks; ++i)
- taximaskstream << uint32(sHordeTaxiNodesMask[i]) << ' ';
+ if (playerClass != CLASS_DEATH_KNIGHT)
+ {
+ for (uint8 i = 0; i < numFullTaximasks; ++i)
+ taximaskstream << uint32(sAllianceTaxiNodesMask[i]) << ' ';
+ }
+ else
+ {
+ for (uint8 i = 0; i < numFullTaximasks; ++i)
+ taximaskstream << uint32(sAllianceTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << ' ';
+ }
}
else
{
- for (uint8 i = 0; i < numFullTaximasks; ++i)
- taximaskstream << uint32(sHordeTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << ' ';
+ if (playerClass != CLASS_DEATH_KNIGHT)
+ {
+ for (uint8 i = 0; i < numFullTaximasks; ++i)
+ taximaskstream << uint32(sHordeTaxiNodesMask[i]) << ' ';
+ }
+ else
+ {
+ for (uint8 i = 0; i < numFullTaximasks; ++i)
+ taximaskstream << uint32(sHordeTaxiNodesMask[i] | sDeathKnightTaxiNodesMask[i]) << ' ';
+ }
}
- }
- uint32 numEmptyTaximasks = 11 - numFullTaximasks;
- for (uint8 i = 0; i < numEmptyTaximasks; ++i)
- taximaskstream << "0 ";
- taximaskstream << '0';
- std::string taximask = taximaskstream.str();
+ uint32 numEmptyTaximasks = 11 - numFullTaximasks;
+ for (uint8 i = 0; i < numEmptyTaximasks; ++i)
+ taximaskstream << "0 ";
+ taximaskstream << '0';
+ std::string taximask = taximaskstream.str();
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK);
- stmt->setString(0, taximask);
- stmt->setUInt32(1, lowGuid);
- trans->Append(stmt);
- }
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXIMASK);
+ stmt->setString(0, taximask);
+ stmt->setUInt32(1, lowGuid);
+ trans->Append(stmt);
+ }
- // Delete all current quests
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
- stmt->setUInt32(0, GUID_LOPART(guid));
- trans->Append(stmt);
+ // Delete all current quests
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
+ stmt->setUInt32(0, GUID_LOPART(guid));
+ trans->Append(stmt);
- // Delete record of the faction old completed quests
- {
- std::ostringstream quests;
- ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates();
- for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
+ // Delete record of the faction old completed quests
{
- Quest *qinfo = iter->second;
- uint32 requiredRaces = qinfo->GetRequiredRaces();
- if (team == BG_TEAM_ALLIANCE)
+ std::ostringstream quests;
+ ObjectMgr::QuestMap const& qTemplates = sObjectMgr->GetQuestTemplates();
+ for (ObjectMgr::QuestMap::const_iterator iter = qTemplates.begin(); iter != qTemplates.end(); ++iter)
{
- if (requiredRaces & RACEMASK_ALLIANCE)
+ Quest *qinfo = iter->second;
+ uint32 requiredRaces = qinfo->GetRequiredRaces();
+ if (team == TEAM_ALLIANCE)
{
- quests << uint32(qinfo->GetQuestId());
- quests << ',';
+ if (requiredRaces & RACEMASK_ALLIANCE)
+ {
+ quests << uint32(qinfo->GetQuestId());
+ quests << ',';
+ }
}
- }
- else // if (team == BG_TEAM_HORDE)
- {
- if (requiredRaces & RACEMASK_HORDE)
+ else // if (team == TEAM_HORDE)
{
- quests << uint32(qinfo->GetQuestId());
- quests << ',';
+ if (requiredRaces & RACEMASK_HORDE)
+ {
+ quests << uint32(qinfo->GetQuestId());
+ quests << ',';
+ }
}
}
+
+ std::string questsStr = quests.str();
+ questsStr = questsStr.substr(0, questsStr.length() - 1);
+
+ if (!questsStr.empty())
+ trans->PAppend("DELETE FROM `character_queststatus_rewarded` WHERE guid='%u' AND quest IN (%s)", lowGuid, questsStr.c_str());
}
- std::string questsStr = quests.str();
- questsStr = questsStr.substr(0, questsStr.length() - 1);
+ if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
+ {
+ // Reset guild
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
- if (!questsStr.empty())
- trans->PAppend("DELETE FROM `character_queststatus_rewarded` WHERE guid='%u' AND quest IN (%s)", lowGuid, questsStr.c_str());
- }
+ stmt->setUInt32(0, lowGuid);
- if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
- {
- // Reset guild
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (result)
+ if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32()))
+ guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER));
+ }
- stmt->setUInt32(0, lowGuid);
+ if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND))
+ {
+ // Delete Friend List
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
+ stmt->setUInt32(0, lowGuid);
+ trans->Append(stmt);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
- if (result)
- if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32()))
- guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER));
- }
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
+ stmt->setUInt32(0, lowGuid);
+ trans->Append(stmt);
- if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND))
- {
- // Delete Friend List
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
+ }
+
+ // Leave Arena Teams
+ Player::LeaveAllArenaTeams(guid);
+
+ // Reset homebind and position
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND);
stmt->setUInt32(0, lowGuid);
trans->Append(stmt);
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND);
stmt->setUInt32(0, lowGuid);
+ if (team == TEAM_ALLIANCE)
+ {
+ stmt->setUInt16(1, 0);
+ stmt->setUInt16(2, 1519);
+ stmt->setFloat (3, -8867.68f);
+ stmt->setFloat (4, 673.373f);
+ stmt->setFloat (5, 97.9034f);
+ Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, lowGuid);
+ }
+ else
+ {
+ stmt->setUInt16(1, 1);
+ stmt->setUInt16(2, 1637);
+ stmt->setFloat (3, 1633.33f);
+ stmt->setFloat (4, -4439.11f);
+ stmt->setFloat (5, 15.7588f);
+ Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, lowGuid);
+ }
trans->Append(stmt);
- }
-
- // Leave Arena Teams
- Player::LeaveAllArenaTeams(guid);
-
- // Reset homebind and position
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND);
- stmt->setUInt32(0, lowGuid);
- trans->Append(stmt);
+ // Achievement conversion
+ for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Achievements.begin(); it != sObjectMgr->FactionChange_Achievements.end(); ++it)
+ {
+ uint32 achiev_alliance = it->first;
+ uint32 achiev_horde = it->second;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
+ stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
+ stmt->setUInt32(1, lowGuid);
+ trans->Append(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACHIEVEMENT);
+ stmt->setUInt16(0, uint16(team == TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
+ stmt->setUInt16(1, uint16(team == TEAM_ALLIANCE ? achiev_horde : achiev_alliance));
+ stmt->setUInt32(2, lowGuid);
+ trans->Append(stmt);
+ }
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND);
- stmt->setUInt32(0, lowGuid);
- if (team == BG_TEAM_ALLIANCE)
- {
- stmt->setUInt16(1, 0);
- stmt->setUInt16(2, 1519);
- stmt->setFloat (3, -8867.68f);
- stmt->setFloat (4, 673.373f);
- stmt->setFloat (5, 97.9034f);
- Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, lowGuid);
- }
- else
- {
- stmt->setUInt16(1, 1);
- stmt->setUInt16(2, 1637);
- stmt->setFloat (3, 1633.33f);
- stmt->setFloat (4, -4439.11f);
- stmt->setFloat (5, 15.7588f);
- Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, lowGuid);
- }
- trans->Append(stmt);
+ // Item conversion
+ for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Items.begin(); it != sObjectMgr->FactionChange_Items.end(); ++it)
+ {
+ uint32 item_alliance = it->first;
+ uint32 item_horde = it->second;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
+ stmt->setUInt32(0, (team == TEAM_ALLIANCE ? item_alliance : item_horde));
+ stmt->setUInt32(1, (team == TEAM_ALLIANCE ? item_horde : item_alliance));
+ stmt->setUInt32(2, guid);
+ trans->Append(stmt);
+ }
- // Achievement conversion
- for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Achievements.begin(); it != sObjectMgr->FactionChange_Achievements.end(); ++it)
- {
- uint32 achiev_alliance = it->first;
- uint32 achiev_horde = it->second;
+ // Spell conversion
+ for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Spells.begin(); it != sObjectMgr->FactionChange_Spells.end(); ++it)
+ {
+ uint32 spell_alliance = it->first;
+ uint32 spell_horde = it->second;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
+ stmt->setUInt32(0, (team == TEAM_ALLIANCE ? spell_alliance : spell_horde));
+ stmt->setUInt32(1, lowGuid);
+ trans->Append(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE);
+ stmt->setUInt32(0, (team == TEAM_ALLIANCE ? spell_alliance : spell_horde));
+ stmt->setUInt32(1, (team == TEAM_ALLIANCE ? spell_horde : spell_alliance));
+ stmt->setUInt32(2, lowGuid);
+ trans->Append(stmt);
+ }
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
- stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
- stmt->setUInt32(1, lowGuid);
- trans->Append(stmt);
+ // Reputation conversion
+ for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Reputation.begin(); it != sObjectMgr->FactionChange_Reputation.end(); ++it)
+ {
+ uint32 reputation_alliance = it->first;
+ uint32 reputation_horde = it->second;
+ uint32 newReputation = (team == TEAM_ALLIANCE) ? reputation_alliance : reputation_horde;
+ uint32 oldReputation = (team == TEAM_ALLIANCE) ? reputation_horde : reputation_alliance;
+
+ // select old standing set in db
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_REP_BY_FACTION);
+ stmt->setUInt32(0, oldReputation);
+ stmt->setUInt32(1, lowGuid);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ {
+ WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
+ data << uint8(CHAR_CREATE_ERROR);
+ SendPacket(&data);
+ return;
+ }
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACHIEVEMENT);
- stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
- stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? achiev_horde : achiev_alliance));
- stmt->setUInt32(2, lowGuid);
- trans->Append(stmt);
- }
+ Field* fields = result->Fetch();
+ int32 oldDBRep = fields[0].GetInt32();
+ FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation);
+
+ // old base reputation
+ int32 oldBaseRep = sObjectMgr->GetBaseReputationOff(factionEntry, oldRace, playerClass);
+
+ // new base reputation
+ int32 newBaseRep = sObjectMgr->GetBaseReputationOff(sFactionStore.LookupEntry(newReputation), race, playerClass);
+
+ // final reputation shouldnt change
+ int32 FinalRep = oldDBRep + oldBaseRep;
+ int32 newDBRep = FinalRep - newBaseRep;
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION);
+ stmt->setUInt32(0, newReputation);
+ stmt->setUInt32(1, lowGuid);
+ trans->Append(stmt);
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE);
+ stmt->setUInt16(0, uint16(newReputation));
+ stmt->setInt32(1, newDBRep);
+ stmt->setUInt16(2, uint16(oldReputation));
+ stmt->setUInt32(3, lowGuid);
+ trans->Append(stmt);
+ }
- // Item conversion
- for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Items.begin(); it != sObjectMgr->FactionChange_Items.end(); ++it)
- {
- uint32 item_alliance = it->first;
- uint32 item_horde = it->second;
+ // Title conversion
+ if (knownTitlesStr)
+ {
+ const uint32 ktcount = KNOWN_TITLES_SIZE * 2;
+ uint32 knownTitles[ktcount];
+ Tokenizer tokens(knownTitlesStr, ' ', ktcount);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
- stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? item_alliance : item_horde));
- stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? item_horde : item_alliance));
- stmt->setUInt32(2, guid);
- trans->Append(stmt);
- }
+ if (tokens.size() != ktcount)
+ return;
- // Spell conversion
- for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Spells.begin(); it != sObjectMgr->FactionChange_Spells.end(); ++it)
- {
- uint32 spell_alliance = it->first;
- uint32 spell_horde = it->second;
+ for (uint32 index = 0; index < ktcount; ++index)
+ knownTitles[index] = atol(tokens[index]);
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
- stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde));
- stmt->setUInt32(1, lowGuid);
- trans->Append(stmt);
+ for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Titles.begin(); it != sObjectMgr->FactionChange_Titles.end(); ++it)
+ {
+ uint32 title_alliance = it->first;
+ uint32 title_horde = it->second;
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE);
- stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde));
- stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? spell_horde : spell_alliance));
- stmt->setUInt32(2, lowGuid);
- trans->Append(stmt);
- }
+ CharTitlesEntry const* atitleInfo = sCharTitlesStore.LookupEntry(title_alliance);
+ CharTitlesEntry const* htitleInfo = sCharTitlesStore.LookupEntry(title_horde);
+ // new team
+ if (team == TEAM_ALLIANCE)
+ {
+ uint32 bitIndex = htitleInfo->bit_index;
+ uint32 index = bitIndex / 32;
+ uint32 old_flag = 1 << (bitIndex % 32);
+ uint32 new_flag = 1 << (atitleInfo->bit_index % 32);
+ if (knownTitles[index] & old_flag)
+ {
+ knownTitles[index] &= ~old_flag;
+ // use index of the new title
+ knownTitles[atitleInfo->bit_index / 32] |= new_flag;
+ }
+ }
+ else
+ {
+ uint32 bitIndex = atitleInfo->bit_index;
+ uint32 index = bitIndex / 32;
+ uint32 old_flag = 1 << (bitIndex % 32);
+ uint32 new_flag = 1 << (htitleInfo->bit_index % 32);
+ if (knownTitles[index] & old_flag)
+ {
+ knownTitles[index] &= ~old_flag;
+ // use index of the new title
+ knownTitles[htitleInfo->bit_index / 32] |= new_flag;
+ }
+ }
- // Reputation conversion
- for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Reputation.begin(); it != sObjectMgr->FactionChange_Reputation.end(); ++it)
- {
- uint32 reputation_alliance = it->first;
- uint32 reputation_horde = it->second;
+ std::ostringstream ss;
+ for (uint32 index = 0; index < ktcount; ++index)
+ ss << knownTitles[index] << ' ';
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION);
- stmt->setUInt32(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
- stmt->setUInt32(1, lowGuid);
- trans->Append(stmt);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE);
+ stmt->setString(0, ss.str().c_str());
+ stmt->setUInt32(1, lowGuid);
+ trans->Append(stmt);
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE);
- stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
- stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? reputation_horde : reputation_alliance));
- stmt->setUInt32(2, lowGuid);
- trans->Append(stmt);
+ // unset any currently chosen title
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_RES_CHAR_TITLES_FACTION_CHANGE);
+ stmt->setUInt32(0, lowGuid);
+ trans->Append(stmt);
+ }
+ }
}
}
CharacterDatabase.CommitTransaction(trans);
std::string IP_str = GetRemoteAddress();
- sLog->outDebug(LOG_FILTER_UNITS, "Account: %d (IP: %s), Character guid: %u Change Race/Faction to: %s", GetAccountId(), IP_str.c_str(), lowGuid, newname.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER, "%s (IP: %s) changed race from %u to %u", GetPlayerInfo().c_str(), IP_str.c_str(), oldRace, race);
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1 + 8 + (newname.size() + 1) + 1 + 1 + 1 + 1 + 1 + 1 + 1);
data << uint8(RESPONSE_SUCCESS);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 966eae598a6..e4989816998 100755..100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -24,7 +24,6 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "DatabaseEnv.h"
-
#include "CellImpl.h"
#include "Chat.h"
#include "ChannelMgr.h"
@@ -41,40 +40,18 @@
#include "ScriptMgr.h"
#include "AccountMgr.h"
-bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg, uint32 lang)
-{
- if (lang != LANG_ADDON)
- {
- // strip invisible characters for non-addon messages
- if (sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
- stripLineInvisibleChars(msg);
-
- if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && AccountMgr::IsPlayerAccount(GetSecurity())
- && !ChatHandler(this).isValidChatMessage(msg.c_str()))
- {
- sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
- GetPlayer()->GetGUIDLow(), msg.c_str());
- if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
- KickPlayer();
- return false;
- }
- }
-
- return true;
-}
-
-void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
+void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
{
uint32 type;
uint32 lang;
- recv_data >> type;
- recv_data >> lang;
+ recvData >> type;
+ recvData >> lang;
if (type >= MAX_CHAT_MSG_TYPE)
{
- sLog->outError("CHAT: Wrong message type received: %u", type);
- recv_data.rfinish();
+ sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: Wrong message type received: %u", type);
+ recvData.rfinish();
return;
}
@@ -87,7 +64,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
if (!langDesc)
{
SendNotification(LANG_UNKNOWN_LANGUAGE);
- recv_data.rfinish();
+ recvData.rfinish();
return;
}
if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id))
@@ -106,27 +83,43 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
if (!foundAura)
{
SendNotification(LANG_NOT_LEARNED_LANGUAGE);
- recv_data.rfinish();
+ recvData.rfinish();
return;
}
}
if (lang == LANG_ADDON)
{
- if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
+ // LANG_ADDON is only valid for the following message types
+ switch (type)
{
- std::string msg = "";
- recv_data >> msg;
+ case CHAT_MSG_PARTY:
+ case CHAT_MSG_RAID:
+ case CHAT_MSG_GUILD:
+ case CHAT_MSG_BATTLEGROUND:
+ case CHAT_MSG_WHISPER:
+ if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
+ {
+ std::string msg = "";
+ recvData >> msg;
- if (msg.empty())
- return;
+ if (msg.empty())
+ return;
- sScriptMgr->OnPlayerChat(sender, uint32(CHAT_MSG_ADDON), lang, msg);
- }
+ sScriptMgr->OnPlayerChat(sender, uint32(CHAT_MSG_ADDON), lang, msg);
+ }
- // Disabled addon channel?
- if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))
- return;
+ // Disabled addon channel?
+ if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))
+ return;
+ break;
+ default:
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
+ GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
+
+ recvData.rfinish();
+ return;
+ }
}
// LANG_ADDON should not be changed nor be affected by flood control
else
@@ -171,7 +164,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
{
std::string timeStr = secsToTimeString(m_muteTime - time(NULL));
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
- recv_data.rfinish(); // Prevent warnings
+ recvData.rfinish(); // Prevent warnings
return;
}
@@ -181,10 +174,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
if (sender->HasAura(1852) && type != CHAT_MSG_WHISPER)
{
- std::string msg="";
- recv_data >> msg;
-
- SendNotification(GetTrinityString(LANG_GM_SILENCE), sender->GetName());
+ SendNotification(GetTrinityString(LANG_GM_SILENCE), sender->GetName().c_str());
+ recvData.rfinish();
return;
}
@@ -204,19 +195,19 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
case CHAT_MSG_RAID_WARNING:
case CHAT_MSG_BATTLEGROUND:
case CHAT_MSG_BATTLEGROUND_LEADER:
- recv_data >> msg;
+ recvData >> msg;
break;
case CHAT_MSG_WHISPER:
- recv_data >> to;
- recv_data >> msg;
+ recvData >> to;
+ recvData >> msg;
break;
case CHAT_MSG_CHANNEL:
- recv_data >> channel;
- recv_data >> msg;
+ recvData >> channel;
+ recvData >> msg;
break;
case CHAT_MSG_AFK:
case CHAT_MSG_DND:
- recv_data >> msg;
+ recvData >> msg;
ignoreChecks = true;
break;
}
@@ -226,14 +217,26 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
if (msg.empty())
return;
- if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
+ if (ChatHandler(this).ParseCommands(msg.c_str()))
return;
- if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
- return;
+ if (lang != LANG_ADDON)
+ {
+ // Strip invisible characters for non-addon messages
+ if (sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
+ stripLineInvisibleChars(msg);
- if (msg.empty())
- return;
+ if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && !ChatHandler(this).isValidChatMessage(msg.c_str()))
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(),
+ GetPlayer()->GetGUIDLow(), msg.c_str());
+
+ if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
+ KickPlayer();
+
+ return;
+ }
+ }
}
switch (type)
@@ -269,7 +272,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
break;
}
- Player* receiver = sObjectAccessor->FindPlayerByName(to.c_str());
+ 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())))
@@ -287,7 +290,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
if (GetPlayer()->HasAura(1852) && !receiver->isGameMaster())
{
- SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName());
+ SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName().c_str());
return;
}
@@ -426,13 +429,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
}
}
- if (ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam()))
{
-
if (Channel* chn = cMgr->GetChannel(channel, _player))
{
sScriptMgr->OnPlayerChat(_player, type, lang, msg, chn);
-
chn->Say(_player->GetGUID(), msg.c_str(), lang);
}
}
@@ -474,18 +475,18 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
}
} break;
default:
- sLog->outError("CHAT: unknown message type %u, lang: %u", type, lang);
+ sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: unknown message type %u, lang: %u", type, lang);
break;
}
}
-void WorldSession::HandleEmoteOpcode(WorldPacket & recv_data)
+void WorldSession::HandleEmoteOpcode(WorldPacket& recvData)
{
if (!GetPlayer()->isAlive() || GetPlayer()->HasUnitState(UNIT_STATE_DIED))
return;
uint32 emote;
- recv_data >> emote;
+ recvData >> emote;
sScriptMgr->OnPlayerEmote(GetPlayer(), emote);
GetPlayer()->HandleEmoteCommand(emote);
}
@@ -500,18 +501,18 @@ namespace Trinity
void operator()(WorldPacket& data, LocaleConstant loc_idx)
{
- char const* nam = i_target ? i_target->GetNameForLocaleIdx(loc_idx) : NULL;
- uint32 namlen = (nam ? strlen(nam) : 0) + 1;
+ std::string const name(i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
+ uint32 namlen = name.size();
- data.Initialize(SMSG_TEXT_EMOTE, (20+namlen));
+ data.Initialize(SMSG_TEXT_EMOTE, 20 + namlen);
data << i_player.GetGUID();
- data << (uint32)i_text_emote;
- data << i_emote_num;
- data << (uint32)namlen;
+ data << uint32(i_text_emote);
+ data << uint32(i_emote_num);
+ data << uint32(namlen);
if (namlen > 1)
- data.append(nam, namlen);
+ data << name;
else
- data << (uint8)0x00;
+ data << uint8(0x00);
}
private:
@@ -522,7 +523,7 @@ namespace Trinity
};
} // namespace Trinity
-void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
{
if (!GetPlayer()->isAlive())
return;
@@ -537,9 +538,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data)
uint32 text_emote, emoteNum;
uint64 guid;
- recv_data >> text_emote;
- recv_data >> emoteNum;
- recv_data >> guid;
+ recvData >> text_emote;
+ recvData >> emoteNum;
+ recvData >> guid;
sScriptMgr->OnPlayerTextEmote(GetPlayer(), text_emote, emoteNum, guid);
@@ -560,8 +561,8 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data)
// Only allow text-emotes for "dead" entities (feign death included)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
break;
- GetPlayer()->HandleEmoteCommand(emote_anim);
- break;
+ GetPlayer()->HandleEmoteCommand(emote_anim);
+ break;
}
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
@@ -577,28 +578,28 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data)
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder> >, WorldTypeMapContainer> message(emote_worker);
cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit);
//Send scripted event call
if (unit && unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->AI())
((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote);
}
-void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data)
+void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData)
{
uint64 iguid;
uint8 unk;
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_CHAT_IGNORED");
- recv_data >> iguid;
- recv_data >> unk; // probably related to spam reporting
+ recvData >> iguid;
+ recvData >> unk; // probably related to spam reporting
Player* player = ObjectAccessor::FindPlayer(iguid);
if (!player || !player->GetSession())
return;
WorldPacket data;
- ChatHandler::FillMessageData(&data, this, CHAT_MSG_IGNORED, LANG_UNIVERSAL, NULL, GetPlayer()->GetGUID(), GetPlayer()->GetName(), NULL);
+ ChatHandler::FillMessageData(&data, this, CHAT_MSG_IGNORED, LANG_UNIVERSAL, NULL, GetPlayer()->GetGUID(), GetPlayer()->GetName().c_str(), NULL);
player->GetSession()->SendPacket(&data);
}
@@ -607,14 +608,14 @@ void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
}
-void WorldSession::SendPlayerNotFoundNotice(std::string name)
+void WorldSession::SendPlayerNotFoundNotice(std::string const& name)
{
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, name.size()+1);
data << name;
SendPacket(&data);
}
-void WorldSession::SendPlayerAmbiguousNotice(std::string name)
+void WorldSession::SendPlayerAmbiguousNotice(std::string const& name)
{
WorldPacket data(SMSG_CHAT_PLAYER_AMBIGUOUS, name.size()+1);
data << name;
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index 6693cdfca27..d30164b2592 100755..100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -25,11 +25,13 @@
#include "ObjectDefines.h"
#include "Vehicle.h"
#include "VehicleDefines.h"
+#include "Player.h"
+#include "Opcodes.h"
-void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data)
+void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid));
@@ -66,21 +68,21 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data)
_player->Attack(pEnemy, true);
}
-void WorldSession::HandleAttackStopOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleAttackStopOpcode(WorldPacket & /*recvData*/)
{
GetPlayer()->AttackStop();
}
-void WorldSession::HandleSetSheathedOpcode(WorldPacket& recv_data)
+void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData)
{
uint32 sheathed;
- recv_data >> sheathed;
+ recvData >> sheathed;
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed);
if (sheathed >= MAX_SHEATH_STATE)
{
- sLog->outError("Unknown sheath state %u ??", sheathed);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Unknown sheath state %u ??", sheathed);
return;
}
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index 8afd9f3b978..bdfb2369198 100755..100644
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
@@ -42,8 +42,8 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
return;
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
- sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
- sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str());
time_t now = time(NULL);
player->duel->startTimer = now;
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 18435263b2e..5b517e1d726 100755..100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -18,19 +18,20 @@
#include "Common.h"
#include "DatabaseEnv.h"
-#include "Opcodes.h"
+#include "Group.h"
+#include "GroupMgr.h"
#include "Log.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "World.h"
#include "ObjectMgr.h"
-#include "GroupMgr.h"
+#include "Opcodes.h"
+#include "Pet.h"
#include "Player.h"
-#include "Group.h"
#include "SocialMgr.h"
-#include "Util.h"
#include "SpellAuras.h"
+#include "Util.h"
#include "Vehicle.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
class Aura;
@@ -56,13 +57,13 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string&
SendPacket(&data);
}
-void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_INVITE");
std::string membername;
- recv_data >> membername;
- recv_data.read_skip<uint32>();
+ recvData >> membername;
+ recvData.read_skip<uint32>();
// attempt add selected player
@@ -73,7 +74,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
return;
}
- Player* player = sObjectAccessor->FindPlayerByName(membername.c_str());
+ Player* player = sObjectAccessor->FindPlayerByName(membername);
// no player
if (!player)
@@ -84,7 +85,10 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
// restrict invite to GMs
if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->isGameMaster() && player->isGameMaster())
+ {
+ SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
+ }
// can't group with
if (!GetPlayer()->isGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam())
@@ -192,11 +196,11 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
}
-void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data)
+void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ACCEPT");
- recv_data.read_skip<uint32>();
+ recvData.read_skip<uint32>();
Group* group = GetPlayer()->GetGroupInvite();
if (!group)
@@ -207,7 +211,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data)
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
{
- sLog->outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
return;
}
@@ -244,7 +248,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data)
group->BroadcastGroupUpdate();
}
-void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE");
@@ -262,25 +266,25 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/)
return;
// report
- std::string name = std::string(GetPlayer()->GetName());
- WorldPacket data(SMSG_GROUP_DECLINE, name.length());
- data << name.c_str();
+ WorldPacket data(SMSG_GROUP_DECLINE, GetPlayer()->GetName().length());
+ data << GetPlayer()->GetName();
leader->GetSession()->SendPacket(&data);
}
-void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE_GUID");
uint64 guid;
std::string reason;
- recv_data >> guid;
- recv_data >> reason;
+ recvData >> guid;
+ recvData >> reason;
//can't uninvite yourself
if (guid == GetPlayer()->GetGUID())
{
- sLog->outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.",
+ GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
return;
}
@@ -316,12 +320,12 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
SendPartyResult(PARTY_OP_UNINVITE, "", ERR_TARGET_NOT_IN_GROUP_S);
}
-void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE");
std::string membername;
- recv_data >> membername;
+ recvData >> membername;
// player not found
if (!normalizePlayerName(membername))
@@ -330,7 +334,8 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
// can't uninvite yourself
if (GetPlayer()->GetName() == membername)
{
- sLog->outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.",
+ GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
return;
}
@@ -360,12 +365,12 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
SendPartyResult(PARTY_OP_UNINVITE, membername, ERR_TARGET_NOT_IN_GROUP_S);
}
-void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
Player* player = ObjectAccessor::FindPlayer(guid);
Group* group = GetPlayer()->GetGroup();
@@ -381,7 +386,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket & recv_data)
group->SendUpdate();
}
-void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DISBAND");
@@ -404,14 +409,14 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recv_data*/)
GetPlayer()->RemoveFromGroup(GROUP_REMOVEMETHOD_LEAVE);
}
-void WorldSession::HandleLootMethodOpcode(WorldPacket & recv_data)
+void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LOOT_METHOD");
uint32 lootMethod;
uint64 lootMaster;
uint32 lootThreshold;
- recv_data >> lootMethod >> lootMaster >> lootThreshold;
+ recvData >> lootMethod >> lootMaster >> lootThreshold;
Group* group = GetPlayer()->GetGroup();
if (!group)
@@ -447,15 +452,15 @@ void WorldSession::HandleLootRoll(WorldPacket& recvData)
switch (rollType)
{
case ROLL_NEED:
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);
break;
case ROLL_GREED:
- GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);
+ GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);
break;
}
}
-void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
+void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_MINIMAP_PING");
@@ -463,8 +468,8 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
return;
float x, y;
- recv_data >> x;
- recv_data >> y;
+ recvData >> x;
+ recvData >> y;
//sLog->outDebug("Received opcode MSG_MINIMAP_PING X: %f, Y: %f", x, y);
@@ -479,13 +484,13 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
GetPlayer()->GetGroup()->BroadcastPacket(&data, true, -1, GetPlayer()->GetGUID());
}
-void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
+void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RANDOM_ROLL");
uint32 minimum, maximum, roll;
- recv_data >> minimum;
- recv_data >> maximum;
+ recvData >> minimum;
+ recvData >> maximum;
/** error handling **/
if (minimum > maximum || maximum > 10000) // < 32768 for urand call
@@ -508,7 +513,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_TARGET_UPDATE");
@@ -517,7 +522,7 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket & recv_data)
return;
uint8 x;
- recv_data >> x;
+ recvData >> x;
/** error handling **/
/********************/
@@ -533,12 +538,12 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket & recv_data)
return;
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
group->SetTargetIcon(x, _player->GetGUID(), guid);
}
}
-void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_RAID_CONVERT");
@@ -559,7 +564,7 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recv_data*/)
group->ConvertToRaid();
}
-void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");
@@ -570,8 +575,8 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
std::string name;
uint8 groupNr;
- recv_data >> name;
- recv_data >> groupNr;
+ recvData >> name;
+ recvData >> groupNr;
if (groupNr >= MAX_RAID_SUBGROUPS)
return;
@@ -583,7 +588,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
if (!group->HasFreeSlotSubGroup(groupNr))
return;
- Player* movedPlayer = sObjectAccessor->FindPlayerByName(name.c_str());
+ Player* movedPlayer = sObjectAccessor->FindPlayerByName(name);
uint64 guid;
if (movedPlayer)
{
@@ -598,7 +603,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data)
group->ChangeMembersGroup(guid, groupNr);
}
-void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER");
@@ -611,15 +616,15 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket & recv_data)
uint64 guid;
bool apply;
- recv_data >> guid;
- recv_data >> apply;
+ recvData >> guid;
+ recvData >> apply;
group->SetGroupMemberFlag(guid, apply, MEMBER_FLAG_ASSISTANT);
group->SendUpdate();
}
-void WorldSession::HandlePartyAssignmentOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_PARTY_ASSIGNMENT");
@@ -634,8 +639,8 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket & recv_data)
uint8 assignment;
bool apply;
uint64 guid;
- recv_data >> assignment >> apply;
- recv_data >> guid;
+ recvData >> assignment >> apply;
+ recvData >> guid;
switch (assignment)
{
@@ -653,7 +658,7 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket & recv_data)
group->SendUpdate();
}
-void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket & recv_data)
+void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_READY_CHECK");
@@ -661,7 +666,7 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket & recv_data)
if (!group)
return;
- if (recv_data.empty()) // request
+ if (recvData.empty()) // request
{
/** error handling **/
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
@@ -678,7 +683,7 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket & recv_data)
else // answer
{
uint8 state;
- recv_data >> state;
+ recvData >> state;
// everything's fine, do it
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
@@ -688,7 +693,7 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket & /*recvData*/)
{
//Group* group = GetPlayer()->GetGroup();
//if (!group)
@@ -856,7 +861,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
{
if (auramask & (uint64(1) << i))
{
- AuraApplication const* aurApp = player->GetVisibleAura(i);
+ AuraApplication const* aurApp = pet->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
*data << uint8(1);
}
@@ -868,11 +873,11 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
}
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
-void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recv_data)
+void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
uint64 Guid;
- recv_data >> Guid;
+ recvData >> Guid;
Player* player = HashMapHolder<Player>::Find(Guid);
if (!player)
@@ -958,29 +963,29 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recv_data)
SendPacket(&data);
}
-/*!*/void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket & /*recv_data*/)
+/*!*/void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket & /*recvData*/)
{
// every time the player checks the character screen
_player->SendRaidInfo();
}
-/*void WorldSession::HandleGroupCancelOpcode(WorldPacket & recv_data)
+/*void WorldSession::HandleGroupCancelOpcode(WorldPacket& recvData)
{
sLog->outDebug("WORLD: got CMSG_GROUP_CANCEL.");
}*/
-void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recv_data)
+void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_OPT_OUT_OF_LOOT");
uint32 passOnLoot;
- recv_data >> passOnLoot; // 1 always pass, 0 do not pass
+ recvData >> passOnLoot; // 1 always pass, 0 do not pass
// ignore if player not loaded
if (!GetPlayer()) // needed because STATUS_AUTHED
{
if (passOnLoot != 0)
- sLog->outError("CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!");
+ sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_OPT_OUT_OF_LOOT value<>0 for not-loaded character!");
return;
}
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index ccd1c931f51..929a31938d2 100755..100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -28,29 +28,17 @@
#include "GossipDef.h"
#include "SocialMgr.h"
-// Helper for getting guild object of session's player.
-// If guild does not exist, sends error (if necessary).
-inline Guild* _GetPlayerGuild(WorldSession* session, bool sendError = false)
-{
- if (uint32 guildId = session->GetPlayer()->GetGuildId()) // If guild id = 0, player is not in guild
- if (Guild* guild = sGuildMgr->GetGuildById(guildId)) // Find guild by id
- return guild;
- if (sendError)
- Guild::SendCommandResult(session, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
- return NULL;
-}
-
void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_QUERY");
-
uint32 guildId;
recvPacket >> guildId;
- // Use received guild id to access guild method (not player's guild id)
+
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId);
+ if (!guildId)
+ return;
+
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
guild->HandleQuery(this);
- else
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD);
}
void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
@@ -72,41 +60,39 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INVITE");
-
std::string invitedName;
recvPacket >> invitedName;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_INVITE [%s]: Invited: %s", GetPlayerInfo().c_str(), invitedName.c_str());
if (normalizePlayerName(invitedName))
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleInviteMember(this, invitedName);
}
void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_REMOVE");
-
std::string playerName;
recvPacket >> playerName;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str());
+
if (normalizePlayerName(playerName))
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleRemoveMember(this, playerName);
}
void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ACCEPT");
- // Player cannot be in guild
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_ACCEPT [%s]", GetPlayer()->GetName().c_str());
+
if (!GetPlayer()->GetGuildId())
- // Guild where player was invited must exist
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited()))
guild->HandleAcceptMember(this);
}
void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DECLINE");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str());
GetPlayer()->SetGuildIdInvited(0);
GetPlayer()->SetInGuild(0);
@@ -114,125 +100,115 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INFO");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_INFO [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendInfo(this);
}
void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ROSTER");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_ROSTER [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleRoster(this);
+ else
+ Guild::SendCommandResult(this, GUILD_COMMAND_ROSTER, ERR_GUILD_PLAYER_NOT_IN_GUILD);
}
void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_PROMOTE");
-
std::string playerName;
recvPacket >> playerName;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str());
+
if (normalizePlayerName(playerName))
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleUpdateMemberRank(this, playerName, false);
}
void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DEMOTE");
-
std::string playerName;
recvPacket >> playerName;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str());
+
if (normalizePlayerName(playerName))
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleUpdateMemberRank(this, playerName, true);
}
void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_LEAVE");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_LEAVE [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleLeaveMember(this);
}
void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DISBAND");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DISBAND [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleDisband(this);
}
void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_LEADER");
-
std::string name;
recvPacket >> name;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_LEADER [%s]: Target: %s", GetPlayerInfo().c_str(), name.c_str());
+
if (normalizePlayerName(name))
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetLeader(this, name);
}
void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_MOTD");
+ std::string motd;
+ recvPacket >> motd;
- std::string motd; // Empty by default
- if (!recvPacket.empty())
- recvPacket >> motd;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_MOTD [%s]: MOTD: %s", GetPlayerInfo().c_str(), motd.c_str());
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetMOTD(this, motd);
}
void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_SET_PUBLIC_NOTE");
-
std::string playerName;
- recvPacket >> playerName;
+ std::string note;
+ recvPacket >> playerName >> note;
- std::string publicNote;
- recvPacket >> publicNote;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_SET_PUBLIC_NOTE [%s]: Target: %s, Note: %s",
+ GetPlayerInfo().c_str(), playerName.c_str(), note.c_str());
if (normalizePlayerName(playerName))
- if (Guild* guild = _GetPlayerGuild(this, true))
- guild->HandleSetMemberNote(this, playerName, publicNote, false);
+ if (Guild* guild = GetPlayer()->GetGuild())
+ guild->HandleSetMemberNote(this, playerName, note, true);
}
void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_SET_OFFICER_NOTE");
-
std::string playerName;
- recvPacket >> playerName;
+ std::string note;
+ recvPacket >> playerName >> note;
- std::string officerNote;
- recvPacket >> officerNote;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s",
+ GetPlayerInfo().c_str(), playerName.c_str(), note.c_str());
if (normalizePlayerName(playerName))
- if (Guild* guild = _GetPlayerGuild(this, true))
- guild->HandleSetMemberNote(this, playerName, officerNote, true);
+ if (Guild* guild = GetPlayer()->GetGuild())
+ guild->HandleSetMemberNote(this, playerName, note, false);
}
void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_RANK");
-
- Guild* guild = _GetPlayerGuild(this, true);
- if (!guild)
- {
- recvPacket.rpos(recvPacket.wpos());
- return;
- }
-
uint32 rankId;
recvPacket >> rankId;
@@ -245,7 +221,17 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
uint32 money;
recvPacket >> money;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId);
+
+ Guild* guild = GetPlayer()->GetGuild();
+ if (!guild)
+ {
+ recvPacket.rpos(recvPacket.wpos());
+ return;
+ }
+
GuildBankRightsAndSlotsVec rightsAndSlots(GUILD_BANK_MAX_TABS);
+
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
{
uint32 bankRights;
@@ -254,7 +240,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
recvPacket >> bankRights;
recvPacket >> slots;
- rightsAndSlots[tabId] = GuildBankRightsAndSlots(uint8(bankRights), slots);
+ rightsAndSlots[tabId] = GuildBankRightsAndSlots(tabId, bankRights, slots);
}
guild->HandleSetRankInfo(this, rankId, rankName, rights, money, rightsAndSlots);
@@ -262,181 +248,175 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ADD_RANK");
-
std::string rankName;
recvPacket >> rankName;
- if (Guild* guild = _GetPlayerGuild(this, true))
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), rankName.c_str());
+
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleAddNewRank(this, rankName);
}
void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DEL_RANK");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DEL_RANK [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this, true))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleRemoveLowestRank(this);
}
void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INFO_TEXT");
-
std::string info;
recvPacket >> info;
- if (Guild* guild = _GetPlayerGuild(this, true))
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), info.c_str());
+
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetInfo(this, info);
}
void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_SAVE_GUILD_EMBLEM");
-
uint64 vendorGuid;
recvPacket >> vendorGuid;
EmblemInfo emblemInfo;
emblemInfo.ReadPacket(recvPacket);
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD
+ "] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
+ , GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle()
+ , emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
+ , emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
+
if (GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER))
{
// Remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetEmblem(this, emblemInfo);
else
- // "You are not part of a guild!";
- Guild::SendSaveEmblemResult(this, ERR_GUILDEMBLEM_NOGUILD);
+ Guild::SendSaveEmblemResult(this, ERR_GUILDEMBLEM_NOGUILD); // "You are not part of a guild!";
}
else
- {
- // "That's not an emblem vendor!"
- Guild::SendSaveEmblemResult(this, ERR_GUILDEMBLEM_INVALIDVENDOR);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSaveGuildEmblemOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(vendorGuid));
- }
+ Guild::SendSaveEmblemResult(this, ERR_GUILDEMBLEM_INVALIDVENDOR); // "That's not an emblem vendor!"
}
void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_EVENT_LOG_QUERY [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendEventLog(this);
}
-void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recv_data */)
+void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recvData */)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendMoneyInfo(this);
}
-void WorldSession::HandleGuildPermissions(WorldPacket& /* recv_data */)
+void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_PERMISSIONS)");
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_PERMISSIONS [%s]", GetPlayerInfo().c_str());
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendPermissions(this);
}
// Called when clicking on Guild bank gameobject
-void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)");
-
- uint64 GoGuid;
- recv_data >> GoGuid;
+ uint64 guid;
+ bool sendAllSlots;
+ recvData >> guid >> sendAllSlots;
- uint8 fullSlotList;
- recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u"
+ , GetPlayerInfo().c_str(), guid, sendAllSlots);
- if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
+ Guild * const guild = GetPlayer()->GetGuild();
+ if (!guild)
{
- if (Guild* guild = _GetPlayerGuild(this))
- guild->SendBankTabsInfo(this);
- else
- Guild::SendCommandResult(this, GUILD_UNK1, ERR_GUILD_PLAYER_NOT_IN_GUILD);
+ Guild::SendCommandResult(this, GUILD_COMMAND_VIEW_TAB, ERR_GUILD_PLAYER_NOT_IN_GUILD);
+ return;
}
+
+ guild->SendBankTabsInfo(this, sendAllSlots);
}
// Called when opening guild bank tab only (first one)
-void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)");
-
- uint64 GoGuid;
- recv_data >> GoGuid;
-
+ uint64 guid;
uint8 tabId;
- recv_data >> tabId;
+ bool full;
- uint8 fullSlotList;
- recv_data >> fullSlotList; // 0 = only slots updated in last operation are shown. 1 = all slots updated
+ recvData >> guid >> tabId >> full;
- if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
- if (Guild* guild = _GetPlayerGuild(this))
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u"
+ , GetPlayerInfo().c_str(), guid, tabId, full);
+
+ if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendBankTabData(this, tabId);
}
-void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)");
-
- uint64 GoGuid;
- recv_data >> GoGuid;
-
+ uint64 guid;
uint32 money;
- recv_data >> money;
+ recvData >> guid >> money;
+
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
+ GetPlayerInfo().c_str(), guid, money);
- if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
+ if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
if (money && GetPlayer()->HasEnoughMoney(money))
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleMemberDepositMoney(this, money);
}
-void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_WITHDRAW_MONEY)");
-
- uint64 GoGuid;
- recv_data >> GoGuid;
-
+ uint64 guid;
uint32 money;
- recv_data >> money;
+ recvData >> guid >> money;
- if (money)
- if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
- if (Guild* guild = _GetPlayerGuild(this))
- guild->HandleMemberWithdrawMoney(this, money);
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
+ GetPlayerInfo().c_str(), guid, money);
+
+ if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
+ if (Guild* guild = GetPlayer()->GetGuild())
+ guild->HandleMemberWithdrawMoney(this, money);
}
-void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_SWAP_ITEMS)");
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str());
uint64 GoGuid;
- recv_data >> GoGuid;
+ recvData >> GoGuid;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
{
- recv_data.rfinish(); // Prevent additional spam at rejected packet
+ recvData.rfinish(); // Prevent additional spam at rejected packet
return;
}
- Guild* guild = _GetPlayerGuild(this);
+ Guild* guild = GetPlayer()->GetGuild();
if (!guild)
{
- recv_data.rfinish(); // Prevent additional spam at rejected packet
+ recvData.rfinish(); // Prevent additional spam at rejected packet
return;
}
uint8 bankToBank;
- recv_data >> bankToBank;
+ recvData >> bankToBank;
uint8 tabId;
uint8 slotId;
@@ -446,18 +426,18 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
if (bankToBank)
{
uint8 destTabId;
- recv_data >> destTabId;
+ recvData >> destTabId;
uint8 destSlotId;
- recv_data >> destSlotId;
- recv_data.read_skip<uint32>(); // Always 0
+ recvData >> destSlotId;
+ recvData.read_skip<uint32>(); // Always 0
- recv_data >> tabId;
- recv_data >> slotId;
- recv_data >> itemEntry;
- recv_data.read_skip<uint8>(); // Always 0
+ recvData >> tabId;
+ recvData >> slotId;
+ recvData >> itemEntry;
+ recvData.read_skip<uint8>(); // Always 0
- recv_data >> splitedAmount;
+ recvData >> splitedAmount;
guild->SwapItems(GetPlayer(), tabId, slotId, destTabId, destSlotId, splitedAmount);
}
@@ -467,24 +447,24 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
uint8 playerSlotId = NULL_SLOT;
uint8 toChar = 1;
- recv_data >> tabId;
- recv_data >> slotId;
- recv_data >> itemEntry;
+ recvData >> tabId;
+ recvData >> slotId;
+ recvData >> itemEntry;
uint8 autoStore;
- recv_data >> autoStore;
+ recvData >> autoStore;
if (autoStore)
{
- recv_data.read_skip<uint32>(); // autoStoreCount
- recv_data.read_skip<uint8>(); // ToChar (?), always and expected to be 1 (autostore only triggered in Bank -> Char)
- recv_data.read_skip<uint32>(); // Always 0
+ recvData.read_skip<uint32>(); // autoStoreCount
+ recvData.read_skip<uint8>(); // ToChar (?), always and expected to be 1 (autostore only triggered in Bank -> Char)
+ recvData.read_skip<uint32>(); // Always 0
}
else
{
- recv_data >> playerBag;
- recv_data >> playerSlotId;
- recv_data >> toChar;
- recv_data >> splitedAmount;
+ recvData >> playerBag;
+ recvData >> playerSlotId;
+ recvData >> toChar;
+ recvData >> splitedAmount;
}
// Player <-> Bank
@@ -496,75 +476,68 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
}
}
-void WorldSession::HandleGuildBankBuyTab(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_BUY_TAB)");
+ uint64 guid;
+ uint8 tabId;
- uint64 GoGuid;
- recv_data >> GoGuid;
+ recvData >> guid >> tabId;
+
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId);
- uint8 tabId;
- recv_data >> tabId;
- if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
- if (Guild* guild = _GetPlayerGuild(this))
+ if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleBuyBankTab(this, tabId);
}
-void WorldSession::HandleGuildBankUpdateTab(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_UPDATE_TAB)");
-
- uint64 GoGuid;
- recv_data >> GoGuid;
-
+ uint64 guid;
uint8 tabId;
- recv_data >> tabId;
+ std::string name, icon;
- std::string name;
- recv_data >> name;
+ recvData >> guid >> tabId >> name >> icon;
- std::string icon;
- recv_data >> icon;
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s"
+ , GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str());
if (!name.empty() && !icon.empty())
- if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
- if (Guild* guild = _GetPlayerGuild(this))
+ if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->HandleSetBankTabInfo(this, tabId, name, icon);
}
-void WorldSession::HandleGuildBankLogQuery(WorldPacket & recv_data)
+void WorldSession::HandleGuildBankLogQuery(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_BANK_LOG_QUERY)");
-
uint8 tabId;
- recv_data >> tabId;
+ recvData >> tabId;
- if (Guild* guild = _GetPlayerGuild(this))
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_LOG_QUERY [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId);
+
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendBankLog(this, tabId);
}
-void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data)
+void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_QUERY_GUILD_BANK_TEXT");
-
uint8 tabId;
- recv_data >> tabId;
+ recvData >> tabId;
- if (Guild* guild = _GetPlayerGuild(this))
+ sLog->outDebug(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId);
+
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SendBankTabText(this, tabId);
}
-void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data)
+void WorldSession::HandleSetGuildBankTabText(WorldPacket &recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_GUILD_BANK_TEXT");
-
uint8 tabId;
- recv_data >> tabId;
-
std::string text;
- recv_data >> text;
+ recvData >> tabId >> text;
+
+ sLog->outDebug(LOG_FILTER_GUILD, "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), tabId, text.c_str());
- if (Guild* guild = _GetPlayerGuild(this))
+ if (Guild* guild = GetPlayer()->GetGuild())
guild->SetBankTabText(tabId, text);
}
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index e0ba190d2fc..2053f14e814 100755..100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -28,13 +28,13 @@
#include "ObjectAccessor.h"
#include "SpellInfo.h"
-void WorldSession::HandleSplitItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SPLIT_ITEM");
uint8 srcbag, srcslot, dstbag, dstslot;
uint32 count;
- recv_data >> srcbag >> srcslot >> dstbag >> dstslot >> count;
+ recvData >> srcbag >> srcslot >> dstbag >> dstslot >> count;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u, count = %u", srcbag, srcslot, dstbag, dstslot, count);
uint16 src = ((srcbag << 8) | srcslot);
@@ -61,12 +61,12 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket & recv_data)
_player->SplitItem(src, dst, count);
}
-void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_INV_ITEM");
uint8 srcslot, dstslot;
- recv_data >> dstslot >> srcslot;
+ recvData >> dstslot >> srcslot;
//sLog->outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot);
// prevent attempt swap same item to current position generated by client at special checting sequence
@@ -91,11 +91,11 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recv_data)
_player->SwapItem(src, dst);
}
-void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
{
uint64 itemguid;
uint8 dstslot;
- recv_data >> itemguid >> dstslot;
+ recvData >> itemguid >> dstslot;
// cheating attempt, client should never send opcode in that case
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, dstslot))
@@ -110,12 +110,12 @@ void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recv_data)
_player->SwapItem(item->GetPos(), dstpos);
}
-void WorldSession::HandleSwapItem(WorldPacket & recv_data)
+void WorldSession::HandleSwapItem(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM");
uint8 dstbag, dstslot, srcbag, srcslot;
- recv_data >> dstbag >> dstslot >> srcbag >> srcslot;
+ recvData >> dstbag >> dstslot >> srcbag >> srcslot;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u", srcbag, srcslot, dstbag, dstslot);
uint16 src = ((srcbag << 8) | srcslot);
@@ -140,12 +140,12 @@ void WorldSession::HandleSwapItem(WorldPacket & recv_data)
_player->SwapItem(src, dst);
}
-void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOEQUIP_ITEM");
uint8 srcbag, srcslot;
- recv_data >> srcbag >> srcslot;
+ recvData >> srcbag >> srcslot;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot);
Item* pSrcItem = _player->GetItemByPos(srcbag, srcslot);
@@ -234,12 +234,12 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_DESTROYITEM");
uint8 bag, slot, count, data1, data2, data3;
- recv_data >> bag >> slot >> count >> data1 >> data2 >> data3;
+ recvData >> bag >> slot >> count >> data1 >> data2 >> data3;
//sLog->outDebug("STORAGE: receive bag = %u, slot = %u, count = %u", bag, slot, count);
uint16 pos = (bag << 8) | slot;
@@ -278,13 +278,13 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data)
}
// Only _static_ data send in this packet !!!
-void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
+void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_ITEM_QUERY_SINGLE");
uint32 item;
- recv_data >> item;
+ recvData >> item;
- sLog->outDetail("STORAGE: Item Query = %u", item);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Item Query = %u", item);
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
if (pProto)
@@ -306,7 +306,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
data << pProto->ItemId;
data << pProto->Class;
data << pProto->SubClass;
- data << int32(pProto->Unk0); // new 2.0.3, not exist in wdb cache?
+ data << pProto->SoundOverrideSubclass;
data << Name;
data << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
data << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00);
@@ -437,14 +437,14 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleReadItem(WorldPacket & recv_data)
+void WorldSession::HandleReadItem(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_READ_ITEM");
uint8 bag, slot;
- recv_data >> bag >> slot;
+ recvData >> bag >> slot;
- //sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot);
+ //sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Read bag = %u, slot = %u", bag, slot);
Item* pItem = _player->GetItemByPos(bag, slot);
if (pItem && pItem->GetTemplate()->PageText)
@@ -455,12 +455,12 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
if (msg == EQUIP_ERR_OK)
{
data.Initialize (SMSG_READ_ITEM_OK, 8);
- sLog->outDetail("STORAGE: Item page sent");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Item page sent");
}
else
{
data.Initialize(SMSG_READ_ITEM_FAILED, 8);
- sLog->outDetail("STORAGE: Unable to read item");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "STORAGE: Unable to read item");
_player->SendEquipError(msg, pItem, NULL);
}
data << pItem->GetGUID();
@@ -470,26 +470,26 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data)
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
}
-void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePageQuerySkippedOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY");
uint32 itemid;
uint64 guid;
- recv_data >> itemid >> guid;
+ recvData >> itemid >> guid;
- sLog->outDetail("Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid));
}
-void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SELL_ITEM");
uint64 vendorguid, itemguid;
uint32 count;
- recv_data >> vendorguid >> itemguid >> count;
+ recvData >> vendorguid >> itemguid >> count;
if (!itemguid)
return;
@@ -538,9 +538,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
// special case at auto sell (sell all)
if (count == 0)
- {
count = pItem->GetCount();
- }
else
{
// prevent sell more items that exist in stack (possible only not from client)
@@ -561,7 +559,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
Item* pNewItem = pItem->CloneItem(count, _player);
if (!pNewItem)
{
- sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count);
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
return;
}
@@ -586,7 +584,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
uint32 money = pProto->SellPrice * count;
_player->ModifyMoney(money);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money);
}
else
_player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0);
@@ -597,13 +595,13 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data)
return;
}
-void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
+void WorldSession::HandleBuybackItem(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUYBACK_ITEM");
uint64 vendorguid;
uint32 slot;
- recv_data >> vendorguid >> slot;
+ recvData >> vendorguid >> slot;
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR);
if (!creature)
@@ -634,7 +632,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
_player->ModifyMoney(-(int32)price);
_player->RemoveItemFromBuyBackSlot(slot, false);
_player->ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount());
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, pItem->GetEntry(), pItem->GetCount());
_player->StoreItem(dest, pItem, true);
}
else
@@ -645,14 +643,14 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0);
}
-void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
uint64 vendorguid, bagguid;
uint32 item, slot, count;
uint8 bagslot;
- recv_data >> vendorguid >> item >> slot >> bagguid >> bagslot >> count;
+ recvData >> vendorguid >> item >> slot >> bagguid >> bagslot >> count;
// client expects count starting at 1, and we send vendorslot+1 to client already
if (slot > 0)
@@ -687,14 +685,14 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data)
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, bag, bagslot);
}
-void WorldSession::HandleBuyItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM");
uint64 vendorguid;
uint32 item, slot, count;
uint8 unk1;
- recv_data >> vendorguid >> item >> slot >> count >> unk1;
+ recvData >> vendorguid >> item >> slot >> count >> unk1;
// client expects count starting at 1, and we send vendorslot+1 to client already
if (slot > 0)
@@ -705,11 +703,11 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket & recv_data)
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, NULL_BAG, NULL_SLOT);
}
-void WorldSession::HandleListInventoryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
if (!GetPlayer()->isAlive())
return;
@@ -779,6 +777,13 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
if (!_player->isGameMaster() && !leftInStock)
continue;
+ ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(vendor->GetEntry(), item->item);
+ if (!sConditionMgr->IsObjectMeetToConditions(_player, vendor, conditions))
+ {
+ sLog->outDebug(LOG_FILTER_CONDITIONSYS, "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item);
+ continue;
+ }
+
++count;
// reputation discount
@@ -807,12 +812,12 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
SendPacket(&data);
}
-void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
{
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOSTORE_BAG_ITEM");
uint8 srcbag, srcslot, dstbag;
- recv_data >> srcbag >> srcslot >> dstbag;
+ recvData >> srcbag >> srcslot >> dstbag;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag);
Item* pItem = _player->GetItemByPos(srcbag, srcslot);
@@ -880,7 +885,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
// next slot
++slot;
- sLog->outDetail("PLAYER: Buy bank bag slot, slot number = %u", slot);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "PLAYER: Buy bank bag slot, slot number = %u", slot);
BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot);
@@ -908,7 +913,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
data << uint32(ERR_BANKSLOT_OK);
SendPacket(&data);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT);
}
void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
@@ -983,7 +988,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
}
}
-void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
{
if (!GetPlayer()->isAlive())
{
@@ -994,7 +999,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_AMMO");
uint32 item;
- recv_data >> item;
+ recvData >> item;
if (!item)
GetPlayer()->RemoveAmmo();
@@ -1024,11 +1029,11 @@ void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,
SendPacket(&data);
}
-void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData)
{
uint32 itemid;
- recv_data >> itemid;
- recv_data.read_skip<uint64>(); // guid
+ recvData >> itemid;
+ recvData.read_skip<uint64>(); // guid
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
ItemSetNameEntry const* pName = sObjectMgr->GetItemSetNameEntry(itemid);
@@ -1048,14 +1053,14 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
+void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WRAP_ITEM");
uint8 gift_bag, gift_slot, item_bag, item_slot;
- recv_data >> gift_bag >> gift_slot; // paper
- recv_data >> item_bag >> item_slot; // item
+ recvData >> gift_bag >> gift_slot; // paper
+ recvData >> item_bag >> item_slot; // item
sLog->outDebug(LOG_FILTER_NETWORKIO, "WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot);
@@ -1159,19 +1164,19 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
_player->DestroyItemCount(gift, count, true);
}
-void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
+void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SOCKET_GEMS");
uint64 item_guid;
uint64 gem_guids[MAX_GEM_SOCKETS];
- recv_data >> item_guid;
+ recvData >> item_guid;
if (!item_guid)
return;
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
- recv_data >> gem_guids[i];
+ recvData >> gem_guids[i];
//cheat -> tried to socket same gem multiple times
if ((gem_guids[0] && (gem_guids[0] == gem_guids[1] || gem_guids[0] == gem_guids[2])) ||
@@ -1353,13 +1358,13 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
itemTarget->ClearSoulboundTradeable(_player); // clear tradeable flag
}
-void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
+void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT");
uint32 eslot;
- recv_data >> eslot;
+ recvData >> eslot;
// apply only to equipped item
if (!Player::IsEquipmentPos(INVENTORY_SLOT_BAG_0, eslot))
@@ -1377,12 +1382,12 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data)
item->ClearEnchantment(TEMP_ENCHANTMENT_SLOT);
}
-void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data)
+void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND_INFO");
uint64 guid;
- recv_data >> guid; // item guid
+ recvData >> guid; // item guid
Item* item = _player->GetItemByGuid(guid);
if (!item)
@@ -1394,11 +1399,11 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data)
GetPlayer()->SendRefundInfo(item);
}
-void WorldSession::HandleItemRefund(WorldPacket &recv_data)
+void WorldSession::HandleItemRefund(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND");
uint64 guid;
- recv_data >> guid; // item guid
+ recvData >> guid; // item guid
Item* item = _player->GetItemByGuid(guid);
if (!item)
@@ -1415,10 +1420,10 @@ void WorldSession::HandleItemRefund(WorldPacket &recv_data)
*
* This function is called when player clicks on item which has some flag set
*/
-void WorldSession::HandleItemTextQuery(WorldPacket & recv_data )
+void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
{
uint64 itemGuid;
- recv_data >> itemGuid;
+ recvData >> itemGuid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index aa6d208ad3a..3f33b60329b 100755..100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -15,15 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "WorldSession.h"
-#include "WorldPacket.h"
-#include "DBCStores.h"
-#include "Player.h"
-#include "Group.h"
#include "LFGMgr.h"
#include "ObjectMgr.h"
-#include "GroupMgr.h"
-#include "InstanceScript.h"
+#include "Group.h"
+#include "Player.h"
+#include "Opcodes.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock)
{
@@ -45,13 +43,13 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMa
}
}
-void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
{
- if (!sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) ||
+ if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER) ||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() &&
(GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup())))
{
- recv_data.rfinish();
+ recvData.rfinish();
return;
}
@@ -59,121 +57,134 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
uint32 dungeon;
uint32 roles;
- recv_data >> roles;
- recv_data.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0)
- recv_data >> numDungeons;
+ recvData >> roles;
+ recvData.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0)
+ recvData >> numDungeons;
if (!numDungeons)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID());
- recv_data.rfinish();
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s no dungeons selected", GetPlayerInfo().c_str());
+ recvData.rfinish();
return;
}
LfgDungeonSet newDungeons;
for (int8 i = 0; i < numDungeons; ++i)
{
- recv_data >> dungeon;
- newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
+ recvData >> dungeon;
+ newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
}
- recv_data.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) }
+ recvData.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) }
std::string comment;
- recv_data >> comment;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str());
- sLFGMgr->Join(GetPlayer(), uint8(roles), newDungeons, comment);
+ recvData >> comment;
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_JOIN %s roles: %u, Dungeons: %u, Comment: %s",
+ GetPlayerInfo().c_str(), roles, uint8(newDungeons.size()), comment.c_str());
+ sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment);
}
-void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recv_data*/)
+void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
{
Group* grp = GetPlayer()->GetGroup();
+ uint64 guid = GetPlayer()->GetGUID();
+ uint64 gguid = grp ? grp->GetGUID() : guid;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_LEAVE [" UI64FMTD "] in group: %u", GetPlayer()->GetGUID(), grp ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LEAVE %s in group: %u",
+ GetPlayerInfo().c_str(), grp ? 1 : 0);
// Check cheating - only leader can leave the queue
if (!grp || grp->GetLeaderGUID() == GetPlayer()->GetGUID())
- sLFGMgr->Leave(GetPlayer(), grp);
+ sLFGMgr->LeaveLfg(gguid);
}
-void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData)
{
- uint32 lfgGroupID; // Internal lfgGroupID
+ uint32 lfgGroupID; // Internal lfgGroupID
bool accept; // Accept to join?
- recv_data >> lfgGroupID;
- recv_data >> accept;
+ recvData >> lfgGroupID;
+ recvData >> accept;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_PROPOSAL_RESULT [" UI64FMTD "] proposal: %u accept: %u", GetPlayer()->GetGUID(), lfgGroupID, accept ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PROPOSAL_RESULT %s proposal: %u accept: %u",
+ GetPlayerInfo().c_str(), lfgGroupID, accept ? 1 : 0);
sLFGMgr->UpdateProposal(lfgGroupID, GetPlayer()->GetGUID(), accept);
}
-void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
{
uint8 roles;
- recv_data >> roles; // Player Group Roles
+ recvData >> roles; // Player Group Roles
uint64 guid = GetPlayer()->GetGUID();
Group* grp = GetPlayer()->GetGroup();
if (!grp)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_ROLES [" UI64FMTD "] Not in group", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES %s Not in group",
+ GetPlayerInfo().c_str());
return;
}
uint64 gguid = grp->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_ROLES: Group [" UI64FMTD "], Player [" UI64FMTD "], Roles: %u", gguid, guid, roles);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_ROLES: Group %u, Player %s, Roles: %u",
+ GUID_LOPART(gguid), GetPlayerInfo().c_str(), roles);
sLFGMgr->UpdateRoleCheck(gguid, guid, roles);
}
-void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recvData)
{
std::string comment;
- recv_data >> comment;
+ recvData >> comment;
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_LFG_COMMENT [" UI64FMTD "] comment: %s", guid, comment.c_str());
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_COMMENT %s comment: %s",
+ GetPlayerInfo().c_str(), comment.c_str());
sLFGMgr->SetComment(guid, comment);
}
-void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
{
bool agree; // Agree to kick player
- recv_data >> agree;
+ recvData >> agree;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", GetPlayer()->GetGUID(), agree ? 1 : 0);
- sLFGMgr->UpdateBoot(GetPlayer(), agree);
+ uint64 guid = GetPlayer()->GetGUID();
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE %s agree: %u",
+ GetPlayerInfo().c_str(), agree ? 1 : 0);
+ sLFGMgr->UpdateBoot(guid, agree);
}
-void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData)
{
bool out;
- recv_data >> out;
+ recvData >> out;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_TELEPORT [" UI64FMTD "] out: %u", GetPlayer()->GetGUID(), out ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_TELEPORT %s out: %u",
+ GetPlayerInfo().c_str(), out ? 1 : 0);
sLFGMgr->TeleportPlayer(GetPlayer(), out, true);
}
-void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data*/)
+void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST %s",
+ GetPlayerInfo().c_str());
// Get Random dungeons that can be done at a certain level and expansion
- // FIXME - Should return seasonals (when not disabled)
LfgDungeonSet randomDungeons;
uint8 level = GetPlayer()->getLevel();
uint8 expansion = GetPlayer()->GetSession()->Expansion();
- for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
+
+ LFGDungeonContainer& LfgDungeons = sLFGMgr->GetLFGDungeonMap();
+ for (LFGDungeonContainer::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr)
{
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
- if (dungeon && dungeon->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion &&
- dungeon->minlevel <= level && level <= dungeon->maxlevel)
- randomDungeons.insert(dungeon->Entry());
+ 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());
}
// Get player locked Dungeons
- LfgLockMap lock = sLFGMgr->GetLockedDungeons(guid);
+ LfgLockMap const& lock = sLFGMgr->GetLockedDungeons(guid);
uint32 rsize = uint32(randomDungeons.size());
uint32 lsize = uint32(lock.size());
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_INFO %s", GetPlayerInfo().c_str());
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
@@ -181,40 +192,37 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data
{
data << uint32(*it); // Dungeon Entry (id + type)
LfgReward const* reward = sLFGMgr->GetRandomDungeonReward(*it, level);
- Quest const* qRew = NULL;
+ Quest const* quest = NULL;
uint8 done = 0;
if (reward)
{
- qRew = sObjectMgr->GetQuestTemplate(reward->reward[0].questId);
- if (qRew)
+ quest = sObjectMgr->GetQuestTemplate(reward->reward[0].questId);
+ if (quest)
{
- done = !GetPlayer()->CanRewardQuest(qRew, false);
+ done = !GetPlayer()->CanRewardQuest(quest, false);
if (done)
- qRew = sObjectMgr->GetQuestTemplate(reward->reward[1].questId);
+ quest = sObjectMgr->GetQuestTemplate(reward->reward[1].questId);
}
}
- if (qRew)
+
+ if (quest)
{
data << uint8(done);
- data << uint32(qRew->GetRewOrReqMoney());
- data << uint32(qRew->XPValue(GetPlayer()));
+ data << uint32(quest->GetRewOrReqMoney());
+ data << uint32(quest->XPValue(GetPlayer()));
data << uint32(reward->reward[done].variableMoney);
data << uint32(reward->reward[done].variableXP);
- data << uint8(qRew->GetRewItemsCount());
- if (qRew->GetRewItemsCount())
+ data << uint8(quest->GetRewItemsCount());
+ if (quest->GetRewItemsCount())
{
- ItemTemplate const* iProto = NULL;
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
- {
- if (!qRew->RewardItemId[i])
- continue;
-
- iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]);
-
- data << uint32(qRew->RewardItemId[i]);
- data << uint32(iProto ? iProto->DisplayInfoID : 0);
- data << uint32(qRew->RewardItemIdCount[i]);
- }
+ if (uint32 itemId = quest->RewardItemId[i])
+ {
+ ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId);
+ data << uint32(itemId);
+ data << uint32(item ? item->DisplayInfoID : 0);
+ data << uint32(quest->RewardItemIdCount[i]);
+ }
}
}
else
@@ -231,10 +239,10 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data
SendPacket(&data);
}
-void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recv_data*/)
+void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/)
{
uint64 guid = GetPlayer()->GetGUID();
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFD_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST %s", GetPlayerInfo().c_str());
Group* grp = GetPlayer()->GetGroup();
if (!grp)
@@ -259,65 +267,83 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recv_data
for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PARTY_INFO %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
BuildPartyLockDungeonBlock(data, lockMap);
SendPacket(&data);
}
-void WorldSession::HandleLfrSearchOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfrJoinOpcode(WorldPacket& recvData)
{
uint32 entry; // Raid id to search
- recv_data >> entry;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SEARCH_LFG_JOIN [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), entry);
+ recvData >> entry;
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_JOIN %s dungeon entry: %u",
+ GetPlayerInfo().c_str(), entry);
//SendLfrUpdateListOpcode(entry);
}
-void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recv_data)
+void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recvData)
{
uint32 dungeonId; // Raid id queue to leave
- recv_data >> dungeonId;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SEARCH_LFG_LEAVE [" UI64FMTD "] dungeonId: %u", GetPlayer()->GetGUID(), dungeonId);
+ recvData >> dungeonId;
+ sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_LFR_LEAVE %s dungeonId: %u",
+ GetPlayerInfo().c_str(), dungeonId);
//sLFGMgr->LeaveLfr(GetPlayer(), dungeonId);
}
+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);
+
+ if (GetPlayer()->GetGroup())
+ {
+ SendLfgUpdateParty(updateData);
+ updateData.dungeons.clear();
+ SendLfgUpdatePlayer(updateData);
+ }
+ else
+ {
+ SendLfgUpdatePlayer(updateData);
+ updateData.dungeons.clear();
+ SendLfgUpdateParty(updateData);
+ }
+}
+
void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
{
bool queued = false;
- bool extrainfo = false;
+ uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType)
{
- case LFG_UPDATETYPE_JOIN_PROPOSAL:
+ case LFG_UPDATETYPE_JOIN_QUEUE:
case LFG_UPDATETYPE_ADDED_TO_QUEUE:
queued = true;
- extrainfo = true;
break;
- //case LFG_UPDATETYPE_CLEAR_LOCK_LIST: // TODO: Sometimes has extrainfo - Check ocurrences...
- case LFG_UPDATETYPE_PROPOSAL_BEGIN:
- extrainfo = true;
+ case LFG_UPDATETYPE_UPDATE_STATUS:
+ queued = updateData.state == LFG_STATE_QUEUED;
break;
default:
break;
}
- uint64 guid = GetPlayer()->GetGUID();
- uint8 size = uint8(updateData.dungeons.size());
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_UPDATE_PLAYER [" UI64FMTD "] updatetype: %u", guid, updateData.updateType);
- WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
- data << uint8(updateData.updateType); // Lfg Update type
- data << uint8(extrainfo); // Extra info
- if (extrainfo)
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u",
+ GetPlayerInfo().c_str(), updateData.updateType);
+ WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
+ data << uint8(updateData.updateType); // Lfg Update type
+ data << uint8(size > 0); // Extra info
+ if (size)
{
- data << uint8(queued); // Join the queue
- data << uint8(0); // unk - Always 0
- data << uint8(0); // unk - Always 0
+ data << uint8(queued); // Join the queue
+ data << uint8(0); // unk - Always 0
+ data << uint8(0); // unk - Always 0
data << uint8(size);
- if (size)
- for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
- data << uint32(*it);
+ for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
+ data << uint32(*it);
data << updateData.comment;
}
SendPacket(&data);
@@ -326,51 +352,42 @@ void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
{
bool join = false;
- bool extrainfo = false;
bool queued = false;
+ uint8 size = uint8(updateData.dungeons.size());
switch (updateData.updateType)
{
- case LFG_UPDATETYPE_JOIN_PROPOSAL:
- extrainfo = true;
- break;
- case LFG_UPDATETYPE_ADDED_TO_QUEUE:
- extrainfo = true;
- join = true;
- queued = true;
- break;
- case LFG_UPDATETYPE_CLEAR_LOCK_LIST:
- // join = true; // TODO: Sometimes queued and extrainfo - Check ocurrences...
+ case LFG_UPDATETYPE_ADDED_TO_QUEUE: // Rolecheck Success
queued = true;
- break;
+ // no break on purpose
case LFG_UPDATETYPE_PROPOSAL_BEGIN:
- extrainfo = true;
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;
+ break;
default:
break;
}
- uint64 guid = GetPlayer()->GetGUID();
- uint8 size = uint8(updateData.dungeons.size());
-
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_UPDATE_PARTY [" UI64FMTD "] updatetype: %u", guid, updateData.updateType);
- WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
- data << uint8(updateData.updateType); // Lfg Update type
- data << uint8(extrainfo); // Extra info
- if (extrainfo)
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u",
+ GetPlayerInfo().c_str(), updateData.updateType);
+ WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
+ data << uint8(updateData.updateType); // Lfg Update type
+ data << uint8(size > 0); // Extra info
+ if (size)
{
- data << uint8(join); // LFG Join
- data << uint8(queued); // Join the queue
- data << uint8(0); // unk - Always 0
- data << uint8(0); // unk - Always 0
+ data << uint8(join); // LFG Join
+ data << uint8(queued); // Join the queue
+ data << uint8(0); // unk - Always 0
+ data << uint8(0); // unk - Always 0
for (uint8 i = 0; i < 3; ++i)
- data << uint8(0); // unk - Always 0
+ data << uint8(0); // unk - Always 0
data << uint8(size);
- if (size)
- for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
- data << uint32(*it);
+ for (LfgDungeonSet::const_iterator it = updateData.dungeons.begin(); it != updateData.dungeons.end(); ++it)
+ data << uint32(*it);
data << updateData.comment;
}
SendPacket(&data);
@@ -378,7 +395,8 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHOSEN %s guid: %u roles: %u",
+ GetPlayerInfo().c_str(), GUID_LOPART(guid), roles);
WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4);
data << uint64(guid); // Guid
@@ -387,45 +405,44 @@ void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
SendPacket(&data);
}
-void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
+void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck)
{
- ASSERT(pRoleCheck);
LfgDungeonSet dungeons;
- if (pRoleCheck->rDungeonId)
- dungeons.insert(pRoleCheck->rDungeonId);
+ if (roleCheck.rDungeonId)
+ dungeons.insert(roleCheck.rDungeonId);
else
- dungeons = pRoleCheck->dungeons;
+ dungeons = roleCheck.dungeons;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID());
- WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_ROLE_CHECK_UPDATE %s", GetPlayerInfo().c_str());
+ WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1));
- data << uint32(pRoleCheck->state); // Check result
- data << uint8(pRoleCheck->state == LFG_ROLECHECK_INITIALITING);
+ data << uint32(roleCheck.state); // Check result
+ data << uint8(roleCheck.state == LFG_ROLECHECK_INITIALITING);
data << uint8(dungeons.size()); // Number of dungeons
if (!dungeons.empty())
{
for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
- LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(*it);
+ LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(*it);
data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon
}
}
- data << uint8(pRoleCheck->roles.size()); // Players in group
- if (!pRoleCheck->roles.empty())
+ data << uint8(roleCheck.roles.size()); // Players in group
+ if (!roleCheck.roles.empty())
{
// Leader info MUST be sent 1st :S
- uint64 guid = pRoleCheck->leader;
- uint8 roles = pRoleCheck->roles.find(guid)->second;
+ uint64 guid = roleCheck.leader;
+ uint8 roles = roleCheck.roles.find(guid)->second;
data << uint64(guid); // Guid
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
Player* player = ObjectAccessor::FindPlayer(guid);
- data << uint8(player ? player->getLevel() : 0); // Level
+ data << uint8(player ? player->getLevel() : 0); // Level
- for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
+ for (LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
{
- if (it->first == pRoleCheck->leader)
+ if (it->first == roleCheck.leader)
continue;
guid = it->first;
@@ -434,7 +451,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
data << uint8(roles > 0); // Ready
data << uint32(roles); // Roles
player = ObjectAccessor::FindPlayer(guid);
- data << uint8(player ? player->getLevel() : 0); // Level
+ data << uint8(player ? player->getLevel() : 0);// Level
}
}
SendPacket(&data);
@@ -446,7 +463,8 @@ void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData)
for (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_NETWORKIO, "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_JOIN_RESULT %s checkResult: %u checkValue: %u",
+ GetPlayerInfo().c_str(), joinData.result, joinData.state);
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
data << uint32(joinData.result); // Check Result
data << uint32(joinData.state); // Check Value
@@ -455,68 +473,66 @@ void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData)
SendPacket(&data);
}
-void WorldSession::SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgWaitTime, int32 waitTimeTanks, int32 waitTimeHealer, int32 waitTimeDps, uint32 queuedTime, uint8 tanks, uint8 healers, uint8 dps)
+void WorldSession::SendLfgQueueStatus(const LfgQueueStatusData& queueData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u", GetPlayer()->GetGUID(), dungeon, waitTime, avgWaitTime, waitTimeTanks, waitTimeHealer, waitTimeDps, queuedTime, tanks, healers, dps);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_QUEUE_STATUS %s dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u",
+ GetPlayerInfo().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 +4 + 1 + 1 + 1 + 4);
- data << uint32(dungeon); // Dungeon
- data << int32(avgWaitTime); // Average Wait time
- data << int32(waitTime); // Wait Time
- data << int32(waitTimeTanks); // Wait Tanks
- data << int32(waitTimeHealer); // Wait Healers
- data << int32(waitTimeDps); // Wait Dps
- data << uint8(tanks); // Tanks needed
- data << uint8(healers); // Healers needed
- data << uint8(dps); // Dps needed
- data << uint32(queuedTime); // Player wait time in queue
+ data << uint32(queueData.dungeonId); // Dungeon
+ data << int32(queueData.waitTimeAvg); // Average Wait time
+ data << int32(queueData.waitTime); // Wait Time
+ data << int32(queueData.waitTimeTank); // Wait Tanks
+ data << int32(queueData.waitTimeHealer); // Wait Healers
+ data << int32(queueData.waitTimeDps); // Wait Dps
+ data << uint8(queueData.tanks); // Tanks needed
+ data << uint8(queueData.healers); // Healers needed
+ data << uint8(queueData.dps); // Dps needed
+ data << uint32(queueData.queuedTime); // Player wait time in queue
SendPacket(&data);
}
-void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward* reward, const Quest* qRew)
+void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward* reward, const Quest* quest)
{
- if (!rdungeonEntry || !sdungeonEntry || !qRew)
+ if (!rdungeonEntry || !sdungeonEntry || !quest)
return;
- uint8 itemNum = uint8(qRew ? qRew->GetRewItemsCount() : 0);
+ uint8 itemNum = uint8(quest ? quest->GetRewItemsCount() : 0);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_REWARD [" UI64FMTD "] rdungeonEntry: %u - sdungeonEntry: %u - done: %u", GetPlayer()->GetGUID(), rdungeonEntry, sdungeonEntry, done);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u - sdungeonEntry: %u - done: %u",
+ GetPlayerInfo().c_str(), rdungeonEntry, sdungeonEntry, done);
WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4));
data << uint32(rdungeonEntry); // Random Dungeon Finished
data << uint32(sdungeonEntry); // Dungeon Finished
data << uint8(done);
data << uint32(1);
- data << uint32(qRew->GetRewOrReqMoney());
- data << uint32(qRew->XPValue(GetPlayer()));
+ data << uint32(quest->GetRewOrReqMoney());
+ data << uint32(quest->XPValue(GetPlayer()));
data << uint32(reward->reward[done].variableMoney);
data << uint32(reward->reward[done].variableXP);
data << uint8(itemNum);
if (itemNum)
{
- ItemTemplate const* iProto = NULL;
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
- {
- if (!qRew->RewardItemId[i])
- continue;
-
- iProto = sObjectMgr->GetItemTemplate(qRew->RewardItemId[i]);
-
- data << uint32(qRew->RewardItemId[i]);
- data << uint32(iProto ? iProto->DisplayInfoID : 0);
- data << uint32(qRew->RewardItemIdCount[i]);
- }
+ if (uint32 itemId = quest->RewardItemId[i])
+ {
+ ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId);
+ data << uint32(itemId);
+ data << uint32(item ? item->DisplayInfoID : 0);
+ data << uint32(quest->RewardItemIdCount[i]);
+ }
}
SendPacket(&data);
}
-void WorldSession::SendLfgBootPlayer(const LfgPlayerBoot* pBoot)
+void WorldSession::SendLfgBootProposalUpdate(const LfgPlayerBoot& boot)
{
uint64 guid = GetPlayer()->GetGUID();
- LfgAnswer playerVote = pBoot->votes.find(guid)->second;
+ LfgAnswer playerVote = boot.votes.find(guid)->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
- uint32 secsleft = uint8((pBoot->cancelTime - time(NULL)) / 1000);
- for (LfgAnswerMap::const_iterator it = pBoot->votes.begin(); it != pBoot->votes.end(); ++it)
+ uint32 secsleft = uint8((boot.cancelTime - time(NULL)) / 1000);
+ for (LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it)
{
if (it->second != LFG_ANSWER_PENDING)
{
@@ -525,107 +541,79 @@ void WorldSession::SendLfgBootPlayer(const LfgPlayerBoot* pBoot)
++agreeNum;
}
}
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
- guid, uint8(pBoot->inProgress), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), pBoot->victim, votesNum, agreeNum, secsleft, pBoot->votedNeeded, pBoot->reason.c_str());
- WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + pBoot->reason.length());
- data << uint8(pBoot->inProgress); // Vote in progress
+ 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());
+ 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 << uint64(pBoot->victim); // Victim GUID
+ data << uint64(boot.victim); // Victim GUID
data << uint32(votesNum); // Total Votes
data << uint32(agreeNum); // Agree Count
data << uint32(secsleft); // Time Left
- data << uint32(pBoot->votedNeeded); // Needed Votes
- data << pBoot->reason.c_str(); // Kick reason
+ data << uint32(LFG_GROUP_KICK_VOTES_NEEDED); // Needed Votes
+ data << boot.reason.c_str(); // Kick reason
SendPacket(&data);
}
-void WorldSession::SendLfgUpdateProposal(uint32 proposalId, const LfgProposal* pProp)
+void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& proposal)
{
- if (!pProp)
- return;
-
uint64 guid = GetPlayer()->GetGUID();
- LfgProposalPlayerMap::const_iterator itPlayer = pProp->players.find(guid);
- if (itPlayer == pProp->players.end()) // Player MUST be in the proposal
- return;
-
- LfgProposalPlayer* ppPlayer = itPlayer->second;
- uint32 pLowGroupGuid = ppPlayer->groupLowGuid;
- uint32 dLowGuid = pProp->groupLowGuid;
- uint32 dungeonId = pProp->dungeonId;
- bool isSameDungeon = false;
- bool isContinue = false;
- Group* grp = dLowGuid ? sGroupMgr->GetGroupByGUID(dLowGuid) : NULL;
- uint32 completedEncounters = 0;
- if (grp)
- {
- uint64 gguid = grp->GetGUID();
- isContinue = grp->isLFGGroup() && sLFGMgr->GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
- isSameDungeon = GetPlayer()->GetGroup() == grp && isContinue;
- }
+ uint64 gguid = proposal.players.find(guid)->second.group;
+ bool silent = !proposal.isNew && gguid == proposal.group;
+ uint32 dungeonEntry = proposal.dungeonId;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", GetPlayer()->GetGUID(), pProp->state);
- WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + pProp->players.size() * (4 + 1 + 1 + 1 + 1 +1));
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PROPOSAL_UPDATE %s state: %u",
+ GetPlayerInfo().c_str(), proposal.state);
+ WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + proposal.players.size() * (4 + 1 + 1 + 1 + 1 +1));
- if (!isContinue) // Only show proposal dungeon if it's continue
+ // show random dungeon if player selected random dungeon and it's not lfg group
+ if (!silent)
{
- LfgDungeonSet playerDungeons = sLFGMgr->GetSelectedDungeons(guid);
- if (playerDungeons.size() == 1)
- dungeonId = (*playerDungeons.begin());
+ LfgDungeonSet const& playerDungeons = sLFGMgr->GetSelectedDungeons(guid);
+ if (playerDungeons.find(proposal.dungeonId) == playerDungeons.end())
+ dungeonEntry = (*playerDungeons.begin());
}
- if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
- {
- dungeonId = dungeon->Entry();
-
- // Select a player inside to be get completed encounters from
- if (grp)
- {
- for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* groupMember = itr->getSource();
- if (groupMember && groupMember->GetMapId() == uint32(dungeon->map))
- {
- if (InstanceScript* instance = groupMember->GetInstanceScript())
- completedEncounters = instance->GetCompletedEncounterMask();
- break;
- }
- }
- }
- }
+ if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonEntry))
+ dungeonEntry = dungeon->Entry();
- data << uint32(dungeonId); // Dungeon
- data << uint8(pProp->state); // Result state
- data << uint32(proposalId); // Internal Proposal ID
- data << uint32(completedEncounters); // Bosses killed
- data << uint8(isSameDungeon); // Silent (show client window)
- data << uint8(pProp->players.size()); // Group size
+ data << uint32(dungeonEntry); // Dungeon
+ data << uint8(proposal.state); // Proposal state
+ data << uint32(proposalId); // Proposal ID
+ data << uint32(proposal.encounters); // encounters done
+ data << uint8(silent); // Show proposal window
+ data << uint8(proposal.players.size()); // Group size
- for (itPlayer = pProp->players.begin(); itPlayer != pProp->players.end(); ++itPlayer)
+ for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
{
- ppPlayer = itPlayer->second;
- data << uint32(ppPlayer->role); // Role
- data << uint8(itPlayer->first == guid); // Self player
- if (!ppPlayer->groupLowGuid) // Player not it a group
+ 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
{
data << uint8(0); // Not in dungeon
data << uint8(0); // Not same group
}
else
{
- data << uint8(ppPlayer->groupLowGuid == dLowGuid); // In dungeon (silent)
- data << uint8(ppPlayer->groupLowGuid == pLowGroupGuid); // Same Group than player
+ data << uint8(player.group == proposal.group); // In dungeon (silent)
+ data << uint8(player.group == gguid); // Same Group than player
}
- data << uint8(ppPlayer->accept != LFG_ANSWER_PENDING); // Answered
- data << uint8(ppPlayer->accept == LFG_ANSWER_AGREE); // Accepted
+ data << uint8(player.accept != LFG_ANSWER_PENDING);// Answered
+ data << uint8(player.accept == LFG_ANSWER_AGREE); // Accepted
}
SendPacket(&data);
}
-void WorldSession::SendLfgUpdateSearch(bool update)
+void WorldSession::SendLfgLfrList(bool update)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_UPDATE_SEARCH [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_LFR_LIST %s update: %u",
+ GetPlayerInfo().c_str(), update ? 1 : 0);
WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1);
data << uint8(update); // In Lfg Queue?
SendPacket(&data);
@@ -633,14 +621,15 @@ void WorldSession::SendLfgUpdateSearch(bool update)
void WorldSession::SendLfgDisabled()
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_DISABLED [" UI64FMTD "]", GetPlayer()->GetGUID());
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_DISABLED %s", GetPlayerInfo().c_str());
WorldPacket data(SMSG_LFG_DISABLED, 0);
SendPacket(&data);
}
void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_OFFER_CONTINUE [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_OFFER_CONTINUE %s dungeon entry: %u",
+ GetPlayerInfo().c_str(), dungeonEntry);
WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4);
data << uint32(dungeonEntry);
SendPacket(&data);
@@ -648,7 +637,8 @@ void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry)
void WorldSession::SendLfgTeleportError(uint8 err)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err);
+ sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_TELEPORT_DENIED %s reason: %u",
+ GetPlayerInfo().c_str(), err);
WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4);
data << uint32(err); // Error
SendPacket(&data);
@@ -657,8 +647,9 @@ void WorldSession::SendLfgTeleportError(uint8 err)
/*
void WorldSession::SendLfrUpdateListOpcode(uint32 dungeonEntry)
{
- sLog->outDebug(LOG_FILTER_PACKETIO, "SMSG_UPDATE_LFG_LIST [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry);
- WorldPacket data(SMSG_UPDATE_LFG_LIST);
+ sLog->outDebug(LOG_FILTER_PACKETIO, "SMSG_LFG_UPDATE_LIST %s dungeon entry: %u",
+ GetPlayerInfo().c_str(), dungeonEntry);
+ WorldPacket data(SMSG_LFG_UPDATE_LIST);
SendPacket(&data);
}
*/
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 8259d0c4e9b..752eace536b 100755..100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -17,20 +17,21 @@
*/
#include "Common.h"
-#include "WorldPacket.h"
#include "Log.h"
#include "Corpse.h"
+#include "Creature.h"
#include "GameObject.h"
-#include "Player.h"
-#include "ObjectAccessor.h"
-#include "WorldSession.h"
+#include "Group.h"
#include "LootMgr.h"
+#include "ObjectAccessor.h"
#include "Object.h"
-#include "Group.h"
+#include "Opcodes.h"
+#include "Player.h"
#include "World.h"
-#include "Util.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
-void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
Player* player = GetPlayer();
@@ -38,7 +39,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data)
Loot* loot = NULL;
uint8 lootSlot = 0;
- recv_data >> lootSlot;
+ recvData >> lootSlot;
if (IS_GAMEOBJECT_GUID(lguid))
{
@@ -94,7 +95,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data)
player->StoreLootItem(lootSlot, loot);
}
-void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_MONEY");
@@ -179,7 +180,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/)
for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i)
{
(*i)->ModifyMoney(goldPerPlayer);
- (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer);
+ (*i)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer);
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(goldPerPlayer);
@@ -190,7 +191,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/)
else
{
player->ModifyMoney(loot->gold);
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold);
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(loot->gold);
@@ -202,12 +203,12 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/)
}
}
-void WorldSession::HandleLootOpcode(WorldPacket & recv_data)
+void WorldSession::HandleLootOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// Check possible cheat
if (!_player->isAlive())
@@ -428,12 +429,12 @@ void WorldSession::DoLootRelease(uint64 lguid)
loot->RemoveLooter(player->GetGUID());
}
-void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
+void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
{
uint8 slotid;
uint64 lootguid, target_playerguid;
- recv_data >> lootguid >> slotid >> target_playerguid;
+ recvData >> lootguid >> slotid >> target_playerguid;
if (!_player->GetGroup() || _player->GetGroup()->GetLooterGuid() != _player->GetGUID())
{
@@ -445,7 +446,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (!target)
return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str());
if (_player->GetLootGUID() != lootguid)
return;
@@ -474,7 +475,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (slotid >= loot->items.size() + loot->quest_items.size())
{
- sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)loot->items.size());
+ sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)",
+ GetPlayer()->GetName().c_str(), slotid, (unsigned long)loot->items.size());
return;
}
@@ -498,9 +500,9 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
// not move item from loot to target inventory
Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters);
target->SendNewItem(newitem, uint32(item.count), false, false, true);
- target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
- target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item.count);
- target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count);
+ target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
+ target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item.count);
+ target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count);
// mark as looted
item.count=0;
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 4fb0ab2e9c1..6b8c83cce73 100755..100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -29,29 +29,29 @@
#include "Item.h"
#include "AccountMgr.h"
-void WorldSession::HandleSendMail(WorldPacket & recv_data)
+void WorldSession::HandleSendMail(WorldPacket& recvData)
{
uint64 mailbox, unk3;
std::string receiver, subject, body;
uint32 unk1, unk2, money, COD;
uint8 unk4;
- recv_data >> mailbox;
- recv_data >> receiver;
+ recvData >> mailbox;
+ recvData >> receiver;
- recv_data >> subject;
+ recvData >> subject;
- recv_data >> body;
+ recvData >> body;
- recv_data >> unk1; // stationery?
- recv_data >> unk2; // 0x00000000
+ recvData >> unk1; // stationery?
+ recvData >> unk2; // 0x00000000
uint8 items_count;
- recv_data >> items_count; // attached items count
+ recvData >> items_count; // attached items count
if (items_count > MAX_MAIL_ITEMS) // client limit
{
GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_TOO_MANY_ATTACHMENTS);
- recv_data.rfinish(); // set to end to avoid warnings spam
+ recvData.rfinish(); // set to end to avoid warnings spam
return;
}
@@ -59,13 +59,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
for (uint8 i = 0; i < items_count; ++i)
{
- recv_data.read_skip<uint8>(); // item slot in mail, not used
- recv_data >> itemGUIDs[i];
+ recvData.read_skip<uint8>(); // item slot in mail, not used
+ recvData >> itemGUIDs[i];
}
- recv_data >> money >> COD; // money and cod
- recv_data >> unk3; // const 0
- recv_data >> unk4; // const 0
+ recvData >> money >> COD; // money and cod
+ recvData >> unk3; // const 0
+ recvData >> unk4; // const 0
// packet read complete, now do check
@@ -89,13 +89,13 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (!rc)
{
- sLog->outDetail("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",
+ 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);
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
return;
}
- sLog->outDetail("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(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
if (player->GetGUID() == rc)
{
@@ -246,7 +246,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
player->SendMailResult(0, MAIL_SEND, MAIL_OK);
player->ModifyMoney(-int32(reqmoney));
- player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
bool needItemDelay = false;
@@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account);
}
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
@@ -284,7 +284,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
{
sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)",
- GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account);
+ GetPlayerName().c_str(), GetAccountId(), money, receiver.c_str(), rc_account);
}
}
@@ -302,12 +302,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
}
//called when mail is read
-void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data)
+void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
- recv_data >> mailbox;
- recv_data >> mailId;
+ recvData >> mailbox;
+ recvData >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -325,13 +325,13 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data)
}
//called when client deletes mail
-void WorldSession::HandleMailDelete(WorldPacket & recv_data)
+void WorldSession::HandleMailDelete(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
- recv_data >> mailbox;
- recv_data >> mailId;
- recv_data.read_skip<uint32>(); // mailTemplateId
+ recvData >> mailbox;
+ recvData >> mailId;
+ recvData.read_skip<uint32>(); // mailTemplateId
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -353,13 +353,13 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data)
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
}
-void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
+void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
- recv_data >> mailbox;
- recv_data >> mailId;
- recv_data.read_skip<uint64>(); // original sender GUID for return to, not used
+ recvData >> mailbox;
+ recvData >> mailId;
+ recvData.read_skip<uint64>(); // original sender GUID for return to, not used
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -417,14 +417,14 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
}
//called when player takes item attached in mail
-void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
+void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
uint32 itemId;
- recv_data >> mailbox;
- recv_data >> mailId;
- recv_data >> itemId; // item guid low
+ recvData >> mailbox;
+ recvData >> mailId;
+ recvData >> itemId; // item guid low
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -479,7 +479,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
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)",
- GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
+ GetPlayerName().c_str(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
}
else if (!receive)
sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid);
@@ -500,6 +500,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
player->RemoveMItem(it->GetGUIDLow());
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
+ it->SetState(ITEM_UNCHANGED); // need to set this state, otherwise item cannot be removed later, if neccessary
player->MoveItemToInventory(dest, it, true);
player->SaveInventoryAndGoldToDB(trans);
@@ -512,12 +513,12 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
}
-void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
+void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
- recv_data >> mailbox;
- recv_data >> mailId;
+ recvData >> mailbox;
+ recvData >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -546,10 +547,10 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
}
//called when player lists his received mails
-void WorldSession::HandleGetMailList(WorldPacket & recv_data)
+void WorldSession::HandleGetMailList(WorldPacket& recvData)
{
uint64 mailbox;
- recv_data >> mailbox;
+ recvData >> mailbox;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -573,8 +574,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
{
- // packet send mail count as uint8, prevent overflow
- if (mailsCount >= 254)
+ // Only first 50 mails are displayed
+ if (mailsCount >= 50)
{
realCount += 1;
continue;
@@ -586,7 +587,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
uint8 item_count = (*itr)->items.size(); // max count is MAX_MAIL_ITEMS (12)
- size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+7*3*4+4+4+4+4+4+4+1);
+ size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1);
if (data.wpos()+next_mail_size > maxPacketSize)
{
@@ -606,19 +607,17 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
case MAIL_CREATURE:
case MAIL_GAMEOBJECT:
case MAIL_AUCTION:
- data << uint32((*itr)->sender); // creature/gameobject entry, auction id
- break;
- case MAIL_ITEM: // item entry (?) sender = "Unknown", NYI
- data << uint32(0); // item entry
+ case MAIL_CALENDAR:
+ data << uint32((*itr)->sender); // creature/gameobject entry, auction id, calendar event id?
break;
}
data << uint32((*itr)->COD); // COD
- data << uint32(0); // probably changed in 3.3.3
+ data << uint32(0); // package (Package.dbc)
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
data << uint32((*itr)->money); // Gold
data << uint32((*itr)->checked); // flags
- data << float(((*itr)->expire_time-time(NULL))/DAY); // Time
+ data << float(float((*itr)->expire_time-time(NULL))/DAY); // Time
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
data << (*itr)->subject; // Subject string - once 00, when mail type = 3, max 256
data << (*itr)->body; // message? max 8000
@@ -655,8 +654,8 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
data << uint8(0);
}
- realCount += 1;
- mailsCount += 1;
+ ++realCount;
+ ++mailsCount;
}
data.put<uint32>(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount
@@ -668,13 +667,13 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
}
//used when player copies mail body to his inventory
-void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
+void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
{
uint64 mailbox;
uint32 mailId;
- recv_data >> mailbox;
- recv_data >> mailId;
+ recvData >> mailbox;
+ recvData >> mailId;
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
return;
@@ -713,7 +712,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
bodyItem->SetUInt32Value(ITEM_FIELD_CREATOR, m->sender);
bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK);
- sLog->outDetail("HandleMailCreateTextItem mailid=%u", mailId);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleMailCreateTextItem mailid=%u", mailId);
ItemPosCountVec dest;
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false);
@@ -734,7 +733,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
}
//TODO Fix me! ... this void has probably bad condition, but good data are sent
-void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/)
+void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recvData*/)
{
WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8);
@@ -743,11 +742,12 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/)
if (_player->unReadMails > 0)
{
- data << uint32(0); // float
+ data << float(0); // float
data << uint32(0); // count
uint32 count = 0;
time_t now = time(NULL);
+ std::set<uint32> sentSenders;
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
Mail* m = (*itr);
@@ -759,36 +759,29 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/)
if (now < m->deliver_time)
continue;
- if (m->messageType)
- data << uint64(m->sender); // player guid
- else
- data << uint32(m->sender); // creature entry
+ // only send each mail sender once
+ if (sentSenders.count(m->sender))
+ continue;
- switch (m->messageType)
- {
- case MAIL_AUCTION:
- data << uint32(2);
- data << uint32(2);
- data << uint32(m->stationery);
- break;
- default:
- data << uint32(0);
- data << uint32(0);
- data << uint32(m->stationery);
- break;
- }
- data << uint32(0xC6000000); // float unk, time or something
+ data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid
+ data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries
+ data << uint32(m->messageType);
+ data << uint32(m->stationery);
+ data << float(m->deliver_time - now);
+ sentSenders.insert(m->sender);
++count;
if (count == 2) // do not display more than 2 mails
break;
}
+
data.put<uint32>(4, count);
}
else
{
- data << uint32(0xC7A8C000);
- data << uint32(0x00000000);
+ data << float(-DAY);
+ data << uint32(0);
}
+
SendPacket(&data);
}
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 11f0857ca2b..aa182a16d91 100755..100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -52,12 +52,15 @@
#include "Group.h"
#include "AccountMgr.h"
#include "Spell.h"
+#include "BattlegroundMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
-void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
+void WorldSession::HandleRepopRequestOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REPOP_REQUEST Message");
- recv_data.read_skip<uint8>();
+ recvData.read_skip<uint8>();
if (GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
return;
@@ -72,7 +75,8 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
// release spirit after he's killed but before he is updated
if (GetPlayer()->getDeathState() == JUST_DIED)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated",
+ GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
GetPlayer()->KillPlayer();
}
@@ -82,7 +86,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
GetPlayer()->RepopAtGraveyard();
}
-void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION");
@@ -91,10 +95,10 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
uint64 guid;
std::string code = "";
- recv_data >> guid >> menuId >> gossipListId;
+ recvData >> guid >> menuId >> gossipListId;
if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId))
- recv_data >> code;
+ recvData >> code;
Creature* unit = NULL;
GameObject* go = NULL;
@@ -167,7 +171,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
+void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
@@ -182,15 +186,15 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
uint32 zoneids[10]; // 10 is client limit
std::string player_name, guild_name;
- recv_data >> level_min; // maximal player level, default 0
- recv_data >> level_max; // minimal player level, default 100 (MAX_LEVEL)
- recv_data >> player_name; // player name, case sensitive...
+ recvData >> level_min; // maximal player level, default 0
+ recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL)
+ recvData >> player_name; // player name, case sensitive...
- recv_data >> guild_name; // guild name, case sensitive...
+ recvData >> guild_name; // guild name, case sensitive...
- recv_data >> racemask; // race mask
- recv_data >> classmask; // class mask
- recv_data >> zones_count; // zones count, client limit = 10 (2.0.10)
+ recvData >> racemask; // race mask
+ recvData >> classmask; // class mask
+ recvData >> zones_count; // zones count, client limit = 10 (2.0.10)
if (zones_count > 10)
return; // can't be received from real client or broken packet
@@ -198,12 +202,12 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
for (uint32 i = 0; i < zones_count; ++i)
{
uint32 temp;
- recv_data >> temp; // zone id, 0 if zone is unknown...
+ recvData >> temp; // zone id, 0 if zone is unknown...
zoneids[i] = temp;
sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]);
}
- recv_data >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10)
+ recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10)
if (str_count > 4)
return; // can't be received from real client or broken packet
@@ -214,7 +218,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
for (uint32 i = 0; i < str_count; ++i)
{
std::string temp;
- recv_data >> temp; // user entered string, it used as universal search pattern(guild+player name)?
+ recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)?
if (!Utf8toWStr(temp, str[i]))
continue;
@@ -364,7 +368,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");
}
-void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
@@ -421,12 +425,12 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
LogoutRequest(time(NULL));
}
-void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_PLAYER_LOGOUT Message");
}
-void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message");
@@ -458,13 +462,13 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LOGOUT_CANCEL_ACK Message");
}
-void WorldSession::HandleTogglePvP(WorldPacket & recv_data)
+void WorldSession::HandleTogglePvP(WorldPacket& recvData)
{
// this opcode can be used in two ways: Either set explicit new status or toggle old status
- if (recv_data.size() == 1)
+ if (recvData.size() == 1)
{
bool newPvPStatus;
- recv_data >> newPvPStatus;
+ recvData >> newPvPStatus;
GetPlayer()->ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP, newPvPStatus);
GetPlayer()->ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER, !newPvPStatus);
}
@@ -489,10 +493,10 @@ void WorldSession::HandleTogglePvP(WorldPacket & recv_data)
// pvp->HandlePlayerActivityChanged(_player);
}
-void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData)
{
uint32 newZone;
- recv_data >> newZone;
+ recvData >> newZone;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone);
@@ -503,46 +507,47 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data)
//GetPlayer()->SendInitWorldStates(true, newZone);
}
-void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
_player->SetSelection(guid);
}
-void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data)
+void WorldSession::HandleStandStateChangeOpcode(WorldPacket& recvData)
{
- // sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop
+ // sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop
uint32 animstate;
- recv_data >> animstate;
+ recvData >> animstate;
_player->SetStandState(animstate);
}
-void WorldSession::HandleContactListOpcode(WorldPacket & recv_data)
+void WorldSession::HandleContactListOpcode(WorldPacket& recvData)
{
uint32 unk;
- recv_data >> unk;
+ recvData >> unk;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", unk);
_player->GetSocial()->SendSocialList(_player);
}
-void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_FRIEND");
std::string friendName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN);
std::string friendNote;
- recv_data >> friendName;
+ recvData >> friendName;
- recv_data >> friendNote;
+ recvData >> friendNote;
if (!normalizePlayerName(friendName))
return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName(), friendName.c_str());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'",
+ GetPlayer()->GetName().c_str(), friendName.c_str());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME);
@@ -552,7 +557,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
_addFriendCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
-void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string friendNote)
+void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote)
{
if (!GetPlayer())
return;
@@ -593,7 +598,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
{
friendResult = FRIEND_LIST_FULL;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s's friend list is full.", GetPlayer()->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str());
}
}
GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote);
@@ -606,13 +611,13 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
-void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data)
+void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData)
{
uint64 FriendGUID;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DEL_FRIEND");
- recv_data >> FriendGUID;
+ recvData >> FriendGUID;
_player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), false);
@@ -621,19 +626,19 @@ void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
-void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data)
+void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_IGNORE");
std::string ignoreName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN);
- recv_data >> ignoreName;
+ recvData >> ignoreName;
if (!normalizePlayerName(ignoreName))
return;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'",
- GetPlayer()->GetName(), ignoreName.c_str());
+ GetPlayer()->GetName().c_str(), ignoreName.c_str());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME);
@@ -679,13 +684,13 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)");
}
-void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data)
+void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData)
{
uint64 IgnoreGUID;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DEL_IGNORE");
- recv_data >> IgnoreGUID;
+ recvData >> IgnoreGUID;
_player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), true);
@@ -694,23 +699,23 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
}
-void WorldSession::HandleSetContactNotesOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_CONTACT_NOTES");
uint64 guid;
std::string note;
- recv_data >> guid >> note;
+ recvData >> guid >> note;
_player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
}
-void WorldSession::HandleBugOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBugOpcode(WorldPacket& recvData)
{
uint32 suggestion, contentlen, typelen;
std::string content, type;
- recv_data >> suggestion >> contentlen >> content;
+ recvData >> suggestion >> contentlen >> content;
- recv_data >> typelen >> type;
+ recvData >> typelen >> type;
if (suggestion == 0)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUG [Bug Report]");
@@ -728,12 +733,12 @@ void WorldSession::HandleBugOpcode(WorldPacket & recv_data)
CharacterDatabase.Execute(stmt);
}
-void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
+void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
if (GetPlayer()->isAlive())
return;
@@ -765,14 +770,14 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
GetPlayer()->SpawnCorpseBones();
}
-void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
+void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE");
uint64 guid;
uint8 status;
- recv_data >> guid;
- recv_data >> status;
+ recvData >> guid;
+ recvData >> status;
if (GetPlayer()->isAlive())
return;
@@ -806,10 +811,10 @@ void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
SendPacket(&data);
}
-void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
+void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
{
uint32 triggerId;
- recv_data >> triggerId;
+ recvData >> triggerId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_AREATRIGGER. Trigger ID: %u", triggerId);
@@ -817,7 +822,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (player->isInFlight())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",
- player->GetName(), player->GetGUIDLow(), triggerId);
+ player->GetName().c_str(), player->GetGUIDLow(), triggerId);
return;
}
@@ -825,14 +830,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (!atEntry)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",
- player->GetName(), player->GetGUIDLow(), triggerId);
+ player->GetName().c_str(), player->GetGUIDLow(), triggerId);
return;
}
if (player->GetMapId() != atEntry->mapid)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
- player->GetName(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId);
+ player->GetName().c_str(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId);
return;
}
@@ -846,7 +851,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
if (dist > atEntry->radius + delta)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
- player->GetName(), player->GetGUIDLow(), atEntry->radius, dist, triggerId);
+ player->GetName().c_str(), player->GetGUIDLow(), atEntry->radius, dist, triggerId);
return;
}
}
@@ -859,8 +864,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
// 2PI = 360°, keep in mind that ingame orientation is counter-clockwise
double rotation = 2 * M_PI - atEntry->box_orientation;
- double sinVal = sin(rotation);
- double cosVal = cos(rotation);
+ double sinVal = std::sin(rotation);
+ double cosVal = std::cos(rotation);
float playerBoxDistX = player->GetPositionX() - atEntry->x;
float playerBoxDistY = player->GetPositionY() - atEntry->y;
@@ -877,13 +882,13 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
(fabs(dz) > atEntry->box_z / 2 + delta))
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u",
- player->GetName(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId);
+ player->GetName().c_str(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId);
return;
}
}
if (player->isDebugAreaTriggers)
- ChatHandler(player).PSendSysMessage(LANG_DEBUG_AREATRIGGER_REACHED, triggerId);
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_DEBUG_AREATRIGGER_REACHED, triggerId);
if (sScriptMgr->OnAreaTrigger(player, atEntry))
return;
@@ -936,12 +941,12 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT);
}
-void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
+void WorldSession::HandleUpdateAccountData(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
uint32 type, timestamp, decompressedSize;
- recv_data >> type >> timestamp >> decompressedSize;
+ recvData >> type >> timestamp >> decompressedSize;
sLog->outDebug(LOG_FILTER_NETWORKIO, "UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize);
@@ -962,8 +967,8 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
if (decompressedSize > 0xFFFF)
{
- recv_data.rfinish(); // unnneded warning spam in this case
- sLog->outError("UAD: Account data packet too big, size %u", decompressedSize);
+ recvData.rfinish(); // unnneded warning spam in this case
+ sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Account data packet too big, size %u", decompressedSize);
return;
}
@@ -971,14 +976,14 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
dest.resize(decompressedSize);
uLongf realSize = decompressedSize;
- if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK)
+ if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recvData.contents() + recvData.rpos()), recvData.size() - recvData.rpos()) != Z_OK)
{
- recv_data.rfinish(); // unnneded warning spam in this case
- sLog->outError("UAD: Failed to decompress account data");
+ recvData.rfinish(); // unnneded warning spam in this case
+ sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data");
return;
}
- recv_data.rfinish(); // uncompress read (recv_data.size() - recv_data.rpos())
+ recvData.rfinish(); // uncompress read (recvData.size() - recvData.rpos())
std::string adata;
dest >> adata;
@@ -991,12 +996,12 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
SendPacket(&data);
}
-void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
+void WorldSession::HandleRequestAccountData(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");
uint32 type;
- recv_data >> type;
+ recvData >> type;
sLog->outDebug(LOG_FILTER_NETWORKIO, "RAD: type %u", type);
@@ -1029,70 +1034,42 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
+void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recvData)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_ACTION_BUTTON");
uint8 button;
uint32 packetData;
- recv_data >> button >> packetData;
+ recvData >> button >> packetData;
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_ACTION_BUTTON Button: %u Data: %u", button, packetData);
- uint32 action = ACTION_BUTTON_ACTION(packetData);
- uint8 type = ACTION_BUTTON_TYPE(packetData);
-
- sLog->outDetail("BUTTON: %u ACTION: %u TYPE: %u", button, action, type);
if (!packetData)
- {
- sLog->outDetail("MISC: Remove action from button %u", button);
GetPlayer()->removeActionButton(button);
- }
else
- {
- switch (type)
- {
- case ACTION_BUTTON_MACRO:
- case ACTION_BUTTON_CMACRO:
- sLog->outDetail("MISC: Added Macro %u into button %u", action, button);
- break;
- case ACTION_BUTTON_EQSET:
- sLog->outDetail("MISC: Added EquipmentSet %u into button %u", action, button);
- break;
- case ACTION_BUTTON_SPELL:
- sLog->outDetail("MISC: Added Spell %u into button %u", action, button);
- break;
- case ACTION_BUTTON_ITEM:
- sLog->outDetail("MISC: Added Item %u into button %u", action, button);
- break;
- default:
- sLog->outError("MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow());
- return;
- }
- GetPlayer()->addActionButton(button, action, type);
- }
+ GetPlayer()->addActionButton(button, ACTION_BUTTON_ACTION(packetData), ACTION_BUTTON_TYPE(packetData));
}
-void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/)
+void WorldSession::HandleCompleteCinematic(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC");
}
-void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/)
+void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA");
}
-void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data)
+void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
{
/* WorldSession::Update(getMSTime());*/
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_TIME_SKIPPED");
uint64 guid;
- recv_data.readPackGUID(guid);
- recv_data.read_skip<uint32>();
+ recvData.readPackGUID(guid);
+ recvData.read_skip<uint32>();
/*
uint64 guid;
uint32 time_skipped;
- recv_data >> guid;
- recv_data >> time_skipped;
+ recvData >> guid;
+ recvData >> time_skipped;
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_MOVE_TIME_SKIPPED");
/// TODO
@@ -1103,84 +1080,84 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data)
*/
}
-void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data)
+void WorldSession::HandleFeatherFallAck(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
// no used
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
}
-void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
+void WorldSession::HandleMoveUnRootAck(WorldPacket& recvData)
{
// no used
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
/*
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// now can skip not our packet
if (_player->GetGUID() != guid)
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK");
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
movementInfo.guid = guid;
- ReadMovementInfo(recv_data, &movementInfo);
- recv_data.read_skip<float>(); // unk2
+ ReadMovementInfo(recvData, &movementInfo);
+ recvData.read_skip<float>(); // unk2
*/
}
-void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
+void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
{
// no used
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
/*
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// now can skip not our packet
if (_player->GetGUID() != guid)
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_ROOT_ACK");
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
*/
}
-void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
+void WorldSession::HandleSetActionBarToggles(WorldPacket& recvData)
{
- uint8 ActionBar;
+ uint8 actionBar;
- recv_data >> ActionBar;
+ recvData >> actionBar;
if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED)
{
- if (ActionBar != 0)
- sLog->outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar));
+ if (actionBar != 0)
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(actionBar));
return;
}
- GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, ActionBar);
+ GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, actionBar);
}
-void WorldSession::HandlePlayedTime(WorldPacket& recv_data)
+void WorldSession::HandlePlayedTime(WorldPacket& recvData)
{
uint8 unk1;
- recv_data >> unk1; // 0 or 1 expected
+ recvData >> unk1; // 0 or 1 expected
WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1);
data << uint32(_player->GetTotalPlayedTime());
@@ -1189,10 +1166,10 @@ void WorldSession::HandlePlayedTime(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
+void WorldSession::HandleInspectOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT");
@@ -1211,9 +1188,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
data.append(player->GetPackGUID());
if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster())
- {
player->BuildPlayerTalentsInfoData(&data);
- }
else
{
data << uint32(0); // unspentTalentPoints
@@ -1225,10 +1200,10 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
+void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
Player* player = ObjectAccessor::FindPlayer(guid);
@@ -1248,7 +1223,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
+void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData)
{
uint32 time;
uint32 mapid;
@@ -1257,22 +1232,24 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
float PositionZ;
float Orientation;
- recv_data >> time; // time in m.sec.
- recv_data >> mapid;
- recv_data >> PositionX;
- recv_data >> PositionY;
- recv_data >> PositionZ;
- recv_data >> Orientation; // o (3.141593 = 180 degrees)
+ recvData >> time; // time in m.sec.
+ recvData >> mapid;
+ recvData >> PositionX;
+ recvData >> PositionY;
+ recvData >> PositionZ;
+ recvData >> Orientation; // o (3.141593 = 180 degrees)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_WORLD_TELEPORT");
if (GetPlayer()->isInFlight())
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.",
+ GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
return;
}
- sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName(), time, mapid, PositionX, PositionY, PositionZ, Orientation);
+ 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()))
GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation);
@@ -1280,11 +1257,11 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
}
-void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
+void WorldSession::HandleWhoisOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WHOIS");
std::string charname;
- recv_data >> charname;
+ recvData >> charname;
if (!AccountMgr::IsAdminAccount(GetSecurity()))
{
@@ -1298,7 +1275,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
return;
}
- Player* player = sObjectAccessor->FindPlayerByName(charname.c_str());
+ Player* player = sObjectAccessor->FindPlayerByName(charname);
if (!player)
{
@@ -1337,10 +1314,11 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
data << msg;
SendPacket(&data);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s",
+ GetPlayer()->GetName().c_str(), charname.c_str());
}
-void WorldSession::HandleComplainOpcode(WorldPacket & recv_data)
+void WorldSession::HandleComplainOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN");
@@ -1351,21 +1329,21 @@ void WorldSession::HandleComplainOpcode(WorldPacket & recv_data)
uint32 unk3 = 0;
uint32 unk4 = 0;
std::string description = "";
- recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
- recv_data >> spammer_guid; // player guid
+ recvData >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
+ recvData >> spammer_guid; // player guid
switch (spam_type)
{
case 0:
- recv_data >> unk1; // const 0
- recv_data >> unk2; // probably mail id
- recv_data >> unk3; // const 0
+ recvData >> unk1; // const 0
+ recvData >> unk2; // probably mail id
+ recvData >> unk3; // const 0
break;
case 1:
- recv_data >> unk1; // probably language
- recv_data >> unk2; // message type?
- recv_data >> unk3; // probably channel id
- recv_data >> unk4; // unk random value
- recv_data >> description; // spam description string (messagetype, channel name, player name, message)
+ recvData >> unk1; // probably language
+ recvData >> unk2; // message type?
+ recvData >> unk3; // probably channel id
+ recvData >> unk4; // unk random value
+ recvData >> description; // spam description string (messagetype, channel name, player name, message)
break;
}
@@ -1380,13 +1358,13 @@ void WorldSession::HandleComplainOpcode(WorldPacket & recv_data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str());
}
-void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data)
+void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_REALM_SPLIT");
uint32 unk;
std::string split_date = "01/01/01";
- recv_data >> unk;
+ recvData >> unk;
WorldPacket data(SMSG_REALM_SPLIT, 4+4+split_date.size()+1);
data << unk;
@@ -1400,40 +1378,36 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data)
//sLog->outDebug("response sent %u", unk);
}
-void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data)
+void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_FAR_SIGHT");
- uint8 apply;
- recv_data >> apply;
+ bool apply;
+ recvData >> apply;
- switch (apply)
+ if (apply)
{
- case 0:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Player %u set vision to self", _player->GetGUIDLow());
- _player->SetSeer(_player);
- break;
- case 1:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
- if (WorldObject* target = _player->GetViewpoint())
- _player->SetSeer(target);
- else
- sLog->outError("Player %s requests non-existing seer " UI64FMTD, _player->GetName(), _player->GetUInt64Value(PLAYER_FARSIGHT));
- break;
- default:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Unhandled mode in CMSG_FAR_SIGHT: %u", apply);
- return;
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
+ if (WorldObject* target = _player->GetViewpoint())
+ _player->SetSeer(target);
+ else
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT));
+ }
+ else
+ {
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player %u set vision to self", _player->GetGUIDLow());
+ _player->SetSeer(_player);
}
GetPlayer()->UpdateVisibilityForPlayer();
}
-void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetTitleOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_TITLE");
int32 title;
- recv_data >> title;
+ recvData >> title;
// -1 at none
if (title > 0 && title < MAX_TITLE_INDEX)
@@ -1447,15 +1421,15 @@ void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data)
GetPlayer()->SetUInt32Value(PLAYER_CHOSEN_TITLE, title);
}
-void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data)
+void WorldSession::HandleTimeSyncResp(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_TIME_SYNC_RESP");
uint32 counter, clientTicks;
- recv_data >> counter >> clientTicks;
+ recvData >> counter >> clientTicks;
if (counter != _player->m_timeSyncCounter - 1)
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Wrong time sync counter from player %s (cheater?)", _player->GetName());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Wrong time sync counter from player %s (cheater?)", _player->GetName().c_str());
sLog->outDebug(LOG_FILTER_NETWORKIO, "Time sync received: counter %u, client ticks %u, time since last sync %u", counter, clientTicks, clientTicks - _player->m_timeSyncClient);
@@ -1467,7 +1441,7 @@ void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data)
_player->m_timeSyncClient = clientTicks;
}
-void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES");
@@ -1480,16 +1454,16 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/)
_player->ResetInstances(INSTANCE_RESET_ALL, false);
}
-void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_DUNGEON_DIFFICULTY");
uint32 mode;
- recv_data >> mode;
+ recvData >> mode;
if (mode >= MAX_DUNGEON_DIFFICULTY)
{
- sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
@@ -1500,7 +1474,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
- sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", _player->GetName(), _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!",
+ _player->GetName().c_str(), _player->GetGUIDLow());
return;
}
@@ -1520,7 +1495,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
if (groupGuy->GetMap()->IsNonRaidDungeon())
{
- sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName(), groupGuy->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!",
+ _player->GetGUIDLow(), groupGuy->GetName().c_str(), groupGuy->GetGUIDLow());
return;
}
}
@@ -1537,16 +1513,16 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_RAID_DIFFICULTY");
uint32 mode;
- recv_data >> mode;
+ recvData >> mode;
if (mode >= MAX_RAID_DIFFICULTY)
{
- sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode);
return;
}
@@ -1554,7 +1530,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
Map* map = _player->FindMap();
if (map && map->IsDungeon())
{
- sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
@@ -1577,7 +1553,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
if (groupGuy->GetMap()->IsRaid())
{
- sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
}
}
@@ -1594,7 +1570,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_MOUNT_AURA");
@@ -1615,54 +1591,55 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/)
_player->RemoveAurasByType(SPELL_AURA_MOUNTED);
}
-void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data)
+void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData)
{
// fly mode on/off
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
uint64 guid; // guid - unused
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
movementInfo.guid = guid;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
- recv_data.read_skip<float>(); // unk2
+ recvData.read_skip<float>(); // unk2
_player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags();
}
-void WorldSession::HandleRequestPetInfoOpcode(WorldPacket & /*recv_data */)
+void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recvData */)
{
/*
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_REQUEST_PET_INFO");
- recv_data.hexlike();
+ recvData.hexlike();
*/
}
-void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData)
{
uint8 mode;
- recv_data >> mode;
+ recvData >> mode;
sLog->outDebug(LOG_FILTER_NETWORKIO, "Client used \"/timetest %d\" command", mode);
}
-void WorldSession::HandleQueryInspectAchievements(WorldPacket & recv_data)
+void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData)
{
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid);
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
return;
- player->GetAchievementMgr().SendRespondInspectAchievements(_player);
+ player->SendRespondInspectAchievements(_player);
}
-void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/)
+void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recvData*/)
{
// empty opcode
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE");
@@ -1672,7 +1649,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/)
SendPacket(&data);
}
-void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recv_data*/)
+void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recvData*/)
{
// empty opcode
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES");
@@ -1686,12 +1663,64 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
data << uint32(PhaseShift);
SendPacket(&data);
}
+// Battlefield and Battleground
+void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
+
+ Battleground* bg = _player->GetBattleground();
+
+ uint64 guid;
+ recvData >> guid;
+
+ Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ if (!unit)
+ return;
+
+ if (!unit->isSpiritService()) // it's not spirit service
+ return;
+
+ if (bg)
+ sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->SendAreaSpiritHealerQueryOpcode(_player,guid);
+}
-void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/)
+void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData)
+{
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
+
+ Battleground* bg = _player->GetBattleground();
+
+ uint64 guid;
+ recvData >> guid;
+
+ Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ if (!unit)
+ return;
+
+ if (!unit->isSpiritService()) // it's not spirit service
+ return;
+
+ if (bg)
+ bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+}
+
+void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recvData*/)
{
if (_player->isInFlight())
return;
+ if (/*Battlefield* bf = */sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ {
+ // bf->PlayerAskToLeave(_player); FIXME
+ return;
+ }
+
AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2))
return;
@@ -1708,7 +1737,8 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket)
if (!_player->HasPendingBind())
{
- sLog->outDetail("InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName(), _player->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!",
+ _player->GetName().c_str(), _player->GetGUIDLow());
return;
}
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index ff9030f04d5..8c5594abab0 100755..100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -31,7 +31,7 @@
#include "InstanceSaveMgr.h"
#include "ObjectMgr.h"
-void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: got MSG_MOVE_WORLDPORT_ACK.");
HandleMoveWorldportAckOpcode();
@@ -46,7 +46,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SetSemaphoreTeleportFar(false);
// get the teleport destination
- WorldLocation const loc = GetPlayer()->GetTeleportDest();
+ WorldLocation const& loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if (!MapManager::IsValidMapCoord(loc))
@@ -66,7 +66,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
Map* oldMap = GetPlayer()->GetMap();
if (GetPlayer()->IsInWorld())
{
- sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
@@ -76,7 +76,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// while the player is in transit, for example the map may get full
if (!newMap || !newMap->CanEnter(GetPlayer()))
{
- sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
@@ -89,7 +89,8 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
{
- sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!",
+ GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(oldMap);
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
@@ -187,17 +188,17 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->ProcessDelayedOperations();
}
-void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
+void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_MOVE_TELEPORT_ACK");
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
uint32 flags, time;
- recv_data >> flags >> time;
- sLog->outStaticDebug("Guid " UI64FMTD, guid);
- sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS);
+ recvData >> flags >> time;
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Guid " UI64FMTD, guid);
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Flags %u, time %u", flags, time/IN_MILLISECONDS);
Player* plMover = _player->m_mover->ToPlayer();
@@ -238,7 +239,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
GetPlayer()->ProcessDelayedOperations();
}
-void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
+void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
uint16 opcode = recvData.GetOpcode();
@@ -406,9 +407,9 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
}
}
-void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
+void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
{
- uint32 opcode = recv_data.GetOpcode();
+ uint32 opcode = recvData.GetOpcode();
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
/* extract packet */
@@ -416,24 +417,24 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
uint32 unk1;
float newspeed;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
// now can skip not our packet
if (_player->GetGUID() != guid)
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
// continue parse packet
- recv_data >> unk1; // counter or moveEvent
+ recvData >> unk1; // counter or moveEvent
MovementInfo movementInfo;
movementInfo.guid = guid;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
- recv_data >> newspeed;
+ recvData >> newspeed;
/*----------------*/
// client ACK send one packet for mounted/run case and need skip all except last from its
@@ -455,7 +456,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break;
case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break;
default:
- sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
return;
}
@@ -472,49 +473,49 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
{
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
{
- sLog->outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
- move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), newspeed);
+ sLog->outError(LOG_FILTER_NETWORKIO, "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
+ move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed);
_player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true);
}
else // must be lesser - cheating
{
- sLog->outBasic("Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
- _player->GetName(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
+ _player->GetName().c_str(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed);
_player->GetSession()->KickPlayer();
}
}
}
-void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
+void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
if (GetPlayer()->IsInWorld())
{
if (_player->m_mover->GetGUID() != guid)
- sLog->outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
}
}
-void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
+void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
uint64 old_mover_guid;
- recv_data.readPackGUID(old_mover_guid);
+ recvData.readPackGUID(old_mover_guid);
MovementInfo mi;
- ReadMovementInfo(recv_data, &mi);
+ ReadMovementInfo(recvData, &mi);
mi.guid = old_mover_guid;
_player->m_movementInfo = mi;
}
-void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recv_data*/)
+void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/)
{
WorldPacket data(SMSG_MOUNTSPECIAL_ANIM, 8);
data << uint64(GetPlayer()->GetGUID());
@@ -522,20 +523,20 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recv_data*/)
GetPlayer()->SendMessageToSet(&data, false);
}
-void WorldSession::HandleMoveKnockBackAck(WorldPacket & recv_data)
+void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK");
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
if (_player->m_mover->GetGUID() != guid)
return;
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
_player->m_movementInfo = movementInfo;
@@ -552,45 +553,45 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket & recv_data)
_player->SendMessageToSet(&data, false);
}
-void WorldSession::HandleMoveHoverAck(WorldPacket& recv_data)
+void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_HOVER_ACK");
uint64 guid; // guid - unused
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
- recv_data.read_skip<uint32>(); // unk2
+ recvData.read_skip<uint32>(); // unk2
}
-void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
+void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_WATER_WALK_ACK");
uint64 guid; // guid - unused
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
MovementInfo movementInfo;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
- recv_data.read_skip<uint32>(); // unk2
+ recvData.read_skip<uint32>(); // unk2
}
-void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
+void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
{
if (!_player->isAlive() || _player->isInCombat())
return;
uint64 summoner_guid;
bool agree;
- recv_data >> summoner_guid;
- recv_data >> agree;
+ recvData >> summoner_guid;
+ recvData >> agree;
_player->SummonIfPossible(agree);
}
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index f0c3093aa25..a9cb7e9b806 100755..100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -31,6 +31,7 @@
#include "ObjectAccessor.h"
#include "Creature.h"
#include "Pet.h"
+#include "ReputationMgr.h"
#include "BattlegroundMgr.h"
#include "Battleground.h"
#include "ScriptMgr.h"
@@ -44,13 +45,13 @@ enum StableResultCode
STABLE_SUCCESS_STABLE = 0x08, // stable success
STABLE_SUCCESS_UNSTABLE = 0x09, // unstable/swap success
STABLE_SUCCESS_BUY_SLOT = 0x0A, // buy slot success
- STABLE_ERR_EXOTIC = 0x0C, // "you are unable to control exotic creatures"
+ STABLE_ERR_EXOTIC = 0x0C // "you are unable to control exotic creatures"
};
-void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER);
if (!unit)
@@ -73,13 +74,13 @@ void WorldSession::SendTabardVendorActivate(uint64 guid)
SendPacket(&data);
}
-void WorldSession::HandleBankerActivateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
{
uint64 guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BANKER_ACTIVATE");
- recv_data >> guid;
+ recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
if (!unit)
@@ -102,11 +103,11 @@ void WorldSession::SendShowBank(uint64 guid)
SendPacket(&data);
}
-void WorldSession::HandleTrainerListOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
SendTrainerList(guid);
}
@@ -234,12 +235,12 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
SendPacket(&data);
}
-void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 spellId = 0;
- recv_data >> guid >> spellId;
+ recvData >> guid >> spellId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
@@ -294,12 +295,12 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GOSSIP_HELLO");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!unit)
@@ -343,7 +344,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
unit->AI()->sGossipHello(_player);
}
-/*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
+/*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION");
@@ -352,12 +353,12 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
uint64 guid;
std::string code = "";
- recv_data >> guid >> unk >> option;
+ recvData >> guid >> unk >> option;
if (_player->PlayerTalkClass->GossipOptionCoded(option))
{
sLog->outDebug(LOG_FILTER_PACKETIO, "reading string");
- recv_data >> code;
+ recvData >> code;
sLog->outDebug(LOG_FILTER_PACKETIO, "string read: %s", code.c_str());
}
@@ -384,13 +385,13 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
}
}*/
-void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER);
if (!unit)
@@ -439,10 +440,10 @@ void WorldSession::SendSpiritResurrect()
_player->UpdateObjectVisibility();
}
-void WorldSession::HandleBinderActivateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
{
uint64 npcGUID;
- recv_data >> npcGUID;
+ recvData >> npcGUID;
if (!GetPlayer()->IsInWorld() || !GetPlayer()->isAlive())
return;
@@ -469,22 +470,6 @@ void WorldSession::SendBindPoint(Creature* npc)
uint32 bindspell = 3286;
- // update sql homebind
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND);
- stmt->setUInt16(0, _player->GetMapId());
- stmt->setUInt16(1, _player->GetAreaId());
- stmt->setFloat (2, _player->GetPositionX());
- stmt->setFloat (3, _player->GetPositionY());
- stmt->setFloat (4, _player->GetPositionZ());
- stmt->setUInt32(5, _player->GetGUIDLow());
- CharacterDatabase.Execute(stmt);
-
- _player->m_homebindMapId = _player->GetMapId();
- _player->m_homebindAreaId = _player->GetAreaId();
- _player->m_homebindX = _player->GetPositionX();
- _player->m_homebindY = _player->GetPositionY();
- _player->m_homebindZ = _player->GetPositionZ();
-
// send spell for homebinding (3286)
npc->CastSpell(_player, bindspell, true);
@@ -496,12 +481,12 @@ void WorldSession::SendBindPoint(Creature* npc)
_player->PlayerTalkClass->SendCloseGossip();
}
-void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data)
+void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS");
uint64 npcGUID;
- recv_data >> npcGUID;
+ recvData >> npcGUID;
if (!CheckStableMaster(npcGUID))
return;
@@ -589,12 +574,12 @@ void WorldSession::SendStableResult(uint8 res)
SendPacket(&data);
}
-void WorldSession::HandleStablePet(WorldPacket & recv_data)
+void WorldSession::HandleStablePet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET");
uint64 npcGUID;
- recv_data >> npcGUID;
+ recvData >> npcGUID;
if (!GetPlayer()->isAlive())
{
@@ -664,13 +649,13 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
SendStableResult(STABLE_ERR_STABLE);
}
-void WorldSession::HandleUnstablePet(WorldPacket & recv_data)
+void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET.");
uint64 npcGUID;
uint32 petnumber;
- recv_data >> npcGUID >> petnumber;
+ recvData >> npcGUID >> petnumber;
if (!CheckStableMaster(npcGUID))
{
@@ -745,12 +730,12 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
SendStableResult(STABLE_SUCCESS_UNSTABLE);
}
-void WorldSession::HandleBuyStableSlot(WorldPacket & recv_data)
+void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
uint64 npcGUID;
- recv_data >> npcGUID;
+ recvData >> npcGUID;
if (!CheckStableMaster(npcGUID))
{
@@ -778,18 +763,18 @@ void WorldSession::HandleBuyStableSlot(WorldPacket & recv_data)
SendStableResult(STABLE_ERR_STABLE);
}
-void WorldSession::HandleStableRevivePet(WorldPacket &/* recv_data */)
+void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleStableRevivePet: Not implemented");
}
-void WorldSession::HandleStableSwapPet(WorldPacket & recv_data)
+void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
uint64 npcGUID;
uint32 petId;
- recv_data >> npcGUID >> petId;
+ recvData >> npcGUID >> petId;
if (!CheckStableMaster(npcGUID))
{
@@ -875,14 +860,14 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
SendStableResult(STABLE_SUCCESS_UNSTABLE);
}
-void WorldSession::HandleRepairItemOpcode(WorldPacket & recv_data)
+void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REPAIR_ITEM");
uint64 npcGUID, itemGUID;
uint8 guildBank; // new in 2.3.2, bool that means from guild bank money
- recv_data >> npcGUID >> itemGUID >> guildBank;
+ recvData >> npcGUID >> itemGUID >> guildBank;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR);
if (!unit)
diff --git a/src/server/game/Handlers/NPCHandler.h b/src/server/game/Handlers/NPCHandler.h
index af84b71a74f..af84b71a74f 100755..100644
--- a/src/server/game/Handlers/NPCHandler.h
+++ b/src/server/game/Handlers/NPCHandler.h
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 321c0ada247..5e43462b6d0 100755..100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -31,11 +31,12 @@
#include "World.h"
#include "Group.h"
#include "SpellInfo.h"
+#include "Player.h"
-void WorldSession::HandleDismissCritter(WorldPacket &recv_data)
+void WorldSession::HandleDismissCritter(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid);
@@ -44,7 +45,7 @@ void WorldSession::HandleDismissCritter(WorldPacket &recv_data)
if (!pet)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)",
- uint32(GUID_LOPART(guid)), GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), GetAccountId());
+ uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
return;
}
@@ -55,31 +56,31 @@ void WorldSession::HandleDismissCritter(WorldPacket &recv_data)
}
}
-void WorldSession::HandlePetAction(WorldPacket & recv_data)
+void WorldSession::HandlePetAction(WorldPacket& recvData)
{
uint64 guid1;
uint32 data;
uint64 guid2;
- recv_data >> guid1; //pet guid
- recv_data >> data;
- recv_data >> guid2; //tag guid
+ recvData >> guid1; //pet guid
+ recvData >> data;
+ recvData >> guid2; //tag guid
uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
- sLog->outDetail("HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
if (!pet)
{
- sLog->outError("HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
return;
}
if (pet != GetPlayer()->GetFirstControlled())
{
- sLog->outError("HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
return;
}
@@ -110,10 +111,10 @@ void WorldSession::HandlePetAction(WorldPacket & recv_data)
}
}
-void WorldSession::HandlePetStopAttack(WorldPacket &recv_data)
+void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid);
@@ -121,13 +122,14 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recv_data)
if (!pet)
{
- sLog->outError("HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
return;
}
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
{
- sLog->outError("HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s",
+ uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
return;
}
@@ -137,12 +139,12 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recv_data)
pet->AttackStop();
}
-void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2)
+void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2)
{
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId());
return;
}
@@ -160,6 +162,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
charmInfo->SetIsCommandAttack(false);
charmInfo->SetIsAtStay(true);
+ charmInfo->SetIsCommandFollow(false);
charmInfo->SetIsFollowing(false);
charmInfo->SetIsReturning(false);
charmInfo->SaveStayPosition();
@@ -173,6 +176,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
charmInfo->SetIsCommandAttack(false);
charmInfo->SetIsAtStay(false);
charmInfo->SetIsReturning(true);
+ charmInfo->SetIsCommandFollow(true);
charmInfo->SetIsFollowing(false);
break;
case COMMAND_ATTACK: //spellid=1792 //ATTACK
@@ -213,6 +217,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsAtStay(false);
charmInfo->SetIsFollowing(false);
+ charmInfo->SetIsCommandFollow(false);
charmInfo->SetIsReturning(false);
pet->ToCreature()->AI()->AttackStart(TargetUnit);
@@ -234,6 +239,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsAtStay(false);
charmInfo->SetIsFollowing(false);
+ charmInfo->SetIsCommandFollow(false);
charmInfo->SetIsReturning(false);
pet->Attack(TargetUnit, true);
@@ -263,7 +269,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
}
break;
default:
- sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
break;
case ACT_REACTION: // 0x6
@@ -292,7 +298,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown PET spell id %i", spellid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellid);
return;
}
@@ -397,19 +403,19 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
break;
}
default:
- sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
}
-void WorldSession::HandlePetNameQuery(WorldPacket & recv_data)
+void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
{
- sLog->outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetNameQuery. CMSG_PET_NAME_QUERY");
uint32 petnumber;
uint64 petguid;
- recv_data >> petnumber;
- recv_data >> petguid;
+ recvData >> petnumber;
+ recvData >> petguid;
SendPetNameQuery(petguid, petnumber);
}
@@ -428,11 +434,9 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
return;
}
- std::string name = pet->GetName();
-
- WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1));
+ WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+pet->GetName().size()+1));
data << uint32(petnumber);
- data << name.c_str();
+ data << pet->GetName();
data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
if (pet->isPet() && ((Pet*)pet)->GetDeclinedNames())
@@ -454,7 +458,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
{
if (!GetPlayer()->isGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
{
- sLog->outStaticDebug("Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
return false;
}
}
@@ -463,38 +467,38 @@ bool WorldSession::CheckStableMaster(uint64 guid)
{
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
{
- sLog->outStaticDebug("Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
return false;
}
}
return true;
}
-void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
+void WorldSession::HandlePetSetAction(WorldPacket& recvData)
{
- sLog->outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetSetAction. CMSG_PET_SET_ACTION");
uint64 petguid;
uint8 count;
- recv_data >> petguid;
+ recvData >> petguid;
Unit* pet = ObjectAccessor::GetUnit(*_player, petguid);
if (!pet || pet != _player->GetFirstControlled())
{
- sLog->outError("HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
return;
}
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
- count = (recv_data.size() == 24) ? 2 : 1;
+ count = (recvData.size() == 24) ? 2 : 1;
uint32 position[2];
uint32 data[2];
@@ -502,8 +506,8 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
for (uint8 i = 0; i < count; ++i)
{
- recv_data >> position[i];
- recv_data >> data[i];
+ recvData >> position[i];
+ recvData >> data[i];
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]);
@@ -552,7 +556,8 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]);
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]);
- sLog->outDetail("Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X",
+ _player->GetName().c_str(), position[i], spell_id, uint32(act_state));
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
@@ -586,9 +591,9 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
}
}
-void WorldSession::HandlePetRename(WorldPacket & recv_data)
+void WorldSession::HandlePetRename(WorldPacket& recvData)
{
- sLog->outDetail("HandlePetRename. CMSG_PET_RENAME");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetRename. CMSG_PET_RENAME");
uint64 petguid;
uint8 isdeclined;
@@ -596,9 +601,9 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data)
std::string name;
DeclinedName declinedname;
- recv_data >> petguid;
- recv_data >> name;
- recv_data >> isdeclined;
+ recvData >> petguid;
+ recvData >> name;
+ recvData >> isdeclined;
Pet* pet = ObjectAccessor::FindPet(petguid);
// check it!
@@ -632,7 +637,7 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data)
{
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
- recv_data >> declinedname.name[i];
+ recvData >> declinedname.name[i];
}
std::wstring wname;
@@ -671,11 +676,11 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data)
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped
}
-void WorldSession::HandlePetAbandon(WorldPacket & recv_data)
+void WorldSession::HandlePetAbandon(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid; //pet guid
- sLog->outDetail("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
+ recvData >> guid; //pet guid
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
if (!_player->IsInWorld())
return;
@@ -701,7 +706,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recv_data)
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
{
- sLog->outDetail("CMSG_PET_SPELL_AUTOCAST");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_PET_SPELL_AUTOCAST");
uint64 guid;
uint32 spellid;
uint8 state; //1 for on, 0 for off
@@ -717,19 +722,19 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm()))
{
- sLog->outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
// do not add not learned spells/ passive spells
- if (!pet->HasSpell(spellid) || spellInfo->IsAutocastable())
+ if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable())
return;
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
- sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
return;
}
@@ -762,14 +767,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
{
- sLog->outError("HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown PET spell id %i", spellId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %i", spellId);
return;
}
@@ -855,33 +860,33 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec
SendPacket(&data);
}
-void WorldSession::HandlePetLearnTalent(WorldPacket & recv_data)
+void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_LEARN_TALENT");
uint64 guid;
- uint32 talent_id, requested_rank;
- recv_data >> guid >> talent_id >> requested_rank;
+ uint32 talentId, requestedRank;
+ recvData >> guid >> talentId >> requestedRank;
- _player->LearnPetTalent(guid, talent_id, requested_rank);
+ _player->LearnPetTalent(guid, talentId, requestedRank);
_player->SendTalentsInfoData(true);
}
-void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket & recv_data)
+void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS_PET");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
uint32 talentsCount;
- recv_data >> talentsCount;
+ recvData >> talentsCount;
uint32 talentId, talentRank;
for (uint32 i = 0; i < talentsCount; ++i)
{
- recv_data >> talentId >> talentRank;
+ recvData >> talentId >> talentRank;
_player->LearnPetTalent(guid, talentId, talentRank);
}
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index cb3bac0e443..1704229674e 100755..100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -33,12 +33,6 @@
#define CHARTER_DISPLAY_ID 16161
-/*enum PetitionType // dbc data
-{
- PETITION_TYPE_GUILD = 1,
- PETITION_TYPE_ARENA_TEAM = 3
-};*/
-
// Charters ID in item_template
enum CharterItemIDs
{
@@ -56,7 +50,7 @@ enum CharterCosts
ARENA_TEAM_CHARTER_5v5_COST = 2000000
};
-void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY");
@@ -64,28 +58,28 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client
std::string name;
- recv_data >> guidNPC; // NPC GUID
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint64>(); // 0
- recv_data >> name; // name
- recv_data.read_skip<std::string>(); // some string
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint16>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
- recv_data.read_skip<uint32>(); // 0
+ recvData >> guidNPC; // NPC GUID
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint64>(); // 0
+ recvData >> name; // name
+ recvData.read_skip<std::string>(); // some string
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint16>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
+ recvData.read_skip<uint32>(); // 0
for (int i = 0; i < 10; ++i)
- recv_data.read_skip<std::string>();
+ recvData.read_skip<std::string>();
- recv_data >> clientIndex; // index
- recv_data.read_skip<uint32>(); // 0
+ recvData >> clientIndex; // index
+ recvData.read_skip<uint32>(); // 0
sLog->outDebug(LOG_FILTER_NETWORKIO, "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
@@ -157,12 +151,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
{
if (sGuildMgr->GetGuildByName(name))
{
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, name);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NAME_EXISTS_S, name);
return;
}
+
if (sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name))
{
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_INVALID, name);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NAME_INVALID, name);
return;
}
}
@@ -250,13 +245,13 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
CharacterDatabase.CommitTransaction(trans);
}
-void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data)
+void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SHOW_SIGNATURES");
uint8 signs = 0;
uint64 petitionguid;
- recv_data >> petitionguid; // petition guid
+ recvData >> petitionguid; // petition guid
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
uint32 petitionGuidLow = GUID_LOPART(petitionguid);
@@ -269,7 +264,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data)
if (!result)
{
- sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
return;
}
Field* fields = result->Fetch();
@@ -310,14 +305,14 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data)
SendPacket(&data);
}
-void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok
uint32 guildguid;
uint64 petitionguid;
- recv_data >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid)
- recv_data >> petitionguid; // petition guid
+ recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid)
+ recvData >> petitionguid; // petition guid
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid);
SendPetitionQueryOpcode(petitionguid);
@@ -355,8 +350,9 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
data << uint8(0); // some string
if (type == GUILD_CHARTER_TYPE)
{
- data << uint32(9);
- data << uint32(9);
+ uint32 needed = sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
+ data << uint32(needed);
+ data << uint32(needed);
data << uint32(0); // bypass client - side limitation, a different value is needed here for each petition
}
else
@@ -379,15 +375,12 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
data << uint32(0); // 14
- if (type == GUILD_CHARTER_TYPE)
- data << uint32(0); // 15 0 - guild, 1 - arena team
- else
- data << uint32(1);
+ data << uint32(type != GUILD_CHARTER_TYPE); // 15 0 - guild, 1 - arena team
SendPacket(&data);
}
-void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok
@@ -395,8 +388,8 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
uint32 type;
std::string newName;
- recv_data >> petitionGuid; // guid
- recv_data >> newName; // new name
+ recvData >> petitionGuid; // guid
+ recvData >> newName; // new name
Item* item = _player->GetItemByGuid(petitionGuid);
if (!item)
@@ -423,12 +416,12 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
{
if (sGuildMgr->GetGuildByName(newName))
{
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, newName);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NAME_EXISTS_S, newName);
return;
}
if (sObjectMgr->IsReservedName(newName) || !ObjectMgr::IsValidCharterName(newName))
{
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_INVALID, newName);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NAME_INVALID, newName);
return;
}
}
@@ -460,15 +453,15 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok
Field* fields;
uint64 petitionGuid;
uint8 unk;
- recv_data >> petitionGuid; // petition guid
- recv_data >> unk;
+ recvData >> petitionGuid; // petition guid
+ recvData >> unk;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_SIGNATURES);
@@ -479,7 +472,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
if (!result)
{
- sLog->outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
return;
}
@@ -498,7 +491,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
if (type != GUILD_CHARTER_TYPE)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
else
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NOT_ALLIED);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NOT_ALLIED);
return;
}
@@ -506,7 +499,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
{
if (_player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
- SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName().c_str(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return;
}
@@ -516,13 +509,13 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
if (_player->GetArenaTeamId(slot))
{
- SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S);
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName().c_str(), ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
if (_player->GetArenaTeamIdInvited())
{
- SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName().c_str(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
}
}
@@ -530,12 +523,12 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
{
if (_player->GetGuildId())
{
- Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName());
+ Guild::SendCommandResult(this, GUILD_COMMAND_INVITE, ERR_ALREADY_IN_GUILD_S, _player->GetName());
return;
}
if (_player->GetGuildIdInvited())
{
- Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName());
+ Guild::SendCommandResult(this, GUILD_COMMAND_INVITE, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName());
return;
}
}
@@ -577,7 +570,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
CharacterDatabase.Execute(stmt);
- sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName(), playerGuid, GetAccountId());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId());
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
data << uint64(petitionGuid);
@@ -597,13 +590,13 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
owner->GetSession()->SendPacket(&data);
}
-void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok
uint64 petitionguid;
uint64 ownerguid;
- recv_data >> petitionguid; // petition guid
+ recvData >> petitionguid; // petition guid
sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PETITION_OWNER_BY_GUID);
@@ -627,7 +620,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
+void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok
@@ -635,9 +628,9 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
uint64 petitionguid, plguid;
uint32 type, junk;
Player* player;
- recv_data >> junk; // this is not petition type!
- recv_data >> petitionguid; // petition guid
- recv_data >> plguid; // player guid
+ recvData >> junk; // this is not petition type!
+ recvData >> petitionguid; // petition guid
+ recvData >> plguid; // player guid
player = ObjectAccessor::FindPlayer(plguid);
if (!player)
@@ -662,7 +655,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
if (type != GUILD_CHARTER_TYPE)
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
else
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NOT_ALLIED);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NOT_ALLIED);
return;
}
@@ -671,7 +664,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
// player is too low level to join an arena team
- SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName().c_str(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S);
return;
}
@@ -682,13 +675,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
if (player->GetArenaTeamId(slot))
{
// player is already in an arena team
- SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM_S);
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName().c_str(), "", ERR_ALREADY_IN_ARENA_TEAM_S);
return;
}
if (player->GetArenaTeamIdInvited())
{
- SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
+ SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName().c_str(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S);
return;
}
}
@@ -696,13 +689,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
{
if (player->GetGuildId())
{
- Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName());
+ Guild::SendCommandResult(this, GUILD_COMMAND_INVITE, ERR_ALREADY_IN_GUILD_S, _player->GetName());
return;
}
if (player->GetGuildIdInvited())
{
- Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName());
+ Guild::SendCommandResult(this, GUILD_COMMAND_INVITE, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName());
return;
}
}
@@ -736,7 +729,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data)
player->GetSession()->SendPacket(&data);
}
-void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION");
@@ -744,7 +737,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
WorldPacket data;
uint64 petitionGuid;
- recv_data >> petitionGuid;
+ recvData >> petitionGuid;
// Check if player really has the required petition charter
Item* item = _player->GetItemByGuid(petitionGuid);
@@ -771,7 +764,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
}
else
{
- sLog->outError("Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
return;
}
@@ -794,7 +787,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
// Check if guild name is already taken
if (sGuildMgr->GetGuildByName(name))
{
- Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_NAME_EXISTS_S, name);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_NAME_EXISTS_S, name);
return;
}
}
@@ -866,6 +859,8 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
// Register guild and add guild master
sGuildMgr->AddGuild(guild);
+ Guild::SendCommandResult(this, GUILD_COMMAND_CREATE, ERR_GUILD_COMMAND_SUCCESS, name);
+
// Add members from signatures
for (uint8 i = 0; i < signatures; ++i)
{
@@ -878,7 +873,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
{
// Receive the rest of the packet in arena team creation case
uint32 background, icon, iconcolor, border, bordercolor;
- recv_data >> background >> icon >> iconcolor >> border >> bordercolor;
+ recvData >> background >> icon >> iconcolor >> border >> bordercolor;
// Create arena team
ArenaTeam* arenaTeam = new ArenaTeam();
@@ -924,12 +919,12 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received CMSG_PETITION_SHOWLIST");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
SendPetitionShowList(guid);
}
@@ -954,7 +949,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
data << uint32(CHARTER_DISPLAY_ID); // charter display id
data << uint32(GUILD_CHARTER_COST); // charter cost
data << uint32(0); // unknown
- data << uint32(9); // required signs?
+ data << uint32(sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS)); // required signs
}
else
{
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 4fb90bed10b..e44fbd0d899 100755..100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -64,18 +64,18 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
SendPacket(&data);
}
-void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data)
+void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// This is disable by default to prevent lots of console spam
- // sLog->outString("HandleNameQueryOpcode %u", guid);
+ // sLog->outInfo(LOG_FILTER_NETWORKIO, "HandleNameQueryOpcode %u", guid);
SendNameQueryOpcode(guid);
}
-void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/)
{
SendQueryTimeResponse();
}
@@ -89,12 +89,12 @@ void WorldSession::SendQueryTimeResponse()
}
/// Only _static_ data is sent in this packet !!!
-void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
- recv_data >> entry;
+ recvData >> entry;
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
if (ci)
@@ -152,12 +152,12 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data)
}
/// Only _static_ data is sent in this packet !!!
-void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
{
uint32 entry;
- recv_data >> entry;
+ recvData >> entry;
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry);
if (info)
@@ -207,7 +207,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY");
@@ -258,15 +258,15 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
SendPacket(&data);
}
-void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
{
uint32 textID;
uint64 guid;
- recv_data >> textID;
+ recvData >> textID;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID);
- recv_data >> guid;
+ recvData >> guid;
GetPlayer()->SetSelection(guid);
GossipText const* pGossip = sObjectMgr->GetGossipText(textID);
@@ -342,13 +342,13 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data)
}
/// Only _static_ data is sent in this packet !!!
-void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY");
uint32 pageID;
- recv_data >> pageID;
- recv_data.read_skip<uint64>(); // guid
+ recvData >> pageID;
+ recvData.read_skip<uint64>(); // guid
while (pageID)
{
@@ -382,12 +382,12 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleCorpseMapPositionQuery(WorldPacket & recv_data)
+void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY");
uint32 unk;
- recv_data >> unk;
+ recvData >> unk;
WorldPacket data(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4);
data << float(0);
@@ -397,14 +397,14 @@ void WorldSession::HandleCorpseMapPositionQuery(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
+void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData)
{
uint32 count;
- recv_data >> count; // quest count, max=25
+ recvData >> count; // quest count, max=25
if (count >= MAX_QUEST_LOG_SIZE)
{
- recv_data.rfinish();
+ recvData.rfinish();
return;
}
@@ -414,7 +414,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data)
for (uint32 i = 0; i < count; ++i)
{
uint32 questId;
- recv_data >> questId; // quest id
+ recvData >> questId; // quest id
bool questOk = false;
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index d13c2fb0956..8b230ae05c9 100755..100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -33,17 +33,17 @@
#include "ScriptMgr.h"
#include "GameObjectAI.h"
-void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
uint8 questStatus = DIALOG_STATUS_NONE;
uint8 defstatus = DIALOG_STATUS_NONE;
Object* questgiver = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!questgiver)
{
- sLog->outDetail("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for non-existing questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
return;
}
@@ -71,7 +71,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
break;
}
default:
- sLog->outError("QuestGiver called for unexpected type %u", questgiver->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "QuestGiver called for unexpected type %u", questgiver->GetTypeId());
break;
}
@@ -79,10 +79,10 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recv_data)
_player->PlayerTalkClass->SendQuestGiverStatus(questStatus, guid);
}
-void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
@@ -109,12 +109,12 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
creature->AI()->sGossipHello(_player);
}
-void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 questId;
uint32 unk1;
- recv_data >> guid >> questId >> unk1;
+ recvData >> guid >> questId >> unk1;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
@@ -122,7 +122,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
// no or incorrect quest giver
if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
- (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
+ (object->GetTypeId() == TYPEID_PLAYER && object != _player && !object->ToPlayer()->CanShareQuest(questId)))
{
_player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
@@ -230,12 +230,12 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
_player->PlayerTalkClass->SendCloseGossip();
}
-void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
{
uint64 guid;
uint32 questId;
uint8 unk1;
- recv_data >> guid >> questId >> unk1;
+ recvData >> guid >> questId >> unk1;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
// Verify that the guid is valid and is a questgiver or involved in the requested quest
@@ -268,28 +268,28 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleQuestQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
{
if (!_player)
return;
uint32 questId;
- recv_data >> questId;
+ recvData >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId);
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
_player->PlayerTalkClass->SendQuestQueryResponse(quest);
}
-void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
{
uint32 questId, reward;
uint64 guid;
- recv_data >> guid >> questId >> reward;
+ recvData >> guid >> questId >> reward;
if (reward >= QUEST_REWARD_CHOICES_COUNT)
{
- sLog->outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName(), _player->GetGUIDLow(), reward);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (possible packet-hacking detected)", _player->GetName().c_str(), _player->GetGUIDLow(), reward);
return;
}
@@ -308,8 +308,8 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) ||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
{
- sLog->outError("HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
- _player->GetName(), _player->GetGUIDLow(), questId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Error in QUEST_STATUS_COMPLETE: player %s (guid %u) tried to complete quest %u, but is not allowed to do so (possible packet-hacking or high latency)",
+ _player->GetName().c_str(), _player->GetGUIDLow(), questId);
return;
}
if (_player->CanRewardQuest(quest, reward, true))
@@ -365,11 +365,11 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
}
}
-void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data)
+void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
{
uint32 questId;
uint64 guid;
- recv_data >> guid >> questId;
+ recvData >> guid >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
@@ -391,17 +391,17 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data)
_player->PlayerTalkClass->SendQuestGiverOfferReward(quest, guid, true);
}
-void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recv_data*/)
+void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CANCEL");
_player->PlayerTalkClass->SendCloseGossip();
}
-void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data)
+void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recvData)
{
uint8 slot1, slot2;
- recv_data >> slot1 >> slot2;
+ recvData >> slot1 >> slot2;
if (slot1 == slot2 || slot1 >= MAX_QUEST_LOG_SIZE || slot2 >= MAX_QUEST_LOG_SIZE)
return;
@@ -411,10 +411,10 @@ void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recv_data)
GetPlayer()->SwapQuestSlot(slot1, slot2);
}
-void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
+void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
{
uint8 slot;
- recv_data >> slot;
+ recvData >> slot;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot);
@@ -433,21 +433,21 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recv_data)
_player->TakeQuestSourceItem(questId, true); // remove quest src item from player
_player->RemoveActiveQuest(questId);
- _player->GetAchievementMgr().RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
+ _player->RemoveTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, questId);
- sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
}
_player->SetQuestSlot(slot, 0);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED, 1);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED, 1);
}
}
-void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
+void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
{
uint32 questId;
- recv_data >> questId;
+ recvData >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId);
@@ -479,12 +479,12 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data)
}
}
-void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
+void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
{
uint32 questId;
uint64 guid;
- recv_data >> guid >> questId;
+ recvData >> guid >> questId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
@@ -500,8 +500,8 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
{
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
{
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
- _player->GetName(), _player->GetGUIDLow(), questId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
+ _player->GetName().c_str(), _player->GetGUIDLow(), questId);
return;
}
// TODO: need a virtual function
@@ -582,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
- player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true);
+ player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true);
player->SetDivider(_player->GetGUID());
}
}
@@ -634,7 +634,7 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32
}
default:
//its imposible, but check ^)
- sLog->outError("Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Warning: GetDialogStatus called for unexpected type %u", questgiver->GetTypeId());
return DIALOG_STATUS_NONE;
}
@@ -760,7 +760,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
SendPacket(&data);
}
-void WorldSession::HandleQueryQuestsCompleted(WorldPacket & /*recv_data*/)
+void WorldSession::HandleQueryQuestsCompleted(WorldPacket & /*recvData*/)
{
size_t rew_count = _player->GetRewardedQuestCount();
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index 58d425ddf98..7822c38d390 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -21,12 +21,12 @@
#include "Opcodes.h"
#include "Log.h"
-void WorldSession::HandleGrantLevel(WorldPacket& recv_data)
+void WorldSession::HandleGrantLevel(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GRANT_LEVEL");
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
Player* target = ObjectAccessor::GetObjectInWorld(guid, _player);
@@ -63,12 +63,12 @@ void WorldSession::HandleGrantLevel(WorldPacket& recv_data)
target->GetSession()->SendPacket(&data2);
}
-void WorldSession::HandleAcceptGrantLevel(WorldPacket& recv_data)
+void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ACCEPT_LEVEL_GRANT");
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
Player* other = ObjectAccessor::GetObjectInWorld(guid, _player);
if (!(other && other->GetSession()))
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index f9731ba85db..f5f48b2a45b 100755..100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -18,18 +18,19 @@
#include "Common.h"
#include "DatabaseEnv.h"
-#include "Opcodes.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Opcodes.h"
#include "Player.h"
+#include "Pet.h"
+#include "UpdateMask.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "ObjectAccessor.h"
-#include "UpdateMask.h"
-void WorldSession::HandleLearnTalentOpcode(WorldPacket & recv_data)
+void WorldSession::HandleLearnTalentOpcode(WorldPacket& recvData)
{
uint32 talent_id, requested_rank;
- recv_data >> talent_id >> requested_rank;
+ recvData >> talent_id >> requested_rank;
_player->LearnTalent(talent_id, requested_rank);
_player->SendTalentsInfoData(false);
@@ -54,11 +55,11 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
_player->SendTalentsInfoData(false);
}
-void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_TALENT_WIPE_CONFIRM");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
@@ -84,9 +85,13 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recv_data)
unit->CastSpell(_player, 14867, true); //spell: "Untalent Visual Effect"
}
-void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data)
+void WorldSession::HandleUnlearnSkillOpcode(WorldPacket& recvData)
{
- uint32 skill_id;
- recv_data >> skill_id;
- GetPlayer()->SetSkill(skill_id, 0, 0, 0);
+ uint32 skillId;
+ recvData >> skillId;
+
+ if (!IsPrimaryProfessionSkill(skillId))
+ return;
+
+ GetPlayer()->SetSkill(skillId, 0, 0, 0);
}
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index c02bb43a353..7002a55e2d1 100755..100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -32,6 +32,7 @@
#include "ScriptMgr.h"
#include "GameObjectAI.h"
#include "SpellAuraEffects.h"
+#include "Player.h"
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
{
@@ -50,15 +51,8 @@ void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlag
recvPacket >> hasMovementData;
if (hasMovementData)
{
- recvPacket.rfinish();
- // movement packet for caster of the spell
- /*recvPacket.read_skip<uint32>(); // MSG_MOVE_STOP - hardcoded in client
- uint64 guid;
- recvPacket.readPackGUID(guid);
-
- MovementInfo movementInfo;
- movementInfo.guid = guid;
- ReadMovementInfo(recvPacket, &movementInfo);*/
+ recvPacket.SetOpcode(recvPacket.read<uint32>());
+ HandleMovementOpcodes(recvPacket);
}
}
}
@@ -187,7 +181,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
recvPacket >> bagIndex >> slot;
- sLog->outDetail("bagIndex: %u, slot: %u", bagIndex, slot);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "bagIndex: %u, slot: %u", bagIndex, slot);
Item* item = pUser->GetItemByPos(bagIndex, slot);
if (!item)
@@ -207,8 +201,8 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
if (!(proto->Flags & ITEM_PROTO_FLAG_OPENABLE) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
{
pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL);
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
- pUser->GetName(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
+ pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId);
return;
}
@@ -221,7 +215,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
if (!lockInfo)
{
pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, NULL);
- sLog->outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId);
return;
}
@@ -254,7 +248,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
}
else
{
- sLog->outError("Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow());
pUser->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
return;
}
@@ -269,11 +263,11 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
pUser->SendLoot(item->GetGUID(), LOOT_CORPSE);
}
-void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid));
@@ -303,9 +297,10 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket)
if (!go->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
- go->AI()->GossipHello(_player);
+ if (go->AI()->GossipHello(_player))
+ return;
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, go->GetEntry());
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, go->GetEntry());
}
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
@@ -328,7 +323,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if (!spellInfo)
{
- sLog->outError("WORLD: unknown spell id %u", spellId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown spell id %u", spellId);
recvPacket.rfinish(); // prevent spam at ignore packet
return;
}
@@ -444,7 +439,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
- sLog->outError("WORLD: unknown PET spell id %u", spellId);
+ sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: unknown PET spell id %u", spellId);
return;
}
@@ -452,13 +447,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
if (!pet)
{
- sLog->outError("HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
return;
}
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm())
{
- sLog->outError("HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
return;
}
@@ -484,9 +479,9 @@ void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/
_player->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
}
-void WorldSession::HandleCancelChanneling(WorldPacket & recv_data)
+void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
{
- recv_data.read_skip<uint32>(); // spellid, not used
+ recvData.read_skip<uint32>(); // spellid, not used
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
@@ -514,12 +509,12 @@ void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
return;
Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_SummonSlot[slotId]);
- // Don't unsummon sentry totem
- if (totem && totem->isTotem() && totem->GetEntry() != SENTRY_TOTEM_ENTRY)
+
+ if (totem && totem->isTotem())
totem->ToTotem()->UnSummon();
}
-void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SELF_RES"); // empty opcode
@@ -536,10 +531,10 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/)
}
}
-void WorldSession::HandleSpellClick(WorldPacket& recv_data)
+void WorldSession::HandleSpellClick(WorldPacket& recvData)
{
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// this will get something not in world. crash
Creature* unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
@@ -554,11 +549,11 @@ void WorldSession::HandleSpellClick(WorldPacket& recv_data)
unit->HandleSpellClick(_player);
}
-void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recv_data)
+void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GET_MIRRORIMAGE_DATA");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// Get unit for which data is needed by client
Unit* unit = ObjectAccessor::GetObjectInWorld(guid, (Unit*)NULL);
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index b774fbcba70..1df98af315d 100755..100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -28,13 +28,13 @@
#include "Path.h"
#include "WaypointMovementGenerator.h"
-void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket & recv_data)
+void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
SendTaxiStatus(guid);
}
@@ -63,12 +63,12 @@ void WorldSession::SendTaxiStatus(uint64 guid)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_TAXINODE_STATUS");
}
-void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket & recv_data)
+void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
uint64 guid;
- recv_data >> guid;
+ recvData >> guid;
// cheating checks
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
@@ -163,14 +163,14 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
}
}
-void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recv_data)
+void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
uint64 guid;
uint32 node_count;
- recv_data >> guid >> node_count;
+ recvData >> guid >> node_count;
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
@@ -183,7 +183,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recv_data)
for (uint32 i = 0; i < node_count; ++i)
{
uint32 node;
- recv_data >> node;
+ recvData >> node;
nodes.push_back(node);
}
@@ -195,17 +195,17 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recv_data)
GetPlayer()->ActivateTaxiPathTo(nodes, npc);
}
-void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
+void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_SPLINE_DONE");
uint64 guid; // used only for proper packet read
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
MovementInfo movementInfo; // used only for proper packet read
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
- recv_data.read_skip<uint32>(); // unk
+ recvData.read_skip<uint32>(); // unk
// in taxi flight packet received in 2 case:
// 1) end taxi path in far (multi-node) flight
@@ -273,7 +273,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recv_data)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
-void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recv_data)
+void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI");
@@ -281,7 +281,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recv_data)
std::vector<uint32> nodes;
nodes.resize(2);
- recv_data >> guid >> nodes[0] >> nodes[1];
+ recvData >> guid >> nodes[0] >> nodes[1];
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]);
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
if (!npc)
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index d6675188f6e..a632f956470 100755..100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -16,17 +16,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Language.h"
-#include "WorldPacket.h"
+#include "zlib.h"
#include "Common.h"
+#include "Language.h"
#include "ObjectMgr.h"
-#include "TicketMgr.h"
+#include "Opcodes.h"
#include "Player.h"
+#include "TicketMgr.h"
+#include "Util.h"
#include "World.h"
+#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Util.h"
-void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
{
// Don't accept tickets if the ticket queue is disabled. (Ticket UI is greyed out but not fully dependable)
if (sTicketMgr->GetStatus() == GMTICKET_QUEUE_STATUS_DISABLED)
@@ -42,11 +44,50 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
// Player must not have ticket
if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
- GmTicket* ticket = new GmTicket(GetPlayer(), recv_data);
+ GmTicket* ticket = new GmTicket(GetPlayer(), recvData);
+
+ uint32 count;
+ std::list<uint32> times;
+ uint32 decompressedSize;
+ std::string chatLog;
+
+ recvData >> count;
+
+ for (uint32 i = 0; i < count; i++)
+ {
+ uint32 time;
+ recvData >> time;
+ times.push_back(time);
+ }
+
+ recvData >> decompressedSize;
+
+ if (count && decompressedSize && decompressedSize < 0xFFFF)
+ {
+ uint32 pos = recvData.rpos();
+ ByteBuffer dest;
+ 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)
+ {
+ dest >> chatLog;
+ ticket->SetChatLog(times, chatLog);
+ }
+ else
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed.");
+ recvData.rfinish();
+ return;
+ }
+
+ recvData.rfinish(); // Will still have compressed data in buffer.
+ }
+
sTicketMgr->AddTicket(ticket);
sTicketMgr->UpdateLastChange();
- sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId());
+ sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName().c_str(), ticket->GetId());
response = GMTICKET_RESPONSE_CREATE_SUCCESS;
}
@@ -56,10 +97,10 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
+void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket& recvData)
{
std::string message;
- recv_data >> message;
+ recvData >> message;
GMTicketResponse response = GMTICKET_RESPONSE_UPDATE_ERROR;
if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
@@ -68,7 +109,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
ticket->SetMessage(message);
ticket->SaveToDB(trans);
- sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->GetId());
+ sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName().c_str(), ticket->GetId());
response = GMTICKET_RESPONSE_UPDATE_SUCCESS;
}
@@ -78,7 +119,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
SendPacket(&data);
}
-void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recvData*/)
{
if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
{
@@ -86,14 +127,14 @@ void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/)
data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
SendPacket(&data);
- sWorld->SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->GetId());
+ sWorld->SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName().c_str(), ticket->GetId());
sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());
sTicketMgr->SendTicket(this, NULL);
}
}
-void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recvData*/)
{
SendQueryTimeResponse();
@@ -108,7 +149,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/)
sTicketMgr->SendTicket(this, NULL);
}
-void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/)
+void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recvData*/)
{
// Note: This only disables the ticket UI at client side and is not fully reliable
// are we sure this is a uint32? Should ask Zor
@@ -117,25 +158,25 @@ void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/)
SendPacket(&data);
}
-void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data)
+void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData)
{
uint32 nextSurveyID = sTicketMgr->GetNextSurveyID();
// just put the survey into the database
uint32 mainSurvey; // GMSurveyCurrentSurvey.dbc, column 1 (all 9) ref to GMSurveySurveys.dbc
- recv_data >> mainSurvey;
+ recvData >> mainSurvey;
// sub_survey1, r1, comment1, sub_survey2, r2, comment2, sub_survey3, r3, comment3, sub_survey4, r4, comment4, sub_survey5, r5, comment5, sub_survey6, r6, comment6, sub_survey7, r7, comment7, sub_survey8, r8, comment8, sub_survey9, r9, comment9, sub_survey10, r10, comment10,
for (uint8 i = 0; i < 10; i++)
{
uint32 subSurveyId; // ref to i'th GMSurveySurveys.dbc field (all fields in that dbc point to fields in GMSurveyQuestions.dbc)
- recv_data >> subSurveyId;
+ recvData >> subSurveyId;
if (!subSurveyId)
break;
uint8 rank; // probably some sort of ref to GMSurveyAnswers.dbc
- recv_data >> rank;
+ recvData >> rank;
std::string comment; // comment ("Usage: GMSurveyAnswerSubmit(question, rank, comment)")
- recv_data >> comment;
+ recvData >> comment;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SUBSURVEY);
stmt->setUInt32(0, nextSurveyID);
@@ -146,7 +187,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data)
}
std::string comment; // just a guess
- recv_data >> comment;
+ recvData >> comment;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY);
stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
@@ -157,17 +198,17 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data)
CharacterDatabase.Execute(stmt);
}
-void WorldSession::HandleReportLag(WorldPacket& recv_data)
+void WorldSession::HandleReportLag(WorldPacket& recvData)
{
// just put the lag report into the database...
// can't think of anything else to do with it
uint32 lagType, mapId;
- recv_data >> lagType;
- recv_data >> mapId;
+ recvData >> lagType;
+ recvData >> mapId;
float x, y, z;
- recv_data >> x;
- recv_data >> y;
- recv_data >> z;
+ recvData >> x;
+ recvData >> y;
+ recvData >> z;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT);
stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index 9d7fa7da396..08f2d61826e 100755..100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -155,9 +155,9 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && 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(), _player->GetSession()->GetAccountId(),
+ _player->GetName().c_str(), _player->GetSession()->GetAccountId(),
myItems[i]->GetTemplate()->Name1.c_str(), myItems[i]->GetEntry(), myItems[i]->GetCount(),
- trader->GetName(), trader->GetSession()->GetAccountId());
+ trader->GetName().c_str(), trader->GetSession()->GetAccountId());
}
// adjust time (depends on /played)
@@ -173,9 +173,9 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && 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(), trader->GetSession()->GetAccountId(),
+ trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
hisItems[i]->GetTemplate()->Name1.c_str(), hisItems[i]->GetEntry(), hisItems[i]->GetCount(),
- _player->GetName(), _player->GetSession()->GetAccountId());
+ _player->GetName().c_str(), _player->GetSession()->GetAccountId());
}
// adjust time (depends on /played)
@@ -192,21 +192,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
if (myItems[i])
{
if (!traderCanTrade)
- sLog->outError("trader can't store item: %u", myItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "trader can't store item: %u", myItems[i]->GetGUIDLow());
if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK)
_player->MoveItemToInventory(playerDst, myItems[i], true, true);
else
- sLog->outError("player can't take item back: %u", myItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "player can't take item back: %u", myItems[i]->GetGUIDLow());
}
// return the already removed items to the original owner
if (hisItems[i])
{
if (!playerCanTrade)
- sLog->outError("player can't store item: %u", hisItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "player can't store item: %u", hisItems[i]->GetGUIDLow());
if (trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK)
trader->MoveItemToInventory(traderDst, hisItems[i], true, true);
else
- sLog->outError("trader can't take item back: %u", hisItems[i]->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "trader can't take item back: %u", hisItems[i]->GetGUIDLow());
}
}
}
@@ -224,7 +224,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m
{
if (Item* item = myTrade->GetItem(TradeSlots(i)))
{
- sLog->outStaticDebug("player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
//Can return NULL
myItems[i] = item;
myItems[i]->SetInTrade();
@@ -232,7 +232,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *m
if (Item* item = hisTrade->GetItem(TradeSlots(i)))
{
- sLog->outStaticDebug("partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
hisItems[i] = item;
hisItems[i]->SetInTrade();
}
@@ -463,16 +463,16 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && my_trade->GetMoney() > 0)
{
sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
- _player->GetName(), _player->GetSession()->GetAccountId(),
+ _player->GetName().c_str(), _player->GetSession()->GetAccountId(),
my_trade->GetMoney(),
- trader->GetName(), trader->GetSession()->GetAccountId());
+ trader->GetName().c_str(), trader->GetSession()->GetAccountId());
}
if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && his_trade->GetMoney() > 0)
{
sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)",
- trader->GetName(), trader->GetSession()->GetAccountId(),
+ trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
his_trade->GetMoney(),
- _player->GetName(), _player->GetSession()->GetAccountId());
+ _player->GetName().c_str(), _player->GetSession()->GetAccountId());
}
}
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index cfd73c2c987..e16f535a757 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -23,7 +23,7 @@
#include "Log.h"
#include "ObjectAccessor.h"
-void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
+void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
@@ -31,44 +31,44 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
if (!vehicleGUID) // something wrong here...
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
uint64 guid;
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
MovementInfo mi;
mi.guid = guid;
- ReadMovementInfo(recv_data, &mi);
+ ReadMovementInfo(recvData, &mi);
_player->m_movementInfo = mi;
_player->ExitVehicle();
}
-void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
+void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE");
Unit* vehicle_base = GetPlayer()->GetVehicleBase();
if (!vehicle_base)
{
- recv_data.rfinish(); // prevent warnings spam
+ recvData.rfinish(); // prevent warnings spam
return;
}
VehicleSeatEntry const* seat = GetPlayer()->GetVehicle()->GetSeatForPassenger(GetPlayer());
if (!seat->CanSwitchFromSeat())
{
- recv_data.rfinish(); // prevent warnings spam
- sLog->outError("HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
- recv_data.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
+ recvData.rfinish(); // prevent warnings spam
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
+ recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
return;
}
- switch (recv_data.GetOpcode())
+ switch (recvData.GetOpcode())
{
case CMSG_REQUEST_VEHICLE_PREV_SEAT:
GetPlayer()->ChangeSeat(-1, false);
@@ -79,17 +79,17 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
{
uint64 guid; // current vehicle guid
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
MovementInfo movementInfo;
- ReadMovementInfo(recv_data, &movementInfo);
+ ReadMovementInfo(recvData, &movementInfo);
vehicle_base->m_movementInfo = movementInfo;
uint64 accessory; // accessory guid
- recv_data.readPackGUID(accessory);
+ recvData.readPackGUID(accessory);
int8 seatId;
- recv_data >> seatId;
+ recvData >> seatId;
if (vehicle_base->GetGUID() != guid)
return;
@@ -107,10 +107,10 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data)
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
{
uint64 guid; // current vehicle guid
- recv_data.readPackGUID(guid);
+ recvData.readPackGUID(guid);
int8 seatId;
- recv_data >> seatId;
+ recvData >> seatId;
if (vehicle_base->GetGUID() == guid)
GetPlayer()->ChangeSeat(seatId);
@@ -150,7 +150,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
if (!vehicle)
{
data.rfinish(); // prevent warnings spam
- sLog->outError("HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
return;
}
@@ -162,13 +162,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
{
- sLog->outError("Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
if (!player->IsOnVehicle(vehicle->GetBase()))
{
- sLog->outError("Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
@@ -177,7 +177,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
if (seat->IsEjectable())
player->ExitVehicle();
else
- sLog->outError("Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
}
else if (IS_CREATURE_GUID(guid))
@@ -185,13 +185,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
if (!unit) // creatures can be ejected too from player mounts
{
- sLog->outError("Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
if (!unit->IsOnVehicle(vehicle->GetBase()))
{
- sLog->outError("Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
return;
}
@@ -203,13 +203,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
unit->ExitVehicle();
}
else
- sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
}
else
- sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
+ sLog->outError(LOG_FILTER_NETWORKIO, "HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
}
-void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/)
+void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT");
@@ -220,7 +220,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/)
if (seat->CanEnterOrExit())
GetPlayer()->ExitVehicle();
else
- sLog->outError("Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
+ sLog->outError(LOG_FILTER_NETWORKIO, "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags);
}
}
diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp
index 34ad5ac3eae..785b4f8e5cd 100755..100644
--- a/src/server/game/Handlers/VoiceChatHandler.cpp
+++ b/src/server/game/Handlers/VoiceChatHandler.cpp
@@ -22,24 +22,24 @@
#include "Opcodes.h"
#include "Log.h"
-void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recv_data)
+void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_VOICE_SESSION_ENABLE");
// uint8 isVoiceEnabled, uint8 isMicrophoneEnabled
- recv_data.read_skip<uint8>();
- recv_data.read_skip<uint8>();
+ recvData.read_skip<uint8>();
+ recvData.read_skip<uint8>();
}
-void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket& /*recv_data*/)
+void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CHANNEL_VOICE_ON");
// Enable Voice button in channel context menu
}
-void WorldSession::HandleSetActiveVoiceChannel(WorldPacket& recv_data)
+void WorldSession::HandleSetActiveVoiceChannel(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL");
- recv_data.read_skip<uint32>();
- recv_data.read_skip<char*>();
+ recvData.read_skip<uint32>();
+ recvData.read_skip<char*>();
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 59bb86cb68e..48ed7bdba1f 100755..100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -75,19 +75,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
const MapEntry* entry = sMapStore.LookupEntry(mapId);
if (!entry)
{
- sLog->outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId);
return NULL;
}
if (instanceId == 0)
{
- sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId);
return NULL;
}
if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
{
- sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty);
return NULL;
}
@@ -275,8 +275,8 @@ void InstanceSaveManager::LoadInstances()
// Load reset times and clean expired instances
sInstanceSaveMgr->LoadResetTimes();
- sLog->outString(">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
}
void InstanceSaveManager::LoadResetTimes()
@@ -364,7 +364,7 @@ void InstanceSaveManager::LoadResetTimes()
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
if (!mapDiff)
{
- sLog->outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty);
continue;
}
@@ -458,7 +458,7 @@ void InstanceSaveManager::ScheduleReset(bool add, time_t time, InstResetEvent ev
}
if (itr == m_resetTimeQueue.end())
- sLog->outError("InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::ScheduleReset: cannot cancel the reset, the event(%d, %d, %d) was not found!", event.type, event.mapid, event.instanceId);
}
}
else
@@ -566,7 +566,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
if (!mapDiff || !mapDiff->resetTime)
{
- sLog->outError("InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid);
+ sLog->outError(LOG_FILTER_GENERAL, "InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid);
return;
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index 83c2170255d..83c2170255d 100755..100644
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index d2c256e08f7..a370cf25d97 100755..100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -16,15 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "InstanceScript.h"
-#include "DatabaseEnv.h"
-#include "Map.h"
-#include "Player.h"
-#include "GameObject.h"
#include "Creature.h"
#include "CreatureAI.h"
-#include "Log.h"
+#include "DatabaseEnv.h"
+#include "GameObject.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Log.h"
+#include "Map.h"
+#include "Player.h"
+#include "Pet.h"
+#include "WorldSession.h"
+#include "Opcodes.h"
void InstanceScript::SaveToDB()
{
@@ -46,7 +49,7 @@ void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go)
if (go)
go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: InstanceScript: HandleGameObject failed");
+ sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript: HandleGameObject failed");
}
bool InstanceScript::IsEncounterInProgress() const
@@ -197,7 +200,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
if (bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
- //sLog->outError("Inialize boss %u state as %u.", id, (uint32)state);
+ //sLog->outError(LOG_FILTER_GENERAL, "Inialize boss %u state as %u.", id, (uint32)state);
return false;
}
else
@@ -267,7 +270,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime,
go->ResetDoorOrButton();
}
else
- sLog->outError("SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType());
+ sLog->outError(LOG_FILTER_GENERAL, "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType());
}
}
@@ -298,7 +301,7 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
player->SendUpdateWorldState(uiStateId, uiStateData);
}
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoUpdateWorldState attempt send data but no players in map.");
+ sLog->outDebug(LOG_FILTER_TSCR, "DoUpdateWorldState attempt send data but no players in map.");
}
// Send Notify to all players in instance
@@ -339,7 +342,7 @@ void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type,
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* player = i->getSource())
- player->GetAchievementMgr().StartTimedAchievement(type, entry);
+ player->StartTimedAchievement(type, entry);
}
// Stop timed achievement for all players in instance
@@ -350,7 +353,7 @@ void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type,
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* player = i->getSource())
- player->GetAchievementMgr().RemoveTimedAchievement(type, entry);
+ player->RemoveTimedAchievement(type, entry);
}
// Remove Auras due to Spell on all players in instance
@@ -384,7 +387,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
{
- sLog->outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
+ sLog->outError(LOG_FILTER_GENERAL, "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
instance->GetId(), criteria_id);
return false;
}
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 71f1572624b..f1766833aee 100755..100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -25,11 +25,11 @@
//#include "GameObject.h"
//#include "Map.h"
-#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
-#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
-#define OUT_LOAD_INST_DATA_FAIL sLog->outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
+#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
+#define OUT_LOAD_INST_DATA_FAIL sLog->outError(LOG_FILTER_TSCR, "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
class Map;
class Unit;
@@ -49,7 +49,7 @@ enum EncounterFrameType
ENCOUNTER_FRAME_ENABLE_OBJECTIVE = 4,
ENCOUNTER_FRAME_UPDATE_OBJECTIVE = 5,
ENCOUNTER_FRAME_DISABLE_OBJECTIVE = 6,
- ENCOUNTER_FRAME_UNK7 = 7, // Seems to have something to do with sorting the encounter units
+ ENCOUNTER_FRAME_UNK7 = 7 // Seems to have something to do with sorting the encounter units
};
enum EncounterState
@@ -59,7 +59,7 @@ enum EncounterState
FAIL = 2,
DONE = 3,
SPECIAL = 4,
- TO_BE_DECIDED = 5,
+ TO_BE_DECIDED = 5
};
enum DoorType
@@ -67,7 +67,7 @@ enum DoorType
DOOR_TYPE_ROOM = 0, // Door can open if encounter is not in progress
DOOR_TYPE_PASSAGE = 1, // Door can open if encounter is done
DOOR_TYPE_SPAWN_HOLE = 2, // Door can open if encounter is in progress, typically used for spawning places
- MAX_DOOR_TYPES,
+ MAX_DOOR_TYPES
};
enum BoundaryType
@@ -84,7 +84,7 @@ enum BoundaryType
BOUNDARY_MAX_X = BOUNDARY_N,
BOUNDARY_MIN_X = BOUNDARY_S,
BOUNDARY_MAX_Y = BOUNDARY_W,
- BOUNDARY_MIN_Y = BOUNDARY_E,
+ BOUNDARY_MIN_Y = BOUNDARY_E
};
typedef std::map<BoundaryType, float> BossBoundaryMap;
@@ -131,7 +131,6 @@ typedef std::map<uint32 /*entry*/, MinionInfo> MinionInfoMap;
class InstanceScript : public ZoneScript
{
public:
-
explicit InstanceScript(Map* map) : instance(map), completedEncounters(0) {}
virtual ~InstanceScript() {}
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 0520392461f..ef3d2b9fbd6 100755..100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -25,6 +25,7 @@
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "Group.h"
+#include "Player.h"
static Rates const qualityToRate[MAX_ITEM_QUALITY] =
{
@@ -121,7 +122,7 @@ uint32 LootStore::LoadLootTable()
if (maxcount > std::numeric_limits<uint8>::max())
{
- sLog->outErrorDb("Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max());
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: maxcount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits<uint8>::max());
continue; // error already printed to log/console.
}
@@ -225,12 +226,12 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const
{
// all still listed ids isn't referenced
for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr)
- sLog->outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
}
void LootStore::ReportNotExistedId(uint32 id) const
{
- sLog->outErrorDb("Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName());
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName());
}
//
@@ -259,13 +260,13 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
{
if (group >= 1 << 7) // it stored in 7 bit field
{
- sLog->outErrorDb("Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: group (%u) must be less %u - skipped", store.GetName(), entry, itemid, group, 1 << 7);
return false;
}
if (mincountOrRef == 0)
{
- sLog->outErrorDb("Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: wrong mincountOrRef (%d) - skipped", store.GetName(), entry, itemid, mincountOrRef);
return false;
}
@@ -274,36 +275,36 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
if (!proto)
{
- sLog->outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
return false;
}
if (chance == 0 && group == 0) // Zero chance is allowed for grouped entries only
{
- sLog->outErrorDb("Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid);
return false;
}
if (chance != 0 && chance < 0.000001f) // loot with low chance
{
- sLog->outErrorDb("Table '%s' entry %d item %d: low chance (%f) - skipped",
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: low chance (%f) - skipped",
store.GetName(), entry, itemid, chance);
return false;
}
if (maxcount < mincountOrRef) // wrong max count
{
- sLog->outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
return false;
}
}
else // mincountOrRef < 0
{
if (needs_quest)
- sLog->outErrorDb("Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: quest chance will be treated as non-quest chance", store.GetName(), entry, itemid);
else if (chance == 0) // no chance for the reference
{
- sLog->outErrorDb("Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' entry %d item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid);
return false;
}
}
@@ -409,7 +410,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
if (!tab)
{
if (!noEmptyError)
- sLog->outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
+ sLog->outError(LOG_FILTER_SQL, "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId);
return false;
}
@@ -524,7 +525,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
// increase once if one looter only, looter-times if free for all
if (item.freeforall || !item.is_blocked)
++unlootedCount;
- if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT || player->GetGroup()->GetLootMethod() != ROUND_ROBIN))
+ if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT && player->GetGroup()->GetLootMethod() != ROUND_ROBIN))
item.is_blocked = true;
if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS)
@@ -1178,12 +1179,12 @@ 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->outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
+ 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->outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
+ 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);
}
}
@@ -1391,7 +1392,7 @@ bool LootTemplate::addConditionItem(Condition* cond)
{
if (!cond || !cond->isLoaded())//should never happen, checked at loading
{
- sLog->outError("LootTemplate::addConditionItem: condition is null");
+ sLog->outError(LOG_FILTER_LOOT, "LootTemplate::addConditionItem: condition is null");
return false;
}
if (!Entries.empty())
@@ -1450,7 +1451,7 @@ bool LootTemplate::isReference(uint32 id)
void LoadLootTemplates_Creature()
{
- sLog->outString("Loading creature loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1477,16 +1478,14 @@ void LoadLootTemplates_Creature()
LootTemplates_Creature.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
}
void LoadLootTemplates_Disenchant()
{
- sLog->outString("Loading disenchanting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1512,15 +1511,14 @@ void LoadLootTemplates_Disenchant()
LootTemplates_Disenchant.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
}
void LoadLootTemplates_Fishing()
{
- sLog->outString("Loading fishing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1537,16 +1535,14 @@ void LoadLootTemplates_Fishing()
LootTemplates_Fishing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
}
void LoadLootTemplates_Gameobject()
{
- sLog->outString("Loading gameobject loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1573,16 +1569,14 @@ void LoadLootTemplates_Gameobject()
LootTemplates_Gameobject.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
}
void LoadLootTemplates_Item()
{
- sLog->outString("Loading item loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading item loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1599,16 +1593,14 @@ void LoadLootTemplates_Item()
LootTemplates_Item.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
}
void LoadLootTemplates_Milling()
{
- sLog->outString("Loading milling loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1630,16 +1622,14 @@ void LoadLootTemplates_Milling()
LootTemplates_Milling.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
}
void LoadLootTemplates_Pickpocketing()
{
- sLog->outString("Loading pickpocketing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1666,16 +1656,14 @@ void LoadLootTemplates_Pickpocketing()
LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
}
void LoadLootTemplates_Prospecting()
{
- sLog->outString("Loading prospecting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1697,16 +1685,14 @@ void LoadLootTemplates_Prospecting()
LootTemplates_Prospecting.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
}
void LoadLootTemplates_Mail()
{
- sLog->outString("Loading mail loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1723,16 +1709,14 @@ void LoadLootTemplates_Mail()
LootTemplates_Mail.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
}
void LoadLootTemplates_Skinning()
{
- sLog->outString("Loading skinning loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1759,16 +1743,14 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
-
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
}
void LoadLootTemplates_Spell()
{
- sLog->outString("Loading spell loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1803,15 +1785,14 @@ void LoadLootTemplates_Spell()
LootTemplates_Spell.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outErrorDb(">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
}
void LoadLootTemplates_Reference()
{
- sLog->outString("Loading reference loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1834,6 +1815,5 @@ void LoadLootTemplates_Reference()
// output error for any still listed ids (not referenced from any loot table)
LootTemplates_Reference.ReportUnusedIds(lootIdSet);
- sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 1af5bd1ea62..45fc5c7983c 100755..100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -69,7 +69,7 @@ enum PermissionTypes
MASTER_PERMISSION = 2,
ROUND_ROBIN_PERMISSION = 3,
OWNER_PERMISSION = 4,
- NONE_PERMISSION = 5,
+ NONE_PERMISSION = 5
};
enum LootType
@@ -94,7 +94,7 @@ enum LootSlotType
LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
LOOT_SLOT_TYPE_MASTER = 2, // item can only be distributed by group loot master.
LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
- LOOT_SLOT_TYPE_OWNER = 4, // ignore binding confirmation and etc, for single player looting
+ LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
};
class Player;
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 3c3888eb9f8..108856d81b6 100755..100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -26,6 +26,7 @@
#include "BattlegroundMgr.h"
#include "Item.h"
#include "AuctionHouseMgr.h"
+#include "CalendarMgr.h"
MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery)
{
@@ -39,10 +40,10 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery
m_messageType = MAIL_GAMEOBJECT;
m_senderId = sender->GetEntry();
break;
- case TYPEID_ITEM:
+ /*case TYPEID_ITEM:
m_messageType = MAIL_ITEM;
m_senderId = sender->GetEntry();
- break;
+ break;*/
case TYPEID_PLAYER:
m_messageType = MAIL_NORMAL;
m_senderId = sender->GetGUIDLow();
@@ -50,11 +51,16 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery
default:
m_messageType = MAIL_NORMAL;
m_senderId = 0; // will show mail from not existed player
- sLog->outError("MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
+ sLog->outError(LOG_FILTER_GENERAL, "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
break;
}
}
+MailSender::MailSender(CalendarEvent* sender)
+ : m_messageType(MAIL_CALENDAR), m_senderId(sender->GetEventId()), m_stationery(MAIL_STATIONERY_DEFAULT) // what stationery we should use here?
+{
+}
+
MailSender::MailSender(AuctionEntry* sender)
: m_messageType(MAIL_AUCTION), m_senderId(sender->GetHouseId()), m_stationery(MAIL_STATIONERY_AUCTION)
{
diff --git a/src/server/game/Mails/Mail.h b/src/server/game/Mails/Mail.h
index dbd03bd96ee..c2771f4b57c 100755..100644
--- a/src/server/game/Mails/Mail.h
+++ b/src/server/game/Mails/Mail.h
@@ -23,6 +23,7 @@
#include <map>
struct AuctionEntry;
+struct CalendarEvent;
class Item;
class Object;
class Player;
@@ -36,7 +37,7 @@ enum MailMessageType
MAIL_AUCTION = 2,
MAIL_CREATURE = 3, // client send CMSG_CREATURE_QUERY on this mailmessagetype
MAIL_GAMEOBJECT = 4, // client send CMSG_GAMEOBJECT_QUERY on this mailmessagetype
- MAIL_ITEM = 5, // client send CMSG_ITEM_QUERY on this mailmessagetype
+ MAIL_CALENDAR = 5
};
enum MailCheckMask
@@ -46,7 +47,7 @@ enum MailCheckMask
MAIL_CHECK_MASK_RETURNED = 0x02, /// This mail was returned. Do not allow returning mail back again.
MAIL_CHECK_MASK_COPIED = 0x04, /// This mail was copied. Do not allow making a copy of items in mail.
MAIL_CHECK_MASK_COD_PAYMENT = 0x08,
- MAIL_CHECK_MASK_HAS_BODY = 0x10, /// This mail has body text.
+ MAIL_CHECK_MASK_HAS_BODY = 0x10 /// This mail has body text.
};
// gathered from Stationery.dbc
@@ -56,8 +57,9 @@ enum MailStationery
MAIL_STATIONERY_DEFAULT = 41,
MAIL_STATIONERY_GM = 61,
MAIL_STATIONERY_AUCTION = 62,
- MAIL_STATIONERY_VAL = 64,
- MAIL_STATIONERY_CHR = 65,
+ MAIL_STATIONERY_VAL = 64, // Valentine
+ MAIL_STATIONERY_CHR = 65, // Christmas
+ MAIL_STATIONERY_ORP = 67 // Orphan
};
enum MailState
@@ -67,24 +69,13 @@ enum MailState
MAIL_STATE_DELETED = 3
};
-enum MailAuctionAnswers
-{
- AUCTION_OUTBIDDED = 0,
- AUCTION_WON = 1,
- AUCTION_SUCCESSFUL = 2,
- AUCTION_EXPIRED = 3,
- AUCTION_CANCELLED_TO_BIDDER = 4,
- AUCTION_CANCELED = 5,
- AUCTION_SALE_PENDING = 6
-};
-
enum MailShowFlags
{
MAIL_SHOW_UNK0 = 0x0001,
MAIL_SHOW_DELETE = 0x0002, // forced show delete button instead return button
MAIL_SHOW_AUCTION = 0x0004, // from old comment
MAIL_SHOW_UNK2 = 0x0008, // unknown, COD will be shown even without that flag
- MAIL_SHOW_RETURN = 0x0010,
+ MAIL_SHOW_RETURN = 0x0010
};
class MailSender
@@ -95,6 +86,7 @@ class MailSender
{
}
MailSender(Object* sender, MailStationery stationery = MAIL_STATIONERY_DEFAULT);
+ MailSender(CalendarEvent* sender);
MailSender(AuctionEntry* sender);
MailSender(Player* sender);
public: // Accessors
@@ -129,7 +121,7 @@ class MailDraft
explicit MailDraft(uint16 mailTemplateId, bool need_items = true)
: m_mailTemplateId(mailTemplateId), m_mailTemplateItemsNeed(need_items), m_money(0), m_COD(0)
{}
- MailDraft(std::string subject, std::string body)
+ MailDraft(std::string const& subject, std::string const& body)
: m_mailTemplateId(0), m_mailTemplateItemsNeed(false), m_subject(subject), m_body(body), m_money(0), m_COD(0) {}
public: // Accessors
uint16 GetMailTemplateId() const { return m_mailTemplateId; }
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 270c4c782b6..831b29c2cfd 100755..100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -17,22 +17,24 @@
*/
#include "Map.h"
-#include "GridStates.h"
-#include "ScriptMgr.h"
-#include "VMapFactory.h"
-#include "MapInstanced.h"
+#include "Battleground.h"
#include "CellImpl.h"
+#include "DynamicTree.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "Transport.h"
+#include "GridStates.h"
+#include "Group.h"
#include "InstanceScript.h"
-#include "ObjectAccessor.h"
+#include "LFGMgr.h"
+#include "MapInstanced.h"
#include "MapManager.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Group.h"
-#include "LFGMgr.h"
-#include "DynamicTree.h"
+#include "Pet.h"
+#include "ScriptMgr.h"
+#include "Transport.h"
#include "Vehicle.h"
+#include "VMapFactory.h"
union u_map_magic
{
@@ -81,14 +83,14 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy)
FILE* pf=fopen(tmp, "rb");
if (!pf)
- sLog->outError("Map file '%s': does not exist!", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s': does not exist!", tmp);
else
{
map_fileheader header;
if (fread(&header, sizeof(header), 1, pf) == 1)
{
if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt)
- sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp);
else
ret = true;
}
@@ -108,7 +110,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy)
if (!exists)
{
std::string name = vmgr->getDirFileName(mapid, gx, gy);
- sLog->outError("VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str());
+ sLog->outError(LOG_FILTER_MAPS, "VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath()+"vmaps/"+name).c_str());
return false;
}
}
@@ -124,13 +126,13 @@ void Map::LoadVMap(int gx, int gy)
switch (vmapLoadResult)
{
case VMAP::VMAP_LOAD_RESULT_OK:
- sLog->outDetail("VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outInfo(LOG_FILTER_MAPS, "VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
break;
case VMAP::VMAP_LOAD_RESULT_ERROR:
- sLog->outDetail("Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outInfo(LOG_FILTER_MAPS, "Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
break;
case VMAP::VMAP_LOAD_RESULT_IGNORED:
- sLog->outStaticDebug("Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
+ sLog->outDebug(LOG_FILTER_MAPS, "Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
break;
}
}
@@ -144,7 +146,7 @@ void Map::LoadMap(int gx, int gy, bool reload)
// load grid map for base map
if (!m_parentMap->GridMaps[gx][gy])
- m_parentMap->EnsureGridCreated(GridCoord(63-gx, 63-gy));
+ m_parentMap->EnsureGridCreated_i(GridCoord(63-gx, 63-gy));
((MapInstanced*)(m_parentMap))->AddGridMapReference(GridCoord(gx, gy));
GridMaps[gx][gy] = m_parentMap->GridMaps[gx][gy];
@@ -157,7 +159,7 @@ void Map::LoadMap(int gx, int gy, bool reload)
//map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?)
if (GridMaps[gx][gy])
{
- sLog->outDetail("Unloading previously loaded map %u before reloading.", GetId());
+ sLog->outInfo(LOG_FILTER_MAPS, "Unloading previously loaded map %u before reloading.", GetId());
sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy);
delete (GridMaps[gx][gy]);
@@ -169,12 +171,12 @@ void Map::LoadMap(int gx, int gy, bool reload)
int len = sWorld->GetDataPath().length()+strlen("maps/%03u%02u%02u.map")+1;
tmp = new char[len];
snprintf(tmp, len, (char *)(sWorld->GetDataPath()+"maps/%03u%02u%02u.map").c_str(), GetId(), gx, gy);
- sLog->outDetail("Loading map %s", tmp);
+ sLog->outInfo(LOG_FILTER_MAPS, "Loading map %s", tmp);
// loading data
GridMaps[gx][gy] = new GridMap();
if (!GridMaps[gx][gy]->loadData(tmp))
{
- sLog->outError("Error loading map file: \n %s\n", tmp);
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map file: \n %s\n", tmp);
}
delete [] tmp;
@@ -264,7 +266,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
if (!p.IsCoordValid())
{
- sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
+ sLog->outError(LOG_FILTER_MAPS, "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
return;
}
@@ -272,7 +274,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
- sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
+ sLog->outDebug(LOG_FILTER_MAPS, "Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
ASSERT(ngrid != NULL);
@@ -307,32 +309,34 @@ void Map::DeleteFromWorld(Player* player)
delete player;
}
+void Map::EnsureGridCreated(const GridCoord &p)
+{
+ TRINITY_GUARD(ACE_Thread_Mutex, Lock);
+ EnsureGridCreated_i(p);
+}
+
//Create NGrid so the object can be added to it
//But object data is not loaded here
-void Map::EnsureGridCreated(const GridCoord &p)
+void Map::EnsureGridCreated_i(const GridCoord &p)
{
if (!getNGrid(p.x_coord, p.y_coord))
{
- TRINITY_GUARD(ACE_Thread_Mutex, Lock);
- if (!getNGrid(p.x_coord, p.y_coord))
- {
- sLog->outDebug(LOG_FILTER_MAPS, "Creating grid[%u, %u] for map %u instance %u", p.x_coord, p.y_coord, GetId(), i_InstanceId);
+ sLog->outDebug(LOG_FILTER_MAPS, "Creating grid[%u, %u] for map %u instance %u", p.x_coord, p.y_coord, GetId(), i_InstanceId);
- setNGrid(new NGridType(p.x_coord*MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord, i_gridExpiry, sWorld->getBoolConfig(CONFIG_GRID_UNLOAD)),
- p.x_coord, p.y_coord);
+ setNGrid(new NGridType(p.x_coord*MAX_NUMBER_OF_GRIDS + p.y_coord, p.x_coord, p.y_coord, i_gridExpiry, sWorld->getBoolConfig(CONFIG_GRID_UNLOAD)),
+ p.x_coord, p.y_coord);
- // build a linkage between this map and NGridType
- buildNGridLinkage(getNGrid(p.x_coord, p.y_coord));
+ // build a linkage between this map and NGridType
+ buildNGridLinkage(getNGrid(p.x_coord, p.y_coord));
- getNGrid(p.x_coord, p.y_coord)->SetGridState(GRID_STATE_IDLE);
+ getNGrid(p.x_coord, p.y_coord)->SetGridState(GRID_STATE_IDLE);
- //z coord
- int gx = (MAX_NUMBER_OF_GRIDS - 1) - p.x_coord;
- int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
+ //z coord
+ int gx = (MAX_NUMBER_OF_GRIDS - 1) - p.x_coord;
+ int gy = (MAX_NUMBER_OF_GRIDS - 1) - p.y_coord;
- if (!GridMaps[gx][gy])
- LoadMapAndVMap(gx, gy);
- }
+ if (!GridMaps[gx][gy])
+ LoadMapAndVMap(gx, gy);
}
}
@@ -346,7 +350,7 @@ void Map::EnsureGridLoadedForActiveObject(const Cell &cell, WorldObject* object)
// refresh grid state & timer
if (grid->GetGridState() != GRID_STATE_ACTIVE)
{
- sLog->outStaticDebug("Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Active object "UI64FMTD" triggers loading of grid [%u, %u] on map %u", object->GetGUID(), cell.GridX(), cell.GridY(), GetId());
ResetGridExpiry(*grid, 0.1f);
grid->SetGridState(GRID_STATE_ACTIVE);
}
@@ -387,7 +391,7 @@ bool Map::AddPlayerToMap(Player* player)
CellCoord cellCoord = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
if (!cellCoord.IsCoordValid())
{
- sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
+ sLog->outError(LOG_FILTER_MAPS, "Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return false;
}
@@ -439,7 +443,7 @@ bool Map::AddToMap(T *obj)
ASSERT(cellCoord.IsCoordValid());
if (!cellCoord.IsCoordValid())
{
- sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
+ sLog->outError(LOG_FILTER_MAPS, "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
return false; //Should delete object
}
@@ -449,7 +453,7 @@ bool Map::AddToMap(T *obj)
else
EnsureGridCreated(GridCoord(cell.GridX(), cell.GridY()));
AddToGrid(obj, cell);
- sLog->outStaticDebug("Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
+ sLog->outDebug(LOG_FILTER_MAPS, "Object %u enters grid[%u, %u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
//Must already be set before AddToMap. Usually during obj->Create.
//obj->SetMap(this);
@@ -711,11 +715,11 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie
player->Relocate(x, y, z, orientation);
if (player->IsVehicle())
- player->GetVehicleKit()->RelocatePassengers(x, y, z, orientation);
+ player->GetVehicleKit()->RelocatePassengers();
if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
{
- sLog->outStaticDebug("Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
+ sLog->outDebug(LOG_FILTER_MAPS, "Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName().c_str(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
player->RemoveFromGrid();
@@ -757,7 +761,7 @@ void Map::CreatureRelocation(Creature* creature, float x, float y, float z, floa
{
creature->Relocate(x, y, z, ang);
if (creature->IsVehicle())
- creature->GetVehicleKit()->RelocatePassengers(x, y, z, ang);
+ creature->GetVehicleKit()->RelocatePassengers();
creature->UpdateObjectVisibility(false);
RemoveCreatureFromMoveList(creature);
}
@@ -1002,7 +1006,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll)
GridMaps[gx][gy] = NULL;
}
- sLog->outStaticDebug("Unloading grid[%u, %u] for map %u finished", x, y, GetId());
+ sLog->outDebug(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u finished", x, y, GetId());
return true;
}
@@ -1016,7 +1020,7 @@ void Map::RemoveAllPlayers()
if (!player->IsBeingTeleportedFar())
{
// this is happening for bg
- sLog->outError("Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName(), GetId());
+ sLog->outError(LOG_FILTER_MAPS, "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName().c_str(), GetId());
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
}
}
@@ -1089,28 +1093,28 @@ bool GridMap::loadData(char *filename)
// loadup area data
if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize))
{
- sLog->outError("Error loading map area data\n");
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map area data\n");
fclose(in);
return false;
}
// loadup height data
- if (header.heightMapOffset && !loadHeihgtData(in, header.heightMapOffset, header.heightMapSize))
+ if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize))
{
- sLog->outError("Error loading map height data\n");
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map height data\n");
fclose(in);
return false;
}
// loadup liquid data
if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize))
{
- sLog->outError("Error loading map liquids data\n");
+ sLog->outError(LOG_FILTER_MAPS, "Error loading map liquids data\n");
fclose(in);
return false;
}
fclose(in);
return true;
}
- sLog->outError("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 clientversion. Please recreate using the mapextractor.", filename);
fclose(in);
return false;
}
@@ -1150,7 +1154,7 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
return true;
}
-bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
+bool GridMap::loadHeightData(FILE* in, uint32 offset, uint32 /*size*/)
{
map_heightHeader header;
fseek(in, offset, SEEK_SET);
@@ -1223,8 +1227,8 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
}
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
{
- _liquidMap = new float[_liquidWidth*_liquidHeight];
- if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight)
+ _liquidMap = new float[uint32(_liquidWidth) * uint32(_liquidHeight)];
+ if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != (uint32(_liquidWidth) * uint32(_liquidHeight)))
return false;
}
return true;
@@ -1700,7 +1704,7 @@ bool Map::IsOutdoors(float x, float y, float z) const
WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
if (wmoEntry)
{
- sLog->outStaticDebug("Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
+ sLog->outDebug(LOG_FILTER_MAPS, "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
atEntry = GetAreaEntryByAreaID(wmoEntry->areaId);
}
return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
@@ -1987,7 +1991,7 @@ void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpa
void Map::SendInitSelf(Player* player)
{
- sLog->outDetail("Creating player data for himself %u", player->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_MAPS, "Creating player data for himself %u", player->GetGUIDLow());
UpdateData data;
@@ -2071,7 +2075,7 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)
{
if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS)
{
- sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y);
+ sLog->outError(LOG_FILTER_MAPS, "map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y);
ASSERT(false);
}
i_grids[x][y] = grid;
@@ -2144,7 +2148,7 @@ void Map::RemoveAllObjectsInRemoveList()
{
Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID());
if (!corpse)
- sLog->outError("Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow());
+ sLog->outError(LOG_FILTER_MAPS, "Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow());
else
RemoveFromMap(corpse, true);
break;
@@ -2162,7 +2166,7 @@ void Map::RemoveAllObjectsInRemoveList()
RemoveFromMap(obj->ToCreature(), true);
break;
default:
- sLog->outError("Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId());
+ sLog->outError(LOG_FILTER_MAPS, "Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId());
break;
}
@@ -2239,7 +2243,7 @@ void Map::AddToActive(Creature* c)
else
{
GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY());
- sLog->outError("Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
+ sLog->outError(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) added to grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord);
}
}
@@ -2260,7 +2264,7 @@ void Map::RemoveFromActive(Creature* c)
else
{
GridCoord p2 = Trinity::ComputeGridCoord(c->GetPositionX(), c->GetPositionY());
- sLog->outError("Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
+ sLog->outError(LOG_FILTER_MAPS, "Active creature (GUID: %u Entry: %u) removed from grid[%u, %u] but spawn grid[%u, %u] was not loaded.",
c->GetGUIDLow(), c->GetEntry(), p.x_coord, p.y_coord, p2.x_coord, p2.y_coord);
}
}
@@ -2311,7 +2315,7 @@ bool InstanceMap::CanEnter(Player* player)
{
if (player->GetMapRef().getTarget() == this)
{
- sLog->outError("InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode());
ASSERT(false);
return false;
}
@@ -2324,7 +2328,7 @@ bool InstanceMap::CanEnter(Player* player)
uint32 maxPlayers = GetMaxPlayers();
if (GetPlayersCountExceptGMs() >= maxPlayers)
{
- sLog->outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str());
player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS);
return false;
}
@@ -2394,7 +2398,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!mapSave)
{
- sLog->outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
+ sLog->outInfo(LOG_FILTER_MAPS, "InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId());
mapSave = sInstanceSaveMgr->AddInstanceSave(GetId(), GetInstanceId(), Difficulty(GetSpawnMode()), 0, true);
}
@@ -2405,7 +2409,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// cannot enter other instances if bound permanently
if (playerBind->save != mapSave)
{
- sLog->outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset());
return false;
}
}
@@ -2415,11 +2419,11 @@ bool InstanceMap::AddPlayerToMap(Player* player)
{
// solo saves should be reset when entering a group
InstanceGroupBind* groupBind = group->GetBoundInstance(this);
- if (playerBind)
+ if (playerBind && playerBind->save != mapSave)
{
- sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset());
if (groupBind)
- sLog->outError("InstanceMap::Add: the group is bound to the instance %d, %d, %d, %d, %d, %d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: the group is bound to the instance %d, %d, %d, %d, %d, %d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset());
//ASSERT(false);
return false;
}
@@ -2431,15 +2435,15 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// cannot jump to a different instance without resetting it
if (groupBind->save != mapSave)
{
- sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty());
if (mapSave)
- sLog->outError("MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
+ sLog->outError(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount());
else
- sLog->outError("MapSave NULL");
+ sLog->outError(LOG_FILTER_MAPS, "MapSave NULL");
if (groupBind->save)
- sLog->outError("GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
+ sLog->outError(LOG_FILTER_MAPS, "GroupBind save players: %d, group count: %d", groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount());
else
- sLog->outError("GroupBind save NULL");
+ sLog->outError(LOG_FILTER_MAPS, "GroupBind save NULL");
return false;
}
// if the group/leader is permanently bound to the instance
@@ -2468,8 +2472,8 @@ bool InstanceMap::AddPlayerToMap(Player* player)
if (group && group->isLFGGroup())
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
- if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
- if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin())))
+ 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 == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM))
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
}
@@ -2478,7 +2482,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// first player enters (no players yet)
SetResetSchedule(false);
- sLog->outDetail("MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName().c_str(), GetInstanceId(), GetMapName());
// initialize unload state
m_unloadTimer = 0;
m_resetAfterUnload = false;
@@ -2504,7 +2508,7 @@ void InstanceMap::Update(const uint32 t_diff)
void InstanceMap::RemovePlayerFromMap(Player* player, bool remove)
{
- sLog->outDetail("MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName());
//if last player set unload timer
if (!m_unloadTimer && m_mapRefManager.getSize() == 1)
m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY);
@@ -2599,7 +2603,7 @@ void InstanceMap::PermBindAllPlayers(Player* source)
InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
if (!save)
{
- sLog->outError("Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId());
+ sLog->outError(LOG_FILTER_MAPS, "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName().c_str(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId());
return;
}
@@ -2653,7 +2657,7 @@ void InstanceMap::SetResetSchedule(bool on)
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()))
sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId()));
else
- sLog->outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)",
+ sLog->outError(LOG_FILTER_MAPS, "InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)",
on ? "on" : "off", GetId(), GetMapName(), GetInstanceId(), Difficulty(GetSpawnMode()));
}
}
@@ -2688,7 +2692,7 @@ uint32 InstanceMap::GetMaxResetDelay() const
/* ******* Battleground Instance Maps ******* */
BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
- : Map(id, expiry, InstanceId, spawnMode, _parent)
+ : Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(NULL)
{
//lets initialize visibility distance for BG/Arenas
BattlegroundMap::InitVisibilityDistance();
@@ -2715,7 +2719,7 @@ bool BattlegroundMap::CanEnter(Player* player)
{
if (player->GetMapRef().getTarget() == this)
{
- sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow());
+ sLog->outError(LOG_FILTER_MAPS, "BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow());
ASSERT(false);
return false;
}
@@ -2743,7 +2747,7 @@ bool BattlegroundMap::AddPlayerToMap(Player* player)
void BattlegroundMap::RemovePlayerFromMap(Player* player, bool remove)
{
- sLog->outDetail("MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName());
+ sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName());
Map::RemovePlayerFromMap(player, remove);
}
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 6d526f23a94..a2ce227e2ea 100755..100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -176,7 +176,7 @@ class GridMap
bool loadAreaData(FILE* in, uint32 offset, uint32 size);
- bool loadHeihgtData(FILE* in, uint32 offset, uint32 size);
+ bool loadHeightData(FILE* in, uint32 offset, uint32 size);
bool loadLiquidData(FILE* in, uint32 offset, uint32 size);
// Get height functions and pointers
@@ -439,9 +439,9 @@ class Map : public GridRefManager<NGridType>
float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
void Balance() { _dynamicTree.balance(); }
- void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); }
- void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); }
- bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);}
+ void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
+ void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
+ bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
/*
@@ -499,6 +499,7 @@ class Map : public GridRefManager<NGridType>
bool IsGridLoaded(const GridCoord &) const;
void EnsureGridCreated(const GridCoord &);
+ void EnsureGridCreated_i(const GridCoord &);
bool EnsureGridLoaded(Cell const&);
void EnsureGridLoadedForActiveObject(Cell const&, WorldObject* object);
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index 2c1bdb00834..9ca8155e83b 100755..100644
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -24,6 +24,7 @@
#include "InstanceSaveMgr.h"
#include "World.h"
#include "Group.h"
+#include "Player.h"
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DUNGEON_DIFFICULTY_NORMAL)
{
@@ -193,13 +194,13 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
const MapEntry* entry = sMapStore.LookupEntry(GetId());
if (!entry)
{
- sLog->outError("CreateInstance: no entry for map %d", GetId());
+ sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no entry for map %d", GetId());
ASSERT(false);
}
const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId());
if (!iTemplate)
{
- sLog->outError("CreateInstance: no instance template for map %d", GetId());
+ sLog->outError(LOG_FILTER_MAPS, "CreateInstance: no instance template for map %d", GetId());
ASSERT(false);
}
@@ -280,4 +281,4 @@ bool MapInstanced::CanEnter(Player* /*player*/)
{
//ASSERT(false);
return true;
-} \ No newline at end of file
+}
diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h
index 0b1a404630b..0b1a404630b 100755..100644
--- a/src/server/game/Maps/MapInstanced.h
+++ b/src/server/game/Maps/MapInstanced.h
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index e9de3ae001f..96a2a44655d 100755..100644
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -33,6 +33,9 @@
#include "Language.h"
#include "WorldPacket.h"
#include "Group.h"
+#include "Player.h"
+#include "WorldSession.h"
+#include "Opcodes.h"
extern GridState* si_GridStates[]; // debugging code, should be deleted some day
@@ -77,7 +80,7 @@ void MapManager::checkAndCorrectGridStatesArray()
{
if (i_GridStates[i] != si_GridStates[i])
{
- sLog->outError("MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
+ sLog->outError(LOG_FILTER_MAPS, "MapManager::checkGridStates(), GridState: si_GridStates is currupt !!!");
ok = false;
si_GridStates[i] = i_GridStates[i];
}
@@ -192,7 +195,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
// probably there must be special opcode, because client has this string constant in GlobalStrings.lua
// TODO: this is not a good place to send the message
player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetTrinityString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName);
- sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName(), mapName);
+ sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName);
return false;
}
}
@@ -216,15 +219,15 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
{
WorldPacket data(SMSG_CORPSE_NOT_IN_INSTANCE);
player->GetSession()->SendPacket(&data);
- sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName(), mapName);
+ sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName().c_str(), mapName);
return false;
}
- sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName(), mapName);
+ sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName().c_str(), mapName);
player->ResurrectPlayer(0.5f, false);
player->SpawnCorpseBones();
}
else
- sLog->outDebug(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName());
+ sLog->outDebug(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName().c_str());
}
//Get instance where player's group is bound & its map
@@ -411,7 +414,7 @@ uint32 MapManager::GenerateInstanceId()
if (newInstanceId == _nextInstanceId)
{
- sLog->outError("Instance ID overflow!! Can't continue, shutting down server. ");
+ sLog->outError(LOG_FILTER_MAPS, "Instance ID overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
@@ -439,4 +442,4 @@ void MapManager::FreeInstanceId(uint32 instanceId)
SetNextInstanceId(instanceId);
_instanceIds[instanceId] = false;
-} \ No newline at end of file
+}
diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h
index aa07eef2204..aa07eef2204 100755..100644
--- a/src/server/game/Maps/MapManager.h
+++ b/src/server/game/Maps/MapManager.h
diff --git a/src/server/game/Maps/MapRefManager.h b/src/server/game/Maps/MapRefManager.h
index 3976139a18d..3976139a18d 100755..100644
--- a/src/server/game/Maps/MapRefManager.h
+++ b/src/server/game/Maps/MapRefManager.h
diff --git a/src/server/game/Maps/MapReference.h b/src/server/game/Maps/MapReference.h
index 86709fb28ab..86709fb28ab 100755..100644
--- a/src/server/game/Maps/MapReference.h
+++ b/src/server/game/Maps/MapReference.h
diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp
index b747d065a14..5e5f520505c 100644
--- a/src/server/game/Maps/MapUpdater.cpp
+++ b/src/server/game/Maps/MapUpdater.cpp
@@ -69,7 +69,7 @@ MapUpdater::~MapUpdater()
int MapUpdater::activate(size_t num_threads)
{
- return m_executor.activate((int)num_threads, new WDBThreadStartReq1, new WDBThreadEndReq1);
+ return m_executor.start((int)num_threads, new WDBThreadStartReq1, new WDBThreadEndReq1);
}
int MapUpdater::deactivate()
diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h
index df6349a7664..7b20b0ee676 100755..100644
--- a/src/server/game/Maps/ZoneScript.h
+++ b/src/server/game/Maps/ZoneScript.h
@@ -32,19 +32,20 @@ class ZoneScript
virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, CreatureData const* data) { return data->id; }
virtual uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; }
- virtual void OnCreatureCreate(Creature* /*creature*/) {}
- virtual void OnCreatureRemove(Creature* /*creature*/) {}
- virtual void OnGameObjectCreate(GameObject* /*go*/) {}
- virtual void OnGameObjectRemove(GameObject* /*go*/) {}
+ virtual void OnCreatureCreate(Creature *) { }
+ virtual void OnCreatureRemove(Creature *) { }
- virtual void OnUnitDeath(Unit* /*unit*/) {}
+ virtual void OnGameObjectCreate(GameObject *) { }
+ virtual void OnGameObjectRemove(GameObject *) { }
+
+ virtual void OnUnitDeath(Unit*) { }
//All-purpose data storage 64 bit
- virtual uint64 GetData64(uint32 /*DataId*/) { return 0; }
+ virtual uint64 GetData64(uint32 /*DataId*/) const { return 0; }
virtual void SetData64(uint32 /*DataId*/, uint64 /*Value*/) {}
//All-purpose data storage 32 bit
- virtual uint32 GetData(uint32 /*DataId*/) { return 0; }
+ virtual uint32 GetData(uint32 /*DataId*/) const { return 0; }
virtual void SetData(uint32 /*DataId*/, uint32 /*Value*/) {}
virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/) {}
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index bf00514000e..4f358d7a145 100755..100644
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -22,6 +22,7 @@
#include "World.h"
#include "SharedDefines.h"
#include "ScriptMgr.h"
+#include "Player.h"
namespace Trinity
{
@@ -127,7 +128,7 @@ namespace Trinity
nBaseExp = 580;
break;
default:
- sLog->outError("BaseGain: Unsupported content level %u", content);
+ sLog->outError(LOG_FILTER_GENERAL, "BaseGain: Unsupported content level %u", content);
nBaseExp = 45;
break;
}
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index aec72835d86..df5f45622f8 100755..100644
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -337,7 +337,13 @@ enum TrinityStrings
LANG_TITLE_REMOVE_RES = 354,
LANG_TITLE_CURRENT_RES = 355,
LANG_CURRENT_TITLE_RESET = 356,
- // Room for more level 2 357-399 not used
+ LANG_COMMAND_CHEAT_STATUS = 357,
+ LANG_COMMAND_CHEAT_GOD = 358,
+ LANG_COMMAND_CHEAT_CT = 359,
+ LANG_COMMAND_CHEAT_CD = 360,
+ LANG_COMMAND_CHEAT_POWER = 361,
+ LANG_COMMAND_CHEAT_WW = 362,
+ // Room for more level 2 363-399 not used
// level 3 chat
LANG_SCRIPTS_RELOADED = 400,
@@ -943,8 +949,8 @@ enum TrinityStrings
LANG_BATTLEGROUND = 5015,
LANG_ARENA = 5016,
LANG_RAID = 5017,
- LANG_HEROIC = 5018,
- LANG_MOUNTABLE = 5019,
+ //= 5018,
+ //= 5019,
LANG_NPCINFO_PHASEMASK = 5020,
LANG_NPCINFO_ARMOR = 5021,
LANG_CHANNEL_ENABLE_OWNERSHIP = 5022,
@@ -957,7 +963,10 @@ enum TrinityStrings
LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029,
LANG_FLEE = 5030,
LANG_NPCINFO_AIINFO = 5031,
- // Room for more Trinity strings 5032-9999
+ LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032,
+ LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033,
+ LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034,
+ // Room for more Trinity strings 5035-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,
@@ -980,6 +989,27 @@ enum TrinityStrings
LANG_WORLD_CLOSED = 7523,
LANG_WORLD_OPENED = 7524,
+ LANG_LFG_PLAYER_INFO = 9980,
+ LANG_LFG_GROUP_INFO = 9981,
+ LANG_LFG_NOT_IN_GROUP = 9982,
+ LANG_LFG_CLEAN = 9983,
+ LANG_LFG_OPTIONS = 9984,
+ LANG_LFG_OPTIONS_CHANGED = 9985,
+ LANG_LFG_STATE_NONE = 9986,
+ LANG_LFG_STATE_ROLECHECK = 9987,
+ LANG_LFG_STATE_QUEUED = 9988,
+ LANG_LFG_STATE_PROPOSAL = 9989,
+ LANG_LFG_STATE_BOOT = 9990,
+ LANG_LFG_STATE_DUNGEON = 9991,
+ LANG_LFG_STATE_FINISHED_DUNGEON = 9992,
+ LANG_LFG_STATE_RAIDBROWSER = 9993,
+ LANG_LFG_ROLE_TANK = 9994,
+ LANG_LFG_ROLE_HEALER = 9995,
+ LANG_LFG_ROLE_DAMAGE = 9996,
+ LANG_LFG_ROLE_LEADER = 9997,
+ LANG_LFG_ROLE_NONE = 9998,
+ LANG_LFG_ERROR = 9999,
+
// Use for not-in-offcial-sources patches
// 10000-10999
// opvp hp
@@ -1073,4 +1103,3 @@ enum TrinityStrings
// For other tables maybe 2000010000-2147483647 (max index)
};
#endif
-
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index f74d6c44be7..e3cf975e92f 100755..100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -26,7 +26,7 @@ enum SpellEffIndex
{
EFFECT_0 = 0,
EFFECT_1 = 1,
- EFFECT_2 = 2,
+ EFFECT_2 = 2
};
// used in script definitions
@@ -36,11 +36,11 @@ enum SpellEffIndex
// loot modes for creatures and gameobjects, bitmask!
enum LootModes
{
- LOOT_MODE_DEFAULT = 1,
- LOOT_MODE_HARD_MODE_1 = 2,
- LOOT_MODE_HARD_MODE_2 = 4,
- LOOT_MODE_HARD_MODE_3 = 8,
- LOOT_MODE_HARD_MODE_4 = 16
+ LOOT_MODE_DEFAULT = 0x1,
+ LOOT_MODE_HARD_MODE_1 = 0x2,
+ LOOT_MODE_HARD_MODE_2 = 0x4,
+ LOOT_MODE_HARD_MODE_3 = 0x8,
+ LOOT_MODE_HARD_MODE_4 = 0x10
};
enum Gender
@@ -53,28 +53,28 @@ enum Gender
// Race value is index in ChrRaces.dbc
enum Races
{
- RACE_NONE = 0,
- RACE_HUMAN = 1,
- RACE_ORC = 2,
- RACE_DWARF = 3,
- RACE_NIGHTELF = 4,
- RACE_UNDEAD_PLAYER = 5,
- RACE_TAUREN = 6,
- RACE_GNOME = 7,
- RACE_TROLL = 8,
- //RACE_GOBLIN = 9,
- RACE_BLOODELF = 10,
- RACE_DRAENEI = 11
- //RACE_FEL_ORC = 12,
- //RACE_NAGA = 13,
- //RACE_BROKEN = 14,
- //RACE_SKELETON = 15,
- //RACE_VRYKUL = 16,
- //RACE_TUSKARR = 17,
- //RACE_FOREST_TROLL = 18,
- //RACE_TAUNKA = 19,
+ RACE_NONE = 0,
+ RACE_HUMAN = 1,
+ RACE_ORC = 2,
+ RACE_DWARF = 3,
+ RACE_NIGHTELF = 4,
+ RACE_UNDEAD_PLAYER = 5,
+ RACE_TAUREN = 6,
+ RACE_GNOME = 7,
+ RACE_TROLL = 8,
+ //RACE_GOBLIN = 9,
+ RACE_BLOODELF = 10,
+ RACE_DRAENEI = 11
+ //RACE_FEL_ORC = 12,
+ //RACE_NAGA = 13,
+ //RACE_BROKEN = 14,
+ //RACE_SKELETON = 15,
+ //RACE_VRYKUL = 16,
+ //RACE_TUSKARR = 17,
+ //RACE_FOREST_TROLL = 18,
+ //RACE_TAUNKA = 19,
//RACE_NORTHREND_SKELETON = 20,
- //RACE_ICE_TROLL = 21
+ //RACE_ICE_TROLL = 21
};
// max+1 for player race
@@ -82,13 +82,13 @@ enum Races
#define RACEMASK_ALL_PLAYABLE \
((1<<(RACE_HUMAN-1)) |(1<<(RACE_ORC-1)) |(1<<(RACE_DWARF-1)) | \
- (1<<(RACE_NIGHTELF-1))|(1<<(RACE_UNDEAD_PLAYER-1))|(1<<(RACE_TAUREN-1)) | \
- (1<<(RACE_GNOME-1)) |(1<<(RACE_TROLL-1)) |(1<<(RACE_BLOODELF-1))| \
- (1<<(RACE_DRAENEI-1)))
+ (1<<(RACE_NIGHTELF-1))|(1<<(RACE_UNDEAD_PLAYER-1))|(1<<(RACE_TAUREN-1)) | \
+ (1<<(RACE_GNOME-1)) |(1<<(RACE_TROLL-1)) |(1<<(RACE_BLOODELF-1))| \
+ (1<<(RACE_DRAENEI-1)))
#define RACEMASK_ALLIANCE \
((1<<(RACE_HUMAN-1)) | (1<<(RACE_DWARF-1)) | (1<<(RACE_NIGHTELF-1)) | \
- (1<<(RACE_GNOME-1)) | (1<<(RACE_DRAENEI-1)))
+ (1<<(RACE_GNOME-1)) | (1<<(RACE_DRAENEI-1)))
#define RACEMASK_HORDE RACEMASK_ALL_PLAYABLE & ~RACEMASK_ALLIANCE
@@ -124,7 +124,7 @@ enum UnitClass
UNIT_CLASS_WARRIOR = 1,
UNIT_CLASS_PALADIN = 2,
UNIT_CLASS_ROGUE = 4,
- UNIT_CLASS_MAGE = 8,
+ UNIT_CLASS_MAGE = 8
};
#define CLASSMASK_ALL_CREATURES ((1<<(UNIT_CLASS_WARRIOR-1)) | (1<<(UNIT_CLASS_PALADIN-1)) | (1<<(UNIT_CLASS_ROGUE-1)) | (1<<(UNIT_CLASS_MAGE-1)))
@@ -245,7 +245,7 @@ enum ItemQualities
enum SpellCategory
{
SPELL_CATEGORY_FOOD = 11,
- SPELL_CATEGORY_DRINK = 59,
+ SPELL_CATEGORY_DRINK = 59
};
const uint32 ItemQualityColors[MAX_ITEM_QUALITY] =
@@ -465,7 +465,7 @@ enum SpellAttr5
SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped
SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared
SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused
- SPELL_ATTR5_UNK19 = 0x00080000, // 19
+ SPELL_ATTR5_DONT_TURN_DURING_CAST = 0x00080000, // 19 Blocks caster's turning when casting (client does not automatically turn caster's model to face UNIT_FIELD_TARGET)
SPELL_ATTR5_UNK20 = 0x00100000, // 20
SPELL_ATTR5_UNK21 = 0x00200000, // 21
SPELL_ATTR5_UNK22 = 0x00400000, // 22
@@ -572,7 +572,7 @@ enum SpellClickCastFlags
{
NPC_CLICK_CAST_CASTER_CLICKER = 0x01,
NPC_CLICK_CAST_TARGET_CLICKER = 0x02,
- NPC_CLICK_CAST_ORIG_CASTER_OWNER = 0x04,
+ NPC_CLICK_CAST_ORIG_CASTER_OWNER = 0x04
};
enum SheathTypes
@@ -642,7 +642,7 @@ enum TeamId
{
TEAM_ALLIANCE = 0,
TEAM_HORDE,
- TEAM_NEUTRAL,
+ TEAM_NEUTRAL
};
enum Team
@@ -654,7 +654,7 @@ enum Team
//TEAM_HORDE_FORCES = 892,
//TEAM_SANCTUARY = 936,
//TEAM_OUTLAND = 980,
- TEAM_OTHER = 0, // if ReputationListId > 0 && Flags != FACTION_FLAG_TEAM_HEADER
+ TEAM_OTHER = 0 // if ReputationListId > 0 && Flags != FACTION_FLAG_TEAM_HEADER
};
enum SpellEffects
@@ -1121,7 +1121,7 @@ enum SpellCustomErrors
SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_RECRUITS = 96, // You already have the max number of recruits.
SPELL_CUSTOM_ERROR_MAX_NUMBER_OF_VOLUNTEERS = 97, // You already have the max number of volunteers.
SPELL_CUSTOM_ERROR_FROSTMOURNE_RENDERED_RESSURECT = 98, // Frostmourne has rendered you unable to ressurect.
- SPELL_CUSTOM_ERROR_CANT_MOUNT_WITH_SHAPESHIFT = 99, // You can't mount while affected by that shapeshift.
+ SPELL_CUSTOM_ERROR_CANT_MOUNT_WITH_SHAPESHIFT = 99 // You can't mount while affected by that shapeshift.
};
enum StealthType
@@ -1192,7 +1192,7 @@ enum AuraStateType
//AURA_STATE_UNKNOWN20 = 20, // c | only (45317 Suicide)
//AURA_STATE_UNKNOWN21 = 21, // | not used
AURA_STATE_UNKNOWN22 = 22, // C t| varius spells (63884, 50240)
- AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23, // C |
+ AURA_STATE_HEALTH_ABOVE_75_PERCENT = 23 // C |
};
#define PER_CASTER_AURA_STATE_MASK (\
@@ -1485,7 +1485,7 @@ enum GameObjectFlags
GO_FLAG_NODESPAWN = 0x00000020, // never despawn, typically for doors, they just change state
GO_FLAG_TRIGGERED = 0x00000040, // typically, summoned objects. Triggered by spell or other events
GO_FLAG_DAMAGED = 0x00000200,
- GO_FLAG_DESTROYED = 0x00000400,
+ GO_FLAG_DESTROYED = 0x00000400
};
enum GameObjectDynamicLowFlags
@@ -1493,7 +1493,7 @@ enum GameObjectDynamicLowFlags
GO_DYNFLAG_LO_ACTIVATE = 0x01, // enables interaction with GO
GO_DYNFLAG_LO_ANIMATE = 0x02, // possibly more distinct animation of GO
GO_DYNFLAG_LO_NO_INTERACT = 0x04, // appears to disable interaction (not fully verified)
- GO_DYNFLAG_LO_SPARKLE = 0x08, // makes GO sparkle
+ GO_DYNFLAG_LO_SPARKLE = 0x08 // makes GO sparkle
};
enum GameObjectDestructibleState
@@ -1501,7 +1501,7 @@ enum GameObjectDestructibleState
GO_DESTRUCTIBLE_INTACT = 0,
GO_DESTRUCTIBLE_DAMAGED = 1,
GO_DESTRUCTIBLE_DESTROYED = 2,
- GO_DESTRUCTIBLE_REBUILDING = 3,
+ GO_DESTRUCTIBLE_REBUILDING = 3
};
// EmotesText.dbc
@@ -1758,7 +1758,7 @@ enum TextEmotes
TEXT_EMOTE_LOOK = 449,
TEXT_EMOTE_OBJECT = 450,
TEXT_EMOTE_SWEAT = 451,
- TEXT_EMOTE_YW = 453,
+ TEXT_EMOTE_YW = 453
};
// Emotes.dbc
@@ -2519,47 +2519,47 @@ uint32 const CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL = (1 << (CREATURE_TYPE_ME
// CreatureFamily.dbc
enum CreatureFamily
{
- CREATURE_FAMILY_WOLF = 1,
- CREATURE_FAMILY_CAT = 2,
- CREATURE_FAMILY_SPIDER = 3,
- CREATURE_FAMILY_BEAR = 4,
- CREATURE_FAMILY_BOAR = 5,
- CREATURE_FAMILY_CROCOLISK = 6,
- CREATURE_FAMILY_CARRION_BIRD = 7,
- CREATURE_FAMILY_CRAB = 8,
- CREATURE_FAMILY_GORILLA = 9,
- CREATURE_FAMILY_HORSE_CUSTOM = 10, // not exist in DBC but used for horse like beasts in DB
- CREATURE_FAMILY_RAPTOR = 11,
- CREATURE_FAMILY_TALLSTRIDER = 12,
- CREATURE_FAMILY_FELHUNTER = 15,
- CREATURE_FAMILY_VOIDWALKER = 16,
- CREATURE_FAMILY_SUCCUBUS = 17,
- CREATURE_FAMILY_DOOMGUARD = 19,
- CREATURE_FAMILY_SCORPID = 20,
- CREATURE_FAMILY_TURTLE = 21,
- CREATURE_FAMILY_IMP = 23,
- CREATURE_FAMILY_BAT = 24,
- CREATURE_FAMILY_HYENA = 25,
- CREATURE_FAMILY_BIRD_OF_PREY = 26,
- CREATURE_FAMILY_WIND_SERPENT = 27,
- CREATURE_FAMILY_REMOTE_CONTROL = 28,
- CREATURE_FAMILY_FELGUARD = 29,
- CREATURE_FAMILY_DRAGONHAWK = 30,
- CREATURE_FAMILY_RAVAGER = 31,
- CREATURE_FAMILY_WARP_STALKER = 32,
- CREATURE_FAMILY_SPOREBAT = 33,
- CREATURE_FAMILY_NETHER_RAY = 34,
- CREATURE_FAMILY_SERPENT = 35,
- CREATURE_FAMILY_MOTH = 37,
- CREATURE_FAMILY_CHIMAERA = 38,
- CREATURE_FAMILY_DEVILSAUR = 39,
- CREATURE_FAMILY_GHOUL = 40,
- CREATURE_FAMILY_SILITHID = 41,
- CREATURE_FAMILY_WORM = 42,
- CREATURE_FAMILY_RHINO = 43,
- CREATURE_FAMILY_WASP = 44,
- CREATURE_FAMILY_CORE_HOUND = 45,
- CREATURE_FAMILY_SPIRIT_BEAST = 46
+ CREATURE_FAMILY_WOLF = 1,
+ CREATURE_FAMILY_CAT = 2,
+ CREATURE_FAMILY_SPIDER = 3,
+ CREATURE_FAMILY_BEAR = 4,
+ CREATURE_FAMILY_BOAR = 5,
+ CREATURE_FAMILY_CROCOLISK = 6,
+ CREATURE_FAMILY_CARRION_BIRD = 7,
+ CREATURE_FAMILY_CRAB = 8,
+ CREATURE_FAMILY_GORILLA = 9,
+ CREATURE_FAMILY_HORSE_CUSTOM = 10, // Does not exist in DBC but used for horse like beasts in DB
+ CREATURE_FAMILY_RAPTOR = 11,
+ CREATURE_FAMILY_TALLSTRIDER = 12,
+ CREATURE_FAMILY_FELHUNTER = 15,
+ CREATURE_FAMILY_VOIDWALKER = 16,
+ CREATURE_FAMILY_SUCCUBUS = 17,
+ CREATURE_FAMILY_DOOMGUARD = 19,
+ CREATURE_FAMILY_SCORPID = 20,
+ CREATURE_FAMILY_TURTLE = 21,
+ CREATURE_FAMILY_IMP = 23,
+ CREATURE_FAMILY_BAT = 24,
+ CREATURE_FAMILY_HYENA = 25,
+ CREATURE_FAMILY_BIRD_OF_PREY = 26,
+ CREATURE_FAMILY_WIND_SERPENT = 27,
+ CREATURE_FAMILY_REMOTE_CONTROL = 28,
+ CREATURE_FAMILY_FELGUARD = 29,
+ CREATURE_FAMILY_DRAGONHAWK = 30,
+ CREATURE_FAMILY_RAVAGER = 31,
+ CREATURE_FAMILY_WARP_STALKER = 32,
+ CREATURE_FAMILY_SPOREBAT = 33,
+ CREATURE_FAMILY_NETHER_RAY = 34,
+ CREATURE_FAMILY_SERPENT = 35,
+ CREATURE_FAMILY_MOTH = 37,
+ CREATURE_FAMILY_CHIMAERA = 38,
+ CREATURE_FAMILY_DEVILSAUR = 39,
+ CREATURE_FAMILY_GHOUL = 40,
+ CREATURE_FAMILY_SILITHID = 41,
+ CREATURE_FAMILY_WORM = 42,
+ CREATURE_FAMILY_RHINO = 43,
+ CREATURE_FAMILY_WASP = 44,
+ CREATURE_FAMILY_CORE_HOUND = 45,
+ CREATURE_FAMILY_SPIRIT_BEAST = 46
};
enum CreatureTypeFlags
@@ -2595,7 +2595,7 @@ enum CreatureTypeFlags
CREATURE_TYPEFLAGS_UNK28 = 0x10000000,
CREATURE_TYPEFLAGS_UNK29 = 0x20000000,
CREATURE_TYPEFLAGS_UNK30 = 0x40000000,
- CREATURE_TYPEFLAGS_UNK31 = 0x80000000,
+ CREATURE_TYPEFLAGS_UNK31 = 0x80000000
};
enum CreatureEliteType
@@ -2700,7 +2700,7 @@ enum QuestSort
QUEST_SORT_JEWELCRAFTING = 373,
QUEST_SORT_NOBLEGARDEN = 374,
QUEST_SORT_PILGRIMS_BOUNTY = 375,
- QUEST_SORT_LOVE_IS_IN_THE_AIR = 376,
+ QUEST_SORT_LOVE_IS_IN_THE_AIR = 376
};
inline uint8 ClassByQuestSort(int32 QuestSort)
@@ -2992,7 +2992,7 @@ enum WeatherType
enum ChatMsg
{
- CHAT_MSG_ADDON = 0xFFFFFFFF,
+ CHAT_MSG_ADDON = 0xFFFFFFFF, // -1
CHAT_MSG_SYSTEM = 0x00,
CHAT_MSG_SAY = 0x01,
CHAT_MSG_PARTY = 0x02,
@@ -3076,8 +3076,11 @@ enum PetDiet
#define CHAIN_SPELL_JUMP_RADIUS 8
-#define GUILD_BANKLOG_MAX_RECORDS 25
-#define GUILD_EVENTLOG_MAX_RECORDS 100
+enum GuildLogs
+{
+ GUILD_BANKLOG_MAX_RECORDS = 25,
+ GUILD_EVENTLOG_MAX_RECORDS = 100,
+};
enum AiReaction
{
@@ -3085,7 +3088,7 @@ enum AiReaction
AI_REACTION_FRIENDLY = 1, // (NOT used in client packet handler)
AI_REACTION_HOSTILE = 2, // sent on every attack, triggers aggro sound (used in client packet handler)
AI_REACTION_AFRAID = 3, // seen for polymorph (when AI not in control of self?) (NOT used in client packet handler)
- AI_REACTION_DESTROY = 4, // used on object destroy (NOT used in client packet handler)
+ AI_REACTION_DESTROY = 4 // used on object destroy (NOT used in client packet handler)
};
// Diminishing Returns Types
@@ -3119,7 +3122,7 @@ enum DiminishingGroup
DIMINISHING_SLEEP = 17,
DIMINISHING_TAUNT = 18,
DIMINISHING_LIMITONLY = 19,
- DIMINISHING_DRAGONS_BREATH = 20,
+ DIMINISHING_DRAGONS_BREATH = 20
};
enum SummonCategory
@@ -3129,7 +3132,7 @@ enum SummonCategory
SUMMON_CATEGORY_PET = 2,
SUMMON_CATEGORY_PUPPET = 3,
SUMMON_CATEGORY_VEHICLE = 4,
- SUMMON_CATEGORY_UNK = 5, // as of patch 3.3.5a only Bone Spike in Icecrown Citadel
+ SUMMON_CATEGORY_UNK = 5 // as of patch 3.3.5a only Bone Spike in Icecrown Citadel
// uses this category
};
@@ -3146,12 +3149,13 @@ enum SummonType
SUMMON_TYPE_WILD3 = 8,
SUMMON_TYPE_VEHICLE = 9,
SUMMON_TYPE_VEHICLE2 = 10,
- SUMMON_TYPE_OBJECT = 11,
+ SUMMON_TYPE_OBJECT = 11
};
enum EventId
{
EVENT_CHARGE = 1003,
+ EVENT_JUMP = 1004
};
enum ResponseCodes
@@ -3230,9 +3234,7 @@ enum ResponseCodes
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,
@@ -3292,20 +3294,20 @@ enum BanReturn
// indexes of BattlemasterList.dbc
enum BattlegroundTypeId
{
- BATTLEGROUND_TYPE_NONE = 0, // None
- BATTLEGROUND_AV = 1, // Alterac Valley
- BATTLEGROUND_WS = 2, // Warsong Gulch
- BATTLEGROUND_AB = 3, // Arathi Basin
- BATTLEGROUND_NA = 4, // Nagrand Arena
- BATTLEGROUND_BE = 5, // Blade's Edge Arena
- BATTLEGROUND_AA = 6, // All Arenas
- BATTLEGROUND_EY = 7, // Eye of the Storm
- BATTLEGROUND_RL = 8, // Ruins of Lordaernon
- BATTLEGROUND_SA = 9, // Strand of the Ancients
- BATTLEGROUND_DS = 10, // Dalaran Sewers
- BATTLEGROUND_RV = 11, // Ring of Valor
- BATTLEGROUND_IC = 30, // Isle of Conquest
- BATTLEGROUND_RB = 32 // Random Battleground
+ BATTLEGROUND_TYPE_NONE = 0, // None
+ BATTLEGROUND_AV = 1, // Alterac Valley
+ BATTLEGROUND_WS = 2, // Warsong Gulch
+ BATTLEGROUND_AB = 3, // Arathi Basin
+ BATTLEGROUND_NA = 4, // Nagrand Arena
+ BATTLEGROUND_BE = 5, // Blade's Edge Arena
+ BATTLEGROUND_AA = 6, // All Arenas
+ BATTLEGROUND_EY = 7, // Eye of the Storm
+ BATTLEGROUND_RL = 8, // Ruins of Lordaernon
+ BATTLEGROUND_SA = 9, // Strand of the Ancients
+ BATTLEGROUND_DS = 10, // Dalaran Sewers
+ BATTLEGROUND_RV = 11, // Ring of Valor
+ BATTLEGROUND_IC = 30, // Isle of Conquest
+ BATTLEGROUND_RB = 32 // Random Battleground
};
#define MAX_BATTLEGROUND_TYPE_ID 33
@@ -3335,7 +3337,7 @@ enum MailResponseResult
MAIL_ERR_MAIL_AND_CHAT_SUSPENDED = 17,
MAIL_ERR_TOO_MANY_ATTACHMENTS = 18,
MAIL_ERR_MAIL_ATTACHMENT_INVALID = 19,
- MAIL_ERR_ITEM_HAS_EXPIRED = 21,
+ MAIL_ERR_ITEM_HAS_EXPIRED = 21
};
enum SpellFamilyNames
@@ -3399,9 +3401,10 @@ enum XPColorChar
enum RemoveMethod
{
- GROUP_REMOVEMETHOD_DEFAULT = 0,
- GROUP_REMOVEMETHOD_KICK = 1,
- GROUP_REMOVEMETHOD_LEAVE = 2,
+ GROUP_REMOVEMETHOD_DEFAULT = 0,
+ GROUP_REMOVEMETHOD_KICK = 1,
+ GROUP_REMOVEMETHOD_LEAVE = 2,
+ GROUP_REMOVEMETHOD_KICK_LFG = 3
};
enum ActivateTaxiReply
@@ -3421,105 +3424,112 @@ enum ActivateTaxiReply
ERR_TAXINOTSTANDING = 12
};
-// Calendar - start
-
-enum CalendarFlags
-{
- CALENDAR_FLAG_ALL_ALLOWED = 0x001,
- CALENDAR_FLAG_INVITES_LOCKED = 0x010,
- CALENDAR_FLAG_WITHOUT_INVITES = 0x040,
- CALENDAR_FLAG_GUILD_ONLY = 0x400,
-};
-
-enum CalendarActionData
-{
- CALENDAR_ACTION_NONE,
- CALENDAR_ACTION_ADD_EVENT,
- CALENDAR_ACTION_MODIFY_EVENT,
- CALENDAR_ACTION_REMOVE_EVENT,
- CALENDAR_ACTION_COPY_EVENT,
- CALENDAR_ACTION_ADD_EVENT_INVITE,
- CALENDAR_ACTION_MODIFY_EVENT_INVITE,
- CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE,
- CALENDAR_ACTION_REMOVE_EVENT_INVITE,
- CALENDAR_ACTION_SIGNUP_TO_EVENT,
+enum DuelCompleteType
+{
+ DUEL_INTERRUPTED = 0,
+ DUEL_WON = 1,
+ DUEL_FLED = 2
+};
+// handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time
+enum BattlegroundQueueTypeId
+{
+ BATTLEGROUND_QUEUE_NONE = 0,
+ BATTLEGROUND_QUEUE_AV = 1,
+ BATTLEGROUND_QUEUE_WS = 2,
+ BATTLEGROUND_QUEUE_AB = 3,
+ BATTLEGROUND_QUEUE_EY = 4,
+ BATTLEGROUND_QUEUE_SA = 5,
+ BATTLEGROUND_QUEUE_IC = 6,
+ BATTLEGROUND_QUEUE_RB = 7,
+ BATTLEGROUND_QUEUE_2v2 = 8,
+ BATTLEGROUND_QUEUE_3v3 = 9,
+ BATTLEGROUND_QUEUE_5v5 = 10,
+ MAX_BATTLEGROUND_QUEUE_TYPES
+};
+
+enum GroupJoinBattlegroundResult
+{
+ // positive values are indexes in BattlemasterList.dbc
+ ERR_GROUP_JOIN_BATTLEGROUND_FAIL = 0, // Your group has joined a battleground queue, but you are not eligible (showed for non existing BattlemasterList.dbc indexes)
+ ERR_BATTLEGROUND_NONE = -1, // not show anything
+ ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS = -2, // You cannot join the battleground yet because you or one of your party members is flagged as a Deserter.
+ ERR_ARENA_TEAM_PARTY_SIZE = -3, // Incorrect party size for this arena.
+ ERR_BATTLEGROUND_TOO_MANY_QUEUES = -4, // You can only be queued for 2 battles at once
+ ERR_BATTLEGROUND_CANNOT_QUEUE_FOR_RATED = -5, // You cannot queue for a rated match while queued for other battles
+ ERR_BATTLEDGROUND_QUEUED_FOR_RATED = -6, // You cannot queue for another battle while queued for a rated arena match
+ ERR_BATTLEGROUND_TEAM_LEFT_QUEUE = -7, // Your team has left the arena queue
+ ERR_BATTLEGROUND_NOT_IN_BATTLEGROUND = -8, // You can't do that in a battleground.
+ ERR_BATTLEGROUND_JOIN_XP_GAIN = -9, // wtf, doesn't exist in client...
+ ERR_BATTLEGROUND_JOIN_RANGE_INDEX = -10, // Cannot join the queue unless all members of your party are in the same battleground level range.
+ ERR_BATTLEGROUND_JOIN_TIMED_OUT = -11, // %s was unavailable to join the queue. (uint64 guid exist in client cache)
+ ERR_BATTLEGROUND_JOIN_FAILED = -12, // Join as a group failed (uint64 guid doesn't exist in client cache)
+ ERR_LFG_CANT_USE_BATTLEGROUND = -13, // You cannot queue for a battleground or arena while using the dungeon system.
+ ERR_IN_RANDOM_BG = -14, // Can't do that while in a Random Battleground queue.
+ ERR_IN_NON_RANDOM_BG = -15 // Can't queue for Random Battleground while in another Battleground queue.
+};
+
+enum PetNameInvalidReason
+{
+ // custom, not send
+ PET_NAME_SUCCESS = 0,
+
+ PET_NAME_INVALID = 1,
+ PET_NAME_NO_NAME = 2,
+ PET_NAME_TOO_SHORT = 3,
+ PET_NAME_TOO_LONG = 4,
+ PET_NAME_MIXED_LANGUAGES = 6,
+ PET_NAME_PROFANE = 7,
+ PET_NAME_RESERVED = 8,
+ PET_NAME_THREE_CONSECUTIVE = 11,
+ PET_NAME_INVALID_SPACE = 12,
+ PET_NAME_CONSECUTIVE_SPACES = 13,
+ PET_NAME_RUSSIAN_CONSECUTIVE_SILENT_CHARACTERS = 14,
+ PET_NAME_RUSSIAN_SILENT_CHARACTER_AT_BEGINNING_OR_END = 15,
+ PET_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME = 16
+};
+
+enum DungeonStatusFlag
+{
+ DUNGEON_STATUSFLAG_NORMAL = 0x01,
+ DUNGEON_STATUSFLAG_HEROIC = 0x02,
+
+ RAID_STATUSFLAG_10MAN_NORMAL = 0x01,
+ RAID_STATUSFLAG_25MAN_NORMAL = 0x02,
+ RAID_STATUSFLAG_10MAN_HEROIC = 0x04,
+ RAID_STATUSFLAG_25MAN_HEROIC = 0x08
+};
+
+enum PartyResult
+{
+ ERR_PARTY_RESULT_OK = 0,
+ ERR_BAD_PLAYER_NAME_S = 1,
+ ERR_TARGET_NOT_IN_GROUP_S = 2,
+ ERR_TARGET_NOT_IN_INSTANCE_S = 3,
+ ERR_GROUP_FULL = 4,
+ ERR_ALREADY_IN_GROUP_S = 5,
+ ERR_NOT_IN_GROUP = 6,
+ ERR_NOT_LEADER = 7,
+ ERR_PLAYER_WRONG_FACTION = 8,
+ ERR_IGNORING_YOU_S = 9,
+ ERR_LFG_PENDING = 12,
+ ERR_INVITE_RESTRICTED = 13,
+ ERR_GROUP_SWAP_FAILED = 14, // if (PartyOperation == PARTY_OP_SWAP) ERR_GROUP_SWAP_FAILED else ERR_INVITE_IN_COMBAT
+ ERR_INVITE_UNKNOWN_REALM = 15,
+ ERR_INVITE_NO_PARTY_SERVER = 16,
+ ERR_INVITE_PARTY_BUSY = 17,
+ ERR_PARTY_TARGET_AMBIGUOUS = 18,
+ ERR_PARTY_LFG_INVITE_RAID_LOCKED = 19,
+ ERR_PARTY_LFG_BOOT_LIMIT = 20,
+ ERR_PARTY_LFG_BOOT_COOLDOWN_S = 21,
+ ERR_PARTY_LFG_BOOT_IN_PROGRESS = 22,
+ ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS = 23,
+ ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S = 24,
+ ERR_RAID_DISALLOWED_BY_LEVEL = 25,
+ ERR_PARTY_LFG_BOOT_IN_COMBAT = 26,
+ ERR_VOTE_KICK_REASON_NEEDED = 27,
+ ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE = 28,
+ ERR_PARTY_LFG_BOOT_LOOT_ROLLS = 29,
+ ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
};
-enum CalendarModerationRank
-{
- CALENDAR_RANK_PLAYER,
- CALENDAR_RANK_MODERATOR,
- CALENDAR_RANK_OWNER,
-};
-
-enum CalendarSendEventType
-{
- CALENDAR_SENDTYPE_GET,
- CALENDAR_SENDTYPE_ADD,
- CALENDAR_SENDTYPE_COPY,
-};
-
-enum CalendarEventType
-{
- CALENDAR_TYPE_RAID,
- CALENDAR_TYPE_DUNGEON,
- CALENDAR_TYPE_PVP,
- CALENDAR_TYPE_MEETING,
- CALENDAR_TYPE_OTHER,
-};
-
-enum CalendarInviteStatus
-{
- CALENDAR_STATUS_INVITED,
- CALENDAR_STATUS_ACCEPTED,
- CALENDAR_STATUS_DECLINED,
- CALENDAR_STATUS_TENTATIVE,
- CALENDAR_STATUS_OUT,
- CALENDAR_STATUS_STANDBY,
- CALENDAR_STATUS_CONFIRMED,
- CALENDAR_STATUS_NO_OWNER,
- CALENDAR_STATUS_8,
- CALENDAR_STATUS_9,
-};
-
-enum CalendarError
-{
- CALENDAR_OK = 0,
- CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1,
- CALENDAR_ERROR_EVENTS_EXCEEDED = 2,
- CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3,
- CALENDAR_ERROR_OTHER_INVITES_EXCEEDED = 4,
- CALENDAR_ERROR_PERMISSIONS = 5,
- CALENDAR_ERROR_EVENT_INVALID = 6,
- CALENDAR_ERROR_NOT_INVITED = 7,
- CALENDAR_ERROR_INTERNAL = 8,
- CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9,
- CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10,
- CALENDAR_ERROR_PLAYER_NOT_FOUND = 11,
- CALENDAR_ERROR_NOT_ALLIED = 12,
- CALENDAR_ERROR_IGNORING_YOU_S = 13,
- CALENDAR_ERROR_INVITES_EXCEEDED = 14,
- CALENDAR_ERROR_INVALID_DATE = 16,
- CALENDAR_ERROR_INVALID_TIME = 17,
-
- CALENDAR_ERROR_NEEDS_TITLE = 19,
- CALENDAR_ERROR_EVENT_PASSED = 20,
- CALENDAR_ERROR_EVENT_LOCKED = 21,
- CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22,
- CALENDAR_ERROR_SYSTEM_DISABLED = 24,
- CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25,
- CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26,
- CALENDAR_ERROR_RESTRICTED_LEVEL = 27,
- CALENDAR_ERROR_USER_SQUELCHED = 28,
- CALENDAR_ERROR_NO_INVITE = 29,
-
- CALENDAR_ERROR_EVENT_WRONG_SERVER = 36,
- CALENDAR_ERROR_INVITE_WRONG_SERVER = 37,
- CALENDAR_ERROR_NO_GUILD_INVITES = 38,
- CALENDAR_ERROR_INVALID_SIGNUP = 39,
- CALENDAR_ERROR_NO_MODERATOR = 40
-};
-
-// Calendar - end
-
#endif
diff --git a/src/server/game/Movement/FollowerRefManager.h b/src/server/game/Movement/FollowerRefManager.h
index 5066804d60f..5066804d60f 100755..100644
--- a/src/server/game/Movement/FollowerRefManager.h
+++ b/src/server/game/Movement/FollowerRefManager.h
diff --git a/src/server/game/Movement/FollowerReference.cpp b/src/server/game/Movement/FollowerReference.cpp
index 997d066a9f2..997d066a9f2 100755..100644
--- a/src/server/game/Movement/FollowerReference.cpp
+++ b/src/server/game/Movement/FollowerReference.cpp
diff --git a/src/server/game/Movement/FollowerReference.h b/src/server/game/Movement/FollowerReference.h
index 6a1a3719cb8..6a1a3719cb8 100755..100644
--- a/src/server/game/Movement/FollowerReference.h
+++ b/src/server/game/Movement/FollowerReference.h
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index bc0570bb73b..488dbfc9159 100755..100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -44,7 +44,8 @@ void MotionMaster::Initialize()
{
MovementGenerator *curr = top();
pop();
- if (curr) DirectDelete(curr);
+ if (curr)
+ DirectDelete(curr);
}
InitDefault();
@@ -189,7 +190,7 @@ void MotionMaster::MoveRandom(float spawndist)
{
if (_owner->GetTypeId() == TYPEID_UNIT)
{
- sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE);
}
}
@@ -200,22 +201,22 @@ void MotionMaster::MoveTargetedHome()
if (_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)_owner)->GetCharmerOrOwnerGUID())
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow());
Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE);
}
else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID())
{
- sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow());
Unit *target = ((Creature*)_owner)->GetCharmerOrOwner();
if (target)
{
- sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
Mutate(new FollowMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE), MOTION_SLOT_ACTIVE);
}
}
else
{
- sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow());
+ sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow());
}
}
@@ -223,12 +224,12 @@ void MotionMaster::MoveConfused()
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) move confused", _owner->GetGUIDLow());
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) move confused",
_owner->GetEntry(), _owner->GetGUIDLow());
Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED);
}
@@ -243,7 +244,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
//_owner->ClearUnitState(UNIT_STATE_FOLLOW);
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) chase to %s (GUID: %u)",
_owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
@@ -251,7 +252,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
@@ -268,14 +269,14 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
//_owner->AddUnitState(UNIT_STATE_FOLLOW);
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
Mutate(new FollowMovementGenerator<Player>(*target,dist,angle), slot);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(),
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
@@ -287,12 +288,12 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z), MOTION_SLOT_ACTIVE);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z), MOTION_SLOT_ACTIVE);
}
@@ -303,7 +304,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos)
float x, y, z;
pos.GetPosition(x, y, z);
- sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(*_owner);
init.MoveTo(x,y,z);
@@ -317,7 +318,7 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos)
float x, y, z;
pos.GetPosition(x, y, z);
- sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
Movement::MoveSplineInit init(*_owner);
init.MoveTo(x,y,z);
@@ -335,9 +336,17 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa
float x, y, z;
float moveTimeHalf = speedZ / Movement::gravity;
float dist = 2 * moveTimeHalf * speedXY;
+ float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ);
_owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI);
- MoveJump(x, y, z, speedXY, speedZ);
+
+ Movement::MoveSplineInit init(*_owner);
+ init.MoveTo(x,y,z);
+ init.SetParabolic(max_height,0);
+ init.SetOrientationFixed(true);
+ init.SetVelocity(speedXY);
+ init.Launch();
+ Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
@@ -356,7 +365,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id)
{
- sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
float moveTimeHalf = speedZ / Movement::gravity;
float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ);
@@ -375,7 +384,7 @@ void MotionMaster::MoveFall(uint32 id/*=0*/)
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
- sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
+ sLog->outDebug(LOG_FILTER_GENERAL, "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
return;
}
@@ -404,12 +413,12 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed), MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed), MOTION_SLOT_CONTROLLED);
}
@@ -419,11 +428,11 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow());
+ sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow());
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
_owner->AttackStop();
_owner->ToCreature()->SetReactState(REACT_PASSIVE);
@@ -435,11 +444,11 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
{
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow());
+ sLog->outError(LOG_FILTER_GENERAL, "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow());
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), time);
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
}
@@ -455,14 +464,14 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow());
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
_owner->GetEntry(), _owner->GetGUIDLow(),
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
@@ -480,19 +489,19 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
{
if (path < sTaxiPathNodesByPath.size())
{
- sLog->outStaticDebug("%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode);
+ sLog->outDebug(LOG_FILTER_GENERAL, "%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode);
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode);
Mutate(mgen, MOTION_SLOT_CONTROLLED);
}
else
{
- sLog->outError("%s attempt taxi to (not existed Path %u node %u)",
- _owner->GetName(), path, pathnode);
+ sLog->outError(LOG_FILTER_GENERAL, "%s attempt taxi to (not existed Path %u node %u)",
+ _owner->GetName().c_str(), path, pathnode);
}
}
else
{
- sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
+ sLog->outError(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
}
}
@@ -504,11 +513,11 @@ void MotionMaster::MoveDistract(uint32 timer)
if (_owner->GetTypeId() == TYPEID_PLAYER)
{
- sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
+ sLog->outDebug(LOG_FILTER_GENERAL, "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
}
else
{
- sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "Creature (Entry: %u GUID: %u) (timer: %u)",
_owner->GetEntry(), _owner->GetGUIDLow(), timer);
}
@@ -560,7 +569,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
- sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
+ sLog->outDebug(LOG_FILTER_GENERAL, "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
}
@@ -619,7 +628,7 @@ void MotionMaster::DirectDelete(_Ty curr)
void MotionMaster::DelayedDelete(_Ty curr)
{
- sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
+ sLog->outFatal(LOG_FILTER_GENERAL, "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
if (isStatic(curr))
return;
if (!_expList)
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index 727f626cdea..7037d1316f1 100755..100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -51,7 +51,7 @@ enum MovementGeneratorType
FOLLOW_MOTION_TYPE = 14,
ROTATE_MOTION_TYPE = 15,
EFFECT_MOTION_TYPE = 16,
- NULL_MOTION_TYPE = 17,
+ NULL_MOTION_TYPE = 17
};
enum MovementSlot
@@ -59,7 +59,7 @@ enum MovementSlot
MOTION_SLOT_IDLE,
MOTION_SLOT_ACTIVE,
MOTION_SLOT_CONTROLLED,
- MAX_MOTION_SLOT,
+ MAX_MOTION_SLOT
};
enum MMCleanFlag
@@ -72,7 +72,7 @@ enum MMCleanFlag
enum RotateDirection
{
ROTATE_DIRECTION_LEFT,
- ROTATE_DIRECTION_RIGHT,
+ ROTATE_DIRECTION_RIGHT
};
// assume it is 25 yard per 0.6 second
@@ -163,7 +163,9 @@ class MotionMaster //: private std::stack<MovementGenerator *>
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE, uint32 id = EVENT_CHARGE);
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
void MoveJumpTo(float angle, float speedXY, float speedZ);
- void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = 0);
+ void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP)
+ { MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id); };
+ void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = EVENT_JUMP);
void MoveFall(uint32 id = 0);
void MoveSeekAssistance(float x, float y, float z);
diff --git a/src/server/game/Movement/MovementGenerator.cpp b/src/server/game/Movement/MovementGenerator.cpp
index 73921ea86ff..73921ea86ff 100755..100644
--- a/src/server/game/Movement/MovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerator.cpp
diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h
index 0a2ebcfaeee..e586d7e6ae6 100755..100644
--- a/src/server/game/Movement/MovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerator.h
@@ -38,7 +38,7 @@ class MovementGenerator
virtual void Reset(Unit &) = 0;
- virtual bool Update(Unit &, const uint32& time_diff) = 0;
+ virtual bool Update(Unit &, uint32 time_diff) = 0;
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
@@ -52,29 +52,23 @@ class MovementGeneratorMedium : public MovementGenerator
void Initialize(Unit &u)
{
//u->AssertIsType<T>();
- (static_cast<D*>(this))->Initialize(*((T*)&u));
+ (static_cast<D*>(this))->DoInitialize(*((T*)&u));
}
void Finalize(Unit &u)
{
//u->AssertIsType<T>();
- (static_cast<D*>(this))->Finalize(*((T*)&u));
+ (static_cast<D*>(this))->DoFinalize(*((T*)&u));
}
void Reset(Unit &u)
{
//u->AssertIsType<T>();
- (static_cast<D*>(this))->Reset(*((T*)&u));
+ (static_cast<D*>(this))->DoReset(*((T*)&u));
}
- bool Update(Unit &u, const uint32& time_diff)
+ bool Update(Unit &u, uint32 time_diff)
{
//u->AssertIsType<T>();
- return (static_cast<D*>(this))->Update(*((T*)&u), time_diff);
+ return (static_cast<D*>(this))->DoUpdate(*((T*)&u), time_diff);
}
- public:
- // will not link if not overridden in the generators
- void Initialize(T &u);
- void Finalize(T &u);
- void Reset(T &u);
- bool Update(T &u, const uint32& time_diff);
};
struct SelectableMovement : public FactoryHolder<MovementGenerator, MovementGeneratorType>
diff --git a/src/server/game/Movement/MovementGeneratorImpl.h b/src/server/game/Movement/MovementGeneratorImpl.h
index 725b309e3f1..725b309e3f1 100755..100644
--- a/src/server/game/Movement/MovementGeneratorImpl.h
+++ b/src/server/game/Movement/MovementGeneratorImpl.h
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index 54a68f92c66..f93e94fa35b 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -30,8 +30,9 @@
#endif
template<class T>
-void ConfusedMovementGenerator<T>::Initialize(T &unit)
+void ConfusedMovementGenerator<T>::DoInitialize(T &unit)
{
+ unit.StopMoving();
float const wander_distance = 4;
float x = unit.GetPositionX();
float y = unit.GetPositionY();
@@ -99,7 +100,7 @@ void ConfusedMovementGenerator<Player>::_InitSpecific(Player &, bool &is_water_o
}
template<class T>
-void ConfusedMovementGenerator<T>::Reset(T &unit)
+void ConfusedMovementGenerator<T>::DoReset(T &unit)
{
i_nextMove = 1;
i_nextMoveTime.Reset(0);
@@ -108,7 +109,7 @@ void ConfusedMovementGenerator<T>::Reset(T &unit)
}
template<class T>
-bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
+bool ConfusedMovementGenerator<T>::DoUpdate(T &unit, uint32 diff)
{
if (unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
return true;
@@ -148,14 +149,14 @@ bool ConfusedMovementGenerator<T>::Update(T &unit, const uint32 &diff)
}
template<>
-void ConfusedMovementGenerator<Player>::Finalize(Player &unit)
+void ConfusedMovementGenerator<Player>::DoFinalize(Player &unit)
{
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit.ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
}
template<>
-void ConfusedMovementGenerator<Creature>::Finalize(Creature &unit)
+void ConfusedMovementGenerator<Creature>::DoFinalize(Creature &unit)
{
unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
unit.ClearUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_CONFUSED_MOVE);
@@ -163,10 +164,10 @@ void ConfusedMovementGenerator<Creature>::Finalize(Creature &unit)
unit.SetTarget(unit.getVictim()->GetGUID());
}
-template void ConfusedMovementGenerator<Player>::Initialize(Player &player);
-template void ConfusedMovementGenerator<Creature>::Initialize(Creature &creature);
-template void ConfusedMovementGenerator<Player>::Reset(Player &player);
-template void ConfusedMovementGenerator<Creature>::Reset(Creature &creature);
-template bool ConfusedMovementGenerator<Player>::Update(Player &player, const uint32 &diff);
-template bool ConfusedMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff);
+template void ConfusedMovementGenerator<Player>::DoInitialize(Player &player);
+template void ConfusedMovementGenerator<Creature>::DoInitialize(Creature &creature);
+template void ConfusedMovementGenerator<Player>::DoReset(Player &player);
+template void ConfusedMovementGenerator<Creature>::DoReset(Creature &creature);
+template bool ConfusedMovementGenerator<Player>::DoUpdate(Player &player, uint32 diff);
+template bool ConfusedMovementGenerator<Creature>::DoUpdate(Creature &creature, uint32 diff);
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
index 7f2226ea069..34ce1e04dd2 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
@@ -30,10 +30,10 @@ class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMov
public:
explicit ConfusedMovementGenerator() : i_nextMoveTime(0) {}
- void Initialize(T &);
- void Finalize(T &);
- void Reset(T &);
- bool Update(T &, const uint32 &);
+ void DoInitialize(T &);
+ void DoFinalize(T &);
+ void DoReset(T &);
+ bool DoUpdate(T &, uint32);
MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; }
private:
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index 08e27abf050..b070e21ed5b 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -23,6 +23,7 @@
#include "ObjectAccessor.h"
#include "MoveSplineInit.h"
#include "MoveSpline.h"
+#include "Player.h"
#define MIN_QUIET_DISTANCE 28.0f
#define MAX_QUIET_DISTANCE 43.0f
@@ -140,9 +141,14 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
angle = i_cur_angle + static_cast<float>(M_PI);
distance /= 2;
break;
+ default:
+ angle = 0.0f;
+ distance = 0.0f;
+ break;
}
- temp_x = x + distance * cos(angle);
- temp_y = y + distance * sin(angle);
+
+ temp_x = x + distance * std::cos(angle);
+ temp_y = y + distance * std::sin(angle);
Trinity::NormalizeMapCoord(temp_x);
Trinity::NormalizeMapCoord(temp_y);
if (owner.IsWithinLOS(temp_x, temp_y, z))
@@ -167,8 +173,8 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f)
{
- float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle+static_cast<float>(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast<float>(M_PI/2)),z,true);
- float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle-static_cast<float>(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast<float>(M_PI/2)),z,true);
+ float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f* std::cos(angle+static_cast<float>(M_PI/2)),temp_y + 1.0f* std::sin(angle+static_cast<float>(M_PI/2)),z,true);
+ float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f* std::cos(angle-static_cast<float>(M_PI/2)),temp_y + 1.0f* std::sin(angle-static_cast<float>(M_PI/2)),z,true);
if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f)
{
x = temp_x;
@@ -277,7 +283,7 @@ bool FleeingMovementGenerator<T>::_setMoveData(T &owner)
}
template<class T>
-void FleeingMovementGenerator<T>::Initialize(T &owner)
+void FleeingMovementGenerator<T>::DoInitialize(T &owner)
{
if (!&owner)
return;
@@ -326,14 +332,15 @@ void FleeingMovementGenerator<Player>::_Init(Player &)
}
template<>
-void FleeingMovementGenerator<Player>::Finalize(Player &owner)
+void FleeingMovementGenerator<Player>::DoFinalize(Player &owner)
{
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE);
+ owner.StopMoving();
}
template<>
-void FleeingMovementGenerator<Creature>::Finalize(Creature &owner)
+void FleeingMovementGenerator<Creature>::DoFinalize(Creature &owner)
{
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE);
@@ -342,13 +349,13 @@ void FleeingMovementGenerator<Creature>::Finalize(Creature &owner)
}
template<class T>
-void FleeingMovementGenerator<T>::Reset(T &owner)
+void FleeingMovementGenerator<T>::DoReset(T &owner)
{
- Initialize(owner);
+ DoInitialize(owner);
}
template<class T>
-bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
+bool FleeingMovementGenerator<T>::DoUpdate(T &owner, uint32 time_diff)
{
if (!&owner || !owner.isAlive())
return false;
@@ -365,18 +372,18 @@ bool FleeingMovementGenerator<T>::Update(T &owner, const uint32 &time_diff)
return true;
}
-template void FleeingMovementGenerator<Player>::Initialize(Player &);
-template void FleeingMovementGenerator<Creature>::Initialize(Creature &);
+template void FleeingMovementGenerator<Player>::DoInitialize(Player &);
+template void FleeingMovementGenerator<Creature>::DoInitialize(Creature &);
template bool FleeingMovementGenerator<Player>::_setMoveData(Player &);
template bool FleeingMovementGenerator<Creature>::_setMoveData(Creature &);
template bool FleeingMovementGenerator<Player>::_getPoint(Player &, float &, float &, float &);
template bool FleeingMovementGenerator<Creature>::_getPoint(Creature &, float &, float &, float &);
template void FleeingMovementGenerator<Player>::_setTargetLocation(Player &);
template void FleeingMovementGenerator<Creature>::_setTargetLocation(Creature &);
-template void FleeingMovementGenerator<Player>::Reset(Player &);
-template void FleeingMovementGenerator<Creature>::Reset(Creature &);
-template bool FleeingMovementGenerator<Player>::Update(Player &, const uint32 &);
-template bool FleeingMovementGenerator<Creature>::Update(Creature &, const uint32 &);
+template void FleeingMovementGenerator<Player>::DoReset(Player &);
+template void FleeingMovementGenerator<Creature>::DoReset(Creature &);
+template bool FleeingMovementGenerator<Player>::DoUpdate(Player &, uint32);
+template bool FleeingMovementGenerator<Creature>::DoUpdate(Creature &, uint32);
void TimedFleeingMovementGenerator::Finalize(Unit &owner)
{
@@ -392,7 +399,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
}
}
-bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff)
+bool TimedFleeingMovementGenerator::Update(Unit & owner, uint32 time_diff)
{
if (!owner.isAlive())
return false;
@@ -407,11 +414,7 @@ bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff
if (i_totalFleeTime.Passed())
return false;
- i_totalFleeTime.Update(time_diff);
- if (i_totalFleeTime.Passed())
- return false;
-
- // This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, const uint32 &) version
+ // This calls grant-parent Update method hiden by FleeingMovementGenerator::Update(Creature &, uint32) version
// This is done instead of casting Unit& to Creature& and call parent method, then we can use Unit directly
return MovementGeneratorMedium< Creature, FleeingMovementGenerator<Creature> >::Update(owner, time_diff);
}
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
index aec93ad3375..5acebb54c99 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
@@ -27,10 +27,10 @@ class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovem
public:
FleeingMovementGenerator(uint64 fright) : i_frightGUID(fright), i_nextCheckTime(0) {}
- void Initialize(T &);
- void Finalize(T &);
- void Reset(T &);
- bool Update(T &, const uint32 &);
+ void DoInitialize(T &);
+ void DoFinalize(T &);
+ void DoReset(T &);
+ bool DoUpdate(T &, uint32);
MovementGeneratorType GetMovementGeneratorType() { return FLEEING_MOTION_TYPE; }
@@ -62,7 +62,7 @@ class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
i_totalFleeTime(time) {}
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
- bool Update(Unit &, const uint32&);
+ bool Update(Unit &, uint32);
void Finalize(Unit &);
private:
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
index a8bdb698432..1e9ea3156d8 100755..100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
@@ -23,12 +23,12 @@
#include "MoveSplineInit.h"
#include "MoveSpline.h"
-void HomeMovementGenerator<Creature>::Initialize(Creature & owner)
+void HomeMovementGenerator<Creature>::DoInitialize(Creature & owner)
{
_setTargetLocation(owner);
}
-void HomeMovementGenerator<Creature>::Reset(Creature &)
+void HomeMovementGenerator<Creature>::DoReset(Creature &)
{
}
@@ -53,13 +53,13 @@ void HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
owner.ClearUnitState(UNIT_STATE_ALL_STATE & ~UNIT_STATE_EVADE);
}
-bool HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32 /*time_diff*/)
+bool HomeMovementGenerator<Creature>::DoUpdate(Creature &owner, const uint32 /*time_diff*/)
{
arrived = owner.movespline->Finalized();
return !arrived;
}
-void HomeMovementGenerator<Creature>::Finalize(Creature& owner)
+void HomeMovementGenerator<Creature>::DoFinalize(Creature& owner)
{
if (arrived)
{
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
index 95eb05f281c..a3d53e24510 100755..100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
@@ -34,10 +34,10 @@ class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature
HomeMovementGenerator() : arrived(false) {}
~HomeMovementGenerator() {}
- void Initialize(Creature &);
- void Finalize(Creature &);
- void Reset(Creature &);
- bool Update(Creature &, const uint32);
+ void DoInitialize(Creature &);
+ void DoFinalize(Creature &);
+ void DoReset(Creature &);
+ bool DoUpdate(Creature &, const uint32);
MovementGeneratorType GetMovementGeneratorType() { return HOME_MOTION_TYPE; }
private:
diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
index 5a2090cfe28..e237f22e8b1 100755
--- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
@@ -48,7 +48,7 @@ void RotateMovementGenerator::Initialize(Unit& owner)
owner.AttackStop();
}
-bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
+bool RotateMovementGenerator::Update(Unit& owner, uint32 diff)
{
float angle = owner.GetOrientation();
if (m_direction == ROTATE_DIRECTION_LEFT)
@@ -89,7 +89,7 @@ void DistractMovementGenerator::Finalize(Unit& owner)
owner.ClearUnitState(UNIT_STATE_DISTRACTED);
}
-bool DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
+bool DistractMovementGenerator::Update(Unit& /*owner*/, uint32 time_diff)
{
if (time_diff > m_timer)
return false;
diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
index 7acec82af98..ad28cc185e6 100755..100644
--- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
@@ -28,7 +28,7 @@ class IdleMovementGenerator : public MovementGenerator
void Initialize(Unit &);
void Finalize(Unit &) { }
void Reset(Unit &);
- bool Update(Unit &, const uint32&) { return true; }
+ bool Update(Unit &, uint32) { return true; }
MovementGeneratorType GetMovementGeneratorType() { return IDLE_MOTION_TYPE; }
};
@@ -42,7 +42,7 @@ class RotateMovementGenerator : public MovementGenerator
void Initialize(Unit& owner);
void Finalize(Unit& owner);
void Reset(Unit& owner) { Initialize(owner); }
- bool Update(Unit& owner, const uint32& time_diff);
+ bool Update(Unit& owner, uint32 time_diff);
MovementGeneratorType GetMovementGeneratorType() { return ROTATE_MOTION_TYPE; }
private:
@@ -58,7 +58,7 @@ class DistractMovementGenerator : public MovementGenerator
void Initialize(Unit& owner);
void Finalize(Unit& owner);
void Reset(Unit& owner) { Initialize(owner); }
- bool Update(Unit& owner, const uint32& time_diff);
+ bool Update(Unit& owner, uint32 time_diff);
MovementGeneratorType GetMovementGeneratorType() { return DISTRACT_MOTION_TYPE; }
private:
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
index 07a5761517e..9bc3e09640f 100755..100644
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
@@ -27,7 +27,7 @@
//----- Point Movement Generator
template<class T>
-void PointMovementGenerator<T>::Initialize(T &unit)
+void PointMovementGenerator<T>::DoInitialize(T &unit)
{
if (!unit.IsStopped())
unit.StopMoving();
@@ -42,7 +42,7 @@ void PointMovementGenerator<T>::Initialize(T &unit)
}
template<class T>
-bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/)
+bool PointMovementGenerator<T>::DoUpdate(T &unit, uint32 /*diff*/)
{
if (!&unit)
return false;
@@ -69,7 +69,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 & /*diff*/)
}
template<class T>
-void PointMovementGenerator<T>::Finalize(T &unit)
+void PointMovementGenerator<T>::DoFinalize(T &unit)
{
unit.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
@@ -78,7 +78,7 @@ void PointMovementGenerator<T>::Finalize(T &unit)
}
template<class T>
-void PointMovementGenerator<T>::Reset(T &unit)
+void PointMovementGenerator<T>::DoReset(T &unit)
{
if (!unit.IsStopped())
unit.StopMoving();
@@ -97,14 +97,14 @@ template <> void PointMovementGenerator<Creature>::MovementInform(Creature &unit
unit.AI()->MovementInform(POINT_MOTION_TYPE, id);
}
-template void PointMovementGenerator<Player>::Initialize(Player&);
-template void PointMovementGenerator<Creature>::Initialize(Creature&);
-template void PointMovementGenerator<Player>::Finalize(Player&);
-template void PointMovementGenerator<Creature>::Finalize(Creature&);
-template void PointMovementGenerator<Player>::Reset(Player&);
-template void PointMovementGenerator<Creature>::Reset(Creature&);
-template bool PointMovementGenerator<Player>::Update(Player &, const uint32 &);
-template bool PointMovementGenerator<Creature>::Update(Creature&, const uint32 &);
+template void PointMovementGenerator<Player>::DoInitialize(Player&);
+template void PointMovementGenerator<Creature>::DoInitialize(Creature&);
+template void PointMovementGenerator<Player>::DoFinalize(Player&);
+template void PointMovementGenerator<Creature>::DoFinalize(Creature&);
+template void PointMovementGenerator<Player>::DoReset(Player&);
+template void PointMovementGenerator<Creature>::DoReset(Creature&);
+template bool PointMovementGenerator<Player>::DoUpdate(Player &, uint32);
+template bool PointMovementGenerator<Creature>::DoUpdate(Creature&, uint32);
void AssistanceMovementGenerator::Finalize(Unit &unit)
{
@@ -114,7 +114,7 @@ void AssistanceMovementGenerator::Finalize(Unit &unit)
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
}
-bool EffectMovementGenerator::Update(Unit &unit, const uint32&)
+bool EffectMovementGenerator::Update(Unit &unit, uint32)
{
return !unit.movespline->Finalized();
}
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
index d2833a5ee10..93516e5d354 100755..100644
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
@@ -29,10 +29,10 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
PointMovementGenerator(uint32 _id, float _x, float _y, float _z, float _speed = 0.0f) : id(_id),
i_x(_x), i_y(_y), i_z(_z), speed(_speed) {}
- void Initialize(T &);
- void Finalize(T &);
- void Reset(T &);
- bool Update(T &, const uint32 &);
+ void DoInitialize(T &);
+ void DoFinalize(T &);
+ void DoReset(T &);
+ bool DoUpdate(T &, uint32);
void MovementInform(T &);
@@ -66,7 +66,7 @@ class EffectMovementGenerator : public MovementGenerator
void Initialize(Unit &) {}
void Finalize(Unit &unit);
void Reset(Unit &) {}
- bool Update(Unit &u, const uint32&);
+ bool Update(Unit &u, uint32);
MovementGeneratorType GetMovementGeneratorType() { return EFFECT_MOTION_TYPE; }
private:
uint32 m_Id;
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index 84cd9e88295..4d74ba20d96 100755..100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
@@ -46,8 +46,8 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
const float angle = float(rand_norm()) * static_cast<float>(M_PI*2.0f);
const float range = float(rand_norm()) * wander_distance;
- const float distanceX = range * cos(angle);
- const float distanceY = range * sin(angle);
+ const float distanceX = range * std::cos(angle);
+ const float distanceY = range * std::sin(angle);
destX = respX + distanceX;
destY = respY + distanceY;
@@ -114,7 +114,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature& creature)
}
template<>
-void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
+void RandomMovementGenerator<Creature>::DoInitialize(Creature &creature)
{
if (!creature.isAlive())
return;
@@ -127,20 +127,20 @@ void RandomMovementGenerator<Creature>::Initialize(Creature &creature)
}
template<>
-void RandomMovementGenerator<Creature>::Reset(Creature &creature)
+void RandomMovementGenerator<Creature>::DoReset(Creature &creature)
{
- Initialize(creature);
+ DoInitialize(creature);
}
template<>
-void RandomMovementGenerator<Creature>::Finalize(Creature &creature)
+void RandomMovementGenerator<Creature>::DoFinalize(Creature &creature)
{
creature.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
creature.SetWalk(false);
}
template<>
-bool RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 diff)
+bool RandomMovementGenerator<Creature>::DoUpdate(Creature &creature, const uint32 diff)
{
if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
{
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
index 07ec3647052..449b2686a2d 100755..100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
@@ -28,10 +28,10 @@ class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovemen
RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
void _setRandomLocation(T &);
- void Initialize(T &);
- void Finalize(T &);
- void Reset(T &);
- bool Update(T &, const uint32);
+ void DoInitialize(T &);
+ void DoFinalize(T &);
+ void DoReset(T &);
+ bool DoUpdate(T &, const uint32);
bool GetResetPosition(T&, float& x, float& y, float& z);
MovementGeneratorType GetMovementGeneratorType() { return RANDOM_MOTION_TYPE; }
private:
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
index fdff5a92564..8712b2cf527 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
@@ -59,10 +59,31 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
}
else
{
- if (i_target->IsWithinDistInMap(&owner, i_offset + 1.0f))
+ float dist;
+ float size;
+
+ // Pets need special handling.
+ // We need to subtract GetObjectSize() because it gets added back further down the chain
+ // and that makes pets too far away. Subtracting it allows pets to properly
+ // be (GetCombatReach() + i_offset) away.
+ // Only applies when i_target is pet's owner otherwise pets and mobs end up
+ // doing a "dance" while fighting
+ if (owner.isPet() && i_target->GetTypeId() == TYPEID_PLAYER)
+ {
+ dist = i_target->GetCombatReach();
+ size = i_target->GetCombatReach() - i_target->GetObjectSize();
+ }
+ else
+ {
+ dist = i_offset + 1.0f;
+ size = owner.GetObjectSize();
+ }
+
+ if (i_target->IsWithinDistInMap(&owner, dist))
return;
+
// to at i_offset distance from target and i_angle from target facing
- i_target->GetClosePoint(x, y, z, owner.GetObjectSize(), i_offset, i_angle);
+ i_target->GetClosePoint(x, y, z, size, i_offset, i_angle);
}
/*
@@ -120,7 +141,7 @@ void TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature>
}
template<class T, typename D>
-bool TargetedMovementGeneratorMedium<T,D>::Update(T &owner, const uint32 & time_diff)
+bool TargetedMovementGeneratorMedium<T,D>::DoUpdate(T &owner, uint32 time_diff)
{
if (!i_target.isValid() || !i_target->IsInWorld())
return false;
@@ -189,14 +210,14 @@ void ChaseMovementGenerator<T>::_reachTarget(T &owner)
}
template<>
-void ChaseMovementGenerator<Player>::Initialize(Player &owner)
+void ChaseMovementGenerator<Player>::DoInitialize(Player &owner)
{
owner.AddUnitState(UNIT_STATE_CHASE|UNIT_STATE_CHASE_MOVE);
_setTargetLocation(owner);
}
template<>
-void ChaseMovementGenerator<Creature>::Initialize(Creature &owner)
+void ChaseMovementGenerator<Creature>::DoInitialize(Creature &owner)
{
owner.SetWalk(false);
owner.AddUnitState(UNIT_STATE_CHASE|UNIT_STATE_CHASE_MOVE);
@@ -204,15 +225,15 @@ void ChaseMovementGenerator<Creature>::Initialize(Creature &owner)
}
template<class T>
-void ChaseMovementGenerator<T>::Finalize(T &owner)
+void ChaseMovementGenerator<T>::DoFinalize(T &owner)
{
owner.ClearUnitState(UNIT_STATE_CHASE|UNIT_STATE_CHASE_MOVE);
}
template<class T>
-void ChaseMovementGenerator<T>::Reset(T &owner)
+void ChaseMovementGenerator<T>::DoReset(T &owner)
{
- Initialize(owner);
+ DoInitialize(owner);
}
template<class T>
@@ -260,7 +281,7 @@ void FollowMovementGenerator<Creature>::_updateSpeed(Creature &u)
}
template<>
-void FollowMovementGenerator<Player>::Initialize(Player &owner)
+void FollowMovementGenerator<Player>::DoInitialize(Player &owner)
{
owner.AddUnitState(UNIT_STATE_FOLLOW|UNIT_STATE_FOLLOW_MOVE);
_updateSpeed(owner);
@@ -268,7 +289,7 @@ void FollowMovementGenerator<Player>::Initialize(Player &owner)
}
template<>
-void FollowMovementGenerator<Creature>::Initialize(Creature &owner)
+void FollowMovementGenerator<Creature>::DoInitialize(Creature &owner)
{
owner.AddUnitState(UNIT_STATE_FOLLOW|UNIT_STATE_FOLLOW_MOVE);
_updateSpeed(owner);
@@ -276,16 +297,16 @@ void FollowMovementGenerator<Creature>::Initialize(Creature &owner)
}
template<class T>
-void FollowMovementGenerator<T>::Finalize(T &owner)
+void FollowMovementGenerator<T>::DoFinalize(T &owner)
{
owner.ClearUnitState(UNIT_STATE_FOLLOW|UNIT_STATE_FOLLOW_MOVE);
_updateSpeed(owner);
}
template<class T>
-void FollowMovementGenerator<T>::Reset(T &owner)
+void FollowMovementGenerator<T>::DoReset(T &owner)
{
- Initialize(owner);
+ DoInitialize(owner);
}
template<class T>
@@ -306,21 +327,21 @@ template void TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Play
template void TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::_setTargetLocation(Player &);
template void TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::_setTargetLocation(Creature &);
template void TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::_setTargetLocation(Creature &);
-template bool TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::Update(Player &, const uint32 &);
-template bool TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::Update(Player &, const uint32 &);
-template bool TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::Update(Creature &, const uint32 &);
-template bool TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::Update(Creature &, const uint32 &);
+template bool TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::DoUpdate(Player &, uint32);
+template bool TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::DoUpdate(Player &, uint32);
+template bool TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::DoUpdate(Creature &, uint32);
+template bool TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::DoUpdate(Creature &, uint32);
template void ChaseMovementGenerator<Player>::_reachTarget(Player &);
template void ChaseMovementGenerator<Creature>::_reachTarget(Creature &);
-template void ChaseMovementGenerator<Player>::Finalize(Player &);
-template void ChaseMovementGenerator<Creature>::Finalize(Creature &);
-template void ChaseMovementGenerator<Player>::Reset(Player &);
-template void ChaseMovementGenerator<Creature>::Reset(Creature &);
+template void ChaseMovementGenerator<Player>::DoFinalize(Player &);
+template void ChaseMovementGenerator<Creature>::DoFinalize(Creature &);
+template void ChaseMovementGenerator<Player>::DoReset(Player &);
+template void ChaseMovementGenerator<Creature>::DoReset(Creature &);
template void ChaseMovementGenerator<Player>::MovementInform(Player &unit);
-template void FollowMovementGenerator<Player>::Finalize(Player &);
-template void FollowMovementGenerator<Creature>::Finalize(Creature &);
-template void FollowMovementGenerator<Player>::Reset(Player &);
-template void FollowMovementGenerator<Creature>::Reset(Creature &);
+template void FollowMovementGenerator<Player>::DoFinalize(Player &);
+template void FollowMovementGenerator<Creature>::DoFinalize(Creature &);
+template void FollowMovementGenerator<Player>::DoReset(Player &);
+template void FollowMovementGenerator<Creature>::DoReset(Creature &);
template void FollowMovementGenerator<Player>::MovementInform(Player &unit);
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
index 29fd73624e1..67cd8771aa7 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
@@ -46,7 +46,7 @@ class TargetedMovementGeneratorMedium : public MovementGeneratorMedium< T, D >,
~TargetedMovementGeneratorMedium() {}
public:
- bool Update(T &, const uint32 &);
+ bool DoUpdate(T &, uint32);
Unit* GetTarget() const { return i_target.getTarget(); }
void unitSpeedChanged() { i_recalculateTravel=true; }
@@ -74,9 +74,9 @@ class ChaseMovementGenerator : public TargetedMovementGeneratorMedium<T, ChaseMo
MovementGeneratorType GetMovementGeneratorType() { return CHASE_MOTION_TYPE; }
- void Initialize(T &);
- void Finalize(T &);
- void Reset(T &);
+ void DoInitialize(T &);
+ void DoFinalize(T &);
+ void DoReset(T &);
void MovementInform(T &);
static void _clearUnitStateMove(T &u) { u.ClearUnitState(UNIT_STATE_CHASE_MOVE); }
@@ -98,9 +98,9 @@ class FollowMovementGenerator : public TargetedMovementGeneratorMedium<T, Follow
MovementGeneratorType GetMovementGeneratorType() { return FOLLOW_MOTION_TYPE; }
- void Initialize(T &);
- void Finalize(T &);
- void Reset(T &);
+ void DoInitialize(T &);
+ void DoFinalize(T &);
+ void DoReset(T &);
void MovementInform(T &);
static void _clearUnitStateMove(T &u) { u.ClearUnitState(UNIT_STATE_FOLLOW_MOVE); }
@@ -113,4 +113,3 @@ class FollowMovementGenerator : public TargetedMovementGeneratorMedium<T, Follow
};
#endif
-
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 25730f92161..e9c9cf6548d 100755..100644
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -41,26 +41,26 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature)
if (!i_path)
{
// No movement found for entry
- sLog->outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature.GetName(), creature.GetEntry(), creature.GetGUIDLow(), path_id);
+ sLog->outError(LOG_FILTER_SQL, "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature.GetName().c_str(), creature.GetEntry(), creature.GetGUIDLow(), path_id);
return;
}
StartMoveNow(creature);
}
-void WaypointMovementGenerator<Creature>::Initialize(Creature &creature)
+void WaypointMovementGenerator<Creature>::DoInitialize(Creature &creature)
{
LoadPath(creature);
creature.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
}
-void WaypointMovementGenerator<Creature>::Finalize(Creature &creature)
+void WaypointMovementGenerator<Creature>::DoFinalize(Creature &creature)
{
creature.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
creature.SetWalk(false);
}
-void WaypointMovementGenerator<Creature>::Reset(Creature &creature)
+void WaypointMovementGenerator<Creature>::DoReset(Creature &creature)
{
creature.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE);
StartMoveNow(creature);
@@ -130,7 +130,7 @@ bool WaypointMovementGenerator<Creature>::StartMove(Creature &creature)
return true;
}
-bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff)
+bool WaypointMovementGenerator<Creature>::DoUpdate(Creature &creature, uint32 diff)
{
// Waypoint movement can be switched on/off
// This is quite handy for escort quests and other stuff
@@ -196,13 +196,13 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const
return i_path->size();
}
-void FlightPathMovementGenerator::Initialize(Player &player)
+void FlightPathMovementGenerator::DoInitialize(Player &player)
{
- Reset(player);
+ DoReset(player);
InitEndGridInfo();
}
-void FlightPathMovementGenerator::Finalize(Player& player)
+void FlightPathMovementGenerator::DoFinalize(Player& player)
{
// remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack)
player.ClearUnitState(UNIT_STATE_IN_FLIGHT);
@@ -222,7 +222,7 @@ void FlightPathMovementGenerator::Finalize(Player& player)
#define PLAYER_FLIGHT_SPEED 32.0f
-void FlightPathMovementGenerator::Reset(Player & player)
+void FlightPathMovementGenerator::DoReset(Player & player)
{
player.getHostileRefManager().setOnlineOfflineState(false);
player.AddUnitState(UNIT_STATE_IN_FLIGHT);
@@ -241,7 +241,7 @@ void FlightPathMovementGenerator::Reset(Player & player)
init.Launch();
}
-bool FlightPathMovementGenerator::Update(Player &player, const uint32& /*diff*/)
+bool FlightPathMovementGenerator::DoUpdate(Player &player, uint32 /*diff*/)
{
uint32 pointId = (uint32)player.movespline->currentPathIdx();
if (pointId > i_currentNode)
@@ -283,7 +283,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player& player, TaxiPathNodeEntry
{
if (uint32 eventid = departure ? node.departureEventID : node.arrivalEventID)
{
- sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player.GetName());
+ sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player.GetName().c_str());
player.GetMap()->ScriptsStart(sEventScripts, eventid, &player, &player);
}
}
@@ -314,11 +314,11 @@ void FlightPathMovementGenerator::PreloadEndGrid()
// Load the grid
if (endMap)
{
- sLog->outDetail("Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1));
+ sLog->outInfo(LOG_FILTER_GENERAL, "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1));
endMap->LoadGrid(_endGridX, _endGridY);
}
else
- sLog->outDetail("Unable to determine map to preload flightmaster grid");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Unable to determine map to preload flightmaster grid");
}
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
index 0d8f047c83a..0bd75076a33 100755..100644
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
@@ -65,10 +65,10 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true)
: i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {}
~WaypointMovementGenerator() { i_path = NULL; }
- void Initialize(Creature &);
- void Finalize(Creature &);
- void Reset(Creature &);
- bool Update(Creature &, const uint32 &diff);
+ void DoInitialize(Creature &);
+ void DoFinalize(Creature &);
+ void DoReset(Creature &);
+ bool DoUpdate(Creature &, uint32 diff);
void MovementInform(Creature &);
@@ -118,10 +118,10 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig
i_path = &pathnodes;
i_currentNode = startNode;
}
- void Initialize(Player &);
- void Reset(Player &);
- void Finalize(Player &);
- bool Update(Player &, const uint32&);
+ void DoInitialize(Player &);
+ void DoReset(Player &);
+ void DoFinalize(Player &);
+ bool DoUpdate(Player &, uint32);
MovementGeneratorType GetMovementGeneratorType() { return FLIGHT_MOTION_TYPE; }
TaxiPathNodeList const& GetPath() { return *i_path; }
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index b1c25aedfd7..1e96cd00fd3 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -19,6 +19,7 @@
#include "MoveSpline.h"
#include <sstream>
#include "Log.h"
+#include "Creature.h"
namespace Movement{
@@ -50,15 +51,15 @@ Location MoveSpline::ComputePosition() const
if (splineflags.final_angle)
c.orientation = facing.angle;
else if (splineflags.final_point)
- c.orientation = atan2(facing.f.y-c.y, facing.f.x-c.x);
+ c.orientation = atan2(facing.f.y - c.y, facing.f.x - c.x);
//nothing to do for MoveSplineFlag::Final_Target flag
}
else
{
- if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed|MoveSplineFlag::Falling))
+ if (!splineflags.hasFlag(MoveSplineFlag::OrientationFixed | MoveSplineFlag::Falling))
{
Vector3 hermite;
- spline.evaluate_derivative(point_Idx,u,hermite);
+ spline.evaluate_derivative(point_Idx, u, hermite);
c.orientation = atan2(hermite.y, hermite.x);
}
@@ -107,7 +108,7 @@ struct FallInitializer
};
enum{
- minimal_duration = 1,
+ minimal_duration = 1
};
struct CommonInitializer
@@ -153,7 +154,7 @@ void MoveSpline::init_spline(const MoveSplineInitArgs& args)
// TODO: what to do in such cases? problem is in input data (all points are at same coords)
if (spline.length() < minimal_duration)
{
- sLog->outError("MoveSpline::init_spline: zero length spline, wrong input data?");
+ sLog->outError(LOG_FILTER_GENERAL, "MoveSpline::init_spline: zero length spline, wrong input data?");
spline.set_length(spline.last(), spline.isCyclic() ? 1000 : 1);
}
point_Idx = spline.first();
@@ -167,6 +168,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args)
point_Idx_offset = args.path_Idx_offset;
initialOrientation = args.initialOrientation;
+ onTransport = false;
time_passed = 0;
vertical_acceleration = 0.f;
effect_start_time = 0;
@@ -194,12 +196,12 @@ MoveSpline::MoveSpline() : m_Id(0), time_passed(0),
/// ============================================================================================
-bool MoveSplineInitArgs::Validate() const
+bool MoveSplineInitArgs::Validate(Unit* unit) const
{
#define CHECK(exp) \
if (!(exp))\
{\
- sLog->outError("MoveSplineInitArgs::Validate: expression '%s' failed", #exp);\
+ sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::Validate: expression '%s' failed for GUID: %u Entry: %u", #exp, unit->GetTypeId() == TYPEID_PLAYER ? unit->GetGUIDLow() : unit->ToCreature()->GetDBTableGUIDLow(), unit->GetEntry());\
return false;\
}
CHECK(path.size() > 1);
@@ -217,7 +219,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const
if (!(flags & MoveSplineFlag::Mask_CatmullRom) && path.size() > 2)
{
enum{
- MAX_OFFSET = (1 << 11) / 2,
+ MAX_OFFSET = (1 << 11) / 2
};
Vector3 middle = (path.front()+path.back()) / 2;
Vector3 offset;
@@ -226,7 +228,7 @@ bool MoveSplineInitArgs::_checkPathBounds() const
offset = path[i] - middle;
if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET)
{
- sLog->outError("MoveSplineInitArgs::_checkPathBounds check failed");
+ sLog->outError(LOG_FILTER_GENERAL, "MoveSplineInitArgs::_checkPathBounds check failed");
return false;
}
}
diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h
index d4b19b21634..46611e58447 100644
--- a/src/server/game/Movement/Spline/MoveSpline.h
+++ b/src/server/game/Movement/Spline/MoveSpline.h
@@ -41,11 +41,12 @@ namespace Movement
{
public:
typedef Spline<int32> MySpline;
- enum UpdateResult{
+ enum UpdateResult
+ {
Result_None = 0x01,
Result_Arrived = 0x02,
Result_NextCycle = 0x04,
- Result_NextSegment = 0x08,
+ Result_NextSegment = 0x08
};
friend class PacketBuilder;
protected:
@@ -70,27 +71,27 @@ namespace Movement
void init_spline(const MoveSplineInitArgs& args);
protected:
- const MySpline::ControlArray& getPath() const { return spline.getPoints();}
+ const MySpline::ControlArray& getPath() const { return spline.getPoints(); }
void computeParabolicElevation(float& el) const;
void computeFallElevation(float& el) const;
UpdateResult _updateState(int32& ms_time_diff);
- int32 next_timestamp() const { return spline.length(point_Idx+1);}
- int32 segment_time_elapsed() const { return next_timestamp()-time_passed;}
- int32 Duration() const { return spline.length();}
- int32 timeElapsed() const { return Duration() - time_passed;}
- int32 timePassed() const { return time_passed;}
+ int32 next_timestamp() const { return spline.length(point_Idx+1); }
+ int32 segment_time_elapsed() const { return next_timestamp()-time_passed; }
+ int32 Duration() const { return spline.length(); }
+ int32 timeElapsed() const { return Duration() - time_passed; }
+ int32 timePassed() const { return time_passed; }
public:
- const MySpline& _Spline() const { return spline;}
- int32 _currentSplineIdx() const { return point_Idx;}
+ const MySpline& _Spline() const { return spline; }
+ int32 _currentSplineIdx() const { return point_Idx; }
void _Finalize();
void _Interrupt() { splineflags.done = true;}
public:
void Initialize(const MoveSplineInitArgs&);
- bool Initialized() const { return !spline.empty();}
+ bool Initialized() const { return !spline.empty(); }
explicit MoveSpline();
@@ -112,13 +113,14 @@ namespace Movement
Location ComputePosition() const;
- uint32 GetId() const { return m_Id;}
+ uint32 GetId() const { return m_Id; }
bool Finalized() const { return splineflags.done; }
- bool isCyclic() const { return splineflags.cyclic;}
- const Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3();}
- const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx+1) : Vector3();}
+ bool isCyclic() const { return splineflags.cyclic; }
+ const Vector3 FinalDestination() const { return Initialized() ? spline.getPoint(spline.last()) : Vector3(); }
+ const Vector3 CurrentDestination() const { return Initialized() ? spline.getPoint(point_Idx+1) : Vector3(); }
int32 currentPathIdx() const;
+ bool onTransport;
std::string ToString() const;
};
}
diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h
index cfc2fdee450..f3f436c9d00 100644
--- a/src/server/game/Movement/Spline/MoveSplineFlag.h
+++ b/src/server/game/Movement/Spline/MoveSplineFlag.h
@@ -33,7 +33,8 @@ namespace Movement
class MoveSplineFlag
{
public:
- enum eFlags{
+ enum eFlags
+ {
None = 0x00000000,
// x00-xFF(first byte) used as animation Ids storage in pair with Animation flag
Done = 0x00000100,
@@ -70,11 +71,11 @@ namespace Movement
// CatmullRom interpolation mode used
Mask_CatmullRom = Flying | Catmullrom,
// Unused, not suported flags
- Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13,
+ Mask_Unused = No_Spline|Enter_Cycle|Frozen|Unknown7|Unknown8|Unknown10|Unknown11|Unknown12|Unknown13
};
- inline uint32& raw() { return (uint32&)*this;}
- inline const uint32& raw() const { return (const uint32&)*this;}
+ inline uint32& raw() { return (uint32&)*this; }
+ inline const uint32& raw() const { return (const uint32&)*this; }
MoveSplineFlag() { raw() = 0; }
MoveSplineFlag(uint32 f) { raw() = f; }
@@ -82,21 +83,21 @@ namespace Movement
// Constant interface
- bool isSmooth() const { return raw() & Mask_CatmullRom;}
- bool isLinear() const { return !isSmooth();}
- bool isFacing() const { return raw() & Mask_Final_Facing;}
+ bool isSmooth() const { return raw() & Mask_CatmullRom; }
+ bool isLinear() const { return !isSmooth(); }
+ bool isFacing() const { return raw() & Mask_Final_Facing; }
- uint8 getAnimationId() const { return animId;}
- bool hasAllFlags(uint32 f) const { return (raw() & f) == f;}
- bool hasFlag(uint32 f) const { return (raw() & f) != 0;}
- uint32 operator & (uint32 f) const { return (raw() & f);}
- uint32 operator | (uint32 f) const { return (raw() | f);}
+ uint8 getAnimationId() const { return animId; }
+ bool hasAllFlags(uint32 f) const { return (raw() & f) == f; }
+ bool hasFlag(uint32 f) const { return (raw() & f) != 0; }
+ uint32 operator & (uint32 f) const { return (raw() & f); }
+ uint32 operator | (uint32 f) const { return (raw() | f); }
std::string ToString() const;
// Not constant interface
- void operator &= (uint32 f) { raw() &= f;}
- void operator |= (uint32 f) { raw() |= f;}
+ void operator &= (uint32 f) { raw() &= f; }
+ void operator |= (uint32 f) { raw() |= f; }
void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations | Falling | Parabolic)) | Animation | anim; }
void EnableParabolic() { raw() = (raw() & ~(Mask_Animations | Falling | Animation)) | Parabolic; }
@@ -109,31 +110,31 @@ namespace Movement
void EnableTransportEnter() { raw() = (raw() & ~TransportExit) | TransportEnter; }
void EnableTransportExit() { raw() = (raw() & ~TransportEnter) | TransportExit; }
- uint8 animId : 8;
- bool done : 1;
- bool falling : 1;
- bool no_spline : 1;
- bool parabolic : 1;
- bool walkmode : 1;
- bool flying : 1;
- bool orientationFixed : 1;
- bool final_point : 1;
- bool final_target : 1;
- bool final_angle : 1;
- bool catmullrom : 1;
- bool cyclic : 1;
- bool enter_cycle : 1;
- bool animation : 1;
- bool frozen : 1;
- bool transportEnter: 1;
- bool transportExit : 1;
- bool unknown7 : 1;
- bool unknown8 : 1;
+ uint8 animId : 8;
+ bool done : 1;
+ bool falling : 1;
+ bool no_spline : 1;
+ bool parabolic : 1;
+ bool walkmode : 1;
+ bool flying : 1;
+ bool orientationFixed : 1;
+ bool final_point : 1;
+ bool final_target : 1;
+ bool final_angle : 1;
+ bool catmullrom : 1;
+ bool cyclic : 1;
+ bool enter_cycle : 1;
+ bool animation : 1;
+ bool frozen : 1;
+ bool transportEnter : 1;
+ bool transportExit : 1;
+ bool unknown7 : 1;
+ bool unknown8 : 1;
bool orientationInversed : 1;
- bool unknown10 : 1;
- bool unknown11 : 1;
- bool unknown12 : 1;
- bool unknown13 : 1;
+ bool unknown10 : 1;
+ bool unknown11 : 1;
+ bool unknown12 : 1;
+ bool unknown13 : 1;
};
#if defined( __GNUC__ )
#pragma pack()
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index c539dd3cc39..df0b3e3944f 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -22,6 +22,8 @@
#include "Unit.h"
#include "Transport.h"
#include "Vehicle.h"
+#include "WorldPacket.h"
+#include "Opcodes.h"
namespace Movement
{
@@ -74,7 +76,8 @@ namespace Movement
// there is a big chance that current position is unknown if current state is not finalized, need compute it
// this also allows calculate spline position and update map position in much greater intervals
- if (!move_spline.Finalized())
+ // Don't compute for transport movement if the unit is in a motion between two transports
+ if (!move_spline.Finalized() && move_spline.onTransport == transport)
real_position = move_spline.ComputePosition();
// should i do the things that user should do? - no.
@@ -84,6 +87,7 @@ namespace Movement
// corrent first vertex
args.path[0] = real_position;
args.initialOrientation = real_position.orientation;
+ move_spline.onTransport = transport;
uint32 moveFlags = unit.m_movementInfo.GetMovementFlags();
if (args.flags.walkmode)
@@ -96,7 +100,7 @@ namespace Movement
if (!args.HasVelocity)
args.velocity = unit.GetSpeed(SelectSpeedType(moveFlags));
- if (!args.Validate())
+ if (!args.Validate(&unit))
return;
if (moveFlags & MOVEMENTFLAG_ROOT)
@@ -158,17 +162,9 @@ namespace Movement
{
if (_transformForTransport)
{
- if (Unit* vehicle = _owner.GetVehicleBase())
- {
- input.x -= vehicle->GetPositionX();
- input.y -= vehicle->GetPositionY();
- input.z -= vehicle->GetPositionZMinusOffset();
- }
- else if (Transport* transport = _owner.GetTransport())
- {
- float unused = 0.0f;
+ float unused = 0.0f;
+ if (TransportBase* transport = _owner.GetDirectTransport())
transport->CalculatePassengerOffset(input.x, input.y, input.z, unused);
- }
}
return input;
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index ef847809ac8..cae9f1321d2 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -30,7 +30,7 @@ namespace Movement
ToGround = 0, // 460 = ToGround, index of AnimationData.dbc
FlyToFly = 1, // 461 = FlyToFly?
ToFly = 2, // 458 = ToFly
- FlyToGround = 3, // 463 = FlyToGround
+ FlyToGround = 3 // 463 = FlyToGround
};
// Transforms coordinates from global to transport offsets
diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
index de02b35d0a0..32045629c9f 100644
--- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h
+++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
@@ -22,6 +22,8 @@
#include "MoveSplineFlag.h"
#include <G3D/Vector3.h>
+class Unit;
+
namespace Movement
{
typedef std::vector<Vector3> PointsArray;
@@ -61,7 +63,7 @@ namespace Movement
bool TransformForTransport;
/** Returns true to show that the arguments were configured correctly and MoveSpline initialization will succeed. */
- bool Validate() const;
+ bool Validate(Unit* unit) const;
private:
bool _checkPathBounds() const;
};
diff --git a/src/server/game/Movement/Spline/MovementTypedefs.h b/src/server/game/Movement/Spline/MovementTypedefs.h
index 01c8a5b7e7b..d8fe21ad4e6 100644
--- a/src/server/game/Movement/Spline/MovementTypedefs.h
+++ b/src/server/game/Movement/Spline/MovementTypedefs.h
@@ -54,7 +54,7 @@ namespace Movement
class counter
{
public:
- counter() { init();}
+ counter() { init(); }
void Increase()
{
@@ -64,8 +64,8 @@ namespace Movement
++m_counter;
}
- T NewId() { Increase(); return m_counter;}
- T getCurrent() const { return m_counter;}
+ T NewId() { Increase(); return m_counter; }
+ T getCurrent() const { return m_counter; }
private:
void init() { m_counter = 0; }
diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp
index f0ed01c4676..b69d4b39e19 100644
--- a/src/server/game/Movement/Spline/MovementUtil.cpp
+++ b/src/server/game/Movement/Spline/MovementUtil.cpp
@@ -26,31 +26,31 @@ namespace Movement
/// Velocity bounds that makes fall speed limited
float terminalVelocity = 60.148003f;
- float terminalSavefallVelocity = 7.f;
+ float terminalSafefallVelocity = 7.0f;
- const float terminal_length = float(terminalVelocity * terminalVelocity) / (2.f * gravity);
- const float terminal_savefall_length = (terminalSavefallVelocity * terminalSavefallVelocity) / (2.f * gravity);
- const float terminalFallTime = float(terminalVelocity/gravity); // the time that needed to reach terminalVelocity
+ const float terminal_length = float(terminalVelocity * terminalVelocity) / (2.0f * gravity);
+ const float terminal_safefall_length = (terminalSafefallVelocity * terminalSafefallVelocity) / (2.0f * gravity);
+ const float terminalFallTime = float(terminalVelocity / gravity); // the time that needed to reach terminalVelocity
float computeFallTime(float path_length, bool isSafeFall)
{
- if (path_length < 0.f)
- return 0.f;
+ if (path_length < 0.0f)
+ return 0.0f;
float time;
- if ( isSafeFall )
+ if (isSafeFall)
{
- if (path_length >= terminal_savefall_length)
- time = (path_length - terminal_savefall_length)/terminalSavefallVelocity + terminalSavefallVelocity/gravity;
+ if (path_length >= terminal_safefall_length)
+ time = (path_length - terminal_safefall_length) / terminalSafefallVelocity + terminalSafefallVelocity / gravity;
else
- time = sqrtf(2.f * path_length/gravity);
+ time = sqrtf(2.0f * path_length / gravity);
}
else
{
if (path_length >= terminal_length)
- time = (path_length - terminal_length)/terminalVelocity + terminalFallTime;
+ time = (path_length - terminal_length) / terminalVelocity + terminalFallTime;
else
- time = sqrtf(2.f * path_length/gravity);
+ time = sqrtf(2.0f * path_length / gravity);
}
return time;
@@ -61,20 +61,21 @@ namespace Movement
float termVel;
float result;
- if ( isSafeFall )
- termVel = terminalSavefallVelocity;
+ if (isSafeFall)
+ termVel = terminalSafefallVelocity;
else
termVel = terminalVelocity;
- if ( start_velocity > termVel )
+ if (start_velocity > termVel)
start_velocity = termVel;
float terminal_time = terminalFallTime - start_velocity / gravity; // the time that needed to reach terminalVelocity
- if ( t_passed > terminal_time )
+ if (t_passed > terminal_time)
{
- result = terminalVelocity*(t_passed - terminal_time) +
- start_velocity*terminal_time + gravity*terminal_time*terminal_time*0.5f;
+ result = terminalVelocity * (t_passed - terminal_time) +
+ start_velocity * terminal_time +
+ gravity * terminal_time * terminal_time*0.5f;
}
else
result = t_passed * (start_velocity + t_passed * gravity * 0.5f);
@@ -100,7 +101,7 @@ namespace Movement
#define STR(x) #x
- const char * g_MovementFlag_names[]=
+ char const* g_MovementFlag_names[] =
{
STR(Forward ),// 0x00000001,
STR(Backward ),// 0x00000002,
@@ -135,25 +136,25 @@ namespace Movement
STR(Safe_Fall ),// 0x20000000, // Active Rogue Safe Fall Spell (Passive)
STR(Hover ),// 0x40000000
STR(Unknown13 ),// 0x80000000
- STR(Unk1 ),
- STR(Unk2 ),
- STR(Unk3 ),
- STR(Fullspeedturning ),
- STR(Fullspeedpitching ),
- STR(Allow_Pitching ),
- STR(Unk4 ),
- STR(Unk5 ),
- STR(Unk6 ),
- STR(Unk7 ),
- STR(Interp_Move ),
- STR(Interp_Turning ),
- STR(Interp_Pitching ),
- STR(Unk8 ),
- STR(Unk9 ),
- STR(Unk10 ),
+ STR(Unk1 ),
+ STR(Unk2 ),
+ STR(Unk3 ),
+ STR(Fullspeedturning ),
+ STR(Fullspeedpitching ),
+ STR(Allow_Pitching ),
+ STR(Unk4 ),
+ STR(Unk5 ),
+ STR(Unk6 ),
+ STR(Unk7 ),
+ STR(Interp_Move ),
+ STR(Interp_Turning ),
+ STR(Interp_Pitching ),
+ STR(Unk8 ),
+ STR(Unk9 ),
+ STR(Unk10 ),
};
- const char * g_SplineFlag_names[32]=
+ char const* g_SplineFlag_names[32] =
{
STR(AnimBit1 ),// 0x00000001,
STR(AnimBit2 ),// 0x00000002,
@@ -190,11 +191,11 @@ namespace Movement
};
template<class Flags, int N>
- void print_flags(Flags t, const char* (&names)[N], std::string& str)
+ void print_flags(Flags t, char const* (&names)[N], std::string& str)
{
for (int i = 0; i < N; ++i)
{
- if ((t & (Flags)(1 << i)) && names[i] != NULL)
+ if ((t & Flags(1 << i)) && names[i] != NULL)
str.append(" ").append(names[i]);
}
}
@@ -202,7 +203,7 @@ namespace Movement
std::string MoveSplineFlag::ToString() const
{
std::string str;
- print_flags(raw(),g_SplineFlag_names,str);
+ print_flags(raw(), g_SplineFlag_names, str);
return str;
}
}
diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h
index 627cdcf3e3b..63e61b84579 100644
--- a/src/server/game/Movement/Spline/Spline.h
+++ b/src/server/game/Movement/Spline/Spline.h
@@ -53,7 +53,7 @@ protected:
// lesser value saves more performance in cost of lover precision
// minimal value is 1
// client's value is 20, blizzs use 2-3 steps to compute length
- STEPS_PER_SEGMENT = 3,
+ STEPS_PER_SEGMENT = 3
};
static_assert(STEPS_PER_SEGMENT > 0, "shouldn't be lesser than 1");
diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h
index b6ddaa9d726..b6ddaa9d726 100755..100644
--- a/src/server/game/Movement/Waypoints/Path.h
+++ b/src/server/game/Movement/Waypoints/Path.h
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 296c9eee50f..a01e18347f6 100755..100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -48,8 +48,8 @@ void WaypointMgr::Load()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!");
+
return;
}
@@ -86,8 +86,8 @@ void WaypointMgr::Load()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ 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/Movement/Waypoints/WaypointManager.h b/src/server/game/Movement/Waypoints/WaypointManager.h
index 73d611e0419..df20c513c90 100755..100644
--- a/src/server/game/Movement/Waypoints/WaypointManager.h
+++ b/src/server/game/Movement/Waypoints/WaypointManager.h
@@ -27,9 +27,9 @@ struct WaypointData
{
uint32 id;
float x, y, z, orientation;
- bool run;
uint32 delay;
uint32 event_id;
+ bool run;
uint8 event_chance;
};
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index dfdd4fc4ffc..5e3d37acb71 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -30,11 +30,10 @@
#include "CellImpl.h"
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
-m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0), m_maxSpeed(0),
-m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
-m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
-{
-}
+ m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0),
+ m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
+ m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
+{ }
bool OPvPCapturePoint::HandlePlayerEnter(Player* player)
{
@@ -44,14 +43,14 @@ bool OPvPCapturePoint::HandlePlayerEnter(Player* player)
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
}
- return m_activePlayers[player->GetTeamId()].insert(player).second;
+ return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
}
void OPvPCapturePoint::HandlePlayerLeave(Player* player)
{
if (m_capturePoint)
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
- m_activePlayers[player->GetTeamId()].erase(player);
+ m_activePlayers[player->GetTeamId()].erase(player->GetGUID());
}
void OPvPCapturePoint::SendChangePhase()
@@ -123,7 +122,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
{
- sLog->outError("OutdoorPvP: GO %u is not capture point!", entry);
+ sLog->outError(LOG_FILTER_OUTDOORPVP, "OutdoorPvP: GO %u is not capture point!", entry);
return false;
}
@@ -135,7 +134,7 @@ bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, fl
m_maxValue = (float)goinfo->capturePoint.maxTime;
m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
m_neutralValuePct = goinfo->capturePoint.neutralPercent;
- m_minValue = CalculatePctU(m_maxValue, m_neutralValuePct);
+ m_minValue = CalculatePct(m_maxValue, m_neutralValuePct);
return true;
}
@@ -243,7 +242,7 @@ OutdoorPvP::~OutdoorPvP()
void OutdoorPvP::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
{
- m_players[player->GetTeamId()].insert(player);
+ m_players[player->GetTeamId()].insert(player->GetGUID());
}
void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
@@ -254,8 +253,8 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
if (!player->GetSession()->PlayerLogout())
SendRemoveWorldStates(player);
- m_players[player->GetTeamId()].erase(player);
- sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName());
+ m_players[player->GetTeamId()].erase(player->GetGUID());
+ sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName().c_str());
}
void OutdoorPvP::HandlePlayerResurrects(Player* /*player*/, uint32 /*zone*/)
@@ -281,15 +280,10 @@ bool OPvPCapturePoint::Update(uint32 diff)
float radius = (float)m_capturePoint->GetGOInfo()->capturePoint.radius;
for (uint32 team = 0; team < 2; ++team)
- {
- for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
- {
- Player* player = *itr;
- ++itr;
- if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
- HandlePlayerLeave(player);
- }
- }
+ for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
+ if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ HandlePlayerLeave(player);
std::list<Player*> players;
Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
@@ -298,9 +292,10 @@ bool OPvPCapturePoint::Update(uint32 diff)
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
- if ((*itr)->IsOutdoorPvPActive())
+ Player* const player = *itr;
+ if (player->IsOutdoorPvPActive())
{
- if (m_activePlayers[(*itr)->GetTeamId()].insert(*itr).second)
+ if (m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second)
HandlePlayerEnter(*itr);
}
}
@@ -382,7 +377,7 @@ bool OPvPCapturePoint::Update(uint32 diff)
if (m_OldState != m_State)
{
- //sLog->outError("%u->%u", m_OldState, m_State);
+ //sLog->outError(LOG_FILTER_OUTDOORPVP, "%u->%u", m_OldState, m_State);
if (oldTeam != m_team)
ChangeTeam(oldTeam);
ChangeState();
@@ -397,7 +392,8 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
if (m_sendUpdate)
for (int i = 0; i < 2; ++i)
for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
- (*itr)->SendUpdateWorldState(field, value);
+ if (Player * const player = ObjectAccessor::FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
}
void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
@@ -406,9 +402,8 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
{
// send to all players present in the area
for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
- {
- (*itr)->SendUpdateWorldState(field, value);
- }
+ if (Player * const player = ObjectAccessor::FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
}
}
@@ -429,7 +424,8 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
// send to all players present in the area
for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
- (*itr)->KilledMonsterCredit(id, guid);
+ if (Player * const player = ObjectAccessor::FindPlayer(*itr))
+ player->KilledMonsterCredit(id, guid);
}
void OutdoorPvP::HandleKill(Player* killer, Unit* killed)
@@ -476,7 +472,8 @@ bool OutdoorPvP::IsInsideObjective(Player* player) const
bool OPvPCapturePoint::IsInsideObjective(Player* player) const
{
- return m_activePlayers[player->GetTeamId()].find(player) != m_activePlayers[player->GetTeamId()].end();
+ PlayerSet const &plSet = m_activePlayers[player->GetTeamId()];
+ return plSet.find(player->GetGUID()) != plSet.end();
}
bool OutdoorPvP::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go)
@@ -566,7 +563,8 @@ void OutdoorPvP::BroadcastPacket(WorldPacket &data) const
// This is faster than sWorld->SendZoneMessage
for (uint32 team = 0; team < 2; ++team)
for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
- (*itr)->GetSession()->SendPacket(&data);
+ if (Player * const player = ObjectAccessor::FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
}
void OutdoorPvP::RegisterZone(uint32 zoneId)
@@ -574,19 +572,26 @@ void OutdoorPvP::RegisterZone(uint32 zoneId)
sOutdoorPvPMgr->AddZone(zoneId, this);
}
-bool OutdoorPvP::HasPlayer(Player* player) const
+bool OutdoorPvP::HasPlayer(Player const* player) const
{
- return m_players[player->GetTeamId()].find(player) != m_players[player->GetTeamId()].end();
+ PlayerSet const &plSet = m_players[player->GetTeamId()];
+ return plSet.find(player->GetGUID()) != plSet.end();
}
void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId)
{
if (spellId > 0)
+ {
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
- (*itr)->CastSpell(*itr, (uint32)spellId, true);
+ if (Player * const player = ObjectAccessor::FindPlayer(*itr))
+ player->CastSpell(player, (uint32)spellId, true);
+ }
else
+ {
for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
- (*itr)->RemoveAura((uint32)-spellId); // by stack?
+ if (Player * const player = ObjectAccessor::FindPlayer(*itr))
+ player->RemoveAura((uint32)-spellId); // by stack?
+ }
}
void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index 6ea13d353c5..e9d5ff9dfdc 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -18,7 +18,7 @@
#ifndef OUTDOOR_PVP_H_
#define OUTDOOR_PVP_H_
-#include "Utilities/Util.h"
+#include "Util.h"
#include "SharedDefines.h"
#include "ZoneScript.h"
@@ -31,7 +31,7 @@ enum OutdoorPvPTypes
OUTDOOR_PVP_TF = 3,
OUTDOOR_PVP_ZM = 4,
OUTDOOR_PVP_SI = 5,
- OUTDOOR_PVP_EP = 6,
+ OUTDOOR_PVP_EP = 6
};
#define MAX_OUTDOORPVP_TYPES 7
@@ -44,7 +44,7 @@ enum ObjectiveStates
OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
- OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE,
+ OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE
};
#define OTHER_TEAM(a) (a == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE)
@@ -85,7 +85,7 @@ class Unit;
struct GossipMenuItems;
class OutdoorPvP;
-typedef std::set<Player*> PlayerSet;
+typedef std::set<uint64> PlayerSet;
class OPvPCapturePoint
{
@@ -285,7 +285,7 @@ class OutdoorPvP : public ZoneScript
void RegisterZone(uint32 zoneid);
- bool HasPlayer(Player* player) const;
+ bool HasPlayer(Player const * player) const;
void TeamCastSpell(TeamId team, int32 spellId);
};
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index a079d2f643b..ce987e25eed 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -46,8 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
return;
}
@@ -65,7 +64,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
if (typeId >= MAX_OUTDOORPVP_TYPES)
{
- sLog->outErrorDb("Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId);
+ sLog->outError(LOG_FILTER_SQL, "Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId);
continue;
}
@@ -85,20 +84,20 @@ void OutdoorPvPMgr::InitOutdoorPvP()
OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i));
if (iter == m_OutdoorPvPDatas.end())
{
- sLog->outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));
+ sLog->outError(LOG_FILTER_SQL, "Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i));
continue;
}
pvp = sScriptMgr->CreateOutdoorPvP(iter->second);
if (!pvp)
{
- sLog->outError("Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));
+ sLog->outError(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; got NULL pointer from script.", uint32(i));
continue;
}
if (!pvp->SetupOutdoorPvP())
{
- sLog->outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));
+ sLog->outError(LOG_FILTER_OUTDOORPVP, "Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i));
delete pvp;
continue;
}
@@ -106,8 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
m_OutdoorPvPSet.push_back(pvp);
}
- sLog->outString(">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
index 1313e29bfb4..1313e29bfb4 100755..100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index d8548b552d3..0d3d97d3996 100755..100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -17,6 +17,7 @@
*/
#include "PoolMgr.h"
+#include "Containers.h"
#include "ObjectMgr.h"
#include "Log.h"
#include "MapManager.h"
@@ -571,8 +572,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
mPoolTemplate.clear();
- sLog->outString(">> Loaded 0 object pools. DB table `pool_template` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
return;
}
@@ -590,13 +590,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Creatures
- sLog->outString("Loading Creatures Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -605,8 +604,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
}
else
{
@@ -622,17 +620,17 @@ void PoolMgr::LoadFromDB()
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
{
- sLog->outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
- sLog->outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
continue;
}
PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id];
@@ -647,14 +645,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Gameobjects
- sLog->outString("Loading Gameobject Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -663,8 +660,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
}
else
{
@@ -680,7 +676,7 @@ void PoolMgr::LoadFromDB()
GameObjectData const* data = sObjectMgr->GetGOData(guid);
if (!data)
{
- sLog->outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
@@ -689,19 +685,19 @@ void PoolMgr::LoadFromDB()
goinfo->type != GAMEOBJECT_TYPE_GOOBER &&
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE)
{
- sLog->outErrorDb("`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
- sLog->outErrorDb("`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
continue;
}
@@ -717,14 +713,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Pool of pools
- sLog->outString("Loading Mother Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -733,8 +728,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 pools in pools");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools");
}
else
{
@@ -749,22 +743,22 @@ void PoolMgr::LoadFromDB()
if (mother_pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id);
continue;
}
if (child_pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id);
continue;
}
if (mother_pool_id == child_pool_id)
{
- sLog->outErrorDb("`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
- sLog->outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id);
continue;
}
PoolTemplateData* pPoolTemplateMother = &mPoolTemplate[mother_pool_id];
@@ -794,7 +788,7 @@ void PoolMgr::LoadFromDB()
ss << *itr << ' ';
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
<< poolItr->first << " and child pool " << poolItr->second;
- sLog->outErrorDb("%s", ss.str().c_str());
+ sLog->outError(LOG_FILTER_SQL, "%s", ss.str().c_str());
mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first);
mPoolSearchMap.erase(poolItr);
--count;
@@ -803,12 +797,11 @@ void PoolMgr::LoadFromDB()
}
}
- sLog->outString(">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outString("Loading Quest Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -817,8 +810,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Loaded 0 quests in pools");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools");
}
else
{
@@ -844,19 +836,19 @@ void PoolMgr::LoadFromDB()
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
if (!quest)
{
- sLog->outErrorDb("`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
- sLog->outErrorDb("`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (!quest->IsDailyOrWeekly())
{
- sLog->outErrorDb("`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id);
continue;
}
@@ -867,7 +859,7 @@ void PoolMgr::LoadFromDB()
if (poolTypeMap[pool_id] != currType)
{
- sLog->outErrorDb("`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.",
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.",
entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY");
continue;
}
@@ -877,7 +869,7 @@ void PoolMgr::LoadFromDB()
if (creBounds.first == creBounds.second && goBounds.first == goBounds.second)
{
- sLog->outErrorDb("`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id);
+ sLog->outError(LOG_FILTER_SQL, "`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id);
continue;
}
@@ -893,13 +885,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
- sLog->outString("Starting objects pooling system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system...");
{
uint32 oldMSTime = getMSTime();
@@ -909,8 +900,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outString(">> Pool handling system initialized, 0 pools spawned.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned.");
}
else
{
@@ -926,9 +916,9 @@ void PoolMgr::LoadFromDB()
if (pool_pool_id)
// The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned,
// however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing.
- sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32());
+ sLog->outError(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32());
else
- sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry);
+ sLog->outError(LOG_FILTER_SQL, "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry);
continue;
}
@@ -941,8 +931,8 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outBasic("Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outDebug(LOG_FILTER_POOLSYS, "Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
}
}
diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h
index be839bf1566..be839bf1566 100755..100644
--- a/src/server/game/Pools/PoolMgr.h
+++ b/src/server/game/Pools/PoolMgr.h
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 9221da53003..1238afe2ee1 100755..100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -140,10 +140,9 @@ Quest::Quest(Field* questRecord)
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32();
- StartScript = questRecord[144].GetUInt32();
- CompleteScript = questRecord[145].GetUInt32();
+ CompleteScript = questRecord[144].GetUInt32();
- // int32 WDBVerified = questRecord[146].GetInt32();
+ // int32 WDBVerified = questRecord[145].GetInt32();
Flags |= SpecialFlags << 20;
if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
@@ -238,10 +237,11 @@ uint32 Quest::CalculateHonorGain(uint8 level) const
if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
{
// values stored from 0.. for 1...
- TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level-1);
+ TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level);
if (!tc)
return 0;
- honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1000000014901161);
+
+ honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1f);
honor += GetRewHonorAddition();
}
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 7f22b441afe..61b3de5f327 100755..100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -90,7 +90,7 @@ enum __QuestTradeSkill
QUEST_TRSKILL_MINING = 11,
QUEST_TRSKILL_FISHING = 12,
QUEST_TRSKILL_SKINNING = 13,
- QUEST_TRSKILL_JEWELCRAFTING = 14,
+ QUEST_TRSKILL_JEWELCRAFTING = 14
};
enum QuestStatus
@@ -120,7 +120,7 @@ enum __QuestGiverStatus
DIALOG_STATUS_REWARD = 10 // yellow dot on minimap
};
-enum __QuestFlags
+enum QuestFlags
{
// Flags used at server and sent to client
QUEST_FLAGS_NONE = 0x00000000,
@@ -150,15 +150,16 @@ enum __QuestFlags
QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT = 0x00200000, // Set by 2 in SpecialFlags from DB (if reequired area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script)
QUEST_TRINITY_FLAGS_AUTO_ACCEPT = 0x00400000, // Set by 4 in SpecialFlags in DB if the quest is to be auto-accepted.
QUEST_TRINITY_FLAGS_DF_QUEST = 0x00800000, // Set by 8 in SpecialFlags in DB if the quest is used by Dungeon Finder.
+ QUEST_TRINITY_FLAGS_MONTHLY = 0x01000000, // Set by 16 in SpecialFlags in DB if the quest is reset at the begining of the month
- QUEST_TRINITY_FLAGS_DB_ALLOWED = 0xFFFFF | QUEST_TRINITY_FLAGS_REPEATABLE | QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT | QUEST_TRINITY_FLAGS_AUTO_ACCEPT | QUEST_TRINITY_FLAGS_DF_QUEST,
+ QUEST_TRINITY_FLAGS_DB_ALLOWED = 0xFFFFF | QUEST_TRINITY_FLAGS_REPEATABLE | QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT | QUEST_TRINITY_FLAGS_AUTO_ACCEPT | QUEST_TRINITY_FLAGS_DF_QUEST | QUEST_TRINITY_FLAGS_MONTHLY,
// Trinity flags for internal use only
QUEST_TRINITY_FLAGS_DELIVER = 0x04000000, // Internal flag computed only
QUEST_TRINITY_FLAGS_SPEAKTO = 0x08000000, // Internal flag computed only
QUEST_TRINITY_FLAGS_KILL_OR_CAST = 0x10000000, // Internal flag computed only
QUEST_TRINITY_FLAGS_TIMED = 0x20000000, // Internal flag computed only
- QUEST_TRINITY_FLAGS_PLAYER_KILL = 0x40000000, // Internal flag computed only
+ QUEST_TRINITY_FLAGS_PLAYER_KILL = 0x40000000 // Internal flag computed only
};
struct QuestLocale
@@ -194,7 +195,7 @@ class Quest
int32 GetZoneOrSort() const { return ZoneOrSort; }
uint32 GetMinLevel() const { return MinLevel; }
uint32 GetMaxLevel() const { return MaxLevel; }
- uint32 GetQuestLevel() const { return Level; }
+ int32 GetQuestLevel() const { return Level; }
uint32 GetType() const { return Type; }
uint32 GetRequiredClasses() const { return RequiredClasses; }
uint32 GetRequiredRaces() const { return RequiredRaces; }
@@ -222,18 +223,17 @@ class Quest
uint32 GetSrcItemId() const { return SourceItemId; }
uint32 GetSrcItemCount() const { return SourceItemIdCount; }
uint32 GetSrcSpell() const { return SourceSpellid; }
- std::string GetTitle() const { return Title; }
- std::string GetDetails() const { return Details; }
- std::string GetObjectives() const { return Objectives; }
- std::string GetOfferRewardText() const { return OfferRewardText; }
- std::string GetRequestItemsText() const { return RequestItemsText; }
- std::string GetEndText() const { return EndText; }
- std::string GetCompletedText() const { return CompletedText; }
+ std::string const& GetTitle() const { return Title; }
+ std::string const& GetDetails() const { return Details; }
+ std::string const& GetObjectives() const { return Objectives; }
+ std::string const& GetOfferRewardText() const { return OfferRewardText; }
+ std::string const& GetRequestItemsText() const { return RequestItemsText; }
+ std::string const& GetEndText() const { return EndText; }
+ std::string const& GetCompletedText() const { return CompletedText; }
int32 GetRewOrReqMoney() const;
uint32 GetRewHonorAddition() const { return RewardHonor; }
float GetRewHonorMultiplier() const { return RewardHonorMultiplier; }
- uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; }
- // use in XP calculation at client
+ uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } // use in XP calculation at client
uint32 GetRewSpell() const { return RewardSpell; }
int32 GetRewSpellCast() const { return RewardSpellCast; }
uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; }
@@ -244,7 +244,6 @@ class Quest
uint32 GetPointOpt() const { return PointOption; }
uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; }
uint32 GetCompleteEmote() const { return EmoteOnComplete; }
- uint32 GetQuestStartScript() const { return StartScript; }
uint32 GetQuestCompleteScript() const { return CompleteScript; }
bool IsRepeatable() const { return Flags & QUEST_TRINITY_FLAGS_REPEATABLE; }
bool IsAutoAccept() const;
@@ -252,6 +251,7 @@ class Quest
uint32 GetFlags() const { return Flags; }
bool IsDaily() const { return Flags & QUEST_FLAGS_DAILY; }
bool IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; }
+ bool IsMonthly() const { return Flags & QUEST_TRINITY_FLAGS_MONTHLY; }
bool IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); }
bool IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
bool IsRaidQuest() const { return Type == QUEST_TYPE_RAID || Type == QUEST_TYPE_RAID_10 || Type == QUEST_TYPE_RAID_25; }
@@ -354,7 +354,6 @@ class Quest
uint32 PointOption;
uint32 EmoteOnIncomplete;
uint32 EmoteOnComplete;
- uint32 StartScript;
uint32 CompleteScript;
};
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 94a6590cc4a..2294ec0d6a4 100755..100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -24,6 +24,7 @@
#include "World.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
+#include "Opcodes.h"
const int32 ReputationMgr::PointsInRank[MAX_REPUTATION_RANK] = {36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000};
@@ -45,7 +46,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const
if (!factionEntry)
{
- sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
+ sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id);
return 0;
}
@@ -68,7 +69,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
if (!factionEntry)
{
- sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
+ sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id);
return 0;
}
@@ -197,23 +198,24 @@ void ReputationMgr::SendState(FactionState const* faction)
void ReputationMgr::SendInitialReputations()
{
- WorldPacket data(SMSG_INITIALIZE_FACTIONS, (4+128*5));
- data << uint32 (0x00000080);
+ uint8 count = 128;
+ WorldPacket data(SMSG_INITIALIZE_FACTIONS, 4 + count * 5);
+ data << uint32(count);
RepListID a = 0;
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
{
// fill in absent fields
- for (; a != itr->first; a++)
+ for (; a != itr->first; ++a)
{
- data << uint8 (0x00);
- data << uint32 (0x00000000);
+ data << uint8(0);
+ data << uint32(0);
}
// fill in encountered data
- data << uint8 (itr->second.Flags);
- data << uint32 (itr->second.Standing);
+ data << uint8(itr->second.Flags);
+ data << uint32(itr->second.Standing);
itr->second.needSend = false;
@@ -221,10 +223,10 @@ void ReputationMgr::SendInitialReputations()
}
// fill in absent fields
- for (; a != 128; a++)
+ for (; a != count; ++a)
{
- data << uint8 (0x00);
- data << uint32 (0x00000000);
+ data << uint8(0);
+ data << uint32(0);
}
_player->SendDirectMessage(&data);
@@ -388,11 +390,11 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
UpdateRankCounters(old_rank, new_rank);
_player->ReputationChanged(factionEntry);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
- _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
+ _player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
return true;
}
diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h
index a073845ea73..f950cbb82c2 100755..100644
--- a/src/server/game/Reputation/ReputationMgr.h
+++ b/src/server/game/Reputation/ReputationMgr.h
@@ -65,7 +65,7 @@ class ReputationMgr
{
public: // constructors and global modifiers
explicit ReputationMgr(Player* owner) : _player(owner),
- _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0) {}
+ _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0), _sendFactionIncreased(false) {}
~ReputationMgr() {}
void SaveToDB(SQLTransaction& trans);
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 5387a3132c6..069ae71b7cb 100755..100644
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -16,19 +16,20 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Map.h"
-#include "World.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "Transport.h"
-#include "ScriptedCreature.h"
-#include "WaypointManager.h"
#include "GossipDef.h"
+#include "Map.h"
#include "MapManager.h"
-#include "ObjectMgr.h"
#include "MapRefManager.h"
+#include "ObjectMgr.h"
+#include "Pet.h"
+#include "ScriptedCreature.h"
#include "ScriptMgr.h"
+#include "Transport.h"
+#include "WaypointManager.h"
+#include "World.h"
/// Put scripts in the execution queue
void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, Object* target)
@@ -102,7 +103,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
{
Player* player = NULL;
if (!source && !target)
- sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
{
// Check target first, then source.
@@ -112,7 +113,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
player = source->ToPlayer();
if (!player)
- sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
@@ -124,7 +125,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
{
Creature* creature = NULL;
if (!source && !target)
- sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str());
else
{
if (bReverse)
@@ -145,7 +146,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
}
if (!creature)
- sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(),
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
@@ -157,15 +158,15 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
{
Unit* unit = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else if (!obj->isType(TYPEMASK_UNIT))
- sLog->outError("%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
else
{
unit = obj->ToUnit();
if (!unit)
- sLog->outError("%s %s object could not be casted to unit.",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object could not be casted to unit.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
}
return unit;
@@ -175,12 +176,12 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf
{
Player* player = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
player = obj->ToPlayer();
if (!player)
- sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return player;
@@ -190,12 +191,12 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip
{
Creature* creature = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
creature = obj->ToCreature();
if (!creature)
- sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return creature;
@@ -205,13 +206,13 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
{
WorldObject* pWorldObject = NULL;
if (!obj)
- sLog->outError("%s %s object is NULL.",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is NULL.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else
{
pWorldObject = dynamic_cast<WorldObject*>(obj);
if (!pWorldObject)
- sLog->outError("%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
}
return pWorldObject;
@@ -227,29 +228,29 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
case SCRIPT_COMMAND_OPEN_DOOR: bOpen = true; break;
case SCRIPT_COMMAND_CLOSE_DOOR: break;
default:
- sLog->outError("%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
return;
}
if (!guid)
- sLog->outError("%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
else if (!source)
- sLog->outError("%s source object is NULL.", scriptInfo->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str());
else if (!source->isType(TYPEMASK_UNIT))
- sLog->outError("%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
+ sLog->outError(LOG_FILTER_TSCR, "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
{
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
if (!wSource)
- sLog->outError("%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
{
GameObject* pDoor = _FindGameObject(wSource, guid);
if (!pDoor)
- sLog->outError("%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
- sLog->outError("%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow());
else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
{
@@ -331,7 +332,7 @@ void Map::ScriptsProcess()
}
break;
default:
- sLog->outError("%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID));
break;
}
@@ -359,7 +360,7 @@ void Map::ScriptsProcess()
target = HashMapHolder<Corpse>::Find(step.targetGUID);
break;
default:
- sLog->outError("%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID));
break;
}
@@ -370,7 +371,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_TALK:
if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
{
- sLog->outError("%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
+ sLog->outError(LOG_FILTER_TSCR, "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
break;
}
if (step.script->Talk.Flags & SF_TALK_USE_PLAYER)
@@ -397,7 +398,7 @@ void Map::ScriptsProcess()
{
uint64 targetGUID = target ? target->GetGUID() : 0;
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
- sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
player->Whisper(text, LANG_UNIVERSAL, targetGUID);
break;
@@ -429,13 +430,13 @@ void Map::ScriptsProcess()
break;
case CHAT_TYPE_WHISPER:
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
- sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
cSource->Whisper(step.script->Talk.TextID, targetGUID);
break;
case CHAT_MSG_RAID_BOSS_WHISPER:
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
- sLog->outError("%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
else
cSource->MonsterWhisper(step.script->Talk.TextID, targetGUID, true);
break;
@@ -463,7 +464,7 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount())
- sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID,
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
else
@@ -492,7 +493,7 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
- sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
@@ -506,7 +507,7 @@ void Map::ScriptsProcess()
{
// Validate field number.
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
- sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
source->GetValuesCount(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
else
@@ -533,12 +534,12 @@ void Map::ScriptsProcess()
{
if (!source)
{
- sLog->outError("%s source object is NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source object is NULL.", step.script->GetDebugInfo().c_str());
break;
}
if (!target)
{
- sLog->outError("%s target object is NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str());
break;
}
@@ -549,7 +550,7 @@ void Map::ScriptsProcess()
{
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
{
- sLog->outError("%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
break;
}
@@ -562,7 +563,7 @@ void Map::ScriptsProcess()
{
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
{
- sLog->outError("%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
@@ -570,7 +571,7 @@ void Map::ScriptsProcess()
}
else
{
- sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
@@ -601,7 +602,7 @@ void Map::ScriptsProcess()
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
if (!step.script->RespawnGameobject.GOGuid)
{
- sLog->outError("%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str());
break;
}
@@ -611,7 +612,7 @@ void Map::ScriptsProcess()
GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid);
if (!pGO)
{
- sLog->outError("%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid);
+ sLog->outError(LOG_FILTER_TSCR, "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid);
break;
}
@@ -620,7 +621,7 @@ void Map::ScriptsProcess()
pGO->GetGoType() == GAMEOBJECT_TYPE_BUTTON ||
pGO->GetGoType() == GAMEOBJECT_TYPE_TRAP)
{
- sLog->outError("%s can not be used with gameobject of type %u (guid: %u).",
+ sLog->outError(LOG_FILTER_TSCR, "%s can not be used with gameobject of type %u (guid: %u).",
step.script->GetDebugInfo().c_str(), uint32(pGO->GetGoType()), step.script->RespawnGameobject.GOGuid);
break;
}
@@ -643,7 +644,7 @@ void Map::ScriptsProcess()
if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script))
{
if (!step.script->TempSummonCreature.CreatureEntry)
- sLog->outError("%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str());
else
{
float x = step.script->TempSummonCreature.PosX;
@@ -652,7 +653,7 @@ void Map::ScriptsProcess()
float o = step.script->TempSummonCreature.Orientation;
if (!pSummoner->SummonCreature(step.script->TempSummonCreature.CreatureEntry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay))
- sLog->outError("%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry);
+ sLog->outError(LOG_FILTER_TSCR, "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry);
}
}
break;
@@ -670,13 +671,13 @@ void Map::ScriptsProcess()
// Target must be GameObject.
if (!target)
{
- sLog->outError("%s target object is NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s target object is NULL.", step.script->GetDebugInfo().c_str());
break;
}
if (target->GetTypeId() != TYPEID_GAMEOBJECT)
{
- sLog->outError("%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
+ sLog->outError(LOG_FILTER_TSCR, "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
@@ -700,7 +701,7 @@ void Map::ScriptsProcess()
// TODO: Allow gameobjects to be targets and casters
if (!source && !target)
{
- sLog->outError("%s source and target objects are NULL.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s source and target objects are NULL.", step.script->GetDebugInfo().c_str());
break;
}
@@ -733,13 +734,13 @@ void Map::ScriptsProcess()
if (!uSource || !uSource->isType(TYPEMASK_UNIT))
{
- sLog->outError("%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
+ sLog->outError(LOG_FILTER_TSCR, "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
break;
}
if (!uTarget || !uTarget->isType(TYPEMASK_UNIT))
{
- sLog->outError("%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
+ sLog->outError(LOG_FILTER_TSCR, "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
break;
}
@@ -799,7 +800,7 @@ void Map::ScriptsProcess()
if (Unit* unit = _GetScriptUnit(source, true, step.script))
{
if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID))
- sLog->outError("%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID);
+ sLog->outError(LOG_FILTER_TSCR, "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID);
else
unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable);
}
@@ -809,12 +810,12 @@ void Map::ScriptsProcess()
{
if (!step.script->CallScript.CreatureEntry)
{
- sLog->outError("%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str());
break;
}
if (!step.script->CallScript.ScriptID)
{
- sLog->outError("%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str());
break;
}
@@ -840,7 +841,7 @@ void Map::ScriptsProcess()
if (!cTarget)
{
- sLog->outError("%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry);
+ sLog->outError(LOG_FILTER_TSCR, "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry);
break;
}
@@ -849,7 +850,7 @@ void Map::ScriptsProcess()
//if no scriptmap present...
if (!datamap)
{
- sLog->outError("%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType);
+ sLog->outError(LOG_FILTER_TSCR, "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType);
break;
}
@@ -863,7 +864,7 @@ void Map::ScriptsProcess()
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
{
if (cSource->isDead())
- sLog->outError("%s creature is already dead (Entry: %u, GUID: %u)",
+ sLog->outError(LOG_FILTER_TSCR, "%s creature is already dead (Entry: %u, GUID: %u)",
step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow());
else
{
@@ -919,7 +920,7 @@ void Map::ScriptsProcess()
break;
default:
- sLog->outError("Unknown script command %s.", step.script->GetDebugInfo().c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Unknown script command %s.", step.script->GetDebugInfo().c_str());
break;
}
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index c95a1aa60d1..b794d45423b 100755..100644
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -47,9 +47,12 @@ void AddSC_SmartSCripts();
void AddSC_account_commandscript();
void AddSC_achievement_commandscript();
void AddSC_ban_commandscript();
+void AddSC_bf_commandscript();
void AddSC_cast_commandscript();
void AddSC_character_commandscript();
+void AddSC_cheat_commandscript();
void AddSC_debug_commandscript();
+void AddSC_disable_commandscript();
void AddSC_event_commandscript();
void AddSC_gm_commandscript();
void AddSC_go_commandscript();
@@ -58,8 +61,10 @@ void AddSC_guild_commandscript();
void AddSC_honor_commandscript();
void AddSC_instance_commandscript();
void AddSC_learn_commandscript();
+void AddSC_lfg_commandscript();
void AddSC_list_commandscript();
void AddSC_lookup_commandscript();
+void AddSC_message_commandscript();
void AddSC_misc_commandscript();
void AddSC_modify_commandscript();
void AddSC_npc_commandscript();
@@ -68,6 +73,7 @@ void AddSC_reload_commandscript();
void AddSC_reset_commandscript();
void AddSC_server_commandscript();
void AddSC_tele_commandscript();
+void AddSC_ticket_commandscript();
void AddSC_titles_commandscript();
void AddSC_wp_commandscript();
@@ -320,6 +326,7 @@ void AddSC_bug_trio();
void AddSC_boss_sartura();
void AddSC_boss_skeram();
void AddSC_boss_twinemperors();
+void AddSC_boss_ouro();
void AddSC_mob_anubisath_sentinel();
void AddSC_instance_temple_of_ahnqiraj();
void AddSC_wailing_caverns(); //Wailing caverns
@@ -496,6 +503,7 @@ void AddSC_ruby_sanctum();
void AddSC_boss_baltharus_the_warborn();
void AddSC_boss_saviana_ragefire();
void AddSC_boss_general_zarithrian();
+void AddSC_boss_halion();
void AddSC_dalaran();
void AddSC_borean_tundra();
@@ -505,6 +513,7 @@ void AddSC_howling_fjord();
void AddSC_icecrown();
void AddSC_sholazar_basin();
void AddSC_storm_peaks();
+void AddSC_wintergrasp();
void AddSC_zuldrak();
void AddSC_crystalsong_forest();
void AddSC_isle_of_conquest();
@@ -592,6 +601,9 @@ void AddSC_shattrath_city();
void AddSC_terokkar_forest();
void AddSC_zangarmarsh();
+// Events
+void AddSC_event_childrens_week();
+
// battlegrounds
// outdoor pvp
@@ -658,9 +670,12 @@ void AddCommandScripts()
AddSC_account_commandscript();
AddSC_achievement_commandscript();
AddSC_ban_commandscript();
+ AddSC_bf_commandscript();
AddSC_cast_commandscript();
AddSC_character_commandscript();
+ AddSC_cheat_commandscript();
AddSC_debug_commandscript();
+ AddSC_disable_commandscript();
AddSC_event_commandscript();
AddSC_gm_commandscript();
AddSC_go_commandscript();
@@ -670,7 +685,9 @@ void AddCommandScripts()
AddSC_instance_commandscript();
AddSC_learn_commandscript();
AddSC_lookup_commandscript();
+ AddSC_lfg_commandscript();
AddSC_list_commandscript();
+ AddSC_message_commandscript();
AddSC_misc_commandscript();
AddSC_modify_commandscript();
AddSC_npc_commandscript();
@@ -679,6 +696,7 @@ void AddCommandScripts()
AddSC_reset_commandscript();
AddSC_server_commandscript();
AddSC_tele_commandscript();
+ AddSC_ticket_commandscript();
AddSC_titles_commandscript();
AddSC_wp_commandscript();
}
@@ -942,6 +960,7 @@ void AddKalimdorScripts()
AddSC_boss_sartura();
AddSC_boss_skeram();
AddSC_boss_twinemperors();
+ AddSC_boss_ouro();
AddSC_mob_anubisath_sentinel();
AddSC_instance_temple_of_ahnqiraj();
AddSC_wailing_caverns(); //Wailing caverns
@@ -1209,6 +1228,7 @@ void AddNorthrendScripts()
AddSC_boss_baltharus_the_warborn();
AddSC_boss_saviana_ragefire();
AddSC_boss_general_zarithrian();
+ AddSC_boss_halion();
AddSC_dalaran();
AddSC_borean_tundra();
@@ -1218,12 +1238,20 @@ void AddNorthrendScripts()
AddSC_icecrown();
AddSC_sholazar_basin();
AddSC_storm_peaks();
+ AddSC_wintergrasp();
AddSC_zuldrak();
AddSC_crystalsong_forest();
AddSC_isle_of_conquest();
#endif
}
+void AddEventScripts()
+{
+#ifdef SCRIPTS
+ AddSC_event_childrens_week();
+#endif
+}
+
void AddOutdoorPvPScripts()
{
#ifdef SCRIPTS
diff --git a/src/server/game/Scripting/ScriptLoader.h b/src/server/game/Scripting/ScriptLoader.h
index 0db6917a0d4..04ab3215551 100644
--- a/src/server/game/Scripting/ScriptLoader.h
+++ b/src/server/game/Scripting/ScriptLoader.h
@@ -27,6 +27,7 @@ void AddEasternKingdomsScripts();
void AddKalimdorScripts();
void AddOutlandScripts();
void AddNorthrendScripts();
+void AddEventScripts();
void AddBattlegroundScripts();
void AddOutdoorPvPScripts();
void AddCustomScripts();
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 23d18e12097..216eee949f6 100755..100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
#include "ScriptMgr.h"
#include "Config.h"
#include "DatabaseEnv.h"
@@ -27,6 +26,12 @@
#include "ScriptSystem.h"
#include "Transport.h"
#include "Vehicle.h"
+#include "SpellInfo.h"
+#include "SpellScript.h"
+#include "GossipDef.h"
+#include "CreatureAI.h"
+#include "Player.h"
+#include "WorldPacket.h"
// This is the global static registry of scripts.
template<class TScript>
@@ -51,7 +56,7 @@ class ScriptRegistry
{
if (it->second == script)
{
- sLog->outError("Script '%s' has same memory pointer as '%s'.",
+ sLog->outError(LOG_FILTER_TSCR, "Script '%s' has same memory pointer as '%s'.",
script->GetName().c_str(), it->second->GetName().c_str());
return;
@@ -87,7 +92,7 @@ class ScriptRegistry
else
{
// If the script is already assigned -> delete it!
- sLog->outError("Script '%s' already assigned with the same script name, so the script can't work.",
+ sLog->outError(LOG_FILTER_TSCR, "Script '%s' already assigned with the same script name, so the script can't work.",
script->GetName().c_str());
ASSERT(false); // Error that should be fixed ASAP.
@@ -97,7 +102,7 @@ class ScriptRegistry
{
// The script uses a script name from database, but isn't assigned to anything.
if (script->GetName().find("example") == std::string::npos && script->GetName().find("Smart") == std::string::npos)
- sLog->outErrorDb("Script named '%s' does not have a script name assigned in database.",
+ sLog->outError(LOG_FILTER_SQL, "Script named '%s' does not have a script name assigned in database.",
script->GetName().c_str());
}
}
@@ -155,83 +160,7 @@ class ScriptRegistry
if (!V) \
return R;
-void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target)
-{
- if (!pSource)
- {
- sLog->outError("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry);
- return;
- }
-
- if (iTextEntry >= 0)
- {
- sLog->outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
- return;
- }
-
- const StringTextData* pData = sScriptSystemMgr->GetTextData(iTextEntry);
-
- if (!pData)
- {
- sLog->outError("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry);
- return;
- }
-
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote);
-
- if (pData->uiSoundId)
- {
- if (sSoundEntriesStore.LookupEntry(pData->uiSoundId))
- pSource->SendPlaySound(pData->uiSoundId, false);
- else
- sLog->outError("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId);
- }
-
- if (pData->uiEmote)
- {
- if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
- ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote);
- else
- sLog->outError("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId());
- }
- switch (pData->uiType)
- {
- case CHAT_TYPE_SAY:
- pSource->MonsterSay(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0);
- break;
- case CHAT_TYPE_YELL:
- pSource->MonsterYell(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0);
- break;
- case CHAT_TYPE_TEXT_EMOTE:
- pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0);
- break;
- case CHAT_TYPE_BOSS_EMOTE:
- pSource->MonsterTextEmote(iTextEntry, target ? target->GetGUID() : 0, true);
- break;
- case CHAT_TYPE_WHISPER:
- {
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- pSource->MonsterWhisper(iTextEntry, target->GetGUID());
- else
- sLog->outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
-
- break;
- }
- case CHAT_TYPE_BOSS_WHISPER:
- {
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- pSource->MonsterWhisper(iTextEntry, target->GetGUID(), true);
- else
- sLog->outError("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry);
-
- break;
- }
- case CHAT_TYPE_ZONE_YELL:
- pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, target ? target->GetGUID() : 0);
- break;
- }
-}
ScriptMgr::ScriptMgr()
: _scriptCount(0), _scheduledScripts(0)
@@ -248,13 +177,12 @@ void ScriptMgr::Initialize()
LoadDatabase();
- sLog->outString("Loading C++ scripts");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts");
FillSpellSummary();
AddScripts();
- sLog->outString(">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
}
void ScriptMgr::Unload()
@@ -295,8 +223,6 @@ void ScriptMgr::Unload()
void ScriptMgr::LoadDatabase()
{
- sScriptSystemMgr->LoadScriptTexts();
- sScriptSystemMgr->LoadScriptTextsCustom();
sScriptSystemMgr->LoadScriptWaypoints();
}
@@ -851,6 +777,14 @@ CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
return tmpscript->GetAI(creature);
}
+GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* gameobject)
+{
+ ASSERT(gameobject);
+
+ GET_SCRIPT_RET(GameObjectScript, gameobject->GetScriptId(), tmpscript, NULL);
+ return tmpscript->GetAI(gameobject);
+}
+
void ScriptMgr::OnCreatureUpdate(Creature* creature, uint32 diff)
{
ASSERT(creature);
@@ -970,14 +904,6 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd
return tmpscript->OnDummyEffect(caster, spellId, effIndex, target);
}
-GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
-{
- ASSERT(go);
-
- GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL);
- return tmpscript->GetAI(go);
-}
-
bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
{
ASSERT(player);
@@ -1184,12 +1110,12 @@ void ScriptMgr::OnShutdown()
FOREACH_SCRIPT(WorldScript)->OnShutdown();
}
-bool ScriptMgr::OnCriteriaCheck(AchievementCriteriaData const* data, Player* source, Unit* target)
+bool ScriptMgr::OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target)
{
ASSERT(source);
// target can be NULL.
- GET_SCRIPT_RET(AchievementCriteriaScript, data->ScriptId, tmpscript, false);
+ GET_SCRIPT_RET(AchievementCriteriaScript, scriptId, tmpscript, false);
return tmpscript->OnCheck(source, target);
}
@@ -1440,7 +1366,7 @@ WorldMapScript::WorldMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<Map>(mapId)
{
if (GetEntry() && !GetEntry()->IsWorldMap())
- sLog->outError("WorldMapScript for map %u is invalid.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "WorldMapScript for map %u is invalid.", mapId);
ScriptRegistry<WorldMapScript>::AddScript(this);
}
@@ -1449,7 +1375,7 @@ InstanceMapScript::InstanceMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<InstanceMap>(mapId)
{
if (GetEntry() && !GetEntry()->IsDungeon())
- sLog->outError("InstanceMapScript for map %u is invalid.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "InstanceMapScript for map %u is invalid.", mapId);
ScriptRegistry<InstanceMapScript>::AddScript(this);
}
@@ -1458,7 +1384,7 @@ BattlegroundMapScript::BattlegroundMapScript(const char* name, uint32 mapId)
: ScriptObject(name), MapScript<BattlegroundMap>(mapId)
{
if (GetEntry() && !GetEntry()->IsBattleground())
- sLog->outError("BattlegroundMapScript for map %u is invalid.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "BattlegroundMapScript for map %u is invalid.", mapId);
ScriptRegistry<BattlegroundMapScript>::AddScript(this);
}
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index b3d445af0c6..df5af95ac30 100755..100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -24,7 +24,6 @@
#include <ace/Atomic_Op.h>
#include "DBCStores.h"
-#include "Player.h"
#include "SharedDefines.h"
#include "World.h"
#include "Weather.h"
@@ -70,8 +69,6 @@ struct OutdoorPvPData;
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
-// Generic scripting text function.
-void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = NULL);
/*
TODO: Add more script type classes.
@@ -164,7 +161,7 @@ class ScriptObject
protected:
ScriptObject(const char* name)
- : _name(std::string(name))
+ : _name(name)
{
}
@@ -314,7 +311,7 @@ template<class TMap> class MapScript : public UpdatableScript<TMap>
: _mapEntry(sMapStore.LookupEntry(mapId))
{
if (!_mapEntry)
- sLog->outError("Invalid MapScript for %u; no such map ID.", mapId);
+ sLog->outError(LOG_FILTER_TSCR, "Invalid MapScript for %u; no such map ID.", mapId);
}
public:
@@ -980,7 +977,7 @@ class ScriptMgr
public: /* AchievementCriteriaScript */
- bool OnCriteriaCheck(AchievementCriteriaData const* data, Player* source, Unit* target);
+ bool OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target);
public: /* PlayerScript */
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index c38d559372f..ea1cf6b1994 100755..100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -16,139 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
#include "ScriptSystem.h"
#include "ObjectMgr.h"
#include "DatabaseEnv.h"
+#include "ScriptMgr.h"
ScriptPointVector const SystemMgr::_empty;
-void SystemMgr::LoadScriptTexts()
-{
- sLog->outString("TSCR: Loading Script Texts...");
- LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2));
-
- sLog->outString("TSCR: Loading Script Texts additional data...");
- uint32 oldMSTime = getMSTime();
-
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts");
-
- if (!result)
- {
- sLog->outString(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
- sLog->outString();
- return;
- }
-
- uint32 uiCount = 0;
-
- do
- {
- Field* pFields = result->Fetch();
- StringTextData temp;
-
- int32 iId = pFields[0].GetInt32();
- temp.uiSoundId = pFields[1].GetUInt32();
- temp.uiType = pFields[2].GetUInt8();
- temp.uiLanguage = pFields[3].GetUInt8();
- temp.uiEmote = pFields[4].GetUInt16();
-
- if (iId >= 0)
- {
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` is not a negative value.", iId);
- continue;
- }
-
- if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2)
- {
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId);
- continue;
- }
-
- if (temp.uiSoundId)
- {
- if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
- }
-
- if (!GetLanguageDescByID(temp.uiLanguage))
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
-
- if (temp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
-
- m_mTextDataMap[iId] = temp;
- ++uiCount;
- }
- while (result->NextRow());
-
- sLog->outString(">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
-}
-
-void SystemMgr::LoadScriptTextsCustom()
-{
- sLog->outString("TSCR: Loading Custom Texts...");
- LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3));
-
- sLog->outString("TSCR: Loading Custom Texts additional data...");
-
- QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
-
- if (!result)
- {
- sLog->outString(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
- sLog->outString();
- return;
- }
-
- uint32 uiCount = 0;
-
- do
- {
- Field* pFields = result->Fetch();
- StringTextData temp;
-
- int32 iId = pFields[0].GetInt32();
- temp.uiSoundId = pFields[1].GetUInt32();
- temp.uiType = pFields[2].GetUInt8();
- temp.uiLanguage = pFields[3].GetUInt8();
- temp.uiEmote = pFields[4].GetUInt16();
-
- if (iId >= 0)
- {
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId);
- continue;
- }
-
- if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3)
- {
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId);
- continue;
- }
-
- if (temp.uiSoundId)
- {
- if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId))
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId);
- }
-
- if (!GetLanguageDescByID(temp.uiLanguage))
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, temp.uiLanguage);
-
- if (temp.uiType > CHAT_TYPE_ZONE_YELL)
- sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, temp.uiType);
-
- m_mTextDataMap[iId] = temp;
- ++uiCount;
- }
- while (result->NextRow());
-
- sLog->outString(">> Loaded %u additional Custom Texts data.", uiCount);
- sLog->outString();
-}
-
void SystemMgr::LoadScriptWaypoints()
{
uint32 oldMSTime = getMSTime();
@@ -163,15 +37,14 @@ void SystemMgr::LoadScriptWaypoints()
if (result)
uiCreatureCount = result->GetRowCount();
- sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
if (!result)
{
- sLog->outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
return;
}
@@ -194,18 +67,17 @@ void SystemMgr::LoadScriptWaypoints()
if (!pCInfo)
{
- sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
continue;
}
if (!pCInfo->ScriptID)
- sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
m_mPointMoveMap[uiEntry].push_back(temp);
++count;
}
while (result->NextRow());
- sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index cf6332b22f2..cc65d493f3e 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -5,6 +5,7 @@
#ifndef SC_SYSTEM_H
#define SC_SYSTEM_H
+#include "ScriptMgr.h"
#include <ace/Singleton.h>
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
@@ -45,14 +46,6 @@ struct ScriptPointMove
typedef std::vector<ScriptPointMove> ScriptPointVector;
-struct StringTextData
-{
- uint32 uiSoundId;
- uint8 uiType;
- uint32 uiLanguage;
- uint32 uiEmote;
-};
-
class SystemMgr
{
friend class ACE_Singleton<SystemMgr, ACE_Null_Mutex>;
@@ -60,26 +53,11 @@ class SystemMgr
~SystemMgr() {}
public:
- //Maps and lists
- typedef UNORDERED_MAP<int32, StringTextData> TextDataMap;
typedef UNORDERED_MAP<uint32, ScriptPointVector> PointMoveMap;
//Database
- void LoadScriptTexts();
- void LoadScriptTextsCustom();
void LoadScriptWaypoints();
- //Retrive from storage
- StringTextData const* GetTextData(int32 textId) const
- {
- TextDataMap::const_iterator itr = m_mTextDataMap.find(textId);
-
- if (itr == m_mTextDataMap.end())
- return NULL;
-
- return &itr->second;
- }
-
ScriptPointVector const& GetPointMoveList(uint32 creatureEntry) const
{
PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry);
@@ -91,7 +69,6 @@ class SystemMgr
}
protected:
- TextDataMap m_mTextDataMap; //additional data for text strings
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
private:
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 8fb8ea0298b..0821be2abb9 100755..100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -684,11 +684,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x28F*/ { "CMSG_GROUP_ASSISTANT_LEADER", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleGroupAssistantLeaderOpcode},
/*0x290*/ { "CMSG_BUYBACK_ITEM", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleBuybackItem },
/*0x291*/ { "SMSG_SERVER_MESSAGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x292*/ { "CMSG_SET_SAVED_INSTANCE_EXTEND", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x292*/ { "CMSG_SET_SAVED_INSTANCE_EXTEND", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSetSavedInstanceExtend },
/*0x293*/ { "SMSG_LFG_OFFER_CONTINUE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x294*/ { "CMSG_TEST_DROP_RATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x295*/ { "SMSG_TEST_DROP_RATE_RESULT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x296*/ { "CMSG_LFG_GET_STATUS", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x296*/ { "CMSG_LFG_GET_STATUS", STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleLfgGetStatus },
/*0x297*/ { "SMSG_SHOW_MAILBOX", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x298*/ { "SMSG_RESET_RANGED_COMBAT_TIMER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x299*/ { "SMSG_MEETINGSTONE_MEMBER_ADDED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
@@ -888,7 +888,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x35B*/ { "SMSG_ARENA_TEAM_STATS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x35C*/ { "CMSG_LFG_JOIN", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfgJoinOpcode },
/*0x35D*/ { "CMSG_LFG_LEAVE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfgLeaveOpcode },
- /*0x35E*/ { "CMSG_SEARCH_LFG_JOIN", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfrSearchOpcode },
+ /*0x35E*/ { "CMSG_SEARCH_LFG_JOIN", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfrJoinOpcode },
/*0x35F*/ { "CMSG_SEARCH_LFG_LEAVE", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleLfrLeaveOpcode },
/*0x360*/ { "SMSG_UPDATE_LFG_LIST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x361*/ { "SMSG_LFG_PROPOSAL_UPDATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
@@ -1273,15 +1273,15 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x4DC*/ { "SMSG_PVP_QUEUE_STATS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4DD*/ { "CMSG_SET_PAID_SERVICE_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4DE*/ { "SMSG_BATTLEFIELD_MGR_ENTRY_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4DF*/ { "CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfEntryInviteResponse },
/*0x4E0*/ { "SMSG_BATTLEFIELD_MGR_ENTERED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E1*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_INVITE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4E2*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_INVITE_RESPONSE", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfQueueInviteResponse },
/*0x4E3*/ { "CMSG_BATTLEFIELD_MGR_QUEUE_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4E4*/ { "SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E5*/ { "SMSG_BATTLEFIELD_MGR_EJECT_PENDING", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E6*/ { "SMSG_BATTLEFIELD_MGR_EJECTED", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
- /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
+ /*0x4E7*/ { "CMSG_BATTLEFIELD_MGR_EXIT_REQUEST", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleBfExitRequest },
/*0x4E8*/ { "SMSG_BATTLEFIELD_MGR_STATE_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide },
/*0x4E9*/ { "CMSG_BATTLEFIELD_MANAGER_ADVANCE_STATE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
/*0x4EA*/ { "CMSG_BATTLEFIELD_MANAGER_SET_NEXT_TRANSITION_TIME", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL },
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index 65e7b3597ce..625ee88a853 100755..100644
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -1356,7 +1356,7 @@ enum SessionStatus
STATUS_TRANSFER, // Player transferring to another map (_player != NULL, m_GUID == _player->GetGUID(), !inWorld())
STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, // _player != NULL or _player == NULL && m_playerRecentlyLogout && m_playerLogout, m_GUID store last _player guid)
STATUS_NEVER, // Opcode not accepted from client (deprecated or server side only)
- STATUS_UNHANDLED, // Opcode not handled yet
+ STATUS_UNHANDLED // Opcode not handled yet
};
enum PacketProcessing
@@ -1385,5 +1385,13 @@ inline const char* LookupOpcodeName(uint16 id)
return "Received unknown opcode, it's more than max!";
return opcodeTable[id].name;
}
+
+inline std::string GetOpcodeNameForLogging(uint16 opcode)
+{
+ std::ostringstream ss;
+ ss << '[' << LookupOpcodeName(opcode) << " 0x" << std::hex << std::uppercase << opcode << std::nouppercase << " (" << std::dec << opcode << ")]";
+ return ss.str();
+}
+
#endif
/// @}
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 81ec5495421..0185d4adc9f 100755..100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -45,6 +45,12 @@
#include "WardenWin.h"
#include "WardenMac.h"
+namespace {
+
+std::string const DefaultPlayerName = "<none>";
+
+} // namespace
+
bool MapSessionFilter::Process(WorldPacket* packet)
{
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
@@ -137,16 +143,20 @@ WorldSession::~WorldSession()
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
}
-void WorldSession::SizeError(WorldPacket const& packet, uint32 size) const
+std::string const & WorldSession::GetPlayerName() const
{
- sLog->outError("Client (account %u) send packet %s (%u) with size " SIZEFMTD " but expected %u (attempt to crash server?), skipped",
- GetAccountId(), LookupOpcodeName(packet.GetOpcode()), packet.GetOpcode(), packet.size(), size);
+ return _player != NULL ? _player->GetName() : DefaultPlayerName;
}
-/// Get the player name
-char const* WorldSession::GetPlayerName() const
+std::string WorldSession::GetPlayerInfo() const
{
- return GetPlayer() ? GetPlayer()->GetName() : "<none>";
+ std::ostringstream ss;
+
+ ss << "[Player: " << GetPlayerName()
+ << " (Guid: " << (_player != NULL ? _player->GetGUID() : 0)
+ << ", Account: " << GetAccountId() << ")]";
+
+ return ss.str();
}
/// Get player guid if available. Use for logging purposes only
@@ -186,8 +196,8 @@ void WorldSession::SendPacket(WorldPacket const* packet)
{
uint64 minTime = uint64(cur_time - lastTime);
uint64 fullTime = uint64(lastTime - firstTime);
- sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
- sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount)/fullTime, float(sendPacketBytes)/fullTime, uint32(fullTime));
+ sLog->outInfo(LOG_FILTER_GENERAL, "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount)/minTime, float(sendLastPacketBytes)/minTime);
lastTime = cur_time;
sendLastPacketCount = 1;
@@ -208,16 +218,18 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
/// Logging helper for unexpected opcodes
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received unexpected opcode %s (0x%.4X, status: %s) %s",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), status, reason);
+ sLog->outError(LOG_FILTER_OPCODES, "Received unexpected opcode %s Status: %s Reason: %s from %s",
+ GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerInfo().c_str());
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnprocessedTail(WorldPacket* packet)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: opcode %s (0x%.4X) have unprocessed tail data (read stop at %u from %u)",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode(), uint32(packet->rpos()), uint32(packet->wpos()));
+ if (!sLog->ShouldLog(LOG_FILTER_OPCODES, LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos())
+ return;
+
+ sLog->outTrace(LOG_FILTER_OPCODES, "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
+ uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerInfo().c_str());
packet->print_storage();
}
@@ -250,7 +262,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
if (packet->GetOpcode() >= NUM_MSG_TYPES)
{
- sLog->outError("SESSION: received non-existed opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerInfo().c_str());
sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet));
}
else
@@ -275,17 +288,15 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
deletePacket = false;
QueuePacket(packet);
//! Log
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s (0x%.4X) with with status STATUS_LOGGEDIN. "
- "Player is currently not in world yet.", opHandle.name, packet->GetOpcode());
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. "
+ "Player is currently not in world yet.", GetOpcodeNameForLogging(packet->GetOpcode()).c_str());
}
-
}
else if (_player->IsInWorld())
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
- LogUnprocessedTail(packet);
+ LogUnprocessedTail(packet);
}
// lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer
break;
@@ -298,8 +309,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
// not expected _player or must checked in packet handler
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
- LogUnprocessedTail(packet);
+ LogUnprocessedTail(packet);
}
break;
case STATUS_TRANSFER:
@@ -311,8 +321,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
{
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
- LogUnprocessedTail(packet);
+ LogUnprocessedTail(packet);
}
break;
case STATUS_AUTHED:
@@ -330,30 +339,23 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
sScriptMgr->OnPacketReceive(m_Socket, WorldPacket(*packet));
(this->*opHandle.handler)(*packet);
- if (sLog->IsOutDebug() && packet->rpos() < packet->wpos())
- LogUnprocessedTail(packet);
+ LogUnprocessedTail(packet);
break;
case STATUS_NEVER:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not allowed opcode %s (0x%.4X)",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerInfo().c_str());
break;
case STATUS_UNHANDLED:
- sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION (account: %u, guidlow: %u, char: %s): received not handled opcode %s (0x%.4X)",
- GetAccountId(), m_GUIDLow, _player ? _player->GetName() : "<none>",
- LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode());
+ sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
+ , GetPlayerInfo().c_str());
break;
}
}
catch(ByteBufferException &)
{
- sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.",
packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId());
- if (sLog->IsOutDebug())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
- packet->hexlike();
- }
+ packet->hexlike();
}
}
@@ -417,10 +419,6 @@ void WorldSession::LogoutPlayer(bool Save)
}
else if (!_player->getAttackers().empty())
{
- _player->CombatStop();
- _player->getHostileRefManager().setOnlineOfflineState(false);
- _player->RemoveAllAurasOnDeath();
-
// 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)
@@ -432,6 +430,11 @@ void WorldSession::LogoutPlayer(bool Save)
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();
@@ -476,7 +479,8 @@ void WorldSession::LogoutPlayer(bool Save)
if (BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i))
{
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
- sBattlegroundMgr->m_BattlegroundQueues[ bgQueueTypeId ].RemovePlayer(_player->GetGUID(), true);
+ BattlegroundQueue& queue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
+ queue.RemovePlayer(_player->GetGUID(), true);
}
}
@@ -537,7 +541,8 @@ void WorldSession::LogoutPlayer(bool Save)
// e.g if he got disconnected during a transfer to another map
// calls to GetMap in this case may cause crashes
_player->CleanupsBeforeDelete();
- sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d",
+ GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel());
if (Map* _map = _player->FindMap())
_map->RemovePlayerFromMap(_player, true);
@@ -610,22 +615,26 @@ const char *WorldSession::GetTrinityString(int32 entry) const
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received opcode %s that must be processed in WorldSocket::OnRead from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
{
- sLog->outError("SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode());
+ sLog->outError(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s"
+ , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::SendAuthWaitQue(uint32 position)
@@ -668,13 +677,15 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
uint32 type = fields[0].GetUInt8();
if (type >= NUM_ACCOUNT_DATA_TYPES)
{
- sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
+ sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have invalid account data type (%u), ignore.",
+ mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
continue;
}
if ((mask & (1 << type)) == 0)
{
- sLog->outError("Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
+ sLog->outError(LOG_FILTER_GENERAL, "Table `%s` have non appropriate for table account data type (%u), ignore.",
+ mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type);
continue;
}
@@ -684,7 +695,7 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
while (result->NextRow());
}
-void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string data)
+void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string const& data)
{
uint32 id = 0;
uint32 index = 0;
@@ -928,7 +939,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
if (size > 0xFFFFF)
{
- sLog->outError("WorldSession::ReadAddonsInfo addon info too big, size %u", size);
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSession::ReadAddonsInfo addon info too big, size %u", size);
return;
}
@@ -958,7 +969,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
addonInfo >> enabled >> crc >> unk1;
- sLog->outDetail("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
AddonInfo addon(addonName, enabled, crc, 2, true);
@@ -971,15 +982,15 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
match = false;
if (!match)
- sLog->outDetail("ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC);
else
- sLog->outDetail("ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC);
}
else
{
AddonMgr::SaveAddon(addon);
- sLog->outDetail("ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC);
}
// TODO: Find out when to not use CRC/pubkey, and other possible states.
@@ -994,7 +1005,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data)
sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!");
}
else
- sLog->outError("Addon packet uncompress error!");
+ sLog->outError(LOG_FILTER_GENERAL, "Addon packet uncompress error!");
}
void WorldSession::SendAddonsInfo()
@@ -1033,7 +1044,7 @@ void WorldSession::SendAddonsInfo()
data << uint8(usepk);
if (usepk) // if CRC is wrong, add public key (client need it)
{
- sLog->outDetail("ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey",
+ sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey",
itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC);
data.append(addonPublicKey, sizeof(addonPublicKey));
@@ -1164,7 +1175,7 @@ void WorldSession::ProcessQueryCallbacks()
}
}
-void WorldSession::InitWarden(BigNumber* k, std::string os)
+void WorldSession::InitWarden(BigNumber* k, std::string const& os)
{
if (os == "Win")
{
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index b8b09531082..a442bb45a69 100755..100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -31,8 +31,6 @@
#include "WorldPacket.h"
#include "Cryptography/BigNumber.h"
-class CalendarEvent;
-class CalendarInvite;
class Creature;
class GameObject;
class InstanceSave;
@@ -54,6 +52,7 @@ struct LfgJoinResultData;
struct LfgLockStatus;
struct LfgPlayerBoot;
struct LfgProposal;
+struct LfgQueueStatusData;
struct LfgReward;
struct LfgRoleCheck;
struct LfgUpdateData;
@@ -68,7 +67,7 @@ enum AccountDataType
GLOBAL_MACROS_CACHE = 4, // 0x10 g
PER_CHARACTER_MACROS_CACHE = 5, // 0x20 p
PER_CHARACTER_LAYOUT_CACHE = 6, // 0x40 p
- PER_CHARACTER_CHAT_CACHE = 7, // 0x80 p
+ PER_CHARACTER_CHAT_CACHE = 7 // 0x80 p
};
#define NUM_ACCOUNT_DATA_TYPES 8
@@ -92,37 +91,13 @@ enum PartyOperation
PARTY_OP_SWAP = 4
};
-enum PartyResult
+enum BFLeaveReason
{
- ERR_PARTY_RESULT_OK = 0,
- ERR_BAD_PLAYER_NAME_S = 1,
- ERR_TARGET_NOT_IN_GROUP_S = 2,
- ERR_TARGET_NOT_IN_INSTANCE_S = 3,
- ERR_GROUP_FULL = 4,
- ERR_ALREADY_IN_GROUP_S = 5,
- ERR_NOT_IN_GROUP = 6,
- ERR_NOT_LEADER = 7,
- ERR_PLAYER_WRONG_FACTION = 8,
- ERR_IGNORING_YOU_S = 9,
- ERR_LFG_PENDING = 12,
- ERR_INVITE_RESTRICTED = 13,
- ERR_GROUP_SWAP_FAILED = 14, // if (PartyOperation == PARTY_OP_SWAP) ERR_GROUP_SWAP_FAILED else ERR_INVITE_IN_COMBAT
- ERR_INVITE_UNKNOWN_REALM = 15,
- ERR_INVITE_NO_PARTY_SERVER = 16,
- ERR_INVITE_PARTY_BUSY = 17,
- ERR_PARTY_TARGET_AMBIGUOUS = 18,
- ERR_PARTY_LFG_INVITE_RAID_LOCKED = 19,
- ERR_PARTY_LFG_BOOT_LIMIT = 20,
- ERR_PARTY_LFG_BOOT_COOLDOWN_S = 21,
- ERR_PARTY_LFG_BOOT_IN_PROGRESS = 22,
- ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS = 23,
- ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S = 24,
- ERR_RAID_DISALLOWED_BY_LEVEL = 25,
- ERR_PARTY_LFG_BOOT_IN_COMBAT = 26,
- ERR_VOTE_KICK_REASON_NEEDED = 27,
- ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE = 28,
- ERR_PARTY_LFG_BOOT_LOOT_ROLLS = 29,
- ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
+ BF_LEAVE_REASON_CLOSE = 0x00000001,
+ //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
+ //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
+ BF_LEAVE_REASON_EXITED = 0x00000008,
+ BF_LEAVE_REASON_LOW_LEVEL = 0x00000010
};
enum ChatRestrictionType
@@ -186,7 +161,7 @@ class CharacterCreateInfo
friend class Player;
protected:
- CharacterCreateInfo(std::string name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId,
+ CharacterCreateInfo(std::string const& name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId,
WorldPacket& data) : Name(name), Race(race), Class(cclass), Gender(gender), Skin(skin), Face(face), HairStyle(hairStyle), HairColor(hairColor), FacialHair(facialHair),
OutfitId(outfitId), Data(data), CharCount(0)
{}
@@ -223,8 +198,6 @@ class WorldSession
bool PlayerLogoutWithSave() const { return m_playerLogout && m_playerSave; }
bool PlayerRecentlyLoggedOut() const { return m_playerRecentlyLogout; }
- void SizeError(WorldPacket const& packet, uint32 size) const;
-
void ReadAddonsInfo(WorldPacket& data);
void SendAddonsInfo();
@@ -234,8 +207,8 @@ class WorldSession
void SendPacket(WorldPacket const* packet);
void SendNotification(const char *format, ...) ATTR_PRINTF(2, 3);
void SendNotification(uint32 string_id, ...);
- void SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName);
- void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res, uint32 val = 0);
+ void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName *declinedName);
+ void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3);
void SendSetPhaseShift(uint32 phaseShift);
void SendQueryTimeResponse();
@@ -246,14 +219,16 @@ class WorldSession
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; }
- char const* GetPlayerName() const;
+ std::string const& GetPlayerName() const;
+ std::string GetPlayerInfo() const;
+
uint32 GetGuidLow() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
void SetPlayer(Player* player);
uint8 Expansion() const { return m_expansion; }
- void InitWarden(BigNumber* k, std::string os);
+ void InitWarden(BigNumber* k, std::string const& os);
/// Session in auth.queue currently
void SetInQueue(bool state) { m_inQueue = state; }
@@ -286,7 +261,7 @@ class WorldSession
void SendNameQueryOpcode(uint64 guid);
void SendTrainerList(uint64 guid);
- void SendTrainerList(uint64 guid, const std::string& strTitle);
+ void SendTrainerList(uint64 guid, std::string const& strTitle);
void SendListInventory(uint64 guid);
void SendShowBank(uint64 guid);
void SendTabardVendorActivate(uint64 guid);
@@ -315,7 +290,7 @@ class WorldSession
// Account Data
AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; }
- void SetAccountData(AccountDataType type, time_t tm, std::string data);
+ void SetAccountData(AccountDataType type, time_t tm, std::string const& data);
void SendAccountDataTimes(uint32 mask);
void LoadGlobalAccountData();
void LoadAccountData(PreparedQueryResult result, uint32 mask);
@@ -352,7 +327,7 @@ class WorldSession
void SendDiscoverNewTaxiNode(uint32 nodeid);
// Guild/Arena Team
- void SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id);
+ void SendArenaTeamCommandResult(uint32 team_action, std::string const& team, std::string const& player, uint32 error_id);
void SendNotInArenaTeamPacket(uint8 type);
void SendPetitionShowList(uint64 guid);
@@ -407,7 +382,7 @@ class WorldSession
void HandlePlayerLoginOpcode(WorldPacket& recvPacket);
void HandleCharEnum(PreparedQueryResult result);
void HandlePlayerLogin(LoginQueryHolder * holder);
- void HandleCharFactionOrRaceChange(WorldPacket& recv_data);
+ void HandleCharFactionOrRaceChange(WorldPacket& recvData);
// played time
void HandlePlayedTime(WorldPacket& recvPacket);
@@ -424,15 +399,15 @@ class WorldSession
void HandleInspectHonorStatsOpcode(WorldPacket& recvPacket);
void HandleMoveWaterWalkAck(WorldPacket& recvPacket);
- void HandleFeatherFallAck(WorldPacket& recv_data);
+ void HandleFeatherFallAck(WorldPacket& recvData);
- void HandleMoveHoverAck(WorldPacket& recv_data);
+ void HandleMoveHoverAck(WorldPacket& recvData);
void HandleMountSpecialAnimOpcode(WorldPacket& recvdata);
// character view
- void HandleShowingHelmOpcode(WorldPacket& recv_data);
- void HandleShowingCloakOpcode(WorldPacket& recv_data);
+ void HandleShowingHelmOpcode(WorldPacket& recvData);
+ void HandleShowingCloakOpcode(WorldPacket& recvData);
// repair
void HandleRepairItemOpcode(WorldPacket& recvPacket);
@@ -441,7 +416,7 @@ class WorldSession
void HandleMoveKnockBackAck(WorldPacket& recvPacket);
void HandleMoveTeleportAck(WorldPacket& recvPacket);
- void HandleForceSpeedChangeAck(WorldPacket& recv_data);
+ void HandleForceSpeedChangeAck(WorldPacket& recvData);
void HandlePingOpcode(WorldPacket& recvPacket);
void HandleAuthSessionOpcode(WorldPacket& recvPacket);
@@ -474,7 +449,7 @@ class WorldSession
void HandleEmoteOpcode(WorldPacket& recvPacket);
void HandleContactListOpcode(WorldPacket& recvPacket);
void HandleAddFriendOpcode(WorldPacket& recvPacket);
- void HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string friendNote);
+ void HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote);
void HandleDelFriendOpcode(WorldPacket& recvPacket);
void HandleAddIgnoreOpcode(WorldPacket& recvPacket);
void HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result);
@@ -486,10 +461,10 @@ class WorldSession
void HandleAreaTriggerOpcode(WorldPacket& recvPacket);
- void HandleSetFactionAtWar(WorldPacket& recv_data);
- void HandleSetFactionCheat(WorldPacket& recv_data);
- void HandleSetWatchedFactionOpcode(WorldPacket& recv_data);
- void HandleSetFactionInactiveOpcode(WorldPacket& recv_data);
+ void HandleSetFactionAtWar(WorldPacket& recvData);
+ void HandleSetFactionCheat(WorldPacket& recvData);
+ void HandleSetWatchedFactionOpcode(WorldPacket& recvData);
+ void HandleSetFactionInactiveOpcode(WorldPacket& recvData);
void HandleUpdateAccountData(WorldPacket& recvPacket);
void HandleRequestAccountData(WorldPacket& recvPacket);
@@ -511,17 +486,17 @@ class WorldSession
void HandleMoveWorldportAckOpcode(); // for server-side calls
void HandleMovementOpcodes(WorldPacket& recvPacket);
- void HandleSetActiveMoverOpcode(WorldPacket& recv_data);
- void HandleMoveNotActiveMover(WorldPacket& recv_data);
- void HandleDismissControlledVehicle(WorldPacket& recv_data);
- void HandleRequestVehicleExit(WorldPacket& recv_data);
- void HandleChangeSeatsOnControlledVehicle(WorldPacket& recv_data);
- void HandleMoveTimeSkippedOpcode(WorldPacket& recv_data);
+ void HandleSetActiveMoverOpcode(WorldPacket& recvData);
+ void HandleMoveNotActiveMover(WorldPacket& recvData);
+ void HandleDismissControlledVehicle(WorldPacket& recvData);
+ void HandleRequestVehicleExit(WorldPacket& recvData);
+ void HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData);
+ void HandleMoveTimeSkippedOpcode(WorldPacket& recvData);
- void HandleRequestRaidInfoOpcode(WorldPacket& recv_data);
+ void HandleRequestRaidInfoOpcode(WorldPacket& recvData);
- void HandleBattlefieldStatusOpcode(WorldPacket& recv_data);
- void HandleBattleMasterHelloOpcode(WorldPacket& recv_data);
+ void HandleBattlefieldStatusOpcode(WorldPacket& recvData);
+ void HandleBattleMasterHelloOpcode(WorldPacket& recvData);
void HandleGroupInviteOpcode(WorldPacket& recvPacket);
//void HandleGroupCancelOpcode(WorldPacket& recvPacket);
@@ -531,26 +506,26 @@ class WorldSession
void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket);
void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket);
void HandleGroupDisbandOpcode(WorldPacket& recvPacket);
- void HandleOptOutOfLootOpcode(WorldPacket& recv_data);
+ void HandleOptOutOfLootOpcode(WorldPacket& recvData);
void HandleLootMethodOpcode(WorldPacket& recvPacket);
- void HandleLootRoll(WorldPacket& recv_data);
- void HandleRequestPartyMemberStatsOpcode(WorldPacket& recv_data);
- void HandleRaidTargetUpdateOpcode(WorldPacket& recv_data);
- void HandleRaidReadyCheckOpcode(WorldPacket& recv_data);
- void HandleRaidReadyCheckFinishedOpcode(WorldPacket& recv_data);
- void HandleGroupRaidConvertOpcode(WorldPacket& recv_data);
- void HandleGroupChangeSubGroupOpcode(WorldPacket& recv_data);
- void HandleGroupAssistantLeaderOpcode(WorldPacket& recv_data);
- void HandlePartyAssignmentOpcode(WorldPacket& recv_data);
-
- void HandlePetitionBuyOpcode(WorldPacket& recv_data);
- void HandlePetitionShowSignOpcode(WorldPacket& recv_data);
- void HandlePetitionQueryOpcode(WorldPacket& recv_data);
- void HandlePetitionRenameOpcode(WorldPacket& recv_data);
- void HandlePetitionSignOpcode(WorldPacket& recv_data);
- void HandlePetitionDeclineOpcode(WorldPacket& recv_data);
- void HandleOfferPetitionOpcode(WorldPacket& recv_data);
- void HandleTurnInPetitionOpcode(WorldPacket& recv_data);
+ void HandleLootRoll(WorldPacket& recvData);
+ void HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData);
+ void HandleRaidTargetUpdateOpcode(WorldPacket& recvData);
+ void HandleRaidReadyCheckOpcode(WorldPacket& recvData);
+ void HandleRaidReadyCheckFinishedOpcode(WorldPacket& recvData);
+ void HandleGroupRaidConvertOpcode(WorldPacket& recvData);
+ void HandleGroupChangeSubGroupOpcode(WorldPacket& recvData);
+ void HandleGroupAssistantLeaderOpcode(WorldPacket& recvData);
+ void HandlePartyAssignmentOpcode(WorldPacket& recvData);
+
+ void HandlePetitionBuyOpcode(WorldPacket& recvData);
+ void HandlePetitionShowSignOpcode(WorldPacket& recvData);
+ void HandlePetitionQueryOpcode(WorldPacket& recvData);
+ void HandlePetitionRenameOpcode(WorldPacket& recvData);
+ void HandlePetitionSignOpcode(WorldPacket& recvData);
+ void HandlePetitionDeclineOpcode(WorldPacket& recvData);
+ void HandleOfferPetitionOpcode(WorldPacket& recvData);
+ void HandleTurnInPetitionOpcode(WorldPacket& recvData);
void HandleGuildQueryOpcode(WorldPacket& recvPacket);
void HandleGuildCreateOpcode(WorldPacket& recvPacket);
@@ -618,25 +593,25 @@ class WorldSession
void HandleUnacceptTradeOpcode(WorldPacket& recvPacket);
void HandleAuctionHelloOpcode(WorldPacket& recvPacket);
- void HandleAuctionListItems(WorldPacket& recv_data);
- void HandleAuctionListBidderItems(WorldPacket& recv_data);
- void HandleAuctionSellItem(WorldPacket& recv_data);
- void HandleAuctionRemoveItem(WorldPacket& recv_data);
- void HandleAuctionListOwnerItems(WorldPacket& recv_data);
- void HandleAuctionPlaceBid(WorldPacket& recv_data);
- void HandleAuctionListPendingSales(WorldPacket& recv_data);
-
- void HandleGetMailList(WorldPacket& recv_data);
- void HandleSendMail(WorldPacket& recv_data);
- void HandleMailTakeMoney(WorldPacket& recv_data);
- void HandleMailTakeItem(WorldPacket& recv_data);
- void HandleMailMarkAsRead(WorldPacket& recv_data);
- void HandleMailReturnToSender(WorldPacket& recv_data);
- void HandleMailDelete(WorldPacket& recv_data);
- void HandleItemTextQuery(WorldPacket& recv_data);
- void HandleMailCreateTextItem(WorldPacket& recv_data);
- void HandleQueryNextMailTime(WorldPacket& recv_data);
- void HandleCancelChanneling(WorldPacket& recv_data);
+ void HandleAuctionListItems(WorldPacket& recvData);
+ void HandleAuctionListBidderItems(WorldPacket& recvData);
+ void HandleAuctionSellItem(WorldPacket& recvData);
+ void HandleAuctionRemoveItem(WorldPacket& recvData);
+ void HandleAuctionListOwnerItems(WorldPacket& recvData);
+ void HandleAuctionPlaceBid(WorldPacket& recvData);
+ void HandleAuctionListPendingSales(WorldPacket& recvData);
+
+ void HandleGetMailList(WorldPacket& recvData);
+ void HandleSendMail(WorldPacket& recvData);
+ void HandleMailTakeMoney(WorldPacket& recvData);
+ void HandleMailTakeItem(WorldPacket& recvData);
+ void HandleMailMarkAsRead(WorldPacket& recvData);
+ void HandleMailReturnToSender(WorldPacket& recvData);
+ void HandleMailDelete(WorldPacket& recvData);
+ void HandleItemTextQuery(WorldPacket& recvData);
+ void HandleMailCreateTextItem(WorldPacket& recvData);
+ void HandleQueryNextMailTime(WorldPacket& recvData);
+ void HandleCancelChanneling(WorldPacket& recvData);
void SendItemPageInfo(ItemTemplate* itemProto);
void HandleSplitItemOpcode(WorldPacket& recvPacket);
@@ -682,19 +657,18 @@ class WorldSession
void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket);
void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket);
void HandleQuestQueryOpcode(WorldPacket& recvPacket);
- void HandleQuestgiverCancel(WorldPacket& recv_data);
- void HandleQuestLogSwapQuest(WorldPacket& recv_data);
- void HandleQuestLogRemoveQuest(WorldPacket& recv_data);
- void HandleQuestConfirmAccept(WorldPacket& recv_data);
- void HandleQuestgiverCompleteQuest(WorldPacket& recv_data);
+ void HandleQuestgiverCancel(WorldPacket& recvData);
+ void HandleQuestLogSwapQuest(WorldPacket& recvData);
+ void HandleQuestLogRemoveQuest(WorldPacket& recvData);
+ void HandleQuestConfirmAccept(WorldPacket& recvData);
+ void HandleQuestgiverCompleteQuest(WorldPacket& recvData);
void HandleQuestgiverQuestAutoLaunch(WorldPacket& recvPacket);
void HandlePushQuestToParty(WorldPacket& recvPacket);
void HandleQuestPushResult(WorldPacket& recvPacket);
- bool processChatmessageFurtherAfterSecurityChecks(std::string&, uint32);
void HandleMessagechatOpcode(WorldPacket& recvPacket);
- void SendPlayerNotFoundNotice(std::string name);
- void SendPlayerAmbiguousNotice(std::string name);
+ void SendPlayerNotFoundNotice(std::string const& name);
+ void SendPlayerAmbiguousNotice(std::string const& name);
void SendWrongFactionNotice();
void SendChatRestrictedNotice(ChatRestrictionType restriction);
void HandleTextEmoteOpcode(WorldPacket& recvPacket);
@@ -704,7 +678,7 @@ class WorldSession
void HandleCorpseQueryOpcode(WorldPacket& recvPacket);
void HandleCorpseMapPositionQuery(WorldPacket& recvPacket);
void HandleResurrectResponseOpcode(WorldPacket& recvPacket);
- void HandleSummonResponseOpcode(WorldPacket& recv_data);
+ void HandleSummonResponseOpcode(WorldPacket& recvData);
void HandleJoinChannel(WorldPacket& recvPacket);
void HandleLeaveChannel(WorldPacket& recvPacket);
@@ -733,138 +707,148 @@ class WorldSession
void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket);
void HandlePageTextQueryOpcode(WorldPacket& recvPacket);
- void HandleTutorialFlag (WorldPacket& recv_data);
- void HandleTutorialClear(WorldPacket& recv_data);
- void HandleTutorialReset(WorldPacket& recv_data);
+ void HandleTutorialFlag (WorldPacket& recvData);
+ void HandleTutorialClear(WorldPacket& recvData);
+ void HandleTutorialReset(WorldPacket& recvData);
//Pet
- void HandlePetAction(WorldPacket& recv_data);
- void HandlePetStopAttack(WorldPacket& recv_data);
- void HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2);
- void HandlePetNameQuery(WorldPacket& recv_data);
- void HandlePetSetAction(WorldPacket& recv_data);
- void HandlePetAbandon(WorldPacket& recv_data);
- void HandlePetRename(WorldPacket& recv_data);
+ void HandlePetAction(WorldPacket& recvData);
+ void HandlePetStopAttack(WorldPacket& recvData);
+ void HandlePetActionHelper(Unit* pet, uint64 guid1, uint32 spellid, uint16 flag, uint64 guid2);
+ void HandlePetNameQuery(WorldPacket& recvData);
+ void HandlePetSetAction(WorldPacket& recvData);
+ void HandlePetAbandon(WorldPacket& recvData);
+ void HandlePetRename(WorldPacket& recvData);
void HandlePetCancelAuraOpcode(WorldPacket& recvPacket);
void HandlePetSpellAutocastOpcode(WorldPacket& recvPacket);
void HandlePetCastSpellOpcode(WorldPacket& recvPacket);
void HandlePetLearnTalent(WorldPacket& recvPacket);
void HandleLearnPreviewTalentsPet(WorldPacket& recvPacket);
- void HandleSetActionBarToggles(WorldPacket& recv_data);
+ void HandleSetActionBarToggles(WorldPacket& recvData);
- void HandleCharRenameOpcode(WorldPacket& recv_data);
- void HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string newName);
- void HandleSetPlayerDeclinedNames(WorldPacket& recv_data);
+ void HandleCharRenameOpcode(WorldPacket& recvData);
+ void HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName);
+ void HandleSetPlayerDeclinedNames(WorldPacket& recvData);
- void HandleTotemDestroyed(WorldPacket& recv_data);
- void HandleDismissCritter(WorldPacket& recv_data);
+ void HandleTotemDestroyed(WorldPacket& recvData);
+ void HandleDismissCritter(WorldPacket& recvData);
//Battleground
- void HandleBattlemasterHelloOpcode(WorldPacket& recv_data);
- void HandleBattlemasterJoinOpcode(WorldPacket& recv_data);
- void HandleBattlegroundPlayerPositionsOpcode(WorldPacket& recv_data);
- void HandlePVPLogDataOpcode(WorldPacket& recv_data);
- void HandleBattleFieldPortOpcode(WorldPacket& recv_data);
- void HandleBattlefieldListOpcode(WorldPacket& recv_data);
- void HandleLeaveBattlefieldOpcode(WorldPacket& recv_data);
- void HandleBattlemasterJoinArena(WorldPacket& recv_data);
- void HandleReportPvPAFK(WorldPacket& recv_data);
-
- void HandleWardenDataOpcode(WorldPacket& recv_data);
- void HandleWorldTeleportOpcode(WorldPacket& recv_data);
- void HandleMinimapPingOpcode(WorldPacket& recv_data);
- void HandleRandomRollOpcode(WorldPacket& recv_data);
- void HandleFarSightOpcode(WorldPacket& recv_data);
- void HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data);
- void HandleSetRaidDifficultyOpcode(WorldPacket& recv_data);
- void HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data);
- void HandleSetTitleOpcode(WorldPacket& recv_data);
- void HandleRealmSplitOpcode(WorldPacket& recv_data);
- void HandleTimeSyncResp(WorldPacket& recv_data);
- void HandleWhoisOpcode(WorldPacket& recv_data);
- void HandleResetInstancesOpcode(WorldPacket& recv_data);
- void HandleHearthAndResurrect(WorldPacket& recv_data);
+ void HandleBattlemasterHelloOpcode(WorldPacket& recvData);
+ void HandleBattlemasterJoinOpcode(WorldPacket& recvData);
+ void HandleBattlegroundPlayerPositionsOpcode(WorldPacket& recvData);
+ void HandlePVPLogDataOpcode(WorldPacket& recvData);
+ void HandleBattleFieldPortOpcode(WorldPacket& recvData);
+ void HandleBattlefieldListOpcode(WorldPacket& recvData);
+ void HandleLeaveBattlefieldOpcode(WorldPacket& recvData);
+ void HandleBattlemasterJoinArena(WorldPacket& recvData);
+ void HandleReportPvPAFK(WorldPacket& recvData);
+
+ void HandleWardenDataOpcode(WorldPacket& recvData);
+ void HandleWorldTeleportOpcode(WorldPacket& recvData);
+ void HandleMinimapPingOpcode(WorldPacket& recvData);
+ void HandleRandomRollOpcode(WorldPacket& recvData);
+ void HandleFarSightOpcode(WorldPacket& recvData);
+ void HandleSetDungeonDifficultyOpcode(WorldPacket& recvData);
+ void HandleSetRaidDifficultyOpcode(WorldPacket& recvData);
+ void HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData);
+ void HandleSetTitleOpcode(WorldPacket& recvData);
+ void HandleRealmSplitOpcode(WorldPacket& recvData);
+ void HandleTimeSyncResp(WorldPacket& recvData);
+ void HandleWhoisOpcode(WorldPacket& recvData);
+ void HandleResetInstancesOpcode(WorldPacket& recvData);
+ void HandleHearthAndResurrect(WorldPacket& recvData);
void HandleInstanceLockResponse(WorldPacket& recvPacket);
- void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
+
+ // Battlefield
+ void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
+ void SendBfInvitePlayerToQueue(uint32 BattleId);
+ void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
+ void SendBfEntered(uint32 BattleId);
+ void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
+ void HandleBfQueueInviteResponse(WorldPacket &recvData);
+ void HandleBfEntryInviteResponse(WorldPacket &recvData);
+ void HandleBfExitRequest(WorldPacket &recvData);
// Looking for Dungeon/Raid
- void HandleLfgSetCommentOpcode(WorldPacket& recv_data);
- void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recv_data);
- void HandleLfgPartyLockInfoRequestOpcode(WorldPacket& recv_data);
- void HandleLfgJoinOpcode(WorldPacket& recv_data);
- void HandleLfgLeaveOpcode(WorldPacket& recv_data);
- void HandleLfgSetRolesOpcode(WorldPacket& recv_data);
- void HandleLfgProposalResultOpcode(WorldPacket& recv_data);
- void HandleLfgSetBootVoteOpcode(WorldPacket& recv_data);
- void HandleLfgTeleportOpcode(WorldPacket& recv_data);
- void HandleLfrSearchOpcode(WorldPacket& recv_data);
- void HandleLfrLeaveOpcode(WorldPacket& recv_data);
+ void HandleLfgSetCommentOpcode(WorldPacket& recvData);
+ void HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& recvData);
+ void HandleLfgPartyLockInfoRequestOpcode(WorldPacket& recvData);
+ void HandleLfgJoinOpcode(WorldPacket& recvData);
+ void HandleLfgLeaveOpcode(WorldPacket& recvData);
+ void HandleLfgSetRolesOpcode(WorldPacket& recvData);
+ void HandleLfgProposalResultOpcode(WorldPacket& recvData);
+ void HandleLfgSetBootVoteOpcode(WorldPacket& recvData);
+ void HandleLfgTeleportOpcode(WorldPacket& recvData);
+ void HandleLfrJoinOpcode(WorldPacket& recvData);
+ void HandleLfrLeaveOpcode(WorldPacket& recvData);
+ void HandleLfgGetStatus(WorldPacket& recvData);
void SendLfgUpdatePlayer(const LfgUpdateData& updateData);
void SendLfgUpdateParty(const LfgUpdateData& updateData);
void SendLfgRoleChosen(uint64 guid, uint8 roles);
- void SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck);
- void SendLfgUpdateSearch(bool update);
+ void SendLfgRoleCheckUpdate(const LfgRoleCheck& pRoleCheck);
+ void SendLfgLfrList(bool update);
void SendLfgJoinResult(const LfgJoinResultData& joinData);
- void SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgWaitTime, int32 waitTimeTanks, int32 waitTimeHealer, int32 waitTimeDps, uint32 queuedTime, uint8 tanks, uint8 healers, uint8 dps);
+ void SendLfgQueueStatus(const LfgQueueStatusData& queueData);
void SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward* reward, const Quest *qRew);
- void SendLfgBootPlayer(const LfgPlayerBoot* pBoot);
- void SendLfgUpdateProposal(uint32 proposalId, const LfgProposal *pProp);
+ void SendLfgBootProposalUpdate(const LfgPlayerBoot& boot);
+ void SendLfgUpdateProposal(uint32 proposalId, const LfgProposal& proposal);
void SendLfgDisabled();
void SendLfgOfferContinue(uint32 dungeonEntry);
void SendLfgTeleportError(uint8 err);
// Arena Team
- void HandleInspectArenaTeamsOpcode(WorldPacket& recv_data);
- void HandleArenaTeamQueryOpcode(WorldPacket& recv_data);
- void HandleArenaTeamRosterOpcode(WorldPacket& recv_data);
- void HandleArenaTeamInviteOpcode(WorldPacket& recv_data);
- void HandleArenaTeamAcceptOpcode(WorldPacket& recv_data);
- void HandleArenaTeamDeclineOpcode(WorldPacket& recv_data);
- void HandleArenaTeamLeaveOpcode(WorldPacket& recv_data);
- void HandleArenaTeamRemoveOpcode(WorldPacket& recv_data);
- void HandleArenaTeamDisbandOpcode(WorldPacket& recv_data);
- void HandleArenaTeamLeaderOpcode(WorldPacket& recv_data);
-
- void HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data);
- void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data);
- void HandleCancelMountAuraOpcode(WorldPacket& recv_data);
- void HandleSelfResOpcode(WorldPacket& recv_data);
- void HandleComplainOpcode(WorldPacket& recv_data);
- void HandleRequestPetInfoOpcode(WorldPacket& recv_data);
+ void HandleInspectArenaTeamsOpcode(WorldPacket& recvData);
+ void HandleArenaTeamQueryOpcode(WorldPacket& recvData);
+ void HandleArenaTeamRosterOpcode(WorldPacket& recvData);
+ void HandleArenaTeamInviteOpcode(WorldPacket& recvData);
+ void HandleArenaTeamAcceptOpcode(WorldPacket& recvData);
+ void HandleArenaTeamDeclineOpcode(WorldPacket& recvData);
+ void HandleArenaTeamLeaveOpcode(WorldPacket& recvData);
+ void HandleArenaTeamRemoveOpcode(WorldPacket& recvData);
+ void HandleArenaTeamDisbandOpcode(WorldPacket& recvData);
+ void HandleArenaTeamLeaderOpcode(WorldPacket& recvData);
+
+ void HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData);
+ void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData);
+ void HandleCancelMountAuraOpcode(WorldPacket& recvData);
+ void HandleSelfResOpcode(WorldPacket& recvData);
+ void HandleComplainOpcode(WorldPacket& recvData);
+ void HandleRequestPetInfoOpcode(WorldPacket& recvData);
// Socket gem
- void HandleSocketOpcode(WorldPacket& recv_data);
+ void HandleSocketOpcode(WorldPacket& recvData);
- void HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data);
+ void HandleCancelTempEnchantmentOpcode(WorldPacket& recvData);
- void HandleItemRefundInfoRequest(WorldPacket& recv_data);
- void HandleItemRefund(WorldPacket& recv_data);
+ void HandleItemRefundInfoRequest(WorldPacket& recvData);
+ void HandleItemRefund(WorldPacket& recvData);
- void HandleChannelVoiceOnOpcode(WorldPacket& recv_data);
- void HandleVoiceSessionEnableOpcode(WorldPacket& recv_data);
- void HandleSetActiveVoiceChannel(WorldPacket& recv_data);
- void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data);
+ void HandleChannelVoiceOnOpcode(WorldPacket& recvData);
+ void HandleVoiceSessionEnableOpcode(WorldPacket& recvData);
+ void HandleSetActiveVoiceChannel(WorldPacket& recvData);
+ void HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData);
// Guild Bank
- void HandleGuildPermissions(WorldPacket& recv_data);
- void HandleGuildBankMoneyWithdrawn(WorldPacket& recv_data);
- void HandleGuildBankerActivate(WorldPacket& recv_data);
- void HandleGuildBankQueryTab(WorldPacket& recv_data);
- void HandleGuildBankLogQuery(WorldPacket& recv_data);
- void HandleGuildBankDepositMoney(WorldPacket& recv_data);
- void HandleGuildBankWithdrawMoney(WorldPacket& recv_data);
- void HandleGuildBankSwapItems(WorldPacket& recv_data);
-
- void HandleGuildBankUpdateTab(WorldPacket& recv_data);
- void HandleGuildBankBuyTab(WorldPacket& recv_data);
- void HandleQueryGuildBankTabText(WorldPacket& recv_data);
- void HandleSetGuildBankTabText(WorldPacket& recv_data);
+ void HandleGuildPermissions(WorldPacket& recvData);
+ void HandleGuildBankMoneyWithdrawn(WorldPacket& recvData);
+ void HandleGuildBankerActivate(WorldPacket& recvData);
+ void HandleGuildBankQueryTab(WorldPacket& recvData);
+ void HandleGuildBankLogQuery(WorldPacket& recvData);
+ void HandleGuildBankDepositMoney(WorldPacket& recvData);
+ void HandleGuildBankWithdrawMoney(WorldPacket& recvData);
+ void HandleGuildBankSwapItems(WorldPacket& recvData);
+
+ void HandleGuildBankUpdateTab(WorldPacket& recvData);
+ void HandleGuildBankBuyTab(WorldPacket& recvData);
+ void HandleQueryGuildBankTabText(WorldPacket& recvData);
+ void HandleSetGuildBankTabText(WorldPacket& recvData);
// Refer-a-Friend
- void HandleGrantLevel(WorldPacket& recv_data);
- void HandleAcceptGrantLevel(WorldPacket& recv_data);
+ void HandleGrantLevel(WorldPacket& recvData);
+ void HandleAcceptGrantLevel(WorldPacket& recvData);
// Calendar
void HandleCalendarGetCalendar(WorldPacket& recvData);
@@ -884,36 +868,27 @@ class WorldSession
void HandleCalendarGetNumPending(WorldPacket& recvData);
void HandleCalendarEventSignup(WorldPacket& recvData);
- void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType);
- void SendCalendarEventInvite(CalendarInvite const& invite, bool pending);
- void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& calendarInvite);
- void SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags);
- void SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status);
- void SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent);
- void SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType);
- void SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
- void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite);
- void SendCalendarClearPendingAction();
void SendCalendarRaidLockout(InstanceSave const* save, bool add);
void SendCalendarRaidLockoutUpdated(InstanceSave const* save);
- void SendCalendarCommandResult(CalendarError err, char const* param = NULL);
-
- void HandleSpellClick(WorldPacket& recv_data);
- void HandleMirrorImageDataRequest(WorldPacket& recv_data);
- void HandleAlterAppearance(WorldPacket& recv_data);
- void HandleRemoveGlyph(WorldPacket& recv_data);
- void HandleCharCustomize(WorldPacket& recv_data);
- void HandleQueryInspectAchievements(WorldPacket& recv_data);
- void HandleEquipmentSetSave(WorldPacket& recv_data);
- void HandleEquipmentSetDelete(WorldPacket& recv_data);
- void HandleEquipmentSetUse(WorldPacket& recv_data);
- void HandleWorldStateUITimerUpdate(WorldPacket& recv_data);
- void HandleReadyForAccountDataTimes(WorldPacket& recv_data);
- void HandleQueryQuestsCompleted(WorldPacket& recv_data);
- void HandleQuestPOIQuery(WorldPacket& recv_data);
+ void HandleSetSavedInstanceExtend(WorldPacket& recvData);
+
+ void HandleSpellClick(WorldPacket& recvData);
+ void HandleMirrorImageDataRequest(WorldPacket& recvData);
+ void HandleAlterAppearance(WorldPacket& recvData);
+ void HandleRemoveGlyph(WorldPacket& recvData);
+ void HandleCharCustomize(WorldPacket& recvData);
+ void HandleQueryInspectAchievements(WorldPacket& recvData);
+ void HandleEquipmentSetSave(WorldPacket& recvData);
+ void HandleEquipmentSetDelete(WorldPacket& recvData);
+ void HandleEquipmentSetUse(WorldPacket& recvData);
+ void HandleWorldStateUITimerUpdate(WorldPacket& recvData);
+ void HandleReadyForAccountDataTimes(WorldPacket& recvData);
+ void HandleQueryQuestsCompleted(WorldPacket& recvData);
+ void HandleQuestPOIQuery(WorldPacket& recvData);
void HandleEjectPassenger(WorldPacket& data);
void HandleEnterPlayerVehicle(WorldPacket& data);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);
+ void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
private:
void InitializeQueryCallbackParameters();
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 646e9c13392..8b034299ad6 100755..100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -29,7 +29,7 @@
#include "WorldSocket.h"
#include "Common.h"
-
+#include "Player.h"
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
@@ -63,19 +63,19 @@ struct ServerPktHeader
if (isLargePacket())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "initializing large server to client packet. Size: %u, cmd: %u", size, cmd);
- header[headerIndex++] = 0x80|(0xFF &(size>>16));
+ header[headerIndex++] = 0x80 | (0xFF & (size >> 16));
}
- header[headerIndex++] = 0xFF &(size>>8);
- header[headerIndex++] = 0xFF &size;
+ header[headerIndex++] = 0xFF &(size >> 8);
+ header[headerIndex++] = 0xFF & size;
header[headerIndex++] = 0xFF & cmd;
- header[headerIndex++] = 0xFF & (cmd>>8);
+ header[headerIndex++] = 0xFF & (cmd >> 8);
}
uint8 getHeaderLength()
{
// cmd = 2 bytes, size= 2||3bytes
- return 2+(isLargePacket()?3:2);
+ return 2 + (isLargePacket() ? 3 : 2);
}
bool isLargePacket() const
@@ -107,8 +107,8 @@ m_Seed(static_cast<uint32> (rand32()))
{
reference_counting_policy().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
- msg_queue()->high_water_mark(8*1024*1024);
- msg_queue()->low_water_mark(8*1024*1024);
+ msg_queue()->high_water_mark(8 * 1024 * 1024);
+ msg_queue()->low_water_mark(8 * 1024 * 1024);
}
WorldSocket::~WorldSocket (void)
@@ -163,6 +163,9 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
if (sPacketLog->CanLogPacket())
sPacketLog->LogPacket(pct, SERVER_TO_CLIENT);
+ if (m_Session)
+ sLog->outTrace(LOG_FILTER_OPCODES, "S->C %s %s", m_Session->GetPlayerInfo().c_str(), GetOpcodeNameForLogging(pct.GetOpcode()).c_str());
+
// Create a copy of the original packet; this is to avoid issues if a hook modifies it.
sScriptMgr->OnPacketSend(this, WorldPacket(pct));
@@ -193,7 +196,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
- sLog->outError("WorldSocket::SendPacket enqueue_tail failed");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::SendPacket enqueue_tail failed");
mb->release();
return -1;
}
@@ -236,7 +239,7 @@ int WorldSocket::open (void *a)
if (peer().get_remote_addr(remote_addr) == -1)
{
- sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -261,7 +264,7 @@ int WorldSocket::open (void *a)
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1;
}
@@ -297,14 +300,14 @@ int WorldSocket::handle_input (ACE_HANDLE)
return Update(); // interesting line, isn't it ?
}
- sLog->outStaticDebug("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
errno = ECONNRESET;
return -1;
}
case 0:
{
- sLog->outStaticDebug("WorldSocket::handle_input: Peer has closed connection");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input: Peer has closed connection");
errno = ECONNRESET;
return -1;
@@ -373,7 +376,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1)
{
- sLog->outError("WorldSocket::handle_output_queue dequeue_head");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue dequeue_head");
return -1;
}
@@ -408,7 +411,7 @@ int WorldSocket::handle_output_queue (GuardType& g)
if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1)
{
- sLog->outError("WorldSocket::handle_output_queue enqueue_head");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_output_queue enqueue_head");
mblk->release();
return -1;
}
@@ -480,10 +483,10 @@ int WorldSocket::handle_input_header (void)
if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240))
{
Player* _player = m_Session ? m_Session->GetPlayer() : NULL;
- sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)",
m_Session ? m_Session->GetAccountId() : 0,
_player ? _player->GetGUIDLow() : 0,
- _player ? _player->GetName() : "<none>",
+ _player ? _player->GetName().c_str() : "<none>",
header.size, header.cmd);
errno = EINVAL;
@@ -586,7 +589,7 @@ int WorldSocket::handle_input_missing_data (void)
// hope this is not hack, as proper m_RecvWPct is asserted around
if (!m_RecvWPct)
{
- sLog->outError("Forcing close on input m_RecvWPct = NULL");
+ sLog->outError(LOG_FILTER_NETWORKIO, "Forcing close on input m_RecvWPct = NULL");
errno = EINVAL;
return -1;
}
@@ -632,7 +635,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
// would be good to store errno from reactor with errno guard
- sLog->outError("WorldSocket::cancel_wakeup_output");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::cancel_wakeup_output");
return -1;
}
@@ -651,7 +654,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
if (reactor()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1)
{
- sLog->outError("WorldSocket::schedule_wakeup_output");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::schedule_wakeup_output");
return -1;
}
@@ -674,6 +677,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
if (sPacketLog->CanLogPacket())
sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER);
+ if (m_Session)
+ sLog->outTrace(LOG_FILTER_OPCODES, "C->S %s %s", m_Session->GetPlayerInfo().c_str(), GetOpcodeNameForLogging(new_pct->GetOpcode()).c_str());
+
try
{
switch (opcode)
@@ -683,58 +689,51 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
case CMSG_AUTH_SESSION:
if (m_Session)
{
- sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str());
return -1;
}
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return HandleAuthSession (*new_pct);
case CMSG_KEEP_ALIVE:
- sLog->outStaticDebug ("CMSG_KEEP_ALIVE, size: " UI64FMTD, uint64(new_pct->size()));
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", GetOpcodeNameForLogging(opcode).c_str());
sScriptMgr->OnPacketReceive(this, WorldPacket(*new_pct));
return 0;
default:
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
- if (m_Session != NULL)
- {
- // Our Idle timer will reset on any non PING opcodes.
- // Catches people idling on the login screen and any lingering ingame connections.
- m_Session->ResetTimeOutTime();
-
- // OK, give the packet to WorldSession
- aptr.release();
- // WARNINIG here we call it with locks held.
- // Its possible to cause deadlock if QueuePacket calls back
- m_Session->QueuePacket (new_pct);
- return 0;
- }
- else
+ if (!m_Session)
{
- sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
+ sLog->outError(LOG_FILTER_NETWORKIO, "ProcessIncoming: Client not authed opcode = %u", uint32(opcode));
return -1;
}
+
+ // Our Idle timer will reset on any non PING opcodes.
+ // Catches people idling on the login screen and any lingering ingame connections.
+ m_Session->ResetTimeOutTime();
+
+ // OK, give the packet to WorldSession
+ aptr.release();
+ // WARNINIG here we call it with locks held.
+ // Its possible to cause deadlock if QueuePacket calls back
+ m_Session->QueuePacket(new_pct);
+ return 0;
}
}
}
catch (ByteBufferException &)
{
- sLog->outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
- opcode, GetRemoteAddress().c_str(), m_Session?m_Session->GetAccountId():-1);
- if (sLog->IsOutDebug())
- {
- sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:");
- new_pct->hexlike();
- }
-
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.",
+ opcode, GetRemoteAddress().c_str(), m_Session ? int32(m_Session->GetAccountId()) : -1);
+ new_pct->hexlike();
return -1;
}
ACE_NOTREACHED (return 0);
}
-int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
+int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
{
// NOTE: ATM the socket is singlethread, have this in mind ...
uint8 digest[20];
@@ -758,7 +757,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet << uint8(AUTH_REJECT);
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str());
return -1;
}
@@ -772,7 +771,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
recvPacket >> unk4;
recvPacket.read(digest, 20);
- sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: client %u, unk2 %u, account %s, unk3 %u, clientseed %u",
BuiltNumberClient,
unk2,
account.c_str(),
@@ -794,7 +793,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account).");
return -1;
}
@@ -814,7 +813,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
const char* sStr = s.AsHexStr(); //Must be freed by OPENSSL_free()
const char* vStr = v.AsHexStr(); //Must be freed by OPENSSL_free()
- sLog->outStaticDebug ("WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: (s, v) check s: %s v: %s",
sStr,
vStr);
@@ -830,7 +829,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet << uint8 (AUTH_FAILED);
SendPacket(packet);
- sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs).");
return -1;
}
}
@@ -864,6 +863,17 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
uint32 recruiter = fields[9].GetUInt32();
std::string os = fields[10].GetString();
+ // Must be done before WorldSession is created
+ if (sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED) && os != "Win" && os != "OSX")
+ {
+ packet.Initialize(SMSG_AUTH_RESPONSE, 1);
+ packet << uint8(AUTH_REJECT);
+ SendPacket(packet);
+
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", GetRemoteAddress().c_str(), os.c_str());
+ return -1;
+ }
+
// Checks gmlevel per Realm
stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID);
@@ -894,7 +904,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
packet << uint8 (AUTH_BANNED);
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned).");
return -1;
}
@@ -908,7 +918,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough");
return -1;
}
@@ -932,11 +942,11 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
SendPacket(packet);
- sLog->outError("WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str());
return -1;
}
- sLog->outStaticDebug("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
account.c_str(),
address.c_str());
@@ -1012,12 +1022,8 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
{
- Player* _player = m_Session->GetPlayer();
- sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)",
- m_Session->GetAccountId(),
- _player ? _player->GetGUIDLow() : 0,
- _player ? _player->GetName() : "<none>",
- GetRemoteAddress().c_str());
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
+ m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str());
return -1;
}
@@ -1035,7 +1041,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
m_Session->SetLatency (latency);
else
{
- sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, "
+ sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked, "
" address = %s",
GetRemoteAddress().c_str());
diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h
index b8080b128f2..b8080b128f2 100755..100644
--- a/src/server/game/Server/WorldSocket.h
+++ b/src/server/game/Server/WorldSocket.h
diff --git a/src/server/game/Server/WorldSocketAcceptor.h b/src/server/game/Server/WorldSocketAcceptor.h
index a16c5c2189f..d4ff7823b02 100644
--- a/src/server/game/Server/WorldSocketAcceptor.h
+++ b/src/server/game/Server/WorldSocketAcceptor.h
@@ -44,7 +44,7 @@ protected:
virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/)
{
- sLog->outBasic("Resuming acceptor");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Resuming acceptor");
reactor()->cancel_timer(this, 1);
return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK);
}
@@ -54,7 +54,7 @@ protected:
#if defined(ENFILE) && defined(EMFILE)
if (errno == ENFILE || errno == EMFILE)
{
- sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds");
+ sLog->outError(LOG_FILTER_GENERAL, "Out of file descriptors, suspending incoming connections for 10 seconds");
reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
reactor()->schedule_timer(this, NULL, ACE_Time_Value(10));
}
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index d357651a5bf..ed960258c41 100755..100644
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -155,7 +155,7 @@ class ReactorRunnable : protected ACE_Task_Base
virtual int svc()
{
- sLog->outStaticDebug ("Network Thread Starting");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Network Thread Starting");
ACE_ASSERT (m_Reactor);
@@ -192,7 +192,7 @@ class ReactorRunnable : protected ACE_Task_Base
}
}
- sLog->outStaticDebug ("Network Thread exits");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Network Thread exits");
return 0;
}
@@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (num_threads <= 0)
{
- sLog->outError("Network.Threads is wrong in your config file");
+ sLog->outError(LOG_FILTER_GENERAL, "Network.Threads is wrong in your config file");
return -1;
}
@@ -244,7 +244,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
m_NetThreads = new ReactorRunnable[m_NetThreadsCount];
- sLog->outBasic ("Max allowed socket connections %d", ACE::max_handles());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Max allowed socket connections %d", ACE::max_handles());
// -1 means use default
m_SockOutKBuff = ConfigMgr::GetIntDefault ("Network.OutKBuff", -1);
@@ -253,7 +253,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_SockOutUBuff <= 0)
{
- sLog->outError("Network.OutUBuff is wrong in your config file");
+ sLog->outError(LOG_FILTER_GENERAL, "Network.OutUBuff is wrong in your config file");
return -1;
}
@@ -263,7 +263,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1)
{
- sLog->outError("Failed to open acceptor, check if the port is free");
+ sLog->outError(LOG_FILTER_GENERAL, "Failed to open acceptor, check if the port is free");
return -1;
}
@@ -276,7 +276,7 @@ WorldSocketMgr::StartReactiveIO (ACE_UINT16 port, const char* address)
int
WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address)
{
- if (!sLog->IsOutDebug())
+ if (!sLog->ShouldLog(LOG_FILTER_GENERAL, LOG_LEVEL_DEBUG))
ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS);
if (StartReactiveIO(port, address) == -1)
@@ -327,7 +327,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*) & m_SockOutKBuff,
sizeof (int)) == -1 && errno != ENOTSUP)
{
- sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF");
return -1;
}
}
@@ -342,7 +342,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock)
(void*)&ndoption,
sizeof (int)) == -1)
{
- sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
+ sLog->outError(LOG_FILTER_GENERAL, "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno));
return -1;
}
}
diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h
index fd7e28485cf..fd7e28485cf 100755..100644
--- a/src/server/game/Server/WorldSocketMgr.h
+++ b/src/server/game/Server/WorldSocketMgr.h
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index e314fab07be..3eac3d34fd2 100755..100644
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -55,8 +55,8 @@ void LoadSkillDiscoveryTable()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
+
return;
}
@@ -89,7 +89,7 @@ void LoadSkillDiscoveryTable()
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
- sLog->outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell);
reportedReqSpells.insert(absReqSkillOrSpell);
}
continue;
@@ -102,7 +102,7 @@ void LoadSkillDiscoveryTable()
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
- sLog->outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
" and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
absReqSkillOrSpell, spellId);
reportedReqSpells.insert(absReqSkillOrSpell);
@@ -118,7 +118,7 @@ void LoadSkillDiscoveryTable()
if (bounds.first == bounds.second)
{
- sLog->outErrorDb("Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId);
continue;
}
@@ -127,7 +127,7 @@ void LoadSkillDiscoveryTable()
}
else
{
- sLog->outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);
continue;
}
@@ -136,7 +136,7 @@ void LoadSkillDiscoveryTable()
while (result->NextRow());
if (!ssNonDiscoverableEntries.str().empty())
- sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
+ sLog->outError(LOG_FILTER_SQL, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
// report about empty data for explicit discovery spells
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
@@ -150,11 +150,11 @@ void LoadSkillDiscoveryTable()
continue;
if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())
- sLog->outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
}
- sLog->outString(">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ 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/SkillDiscovery.h b/src/server/game/Skills/SkillDiscovery.h
index ba5542e0189..ba5542e0189 100755..100644
--- a/src/server/game/Skills/SkillDiscovery.h
+++ b/src/server/game/Skills/SkillDiscovery.h
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 3bb435145f1..9e2648dc943 100755..100644
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -60,8 +60,8 @@ void LoadSkillExtraItemTable()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
+
return;
}
@@ -75,28 +75,28 @@ void LoadSkillExtraItemTable()
if (!sSpellMgr->GetSpellInfo(spellId))
{
- sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_GENERAL, "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("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
+ sLog->outError(LOG_FILTER_GENERAL, "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("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_GENERAL, "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("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
+ sLog->outError(LOG_FILTER_GENERAL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
@@ -110,8 +110,8 @@ void LoadSkillExtraItemTable()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ 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/Skills/SkillExtraItems.h b/src/server/game/Skills/SkillExtraItems.h
index 0cf49021e1c..0cf49021e1c 100755..100644
--- a/src/server/game/Skills/SkillExtraItems.h
+++ b/src/server/game/Skills/SkillExtraItems.h
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index ddb230d6773..11e4a28e084 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -47,341 +47,342 @@ enum AuraEffectHandleModes
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL), // any case handler need to send packet
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL), // any case handler applies effect depending on amount
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK),
- AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL),
+ AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL)
};
//m_schoolAbsorb
enum DAMAGE_ABSORB_TYPE
{
ALL_DAMAGE_ABSORB = -2,
- ONLY_MAGIC_ABSORB = -1,
+ ONLY_MAGIC_ABSORB = -1
};
enum AuraType
{
- SPELL_AURA_NONE = 0,
- SPELL_AURA_BIND_SIGHT = 1,
- SPELL_AURA_MOD_POSSESS = 2,
- SPELL_AURA_PERIODIC_DAMAGE = 3,
- SPELL_AURA_DUMMY = 4,
- SPELL_AURA_MOD_CONFUSE = 5,
- SPELL_AURA_MOD_CHARM = 6,
- SPELL_AURA_MOD_FEAR = 7,
- SPELL_AURA_PERIODIC_HEAL = 8,
- SPELL_AURA_MOD_ATTACKSPEED = 9,
- SPELL_AURA_MOD_THREAT = 10,
- SPELL_AURA_MOD_TAUNT = 11,
- SPELL_AURA_MOD_STUN = 12,
- SPELL_AURA_MOD_DAMAGE_DONE = 13,
- SPELL_AURA_MOD_DAMAGE_TAKEN = 14,
- SPELL_AURA_DAMAGE_SHIELD = 15,
- SPELL_AURA_MOD_STEALTH = 16,
- SPELL_AURA_MOD_STEALTH_DETECT = 17,
- SPELL_AURA_MOD_INVISIBILITY = 18,
- SPELL_AURA_MOD_INVISIBILITY_DETECT = 19,
- SPELL_AURA_OBS_MOD_HEALTH = 20, //20, 21 unofficial
- SPELL_AURA_OBS_MOD_POWER = 21,
- SPELL_AURA_MOD_RESISTANCE = 22,
- SPELL_AURA_PERIODIC_TRIGGER_SPELL = 23,
- SPELL_AURA_PERIODIC_ENERGIZE = 24,
- SPELL_AURA_MOD_PACIFY = 25,
- SPELL_AURA_MOD_ROOT = 26,
- SPELL_AURA_MOD_SILENCE = 27,
- SPELL_AURA_REFLECT_SPELLS = 28,
- SPELL_AURA_MOD_STAT = 29,
- SPELL_AURA_MOD_SKILL = 30,
- SPELL_AURA_MOD_INCREASE_SPEED = 31,
- SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED = 32,
- SPELL_AURA_MOD_DECREASE_SPEED = 33,
- SPELL_AURA_MOD_INCREASE_HEALTH = 34,
- SPELL_AURA_MOD_INCREASE_ENERGY = 35,
- SPELL_AURA_MOD_SHAPESHIFT = 36,
- SPELL_AURA_EFFECT_IMMUNITY = 37,
- SPELL_AURA_STATE_IMMUNITY = 38,
- SPELL_AURA_SCHOOL_IMMUNITY = 39,
- SPELL_AURA_DAMAGE_IMMUNITY = 40,
- SPELL_AURA_DISPEL_IMMUNITY = 41,
- SPELL_AURA_PROC_TRIGGER_SPELL = 42,
- SPELL_AURA_PROC_TRIGGER_DAMAGE = 43,
- SPELL_AURA_TRACK_CREATURES = 44,
- SPELL_AURA_TRACK_RESOURCES = 45,
- SPELL_AURA_46 = 46, // Ignore all Gear test spells
- SPELL_AURA_MOD_PARRY_PERCENT = 47,
- SPELL_AURA_48 = 48, // One periodic spell
- SPELL_AURA_MOD_DODGE_PERCENT = 49,
- SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50,
- SPELL_AURA_MOD_BLOCK_PERCENT = 51,
- SPELL_AURA_MOD_WEAPON_CRIT_PERCENT = 52,
- SPELL_AURA_PERIODIC_LEECH = 53,
- SPELL_AURA_MOD_HIT_CHANCE = 54,
- SPELL_AURA_MOD_SPELL_HIT_CHANCE = 55,
- SPELL_AURA_TRANSFORM = 56,
- SPELL_AURA_MOD_SPELL_CRIT_CHANCE = 57,
- SPELL_AURA_MOD_INCREASE_SWIM_SPEED = 58,
- SPELL_AURA_MOD_DAMAGE_DONE_CREATURE = 59,
- SPELL_AURA_MOD_PACIFY_SILENCE = 60,
- SPELL_AURA_MOD_SCALE = 61,
- SPELL_AURA_PERIODIC_HEALTH_FUNNEL = 62,
- SPELL_AURA_63 = 63, // old SPELL_AURA_PERIODIC_MANA_FUNNEL
- SPELL_AURA_PERIODIC_MANA_LEECH = 64,
- SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK = 65,
- SPELL_AURA_FEIGN_DEATH = 66,
- SPELL_AURA_MOD_DISARM = 67,
- SPELL_AURA_MOD_STALKED = 68,
- SPELL_AURA_SCHOOL_ABSORB = 69,
- SPELL_AURA_EXTRA_ATTACKS = 70,
- SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL = 71,
- SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT = 72,
- SPELL_AURA_MOD_POWER_COST_SCHOOL = 73,
- SPELL_AURA_REFLECT_SPELLS_SCHOOL = 74,
- SPELL_AURA_MOD_LANGUAGE = 75,
- SPELL_AURA_FAR_SIGHT = 76,
- SPELL_AURA_MECHANIC_IMMUNITY = 77,
- SPELL_AURA_MOUNTED = 78,
- SPELL_AURA_MOD_DAMAGE_PERCENT_DONE = 79,
- SPELL_AURA_MOD_PERCENT_STAT = 80,
- SPELL_AURA_SPLIT_DAMAGE_PCT = 81,
- SPELL_AURA_WATER_BREATHING = 82,
- SPELL_AURA_MOD_BASE_RESISTANCE = 83,
- SPELL_AURA_MOD_REGEN = 84,
- SPELL_AURA_MOD_POWER_REGEN = 85,
- SPELL_AURA_CHANNEL_DEATH_ITEM = 86,
- SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87,
- SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88,
- SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89,
- SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE
- SPELL_AURA_MOD_DETECT_RANGE = 91,
- SPELL_AURA_PREVENTS_FLEEING = 92,
- SPELL_AURA_MOD_UNATTACKABLE = 93,
- SPELL_AURA_INTERRUPT_REGEN = 94,
- SPELL_AURA_GHOST = 95,
- SPELL_AURA_SPELL_MAGNET = 96,
- SPELL_AURA_MANA_SHIELD = 97,
- SPELL_AURA_MOD_SKILL_TALENT = 98,
- SPELL_AURA_MOD_ATTACK_POWER = 99,
- SPELL_AURA_AURAS_VISIBLE = 100,
- SPELL_AURA_MOD_RESISTANCE_PCT = 101,
- SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS = 102,
- SPELL_AURA_MOD_TOTAL_THREAT = 103,
- SPELL_AURA_WATER_WALK = 104,
- SPELL_AURA_FEATHER_FALL = 105,
- SPELL_AURA_HOVER = 106,
- SPELL_AURA_ADD_FLAT_MODIFIER = 107,
- SPELL_AURA_ADD_PCT_MODIFIER = 108,
- SPELL_AURA_ADD_TARGET_TRIGGER = 109,
- SPELL_AURA_MOD_POWER_REGEN_PERCENT = 110,
- SPELL_AURA_ADD_CASTER_HIT_TRIGGER = 111,
- SPELL_AURA_OVERRIDE_CLASS_SCRIPTS = 112,
- SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN = 113,
- SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT = 114,
- SPELL_AURA_MOD_HEALING = 115,
- SPELL_AURA_MOD_REGEN_DURING_COMBAT = 116,
- SPELL_AURA_MOD_MECHANIC_RESISTANCE = 117,
- SPELL_AURA_MOD_HEALING_PCT = 118,
- SPELL_AURA_119 = 119, // old SPELL_AURA_SHARE_PET_TRACKING
- SPELL_AURA_UNTRACKABLE = 120,
- SPELL_AURA_EMPATHY = 121,
- SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT = 122,
- SPELL_AURA_MOD_TARGET_RESISTANCE = 123,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER = 124,
- SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN = 125,
- SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT = 126,
- SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS = 127,
- SPELL_AURA_MOD_POSSESS_PET = 128,
- SPELL_AURA_MOD_SPEED_ALWAYS = 129,
- SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS = 130,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS = 131,
- SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT = 132,
- SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT = 133,
- SPELL_AURA_MOD_MANA_REGEN_INTERRUPT = 134,
- SPELL_AURA_MOD_HEALING_DONE = 135,
- SPELL_AURA_MOD_HEALING_DONE_PERCENT = 136,
- SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE = 137,
- SPELL_AURA_MOD_MELEE_HASTE = 138,
- SPELL_AURA_FORCE_REACTION = 139,
- SPELL_AURA_MOD_RANGED_HASTE = 140,
- SPELL_AURA_MOD_RANGED_AMMO_HASTE = 141,
- SPELL_AURA_MOD_BASE_RESISTANCE_PCT = 142,
- SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE = 143,
- SPELL_AURA_SAFE_FALL = 144,
- SPELL_AURA_MOD_PET_TALENT_POINTS = 145,
- SPELL_AURA_ALLOW_TAME_PET_TYPE = 146,
- SPELL_AURA_MECHANIC_IMMUNITY_MASK = 147,
- SPELL_AURA_RETAIN_COMBO_POINTS = 148,
- SPELL_AURA_REDUCE_PUSHBACK = 149, // Reduce Pushback
- SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150,
- SPELL_AURA_TRACK_STEALTHED = 151, // Track Stealthed
- SPELL_AURA_MOD_DETECTED_RANGE = 152, // Mod Detected Range
- SPELL_AURA_SPLIT_DAMAGE_FLAT = 153, // Split Damage Flat
- SPELL_AURA_MOD_STEALTH_LEVEL = 154, // Stealth Level Modifier
- SPELL_AURA_MOD_WATER_BREATHING = 155, // Mod Water Breathing
- SPELL_AURA_MOD_REPUTATION_GAIN = 156, // Mod Reputation Gain
- SPELL_AURA_PET_DAMAGE_MULTI = 157, // Mod Pet Damage
- SPELL_AURA_MOD_SHIELD_BLOCKVALUE = 158,
- SPELL_AURA_NO_PVP_CREDIT = 159,
- SPELL_AURA_MOD_AOE_AVOIDANCE = 160,
- SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT = 161,
- SPELL_AURA_POWER_BURN = 162,
- SPELL_AURA_MOD_CRIT_DAMAGE_BONUS = 163,
- SPELL_AURA_164 = 164,
- SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS = 165,
- SPELL_AURA_MOD_ATTACK_POWER_PCT = 166,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT = 167,
- SPELL_AURA_MOD_DAMAGE_DONE_VERSUS = 168,
- SPELL_AURA_MOD_CRIT_PERCENT_VERSUS = 169,
- SPELL_AURA_DETECT_AMORE = 170,
- SPELL_AURA_MOD_SPEED_NOT_STACK = 171,
- SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK = 172,
- SPELL_AURA_173 = 173, // old SPELL_AURA_ALLOW_CHAMPION_SPELLS
- SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT = 174, // by defeult intelect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
- SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT = 175,
- SPELL_AURA_SPIRIT_OF_REDEMPTION = 176,
- SPELL_AURA_AOE_CHARM = 177,
- SPELL_AURA_MOD_DEBUFF_RESISTANCE = 178,
- SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE = 179,
- SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS = 180,
- SPELL_AURA_181 = 181, // old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS - possible flat spell crit damage versus
- SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT = 182,
- SPELL_AURA_MOD_CRITICAL_THREAT = 183,
- SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE = 184,
- SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE= 185,
- SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE = 186,
- SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE = 187,
- SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE = 188,
- SPELL_AURA_MOD_RATING = 189,
- SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190,
- SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191,
- SPELL_AURA_MOD_MELEE_RANGED_HASTE = 192,
- SPELL_AURA_MELEE_SLOW = 193,
- SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL = 194,
- SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL = 195,
- SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
- SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE = 197,
- SPELL_AURA_198 = 198, // old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
- SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT = 199,
- SPELL_AURA_MOD_XP_PCT = 200,
- SPELL_AURA_FLY = 201,
- SPELL_AURA_IGNORE_COMBAT_RESULT = 202,
- SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE = 203,
- SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE = 204,
- SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN = 205,
- SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED = 206,
- SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED = 207,
- SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED = 208,
- SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS = 209,
- SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS = 210,
- SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK = 211,
- SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT = 212,
- SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT = 213,
- SPELL_AURA_214 = 214,
- SPELL_AURA_ARENA_PREPARATION = 215,
- SPELL_AURA_HASTE_SPELLS = 216,
- SPELL_AURA_MOD_MELEE_HASTE_2 = 217, // NYI
- SPELL_AURA_HASTE_RANGED = 218,
- SPELL_AURA_MOD_MANA_REGEN_FROM_STAT = 219,
- SPELL_AURA_MOD_RATING_FROM_STAT = 220,
- SPELL_AURA_MOD_DETAUNT = 221,
- SPELL_AURA_222 = 222,
- SPELL_AURA_RAID_PROC_FROM_CHARGE = 223,
- SPELL_AURA_224 = 224,
- SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE = 225,
- SPELL_AURA_PERIODIC_DUMMY = 226,
- SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227,
- SPELL_AURA_DETECT_STEALTH = 228,
- SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229,
- SPELL_AURA_230 = 230,
- SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE = 231,
- SPELL_AURA_MECHANIC_DURATION_MOD = 232,
- SPELL_AURA_CHANGE_MODEL_FOR_ALL_HUMANOIDS = 233, // client-side only
- SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK = 234,
- SPELL_AURA_MOD_DISPEL_RESIST = 235,
- SPELL_AURA_CONTROL_VEHICLE = 236,
- SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER = 237,
- SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER = 238,
- SPELL_AURA_MOD_SCALE_2 = 239,
- SPELL_AURA_MOD_EXPERTISE = 240,
- SPELL_AURA_FORCE_MOVE_FORWARD = 241,
- SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
- SPELL_AURA_MOD_FACTION = 243,
- SPELL_AURA_COMPREHEND_LANGUAGE = 244,
- SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL = 245,
- SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK = 246,
- SPELL_AURA_CLONE_CASTER = 247,
- SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
- SPELL_AURA_CONVERT_RUNE = 249,
- SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
- SPELL_AURA_MOD_ENEMY_DODGE = 251,
- SPELL_AURA_MOD_SPEED_SLOW_ALL = 252,
- SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253,
- SPELL_AURA_MOD_DISARM_OFFHAND = 254,
- SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255,
- SPELL_AURA_NO_REAGENT_USE = 256,
- SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS = 257,
- SPELL_AURA_258 = 258,
- SPELL_AURA_MOD_HOT_PCT = 259,
- SPELL_AURA_SCREEN_EFFECT = 260,
- SPELL_AURA_PHASE = 261,
- SPELL_AURA_ABILITY_IGNORE_AURASTATE = 262,
- SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
- SPELL_AURA_264 = 264,
- SPELL_AURA_265 = 265,
- SPELL_AURA_266 = 266,
- SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL = 267,
+ SPELL_AURA_NONE = 0,
+ SPELL_AURA_BIND_SIGHT = 1,
+ SPELL_AURA_MOD_POSSESS = 2,
+ SPELL_AURA_PERIODIC_DAMAGE = 3,
+ SPELL_AURA_DUMMY = 4,
+ SPELL_AURA_MOD_CONFUSE = 5,
+ SPELL_AURA_MOD_CHARM = 6,
+ SPELL_AURA_MOD_FEAR = 7,
+ SPELL_AURA_PERIODIC_HEAL = 8,
+ SPELL_AURA_MOD_ATTACKSPEED = 9,
+ SPELL_AURA_MOD_THREAT = 10,
+ SPELL_AURA_MOD_TAUNT = 11,
+ SPELL_AURA_MOD_STUN = 12,
+ SPELL_AURA_MOD_DAMAGE_DONE = 13,
+ SPELL_AURA_MOD_DAMAGE_TAKEN = 14,
+ SPELL_AURA_DAMAGE_SHIELD = 15,
+ SPELL_AURA_MOD_STEALTH = 16,
+ SPELL_AURA_MOD_STEALTH_DETECT = 17,
+ SPELL_AURA_MOD_INVISIBILITY = 18,
+ SPELL_AURA_MOD_INVISIBILITY_DETECT = 19,
+ SPELL_AURA_OBS_MOD_HEALTH = 20, // 20, 21 unofficial
+ SPELL_AURA_OBS_MOD_POWER = 21,
+ SPELL_AURA_MOD_RESISTANCE = 22,
+ SPELL_AURA_PERIODIC_TRIGGER_SPELL = 23,
+ SPELL_AURA_PERIODIC_ENERGIZE = 24,
+ SPELL_AURA_MOD_PACIFY = 25,
+ SPELL_AURA_MOD_ROOT = 26,
+ SPELL_AURA_MOD_SILENCE = 27,
+ SPELL_AURA_REFLECT_SPELLS = 28,
+ SPELL_AURA_MOD_STAT = 29,
+ SPELL_AURA_MOD_SKILL = 30,
+ SPELL_AURA_MOD_INCREASE_SPEED = 31,
+ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED = 32,
+ SPELL_AURA_MOD_DECREASE_SPEED = 33,
+ SPELL_AURA_MOD_INCREASE_HEALTH = 34,
+ SPELL_AURA_MOD_INCREASE_ENERGY = 35,
+ SPELL_AURA_MOD_SHAPESHIFT = 36,
+ SPELL_AURA_EFFECT_IMMUNITY = 37,
+ SPELL_AURA_STATE_IMMUNITY = 38,
+ SPELL_AURA_SCHOOL_IMMUNITY = 39,
+ SPELL_AURA_DAMAGE_IMMUNITY = 40,
+ SPELL_AURA_DISPEL_IMMUNITY = 41,
+ SPELL_AURA_PROC_TRIGGER_SPELL = 42,
+ SPELL_AURA_PROC_TRIGGER_DAMAGE = 43,
+ SPELL_AURA_TRACK_CREATURES = 44,
+ SPELL_AURA_TRACK_RESOURCES = 45,
+ SPELL_AURA_46 = 46, // Ignore all Gear test spells
+ SPELL_AURA_MOD_PARRY_PERCENT = 47,
+ SPELL_AURA_48 = 48, // One periodic spell
+ SPELL_AURA_MOD_DODGE_PERCENT = 49,
+ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50,
+ SPELL_AURA_MOD_BLOCK_PERCENT = 51,
+ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT = 52,
+ SPELL_AURA_PERIODIC_LEECH = 53,
+ SPELL_AURA_MOD_HIT_CHANCE = 54,
+ SPELL_AURA_MOD_SPELL_HIT_CHANCE = 55,
+ SPELL_AURA_TRANSFORM = 56,
+ SPELL_AURA_MOD_SPELL_CRIT_CHANCE = 57,
+ SPELL_AURA_MOD_INCREASE_SWIM_SPEED = 58,
+ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE = 59,
+ SPELL_AURA_MOD_PACIFY_SILENCE = 60,
+ SPELL_AURA_MOD_SCALE = 61,
+ SPELL_AURA_PERIODIC_HEALTH_FUNNEL = 62,
+ SPELL_AURA_63 = 63, // old SPELL_AURA_PERIODIC_MANA_FUNNEL
+ SPELL_AURA_PERIODIC_MANA_LEECH = 64,
+ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK = 65,
+ SPELL_AURA_FEIGN_DEATH = 66,
+ SPELL_AURA_MOD_DISARM = 67,
+ SPELL_AURA_MOD_STALKED = 68,
+ SPELL_AURA_SCHOOL_ABSORB = 69,
+ SPELL_AURA_EXTRA_ATTACKS = 70,
+ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL = 71,
+ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT = 72,
+ SPELL_AURA_MOD_POWER_COST_SCHOOL = 73,
+ SPELL_AURA_REFLECT_SPELLS_SCHOOL = 74,
+ SPELL_AURA_MOD_LANGUAGE = 75,
+ SPELL_AURA_FAR_SIGHT = 76,
+ SPELL_AURA_MECHANIC_IMMUNITY = 77,
+ SPELL_AURA_MOUNTED = 78,
+ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE = 79,
+ SPELL_AURA_MOD_PERCENT_STAT = 80,
+ SPELL_AURA_SPLIT_DAMAGE_PCT = 81,
+ SPELL_AURA_WATER_BREATHING = 82,
+ SPELL_AURA_MOD_BASE_RESISTANCE = 83,
+ SPELL_AURA_MOD_REGEN = 84,
+ SPELL_AURA_MOD_POWER_REGEN = 85,
+ SPELL_AURA_CHANNEL_DEATH_ITEM = 86,
+ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87,
+ SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88,
+ SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89,
+ SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE
+ SPELL_AURA_MOD_DETECT_RANGE = 91,
+ SPELL_AURA_PREVENTS_FLEEING = 92,
+ SPELL_AURA_MOD_UNATTACKABLE = 93,
+ SPELL_AURA_INTERRUPT_REGEN = 94,
+ SPELL_AURA_GHOST = 95,
+ SPELL_AURA_SPELL_MAGNET = 96,
+ SPELL_AURA_MANA_SHIELD = 97,
+ SPELL_AURA_MOD_SKILL_TALENT = 98,
+ SPELL_AURA_MOD_ATTACK_POWER = 99,
+ SPELL_AURA_AURAS_VISIBLE = 100,
+ SPELL_AURA_MOD_RESISTANCE_PCT = 101,
+ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS = 102,
+ SPELL_AURA_MOD_TOTAL_THREAT = 103,
+ SPELL_AURA_WATER_WALK = 104,
+ SPELL_AURA_FEATHER_FALL = 105,
+ SPELL_AURA_HOVER = 106,
+ SPELL_AURA_ADD_FLAT_MODIFIER = 107,
+ SPELL_AURA_ADD_PCT_MODIFIER = 108,
+ SPELL_AURA_ADD_TARGET_TRIGGER = 109,
+ SPELL_AURA_MOD_POWER_REGEN_PERCENT = 110,
+ SPELL_AURA_ADD_CASTER_HIT_TRIGGER = 111,
+ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS = 112,
+ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN = 113,
+ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT = 114,
+ SPELL_AURA_MOD_HEALING = 115,
+ SPELL_AURA_MOD_REGEN_DURING_COMBAT = 116,
+ SPELL_AURA_MOD_MECHANIC_RESISTANCE = 117,
+ SPELL_AURA_MOD_HEALING_PCT = 118,
+ SPELL_AURA_119 = 119, // old SPELL_AURA_SHARE_PET_TRACKING
+ SPELL_AURA_UNTRACKABLE = 120,
+ SPELL_AURA_EMPATHY = 121,
+ SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT = 122,
+ SPELL_AURA_MOD_TARGET_RESISTANCE = 123,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER = 124,
+ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN = 125,
+ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT = 126,
+ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS = 127,
+ SPELL_AURA_MOD_POSSESS_PET = 128,
+ SPELL_AURA_MOD_SPEED_ALWAYS = 129,
+ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS = 130,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS = 131,
+ SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT = 132,
+ SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT = 133,
+ SPELL_AURA_MOD_MANA_REGEN_INTERRUPT = 134,
+ SPELL_AURA_MOD_HEALING_DONE = 135,
+ SPELL_AURA_MOD_HEALING_DONE_PERCENT = 136,
+ SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE = 137,
+ SPELL_AURA_MOD_MELEE_HASTE = 138,
+ SPELL_AURA_FORCE_REACTION = 139,
+ SPELL_AURA_MOD_RANGED_HASTE = 140,
+ SPELL_AURA_MOD_RANGED_AMMO_HASTE = 141,
+ SPELL_AURA_MOD_BASE_RESISTANCE_PCT = 142,
+ SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE = 143,
+ SPELL_AURA_SAFE_FALL = 144,
+ SPELL_AURA_MOD_PET_TALENT_POINTS = 145,
+ SPELL_AURA_ALLOW_TAME_PET_TYPE = 146,
+ SPELL_AURA_MECHANIC_IMMUNITY_MASK = 147,
+ SPELL_AURA_RETAIN_COMBO_POINTS = 148,
+ SPELL_AURA_REDUCE_PUSHBACK = 149, // Reduce Pushback
+ SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150,
+ SPELL_AURA_TRACK_STEALTHED = 151, // Track Stealthed
+ SPELL_AURA_MOD_DETECTED_RANGE = 152, // Mod Detected Range
+ SPELL_AURA_SPLIT_DAMAGE_FLAT = 153, // Split Damage Flat
+ SPELL_AURA_MOD_STEALTH_LEVEL = 154, // Stealth Level Modifier
+ SPELL_AURA_MOD_WATER_BREATHING = 155, // Mod Water Breathing
+ SPELL_AURA_MOD_REPUTATION_GAIN = 156, // Mod Reputation Gain
+ SPELL_AURA_PET_DAMAGE_MULTI = 157, // Mod Pet Damage
+ SPELL_AURA_MOD_SHIELD_BLOCKVALUE = 158,
+ SPELL_AURA_NO_PVP_CREDIT = 159,
+ SPELL_AURA_MOD_AOE_AVOIDANCE = 160,
+ SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT = 161,
+ SPELL_AURA_POWER_BURN = 162,
+ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS = 163,
+ SPELL_AURA_164 = 164,
+ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS = 165,
+ SPELL_AURA_MOD_ATTACK_POWER_PCT = 166,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT = 167,
+ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS = 168,
+ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS = 169,
+ SPELL_AURA_DETECT_AMORE = 170,
+ SPELL_AURA_MOD_SPEED_NOT_STACK = 171,
+ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK = 172,
+ SPELL_AURA_173 = 173, // old SPELL_AURA_ALLOW_CHAMPION_SPELLS
+ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT = 174, // by defeult intelect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
+ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT = 175,
+ SPELL_AURA_SPIRIT_OF_REDEMPTION = 176,
+ SPELL_AURA_AOE_CHARM = 177,
+ SPELL_AURA_MOD_DEBUFF_RESISTANCE = 178,
+ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE = 179,
+ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS = 180,
+ SPELL_AURA_181 = 181, // old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS - possible flat spell crit damage versus
+ SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT = 182,
+ SPELL_AURA_MOD_CRITICAL_THREAT = 183,
+ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE = 184,
+ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE = 185,
+ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE = 186,
+ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE = 187,
+ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE = 188,
+ SPELL_AURA_MOD_RATING = 189,
+ SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190,
+ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191,
+ SPELL_AURA_MOD_MELEE_RANGED_HASTE = 192,
+ SPELL_AURA_MELEE_SLOW = 193,
+ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL = 194,
+ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL = 195,
+ SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
+ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE = 197,
+ SPELL_AURA_198 = 198, // old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
+ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT = 199,
+ SPELL_AURA_MOD_XP_PCT = 200,
+ SPELL_AURA_FLY = 201,
+ SPELL_AURA_IGNORE_COMBAT_RESULT = 202,
+ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE = 203,
+ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE = 204,
+ SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN = 205,
+ SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED = 206,
+ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED = 207,
+ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED = 208,
+ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS = 209,
+ SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS = 210,
+ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK = 211,
+ SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT = 212,
+ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT = 213,
+ SPELL_AURA_214 = 214,
+ SPELL_AURA_ARENA_PREPARATION = 215,
+ SPELL_AURA_HASTE_SPELLS = 216,
+ SPELL_AURA_MOD_MELEE_HASTE_2 = 217, // NYI
+ SPELL_AURA_HASTE_RANGED = 218,
+ SPELL_AURA_MOD_MANA_REGEN_FROM_STAT = 219,
+ SPELL_AURA_MOD_RATING_FROM_STAT = 220,
+ SPELL_AURA_MOD_DETAUNT = 221,
+ SPELL_AURA_222 = 222,
+ SPELL_AURA_RAID_PROC_FROM_CHARGE = 223,
+ SPELL_AURA_224 = 224,
+ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE = 225,
+ SPELL_AURA_PERIODIC_DUMMY = 226,
+ SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227,
+ SPELL_AURA_DETECT_STEALTH = 228,
+ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229,
+ SPELL_AURA_230 = 230,
+ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE = 231,
+ SPELL_AURA_MECHANIC_DURATION_MOD = 232,
+ SPELL_AURA_CHANGE_MODEL_FOR_ALL_HUMANOIDS = 233, // client-side only
+ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK = 234,
+ SPELL_AURA_MOD_DISPEL_RESIST = 235,
+ SPELL_AURA_CONTROL_VEHICLE = 236,
+ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER = 237,
+ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER = 238,
+ SPELL_AURA_MOD_SCALE_2 = 239,
+ SPELL_AURA_MOD_EXPERTISE = 240,
+ SPELL_AURA_FORCE_MOVE_FORWARD = 241,
+ SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
+ SPELL_AURA_MOD_FACTION = 243,
+ SPELL_AURA_COMPREHEND_LANGUAGE = 244,
+ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL = 245,
+ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK = 246,
+ SPELL_AURA_CLONE_CASTER = 247,
+ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
+ SPELL_AURA_CONVERT_RUNE = 249,
+ SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
+ SPELL_AURA_MOD_ENEMY_DODGE = 251,
+ SPELL_AURA_MOD_SPEED_SLOW_ALL = 252,
+ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253,
+ SPELL_AURA_MOD_DISARM_OFFHAND = 254,
+ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255,
+ SPELL_AURA_NO_REAGENT_USE = 256,
+ SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS = 257,
+ SPELL_AURA_258 = 258,
+ SPELL_AURA_MOD_HOT_PCT = 259,
+ SPELL_AURA_SCREEN_EFFECT = 260,
+ SPELL_AURA_PHASE = 261,
+ SPELL_AURA_ABILITY_IGNORE_AURASTATE = 262,
+ SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
+ SPELL_AURA_264 = 264,
+ SPELL_AURA_265 = 265,
+ SPELL_AURA_266 = 266,
+ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL = 267,
SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT = 268,
- SPELL_AURA_MOD_IGNORE_TARGET_RESIST = 269,
- SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST = 270, // Possibly need swap vs 195 aura used only in 1 spell Chaos Bolt Passive
- SPELL_AURA_MOD_DAMAGE_FROM_CASTER = 271,
- SPELL_AURA_IGNORE_MELEE_RESET = 272,
- SPELL_AURA_X_RAY = 273,
- SPELL_AURA_ABILITY_CONSUME_NO_AMMO = 274,
- SPELL_AURA_MOD_IGNORE_SHAPESHIFT = 275,
- SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC = 276, // NYI
- SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
- SPELL_AURA_MOD_DISARM_RANGED = 278,
- SPELL_AURA_INITIALIZE_IMAGES = 279,
+ SPELL_AURA_MOD_IGNORE_TARGET_RESIST = 269,
+ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST = 270, // Possibly need swap vs 195 aura used only in 1 spell Chaos Bolt Passive
+ SPELL_AURA_MOD_DAMAGE_FROM_CASTER = 271,
+ SPELL_AURA_IGNORE_MELEE_RESET = 272,
+ SPELL_AURA_X_RAY = 273,
+ SPELL_AURA_ABILITY_CONSUME_NO_AMMO = 274,
+ SPELL_AURA_MOD_IGNORE_SHAPESHIFT = 275,
+ SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC = 276, // NYI
+ SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
+ SPELL_AURA_MOD_DISARM_RANGED = 278,
+ SPELL_AURA_INITIALIZE_IMAGES = 279,
SPELL_AURA_MOD_ARMOR_PENETRATION_PCT = 280,
- SPELL_AURA_MOD_HONOR_GAIN_PCT = 281,
- SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
- SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
- SPELL_AURA_LINKED = 284,
- SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
- SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
- SPELL_AURA_DEFLECT_SPELLS = 287,
- SPELL_AURA_IGNORE_HIT_DIRECTION = 288,
- SPELL_AURA_289 = 289,
- SPELL_AURA_MOD_CRIT_PCT = 290,
- SPELL_AURA_MOD_XP_QUEST_PCT = 291,
- SPELL_AURA_OPEN_STABLE = 292,
- SPELL_AURA_OVERRIDE_SPELLS = 293,
- SPELL_AURA_PREVENT_REGENERATE_POWER = 294,
- SPELL_AURA_295 = 295,
- SPELL_AURA_SET_VEHICLE_ID = 296,
- SPELL_AURA_BLOCK_SPELL_FAMILY = 297,
- SPELL_AURA_STRANGULATE = 298,
- SPELL_AURA_299 = 299,
- SPELL_AURA_SHARE_DAMAGE_PCT = 300,
- SPELL_AURA_SCHOOL_HEAL_ABSORB = 301,
- SPELL_AURA_302 = 302,
- SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE = 303,
- SPELL_AURA_MOD_FAKE_INEBRIATE = 304,
- SPELL_AURA_MOD_MINIMUM_SPEED = 305,
- SPELL_AURA_306 = 306,
- SPELL_AURA_HEAL_ABSORB_TEST = 307,
- SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308, // NYI
- SPELL_AURA_309 = 309,
- SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE = 310,
- SPELL_AURA_311 = 311,
- SPELL_AURA_312 = 312,
- SPELL_AURA_313 = 313,
- SPELL_AURA_PREVENT_RESURRECTION = 314,
- SPELL_AURA_UNDERWATER_WALKING = 315,
- SPELL_AURA_PERIODIC_HASTE = 316,
- TOTAL_AURAS = 317
+ SPELL_AURA_MOD_HONOR_GAIN_PCT = 281,
+ SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
+ SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
+ SPELL_AURA_LINKED = 284,
+ SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
+ SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
+ SPELL_AURA_DEFLECT_SPELLS = 287,
+ SPELL_AURA_IGNORE_HIT_DIRECTION = 288,
+ SPELL_AURA_289 = 289,
+ SPELL_AURA_MOD_CRIT_PCT = 290,
+ SPELL_AURA_MOD_XP_QUEST_PCT = 291,
+ SPELL_AURA_OPEN_STABLE = 292,
+ SPELL_AURA_OVERRIDE_SPELLS = 293,
+ SPELL_AURA_PREVENT_REGENERATE_POWER = 294,
+ SPELL_AURA_295 = 295,
+ SPELL_AURA_SET_VEHICLE_ID = 296,
+ SPELL_AURA_BLOCK_SPELL_FAMILY = 297,
+ SPELL_AURA_STRANGULATE = 298,
+ SPELL_AURA_299 = 299,
+ SPELL_AURA_SHARE_DAMAGE_PCT = 300,
+ SPELL_AURA_SCHOOL_HEAL_ABSORB = 301,
+ SPELL_AURA_302 = 302,
+ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE = 303,
+ SPELL_AURA_MOD_FAKE_INEBRIATE = 304,
+ SPELL_AURA_MOD_MINIMUM_SPEED = 305,
+ SPELL_AURA_306 = 306,
+ SPELL_AURA_HEAL_ABSORB_TEST = 307,
+ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308, // NYI
+ SPELL_AURA_309 = 309,
+ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE = 310,
+ SPELL_AURA_311 = 311,
+ SPELL_AURA_312 = 312,
+ SPELL_AURA_313 = 313,
+ SPELL_AURA_PREVENT_RESURRECTION = 314,
+ SPELL_AURA_UNDERWATER_WALKING = 315,
+ SPELL_AURA_PERIODIC_HASTE = 316,
+ TOTAL_AURAS = 317
};
enum AuraObjectType
{
UNIT_AURA_TYPE,
- DYNOBJ_AURA_TYPE,
+ DYNOBJ_AURA_TYPE
};
+
#endif
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 025ebb7275f..17cb16fd6d5 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -36,6 +36,10 @@
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Pet.h"
+#include "ReputationMgr.h"
class Aura;
//
@@ -116,7 +120,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
&AuraEffect::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
&AuraEffect::HandleNoImmediateEffect, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL implemented in AuraEffect::PeriodicTick
- &AuraEffect::HandleNULL, // 63 unused (3.2.0) old SPELL_AURA_PERIODIC_MANA_FUNNEL
+ &AuraEffect::HandleUnused, // 63 unused (3.2.0) old SPELL_AURA_PERIODIC_MANA_FUNNEL
&AuraEffect::HandleNoImmediateEffect, // 64 SPELL_AURA_PERIODIC_MANA_LEECH implemented in AuraEffect::PeriodicTick
&AuraEffect::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
&AuraEffect::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
@@ -143,7 +147,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
&AuraEffect::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT implemented in Player::RegenerateHealth
&AuraEffect::HandleNoImmediateEffect, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
- &AuraEffect::HandleNULL, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
+ &AuraEffect::HandleUnused, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
&AuraEffect::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
&AuraEffect::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
&AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
@@ -172,7 +176,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
&AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
- &AuraEffect::HandleNULL, //119 unused (3.2.0) old SPELL_AURA_SHARE_PET_TRACKING
+ &AuraEffect::HandleUnused, //119 unused (3.2.0) old SPELL_AURA_SHARE_PET_TRACKING
&AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
&AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
&AuraEffect::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
@@ -226,7 +230,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //170 SPELL_AURA_DETECT_AMORE various spells that change visual of units for aura target (clientside?)
&AuraEffect::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
&AuraEffect::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
- &AuraEffect::HandleNULL, //173 unused (3.2.0) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
+ &AuraEffect::HandleUnused, //173 unused (3.2.0) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
&AuraEffect::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
&AuraEffect::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
&AuraEffect::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
@@ -234,7 +238,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
&AuraEffect::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
- &AuraEffect::HandleNULL, //181 unused (3.2.0) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
+ &AuraEffect::HandleUnused, //181 unused (3.2.0) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
&AuraEffect::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
&AuraEffect::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746 - miscvalue - spell school
&AuraEffect::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
@@ -251,7 +255,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
&AuraEffect::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN - flat mod of spell cooldowns
&AuraEffect::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
- &AuraEffect::HandleNULL, //198 unused (3.2.0) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
+ &AuraEffect::HandleUnused, //198 unused (3.2.0) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
&AuraEffect::HandleNoImmediateEffect, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
&AuraEffect::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::RewardPlayerAndGroupAtKill
&AuraEffect::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
@@ -348,25 +352,25 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleAuraOpenStable, //292 SPELL_AURA_OPEN_STABLE
&AuraEffect::HandleAuraOverrideSpells, //293 auras which probably add set of abilities to their target based on it's miscvalue
&AuraEffect::HandleNoImmediateEffect, //294 SPELL_AURA_PREVENT_REGENERATE_POWER implemented in Player::Regenerate(Powers power)
- &AuraEffect::HandleNULL, //295 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //295 0 spells in 3.3.5
&AuraEffect::HandleAuraSetVehicle, //296 SPELL_AURA_SET_VEHICLE_ID sets vehicle on target
&AuraEffect::HandleNULL, //297 Spirit Burst spells
&AuraEffect::HandleNULL, //298 70569 - Strangulating, maybe prevents talk or cast
- &AuraEffect::HandleNULL, //299 unused
+ &AuraEffect::HandleUnused, //299 unused
&AuraEffect::HandleNoImmediateEffect, //300 SPELL_AURA_SHARE_DAMAGE_PCT implemented in Unit::DealDamage
&AuraEffect::HandleNoImmediateEffect, //301 SPELL_AURA_SCHOOL_HEAL_ABSORB implemented in Unit::CalcHealAbsorb
- &AuraEffect::HandleNULL, //302 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //302 0 spells in 3.3.5
&AuraEffect::HandleNoImmediateEffect, //303 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
&AuraEffect::HandleAuraModFakeInebriation, //304 SPELL_AURA_MOD_DRUNK
&AuraEffect::HandleAuraModIncreaseSpeed, //305 SPELL_AURA_MOD_MINIMUM_SPEED
- &AuraEffect::HandleNULL, //306 0 spells in 3.3.5
- &AuraEffect::HandleNULL, //307 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //306 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //307 0 spells in 3.3.5
&AuraEffect::HandleNULL, //308 new aura for hunter traps
- &AuraEffect::HandleNULL, //309 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //309 0 spells in 3.3.5
&AuraEffect::HandleNoImmediateEffect, //310 SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE implemented in Spell::CalculateDamageDone
&AuraEffect::HandleNULL, //311 0 spells in 3.3.5
&AuraEffect::HandleNULL, //312 0 spells in 3.3.5
- &AuraEffect::HandleNULL, //313 0 spells in 3.3.5
+ &AuraEffect::HandleUnused, //313 0 spells in 3.3.5
&AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo
&AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo
&AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_PERIODIC_HASTE implemented in AuraEffect::CalculatePeriodic
@@ -413,9 +417,8 @@ void AuraEffect::GetApplicationList(std::list<AuraApplication*> & applicationLis
int32 AuraEffect::CalculateAmount(Unit* caster)
{
- int32 amount;
// default amount calculation
- amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL);
+ int32 amount = m_spellInfo->Effects[m_effIndex].CalcValue(caster, &m_baseAmount, NULL);
// check item enchant aura cast
if (!amount && caster)
@@ -472,7 +475,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Glyph of Fear, Glyph of Frost nova and similar auras
if ((*itr)->GetMiscValue() == 7801)
{
- AddPctN(amount, (*itr)->GetAmount());
+ AddPct(amount, (*itr)->GetAmount());
break;
}
}
@@ -525,7 +528,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Borrowed Time
if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
- bonus += CalculatePctN(1.0f, pAurEff->GetAmount());
+ bonus += CalculatePct(1.0f, pAurEff->GetAmount());
DoneActualBenefit += caster->SpellBaseHealingBonusDone(m_spellInfo->GetSchoolMask()) * bonus;
// Improved PW: Shield: its weird having a SPELLMOD_ALL_EFFECTS here but its blizzards doing :)
@@ -537,7 +540,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// Twin Disciplines
if (AuraEffect const* pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
- AddPctN(amount, pAurEff->GetAmount());
+ AddPct(amount, pAurEff->GetAmount());
// Focused Power
// Reuse variable, not sure if this code below can be moved before Twin Disciplines
@@ -567,7 +570,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (!pAurEff)
pAurEff = caster->GetAuraEffect(74411, 0); // Battleground - Dampening
if (pAurEff)
- AddPctN(amount, pAurEff->GetAmount());
+ AddPct(amount, pAurEff->GetAmount());
return amount;
}
@@ -633,7 +636,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
else if (AuraEffect const* aurEff = caster->GetAuraEffect(60774, EFFECT_0))
amount += cp * aurEff->GetAmount();
- amount += uint32(CalculatePctU(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
+ amount += uint32(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), cp));
}
// Rend
else if (GetSpellInfo()->SpellFamilyName == SPELLFAMILY_WARRIOR && GetSpellInfo()->SpellFamilyFlags[0] & 0x20)
@@ -651,34 +654,21 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (m_spellInfo->GetRank() >= 9)
{
if (GetBase()->GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, m_spellInfo, caster))
- AddPctN(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
+ AddPct(amount, m_spellInfo->Effects[EFFECT_2].CalcValue(caster));
}
}
- // Unholy Blight damage over time effect
- else if (GetId() == 50536)
- {
- m_canBeRecalculated = false;
- // we're getting total damage on aura apply, change it to be damage per tick
- amount = int32((float)amount / GetTotalTicks());
- }
break;
case SPELL_AURA_PERIODIC_ENERGIZE:
switch (m_spellInfo->Id)
{
- case 57669: // Replenishment (0.2% from max)
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f;
- break;
- case 61782: // Infinite Replenishment
- amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
- break;
- case 29166: // Innervate
- ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
- break;
- case 48391: // Owlkin Frenzy
- ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
- break;
- default:
- break;
+ case 29166: // Innervate
+ ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
+ break;
+ case 48391: // Owlkin Frenzy
+ ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
+ break;
+ default:
+ break;
}
break;
case SPELL_AURA_PERIODIC_HEAL:
@@ -690,7 +680,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (caster->GetTypeId() == TYPEID_PLAYER)
// Bonus from Glyph of Lightwell
if (AuraEffect* modHealing = caster->GetAuraEffect(55673, 0))
- AddPctN(amount, modHealing->GetAmount());
+ AddPct(amount, modHealing->GetAmount());
}
break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN:
@@ -861,21 +851,6 @@ void AuraEffect::CalculateSpellMod()
case SPELL_AURA_DUMMY:
switch (GetSpellInfo()->SpellFamilyName)
{
- case SPELLFAMILY_PRIEST:
- // Pain and Suffering
- if (m_spellInfo->SpellIconID == 2874)
- {
- if (!m_spellmod)
- {
- m_spellmod = new SpellModifier(GetBase());
- m_spellmod->op = SPELLMOD_DOT;
- m_spellmod->type = SPELLMOD_PCT;
- m_spellmod->spellId = GetId();
- m_spellmod->mask[1] = 0x00002000;
- }
- m_spellmod->value = GetAmount();
- }
- break;
case SPELLFAMILY_DRUID:
switch (GetId())
{
@@ -1122,7 +1097,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
{
m_isPeriodic = false;
- sLog->outError("Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId());
}
else
{
@@ -1948,7 +1923,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_SPIRITOFREDEMPTION: // 0x20
break;
default:
- sLog->outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Auras: Unknown Shapeshift Type: %u", GetMiscValue());
}
modelid = target->GetModelForForm(form);
@@ -2293,6 +2268,10 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
case 75532:
target->SetDisplayId(target->getGender() == GENDER_MALE ? 31737 : 31738);
break;
+ // Gnomeregan Pride
+ case 75531:
+ target->SetDisplayId(target->getGender() == GENDER_MALE ? 31654 : 31655);
+ break;
default:
break;
}
@@ -2303,7 +2282,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
if (!ci)
{
target->SetDisplayId(16358); // pig pink ^_^
- sLog->outError("Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
}
else
{
@@ -2822,7 +2801,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry);
if (!ci)
{
- sLog->outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue());
+ sLog->outError(LOG_FILTER_SQL, "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue());
return;
}
@@ -2872,6 +2851,7 @@ void AuraEffect::HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode
{
target->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING_FLY);
target->GetMotionMaster()->MoveFall();
+ target->m_movementInfo.SetFallTime(0);
}
Player* player = target->ToPlayer();
@@ -2971,13 +2951,13 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mod
Unit* target = aurApp->GetTarget();
if (apply)
- target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(GetAuraType()))
return;
- target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
+ target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
}
}
@@ -3115,9 +3095,10 @@ void AuraEffect::HandleModPossess(AuraApplication const* aurApp, uint8 mode, boo
target->RemoveCharmedBy(caster);
}
-// only one spell has this aura
void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const
{
+ // Used by spell "Eyes of the Beast"
+
if (!(mode & AURA_EFFECT_HANDLE_REAL))
return;
@@ -3140,6 +3121,9 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
if (caster->ToPlayer()->GetPet() != pet)
return;
+ // Must clear current motion or pet leashes back to owner after a few yards
+ // when under spell 'Eyes of the Beast'
+ pet->GetMotionMaster()->Clear();
pet->SetCharmedBy(caster, CHARM_TYPE_POSSESS, aurApp);
}
else
@@ -3150,13 +3134,15 @@ void AuraEffect::HandleModPossessPet(AuraApplication const* aurApp, uint8 mode,
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
else
{
- // Reinitialize the pet bar and make the pet come back to the owner
+ // Reinitialize the pet bar or it will appear greyed out
caster->ToPlayer()->PetSpellInitialize();
- if (!pet->getVictim())
+
+ // Follow owner only if not fighting or owner didn't click "stay" at new location
+ // This may be confusing because pet bar shows "stay" when under the spell but it retains
+ // the "follow" flag. Player MUST click "stay" while under the spell.
+ if (!pet->getVictim() && !pet->GetCharmInfo()->HasCommandState(COMMAND_STAY))
{
pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, pet->GetFollowAngle());
- //if (target->GetCharmInfo())
- // target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
}
}
}
@@ -3263,9 +3249,8 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp,
target->SetCanFly(apply);
if (!apply)
{
- target->RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING);
- target->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
target->m_movementInfo.SetFallTime(0);
+ target->RemoveUnitMovementFlag(MOVEMENTFLAG_MASK_MOVING_FLY);
}
Player* player = target->ToPlayer();
@@ -3374,7 +3359,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
- aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
@@ -3406,7 +3390,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
- aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
@@ -3444,7 +3427,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
- aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
@@ -3488,7 +3470,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
- aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
@@ -3523,7 +3504,6 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, apply);
aura_immunity_list.push_back(SPELL_AURA_MOD_STUN);
- aura_immunity_list.push_back(SPELL_AURA_TRANSFORM);
aura_immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
aura_immunity_list.push_back(SPELL_AURA_MOD_ROOT);
aura_immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
@@ -3593,6 +3573,26 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8
switch (GetId())
{
+ case 34471: // The Beast Within
+ case 19574: // Bestial Wrath
+ mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_KNOCKOUT, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_BANISH, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SHACKLE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DAZE, apply);
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
+ break;
case 42292: // PvP trinket
case 59752: // Every Man for Himself
mechanic = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
@@ -3604,28 +3604,6 @@ void AuraEffect::HandleModMechanicImmunity(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
break;
- case 34471: // The Beast Within
- case 19574: // Bestial Wrath
- mechanic = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT)
- | (1 << MECHANIC_FEAR) | (1 << MECHANIC_STUN)
- | (1 << MECHANIC_SLEEP) | (1 << MECHANIC_CHARM)
- | (1 << MECHANIC_SAPPED) | (1 << MECHANIC_HORROR)
- | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_DISORIENTED)
- | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_TURN);
-
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SNARE, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_ROOT, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FEAR, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_STUN, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SLEEP, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_CHARM, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SAPPED, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_HORROR, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_POLYMORPH, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_DISORIENTED, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_FREEZE, apply);
- target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_TURN, apply);
- break;
default:
if (GetMiscValue() < 1)
return;
@@ -3903,7 +3881,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo
if (GetMiscValue() < -2 || GetMiscValue() > 4)
{
- sLog->outError("WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue());
return;
}
@@ -3929,7 +3907,7 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode,
if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
- sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
}
@@ -4027,7 +4005,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8
if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
- sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
}
@@ -4065,7 +4043,7 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aur
{
// support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
// and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
- sLog->outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!");
return;
}
@@ -4759,7 +4737,7 @@ void AuraEffect::HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode
Unit* target = aurApp->GetTarget();
- float amount = CalculatePctN(1.0f, GetAmount());
+ float amount = CalculatePct(1.0f, GetAmount());
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
if (GetMiscValue() & (1 << i))
target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply);
@@ -5036,8 +5014,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER)
+ {
if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
+ bf->RemovePlayerFromResurrectQueue(target->GetGUID());
+ }
break;
case 36730: // Flame Strike
{
@@ -5056,7 +5038,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
}
case 43681: // Inactive
{
- if (!target || target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
return;
if (target->GetMap()->IsBattleground())
@@ -5074,6 +5056,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->CastSpell((Unit*)NULL, GetAmount(), true, NULL, this);
break;
case 58600: // Restricted Flight Area
+ case 58730: // Restricted Flight Area
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
target->CastSpell(target, 58601, true);
break;
@@ -6254,7 +6237,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
caster->DealDamageMods(target, damage, &absorb);
@@ -6324,7 +6307,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
if (target->GetHealth() < damage)
damage = uint32(target->GetHealth());
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
caster->SendSpellNonMeleeDamageLog(target, GetId(), damage, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
@@ -6408,25 +6391,25 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
// Tenacity increase healing % taken
if (AuraEffect const* Tenacity = target->GetAuraEffect(58549, 0))
- AddPctN(TakenTotalMod, Tenacity->GetAmount());
+ AddPct(TakenTotalMod, Tenacity->GetAmount());
// Healing taken percent
float minval = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (minval)
- AddPctF(TakenTotalMod, minval);
+ AddPct(TakenTotalMod, minval);
float maxval = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT);
if (maxval)
- AddPctF(TakenTotalMod, maxval);
+ AddPct(TakenTotalMod, maxval);
// Healing over time taken percent
float minval_hot = (float)target->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (minval_hot)
- AddPctF(TakenTotalMod, minval_hot);
+ AddPct(TakenTotalMod, minval_hot);
float maxval_hot = (float)target->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT);
if (maxval_hot)
- AddPctF(TakenTotalMod, maxval_hot);
+ AddPct(TakenTotalMod, maxval_hot);
TakenTotalMod = std::max(TakenTotalMod, 0.0f);
@@ -6456,7 +6439,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
if (crit)
damage = caster->SpellCriticalHealingBonus(m_spellInfo, damage, target);
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId());
uint32 absorb = 0;
@@ -6519,13 +6502,13 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
if (m_spellInfo->ManaCostPercentage)
{
// max value
- int32 maxmana = CalculatePctF(caster->GetMaxPower(powerType), drainAmount * 2.0f);
- ApplyPctU(drainAmount, target->GetMaxPower(powerType));
+ int32 maxmana = CalculatePct(caster->GetMaxPower(powerType), drainAmount * 2.0f);
+ ApplyPct(drainAmount, target->GetMaxPower(powerType));
if (drainAmount > maxmana)
drainAmount = maxmana;
}
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId());
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
@@ -6557,7 +6540,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
// Mana Feed - Drain Mana
if (manaFeedVal > 0)
{
- int32 feedAmount = CalculatePctN(gainedAmount, manaFeedVal);
+ int32 feedAmount = CalculatePct(gainedAmount, manaFeedVal);
caster->CastCustomSpell(caster, 32554, &feedAmount, NULL, NULL, true, NULL, this);
}
}
@@ -6586,7 +6569,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
// ignore negative values (can be result apply spellmods to aura damage
uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(powerType) /100;
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
@@ -6621,7 +6604,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);
- sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
int32 gain = target->ModifyPower(powerType, amount);
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 9456a219274..d0d9d417c3e 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -424,8 +424,8 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
// TODO: Figure out why this happens
if (itr == m_applications.end())
{
- sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
- target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
+ target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id);
ASSERT(false);
}
@@ -566,9 +566,9 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
if (!GetOwner()->IsSelfOrInSameMap(itr->first))
{
//TODO: There is a crash caused by shadowfiend load addon
- sLog->outCrash("Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
- GetOwner()->GetName(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
- itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
+ sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
+ GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
+ itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
ASSERT(false);
}
itr->first->_CreateAuraApplication(this, itr->second);
@@ -766,7 +766,7 @@ void Aura::SetCharges(uint8 charges)
uint8 Aura::CalcMaxCharges(Unit* caster) const
{
- uint8 maxProcCharges = m_spellInfo->ProcCharges;
+ uint32 maxProcCharges = m_spellInfo->ProcCharges;
if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
maxProcCharges = procEntry->charges;
@@ -1181,7 +1181,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 31571: spellId = 57529; break;
case 31572: spellId = 57531; break;
default:
- sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
}
if (spellId)
caster->CastSpell(caster, spellId, true);
@@ -1215,7 +1215,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
- int32 heal = int32(CalculatePctN(basepoints0, 15));
+ int32 heal = int32(CalculatePct(basepoints0, 15));
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
@@ -1277,7 +1277,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 49631: spellId = 50509; break;
case 49032: spellId = 50508; break;
default:
- sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId());
}
caster->CastSpell(target, spellId, true, 0, GetEffect(0));
}
@@ -1373,17 +1373,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case SPELLFAMILY_WARLOCK:
if (!caster)
break;
- // Curse of Doom
- if (GetSpellInfo()->SpellFamilyFlags[1] & 0x02)
- {
- if (removeMode == AURA_REMOVE_BY_DEATH)
- {
- if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
- caster->CastSpell(target, 18662, true, NULL, GetEffect(0));
- }
- }
// Improved Fear
- else if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
+ if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
{
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
{
@@ -1393,7 +1384,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 53759: spellId = 60947; break;
case 53754: spellId = 60946; break;
default:
- sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId());
}
if (spellId)
caster->CastSpell(target, spellId, true);
@@ -1423,10 +1414,16 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (caster->GetTypeId() == TYPEID_PLAYER)
{
if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
- break;
- // and add if needed
- caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
+ {
+ // This additional check is needed to add a minimal delay before cooldown in in effect
+ // to allow all bubbles broken by a single damage source proc mana return
+ if (caster->ToPlayer()->GetSpellCooldownDelay(aura->GetId()) <= 11)
+ break;
+ }
+ else // and add if needed
+ caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
}
+
// effect on caster
if (AuraEffect const* aurEff = aura->GetEffect(0))
{
@@ -1436,7 +1433,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else if (aurEff->GetId() == 47537)
multiplier += 0.5f;
- int32 basepoints0 = int32(CalculatePctF(caster->GetMaxPower(POWER_MANA), multiplier));
+ int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
}
// effect on aura target
@@ -1450,7 +1447,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
{
case POWER_MANA:
{
- int32 basepoints0 = int32(CalculatePctN(target->GetMaxPower(POWER_MANA), 2));
+ int32 basepoints0 = int32(CalculatePct(target->GetMaxPower(POWER_MANA), 2));
caster->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true);
break;
}
@@ -1602,6 +1599,14 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId())
{
case 19746:
+ // Improved concentration aura - linked aura
+ if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256))
+ {
+ if (apply)
+ target->CastSpell(target, 63510, true);
+ else
+ target->RemoveAura(63510);
+ }
case 31821:
// Aura Mastery Triggered Spell Handler
// If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity
@@ -1610,6 +1615,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Do effects only on aura owner
if (GetCasterGUID() != target->GetGUID())
break;
+
if (apply)
{
if ((GetSpellInfo()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellInfo()->Id == 19746 && target->HasAura(31821)))
@@ -1629,6 +1635,29 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
break;
}
+ if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA)
+ {
+ if (!caster)
+ break;
+
+ // Improved devotion aura
+ if (caster->HasAura(20140) || caster->HasAura(20138) || caster->HasAura(20139))
+ {
+ if (apply)
+ caster->CastSpell(target, 63514, true);
+ else
+ target->RemoveAura(63514);
+ }
+ // 63531 - linked aura for both Sanctified Retribution and Swift Retribution talents
+ // Not allow for Retribution Aura (prevent stacking)
+ if ((GetSpellInfo()->SpellIconID != 555) && (caster->HasAura(53648) || caster->HasAura(53484) || caster->HasAura(53379) || caster->HasAura(31869)))
+ {
+ if (apply)
+ caster->CastSpell(target, 63531, true);
+ else
+ target->RemoveAura(63531);
+ }
+ }
break;
case SPELLFAMILY_DEATHKNIGHT:
if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_PRESENCE)
@@ -2042,6 +2071,7 @@ void Aura::LoadScripts()
{
std::list<AuraScript*>::iterator bitr = itr;
++itr;
+ delete (*bitr);
m_loadedScripts.erase(bitr);
continue;
}
@@ -2297,6 +2327,21 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraAppli
}
}
+void Aura::CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & splitAmount)
+{
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
+ {
+ (*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);
+ }
+ (*scritr)->_FinishScriptCall();
+ }
+}
+
UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
@@ -2304,7 +2349,7 @@ UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
LoadScripts();
_InitEffects(effMask, caster, baseAmount);
GetUnitOwner()->_AddAura(this, caster);
-};
+}
void UnitAura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp)
{
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 2f50d47a79b..85c8992c597 100755..100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -217,6 +217,8 @@ class Aura
void CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount);
void CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented);
void CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount);
+ void CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & splitAmount);
+
std::list<AuraScript*> m_loadedScripts;
private:
void _DeleteRemovedApplications();
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 590f880a931..bb51d9d0e34 100755..100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -53,6 +53,8 @@
#include "SpellScript.h"
#include "InstanceScript.h"
#include "SpellInfo.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -85,7 +87,7 @@ SpellDestination::SpellDestination(WorldObject const& wObj)
}
-SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
+SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
{
m_objectTarget = NULL;
m_itemTarget = NULL;
@@ -94,7 +96,6 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
- m_strTarget = "";
m_targetMask = 0;
}
@@ -458,23 +459,23 @@ void SpellCastTargets::Update(Unit* caster)
void SpellCastTargets::OutDebug() const
{
if (!m_targetMask)
- sLog->outString("No targets");
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "No targets");
- sLog->outString("target mask: %u", m_targetMask);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "target mask: %u", m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK))
- sLog->outString("Object target: " UI64FMTD, m_objectTargetGUID);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Object target: " UI64FMTD, m_objectTargetGUID);
if (m_targetMask & TARGET_FLAG_ITEM)
- sLog->outString("Item target: " UI64FMTD, m_itemTargetGUID);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Item target: " UI64FMTD, m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
- sLog->outString("Trade item target: " UI64FMTD, m_itemTargetGUID);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Trade item target: " UI64FMTD, m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
- sLog->outString("Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
- sLog->outString("Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_STRING)
- sLog->outString("String: %s", m_strTarget.c_str());
- sLog->outString("speed: %f", m_speed);
- sLog->outString("elevation: %f", m_elevation);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "String: %s", m_strTarget.c_str());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "speed: %f", m_speed);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "elevation: %f", m_elevation);
}
SpellValue::SpellValue(SpellInfo const* proto)
@@ -582,7 +583,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
&& !m_spellInfo->IsPassive() && !m_spellInfo->IsPositive();
CleanupTargetList();
- CleanupEffectExecuteData();
+ memset(m_effectExecuteData, 0, MAX_SPELL_EFFECTS * sizeof(ByteBuffer*));
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
m_destTargets[i] = SpellDestination(*m_caster);
@@ -603,7 +604,7 @@ Spell::~Spell()
{
// Clean the reference to avoid later crash.
// If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
- sLog->outError("SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
*m_selfContainer = NULL;
}
@@ -915,7 +916,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
{
case TARGET_UNIT_CHANNEL_TARGET:
{
- WorldObject* target = ObjectAccessor::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID());
+ WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT));
CallScriptObjectTargetSelectHandlers(target, effIndex);
// unit target may be no longer avalible - teleported out of map for example
if (target && target->ToUnit())
@@ -927,7 +928,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
case TARGET_DEST_CHANNEL_TARGET:
if (channeledSpell->m_targets.HasDst())
m_targets.SetDst(channeledSpell->m_targets);
- else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, channeledSpell->m_targets.GetObjectTargetGUID()))
+ else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
{
CallScriptObjectTargetSelectHandlers(target, effIndex);
if (target)
@@ -1391,7 +1392,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id))
{
// TODO: fix this check
- if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS))
+ if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS) || m_spellInfo->HasEffect(SPELL_EFFECT_BIND))
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
else if (st->target_mapId == m_caster->GetMapId())
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
@@ -1637,7 +1638,7 @@ void Spell::SelectImplicitTrajTargets()
float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d);
if (a > -0.0001f)
a = 0;
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: a %f b %f", a, b);)
float bestDist = m_spellInfo->GetMaxRange(false);
@@ -1650,14 +1651,14 @@ void Spell::SelectImplicitTrajTargets()
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
// TODO: all calculation should be based on src instead of m_caster
- const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
+ const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ;
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
float dist = objDist2d - size;
float height = dist * (a * dist + b);
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
if (dist < bestDist && height < dz + size && height > dz - size)
{
bestDist = dist > 0 ? dist : 0;
@@ -1665,7 +1666,7 @@ void Spell::SelectImplicitTrajTargets()
}
#define CHECK_DIST {\
- DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
if (dist > bestDist)\
continue;\
if (dist < objDist2d + size && dist > objDist2d - size)\
@@ -1718,8 +1719,8 @@ void Spell::SelectImplicitTrajTargets()
if (m_targets.GetSrcPos()->GetExactDist2d(m_targets.GetDstPos()) > bestDist)
{
- float x = m_targets.GetSrcPos()->m_positionX + cos(m_caster->GetOrientation()) * bestDist;
- float y = m_targets.GetSrcPos()->m_positionY + sin(m_caster->GetOrientation()) * bestDist;
+ float x = m_targets.GetSrcPos()->m_positionX + std::cos(m_caster->GetOrientation()) * bestDist;
+ float y = m_targets.GetSrcPos()->m_positionY + std::sin(m_caster->GetOrientation()) * bestDist;
float z = m_targets.GetSrcPos()->m_positionZ + bestDist * (a * bestDist + b);
if (itr != targets.end())
@@ -1727,7 +1728,7 @@ void Spell::SelectImplicitTrajTargets()
float distSq = (*itr)->GetExactDistSq(x, y, z);
float sizeSq = (*itr)->GetObjectSize();
sizeSq *= sizeSq;
- DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
if (distSq > sizeSq)
{
float factor = 1 - sqrt(sizeSq / distSq);
@@ -1736,7 +1737,7 @@ void Spell::SelectImplicitTrajTargets()
z += factor * ((*itr)->GetPositionZ() - z);
distSq = (*itr)->GetExactDistSq(x, y, z);
- DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
+ DEBUG_TRAJ(sLog->outError(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
}
}
@@ -2524,7 +2525,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
}
}
- if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
+ if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
{
m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO));
@@ -2576,6 +2577,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber)
{
if (effectMask & (1 << effectNumber))
+ {
if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber))
effectMask &= ~(1 << effectNumber);
else if (m_spellInfo->Effects[effectNumber].IsAura() && !m_spellInfo->IsPositiveEffect(effectNumber))
@@ -2590,24 +2592,26 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
returnVal = SPELL_MISS_RESIST;
}
}
+ }
}
+
if (!effectMask)
return returnVal;
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers();
- if (unit->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = unit->ToPlayer())
{
- unit->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id);
- unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster);
- unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id);
+ player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id);
}
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = m_caster->ToPlayer())
{
- m_caster->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id);
- m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit);
+ player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit);
}
if (m_caster != unit)
@@ -3019,8 +3023,14 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
m_casttime = m_spellInfo->CalcCastTime(m_caster, this);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
+ // Set casttime to 0 if .cheat casttime is enabled.
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME))
+ m_casttime = 0;
+ }
+
// don't allow channeled spells / spells with cast time to be casted while moving
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
if ((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() && m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)
@@ -3059,10 +3069,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
SendSpellStart();
// set target for proper facing
- if (m_casttime && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
- if (uint64 target = m_targets.GetUnitTargetGUID())
- if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT)
- m_caster->FocusTarget(this, target);
+ if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
+ if (m_caster->GetGUID() != m_targets.GetObjectTargetGUID() && m_caster->GetTypeId() == TYPEID_UNIT)
+ m_caster->FocusTarget(this, m_targets.GetObjectTargetGUID());
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD))
TriggerGlobalCooldown();
@@ -3244,15 +3253,15 @@ void Spell::cast(bool skipCheck)
// set to real guid to be sent later to the client
m_targets.UpdateTradeSlotItem();
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Player* player = m_caster->ToPlayer())
{
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_ITEM) && m_CastItem)
{
- m_caster->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_ITEM, m_CastItem->GetEntry());
- m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, m_CastItem->GetEntry());
+ player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_ITEM, m_CastItem->GetEntry());
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, m_CastItem->GetEntry());
}
- m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
+ player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
}
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST))
@@ -3311,8 +3320,14 @@ void Spell::cast(bool skipCheck)
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
+ //Clear spell cooldowns after every spell is cast if .cheat cooldown is enabled.
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
+ m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
+ }
+
SetExecutedCurrently(false);
}
@@ -4067,41 +4082,47 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
*data << uint32(ammoInventoryType);
}
+/// Writes miss and hit targets for a SMSG_SPELL_GO packet
void Spell::WriteSpellGoTargets(WorldPacket* data)
{
// This function also fill data for channeled spells:
// m_needAliveTargetMask req for stop channelig if one target die
- uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO
- uint32 miss = 0;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if ((*ihit).effectMask == 0) // No effect apply - all immuned add state
- {
// possibly SPELL_MISS_IMMUNE2 for this??
ihit->missCondition = SPELL_MISS_IMMUNE2;
- ++miss;
- }
- else if ((*ihit).missCondition == SPELL_MISS_NONE)
- ++hit;
- else
- ++miss;
}
- *data << (uint8)hit;
- for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ // Hit and miss target counts are both uint8, that limits us to 255 targets for each
+ // sending more than 255 targets crashes the client (since count sent would be wrong)
+ // Spells like 40647 (with a huge radius) can easily reach this limit (spell might need
+ // target conditions but we still need to limit the number of targets sent and keeping
+ // correct count for both hit and miss).
+
+ uint32 hit = 0;
+ size_t hitPos = data->wpos();
+ *data << (uint8)0; // placeholder
+ for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit <= 255; ++ihit)
{
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
{
*data << uint64(ihit->targetGUID);
m_channelTargetEffectMask |=ihit->effectMask;
+ ++hit;
}
}
- for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
+ for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit <= 255; ++ighit)
+ {
*data << uint64(ighit->targetGUID); // Always hits
+ ++hit;
+ }
- *data << (uint8)miss;
- for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ uint32 miss = 0;
+ size_t missPos = data->wpos();
+ *data << (uint8)0; // placeholder
+ for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss <= 255; ++ihit)
{
if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss
{
@@ -4109,11 +4130,15 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
*data << uint8(ihit->missCondition);
if (ihit->missCondition == SPELL_MISS_REFLECT)
*data << uint8(ihit->reflectResult);
+ ++miss;
}
}
// Reset m_needAliveTargetMask for non channeled spell
if (!m_spellInfo->IsChanneled())
m_channelTargetEffectMask = 0;
+
+ data->put<uint8>(hitPos, (uint8)hit);
+ data->put<uint8>(missPos, (uint8)miss);
}
void Spell::SendLogExecute()
@@ -4173,12 +4198,12 @@ void Spell::ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 s
*m_effectExecuteData[effIndex] << uint32(spellId);
}
-void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 /*itemslot*/, uint32 damage)
+void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
- *m_effectExecuteData[effIndex] << uint32(m_spellInfo->Id);
- *m_effectExecuteData[effIndex] << uint32(damage);
+ *m_effectExecuteData[effIndex] << int32(itemId);
+ *m_effectExecuteData[effIndex] << int32(slot);
}
void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
@@ -4252,6 +4277,9 @@ void Spell::SendChannelUpdate(uint32 time)
void Spell::SendChannelStart(uint32 duration)
{
uint64 channelTarget = m_targets.GetObjectTargetGUID();
+ if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget())
+ if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY
+ channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID;
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
data.append(m_caster->GetPackGUID());
@@ -4271,13 +4299,15 @@ void Spell::SendResurrectRequest(Player* target)
{
// get ressurector name for creature resurrections, otherwise packet will be not accepted
// for player resurrections the name is looked up by guid
- char const* resurrectorName = m_caster->GetTypeId() == TYPEID_PLAYER ? "" : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex());
+ std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER
+ ? ""
+ : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()));
- WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+strlen(resurrectorName)+1+1+1+4));
- data << uint64(m_caster->GetGUID()); // resurrector guid
- data << uint32(strlen(resurrectorName) + 1);
+ WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+sentName.size()+1+1+1+4));
+ data << uint64(m_caster->GetGUID());
+ data << uint32(sentName.size() + 1);
- data << resurrectorName;
+ data << sentName;
data << uint8(0); // null terminator
data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); // "you'll be afflicted with resurrection sickness"
@@ -4302,7 +4332,7 @@ void Spell::TakeCastItem()
{
// This code is to avoid a crash
// I'm not sure, if this is really an error, but I guess every item needs a prototype
- sLog->outError("Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
return;
}
@@ -4354,6 +4384,13 @@ void Spell::TakePower()
if (m_CastItem || m_triggeredByAuraSpell)
return;
+ //Don't take power if the spell is cast while .cheat power is enabled.
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER))
+ return;
+ }
+
Powers powerType = Powers(m_spellInfo->PowerType);
bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
@@ -4392,7 +4429,7 @@ void Spell::TakePower()
if (powerType >= MAX_POWERS)
{
- sLog->outError("Spell::TakePower: Unknown power type '%d'", powerType);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::TakePower: Unknown power type '%d'", powerType);
return;
}
@@ -4829,17 +4866,12 @@ SpellCastResult Spell::CheckCast(bool strict)
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
{
- // send error msg to player if condition failed and text message available
- // TODO: using WorldSession::SendNotification is not blizzlike
- if (Player* playerCaster = m_caster->ToPlayer())
+ // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
+ if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType)
{
- // mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
- if (playerCaster->GetSession() && condInfo.mLastFailedCondition
- && condInfo.mLastFailedCondition->ErrorTextId)
- {
- playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId);
- return SPELL_FAILED_DONT_REPORT;
- }
+ if (condInfo.mLastFailedCondition->ErrorType == SPELL_FAILED_CUSTOM_ERROR)
+ m_customError = SpellCustomErrors(condInfo.mLastFailedCondition->ErrorTextId);
+ return SpellCastResult(condInfo.mLastFailedCondition->ErrorType);
}
if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
return SPELL_FAILED_CASTER_AURASTATE;
@@ -5112,6 +5144,10 @@ SpellCastResult Spell::CheckCast(bool strict)
}
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
return SPELL_FAILED_ROOTED;
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (Unit* target = m_targets.GetUnitTarget())
+ if (!target->isAlive())
+ return SPELL_FAILED_BAD_TARGETS;
break;
}
case SPELL_EFFECT_SKINNING:
@@ -5171,7 +5207,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() &&
m_targets.GetGOTarget()->GetGOInfo()->type != GAMEOBJECT_TYPE_TRAP))
if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners
- !m_caster->ToPlayer()->CanUseBattlegroundObject())
+ !m_caster->ToPlayer()->CanUseBattlegroundObject(m_targets.GetGOTarget()))
return SPELL_FAILED_TRY_AGAIN;
// get the lock entry
@@ -5396,6 +5432,9 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
+ if (target->GetOwner() && target->GetOwner()->GetTypeId() == TYPEID_PLAYER)
+ return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED;
+
int32 damage = CalculateDamage(i, target);
if (damage && int32(target->getLevel()) > damage)
return SPELL_FAILED_HIGHLEVEL;
@@ -5439,8 +5478,9 @@ SpellCastResult Spell::CheckCast(bool strict)
// allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive())
{
- if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
- if (pArea->flags & AREA_FLAG_NO_FLY_ZONE)
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
+ if (AreaTableEntry const* area = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
+ if (area->flags & AREA_FLAG_NO_FLY_ZONE || (Bf && !Bf->CanFlyIn()))
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
}
break;
@@ -5541,7 +5581,7 @@ SpellCastResult Spell::CheckCasterAuras() const
// We use bitmasks so the loop is done only once and not on every aura check below.
if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
@@ -5551,7 +5591,7 @@ SpellCastResult Spell::CheckCasterAuras() const
dispel_immune |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
// immune movement impairment and loss of control
- if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752)
+ if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752 || m_spellInfo->Id == 19574)
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
}
@@ -5581,7 +5621,7 @@ SpellCastResult Spell::CheckCasterAuras() const
break;
}
}
- if (foundNotStun)
+ if (foundNotStun && m_spellInfo->Id != 22812)
prevented_reason = SPELL_FAILED_STUNNED;
}
else
@@ -5609,7 +5649,7 @@ SpellCastResult Spell::CheckCasterAuras() const
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune)
continue;
- if (auraInfo->GetSchoolMask() & school_immune)
+ if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
continue;
if (auraInfo->GetDispelMask() & dispel_immune)
continue;
@@ -5771,7 +5811,7 @@ SpellCastResult Spell::CheckPower()
// Check valid power type
if (m_spellInfo->PowerType >= MAX_POWERS)
{
- sLog->outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
return SPELL_FAILED_UNKNOWN;
}
@@ -5806,7 +5846,7 @@ SpellCastResult Spell::CheckItems()
else
{
uint32 itemid = m_CastItem->GetEntry();
- if (!p_caster->HasItemCount(itemid, 1))
+ if (!p_caster->HasItemCount(itemid))
return SPELL_FAILED_ITEM_NOT_READY;
ItemTemplate const* proto = m_CastItem->GetTemplate();
@@ -5958,7 +5998,7 @@ SpellCastResult Spell::CheckItems()
{
if (m_spellInfo->Totem[i] != 0)
{
- if (p_caster->HasItemCount(m_spellInfo->Totem[i], 1))
+ if (p_caster->HasItemCount(m_spellInfo->Totem[i]))
{
totems -= 1;
continue;
@@ -6013,7 +6053,7 @@ SpellCastResult Spell::CheckItems()
{
if (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x40000000)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
- else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType, 1)))
+ else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
else
p_caster->CastSpell(m_caster, m_spellInfo->Effects[EFFECT_1].CalcValue(), false); // move this to anywhere
@@ -6192,7 +6232,7 @@ SpellCastResult Spell::CheckItems()
case ITEM_SUBCLASS_WEAPON_THROWN:
{
uint32 ammo = pItem->GetEntry();
- if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
+ if (!m_caster->ToPlayer()->HasItemCount(ammo))
return SPELL_FAILED_NO_AMMO;
};
break;
@@ -6233,7 +6273,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO;
}
- if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
+ if (!m_caster->ToPlayer()->HasItemCount(ammo))
{
m_caster->ToPlayer()->SetUInt32Value(PLAYER_AMMO_ID, 0);
return SPELL_FAILED_NO_AMMO;
@@ -6325,7 +6365,7 @@ void Spell::Delayed() // only called in DealDamage()
if (delayReduce >= 100)
return;
- AddPctN(delaytime, -delayReduce);
+ AddPct(delaytime, -delayReduce);
if (m_timer + delaytime > m_casttime)
{
@@ -6335,7 +6375,7 @@ void Spell::Delayed() // only called in DealDamage()
else
m_timer += delaytime;
- sLog->outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
WorldPacket data(SMSG_SPELL_DELAYED, 8+4);
data.append(m_caster->GetPackGUID());
@@ -6353,14 +6393,14 @@ void Spell::DelayedChannel()
return;
//check pushback reduce
- int32 delaytime = CalculatePctN(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
+ int32 delaytime = CalculatePct(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
- AddPctN(delaytime, -delayReduce);
+ AddPct(delaytime, -delayReduce);
if (m_timer <= delaytime)
{
@@ -6551,7 +6591,7 @@ SpellEvent::~SpellEvent()
}
else
{
- sLog->outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id);
ASSERT(false);
}
@@ -6820,9 +6860,9 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
0 : m_caster->ToPlayer()->GetSkillValue(skillId);
// skill bonus provided by casting spell (mostly item spells)
- // add the damage modifier from the spell casted (cheat lock / skeleton key etc.)
+ // add the effect base points modifier from the spell casted (cheat lock / skeleton key etc.)
if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
- skillValue += uint32(CalculateDamage(effIndex, NULL));
+ skillValue += m_spellInfo->Effects[effIndex].CalcValue();
if (skillValue < reqSkillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
@@ -6891,12 +6931,6 @@ void Spell::InitEffectExecuteData(uint8 effIndex)
}
}
-void Spell::CleanupEffectExecuteData()
-{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
- m_effectExecuteData[i] = NULL;
-}
-
void Spell::CheckEffectExecuteData()
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
@@ -6912,6 +6946,7 @@ void Spell::LoadScripts()
{
std::list<SpellScript*>::iterator bitr = itr;
++itr;
+ delete (*bitr);
m_loadedScripts.erase(bitr);
continue;
}
@@ -7188,6 +7223,10 @@ void Spell::TriggerGlobalCooldown()
if (!gcd)
return;
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
+ return;
+
// Global cooldown can't leave range 1..1.5 secs
// There are some spells (mostly not casted directly by player) that have < 1 sec and > 1.5 sec global cooldowns
// but as tests show are not affected by any spell mods.
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 1376b0fbd40..a892d6c9590 100755..100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -69,14 +69,14 @@ enum SpellCastFlags
CAST_FLAG_UNKNOWN_29 = 0x10000000,
CAST_FLAG_UNKNOWN_30 = 0x20000000,
CAST_FLAG_UNKNOWN_31 = 0x40000000,
- CAST_FLAG_UNKNOWN_32 = 0x80000000,
+ CAST_FLAG_UNKNOWN_32 = 0x80000000
};
enum SpellRangeFlag
{
SPELL_RANGE_DEFAULT = 0,
SPELL_RANGE_MELEE = 1, //melee
- SPELL_RANGE_RANGED = 2, //hunter range and ranged weapon
+ SPELL_RANGE_RANGED = 2 //hunter range and ranged weapon
};
struct SpellDestination
@@ -154,8 +154,8 @@ class SpellCastTargets
void SetSpeed(float speed) { m_speed = speed; }
float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); }
- float GetSpeedXY() const { return m_speed * cos(m_elevation); }
- float GetSpeedZ() const { return m_speed * sin(m_elevation); }
+ float GetSpeedXY() const { return m_speed * std::cos(m_elevation); }
+ float GetSpeedZ() const { return m_speed * std::sin(m_elevation); }
void Update(Unit* caster);
void OutDebug() const;
@@ -203,7 +203,7 @@ enum SpellEffectHandleMode
SPELL_EFFECT_HANDLE_LAUNCH,
SPELL_EFFECT_HANDLE_LAUNCH_TARGET,
SPELL_EFFECT_HANDLE_HIT,
- SPELL_EFFECT_HANDLE_HIT_TARGET,
+ SPELL_EFFECT_HANDLE_HIT_TARGET
};
class Spell
@@ -423,7 +423,7 @@ class Spell
void ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier);
void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount);
void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId);
- void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 itemslot, uint32 damage);
+ void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot);
void ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj);
void ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry);
void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry);
@@ -616,7 +616,6 @@ class Spell
// spell execution log
void InitEffectExecuteData(uint8 effIndex);
- void CleanupEffectExecuteData();
void CheckEffectExecuteData();
// Scripting system
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index dd674672935..a642d40c24d 100755..100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -63,6 +63,7 @@
#include "GameObjectAI.h"
#include "AccountMgr.h"
#include "InstanceScript.h"
+#include "ReputationMgr.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -277,6 +278,10 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/)
if (!unitTarget || !unitTarget->isAlive())
return;
+ if (unitTarget->GetTypeId() == TYPEID_PLAYER)
+ if (unitTarget->ToPlayer()->GetCommandStatus(CHEAT_GOD))
+ return;
+
if (m_caster == unitTarget) // prevent interrupt message
finish();
@@ -312,10 +317,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
return;
- bool apply_direct_bonus = true;
-
if (unitTarget && unitTarget->isAlive())
{
+ bool apply_direct_bonus = true;
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
@@ -374,13 +378,13 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
// Victory Rush
else if (m_spellInfo->SpellFamilyFlags[1] & 0x100)
- ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
+ ApplyPct(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
// Shockwave
else if (m_spellInfo->Id == 46968)
{
int32 pct = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, 2);
if (pct > 0)
- damage += int32(CalculatePctN(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
+ damage += int32(CalculatePct(m_caster->GetTotalAttackPowerValue(BASE_ATTACK), pct));
break;
}
break;
@@ -431,10 +435,10 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
pdamage = unitTarget->SpellDamageBonusTaken(m_caster, aura->GetSpellInfo(), pdamage, DOT, aura->GetBase()->GetStackAmount());
uint32 pct_dir = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 1));
uint8 baseTotalTicks = uint8(m_caster->CalcSpellDuration(aura->GetSpellInfo()) / aura->GetSpellInfo()->Effects[EFFECT_0].Amplitude);
- damage += int32(CalculatePctU(pdamage * baseTotalTicks, pct_dir));
+ damage += int32(CalculatePct(pdamage * baseTotalTicks, pct_dir));
uint32 pct_dot = m_caster->CalculateSpellDamage(unitTarget, m_spellInfo, (effIndex + 2)) / 3;
- m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePctU(pdamage * baseTotalTicks, pct_dot)));
+ m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(int32(CalculatePct(pdamage * baseTotalTicks, pct_dot)));
apply_direct_bonus = false;
// Glyph of Conflagrate
@@ -463,20 +467,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
case SPELLFAMILY_PRIEST:
{
- // Shadow Word: Death - deals damage equal to damage done to caster
- if (m_spellInfo->SpellFamilyFlags[1] & 0x2)
- {
- int32 back_damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
- back_damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, (uint32)back_damage, SPELL_DIRECT_DAMAGE);
- // Pain and Suffering reduces damage
- if (AuraEffect* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0))
- AddPctN(back_damage, -aurEff->GetAmount());
-
- if (back_damage < int32(unitTarget->GetHealth()))
- m_caster->CastCustomSpell(m_caster, 32409, &back_damage, 0, 0, true);
- }
// Improved Mind Blast (Mind Blast in shadow form bonus)
- else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
+ if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
{
Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER);
for (Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i)
@@ -504,7 +496,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
float multiple = ap / 410 + m_spellInfo->Effects[effIndex].DamageMultiplier;
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
damage += int32(energy * multiple);
- damage += int32(CalculatePctN(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
+ damage += int32(CalculatePct(m_caster->ToPlayer()->GetComboPoints() * ap, 7));
}
// Wrath
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
@@ -512,7 +504,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
// Improved Insect Swarm
if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000, 0, 0))
- AddPctN(damage, aurEff->GetAmount());
+ AddPct(damage, aurEff->GetAmount());
}
break;
}
@@ -645,7 +637,7 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
{
uint8 level = m_caster->getLevel();
uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f));
- damage += CalculatePctN(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
+ damage += CalculatePct(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
break;
}
break;
@@ -776,7 +768,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (!spellInfo)
{
- sLog->outError("EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);
return;
}
@@ -1034,7 +1026,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex)
if (!spellInfo)
{
- sLog->outError("Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
return;
}
@@ -1079,7 +1071,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
if (!spellInfo)
{
- sLog->outError("EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
return;
}
@@ -1162,6 +1154,14 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
if (unitTarget->getLevel() > uiMaxSafeLevel)
{
unitTarget->AddAura(60444, unitTarget); //Apply Lost! Aura
+
+ // ALLIANCE from 60323 to 60330 - HORDE from 60328 to 60335
+ uint32 spellId = 60323;
+ if (m_caster->ToPlayer()->GetTeam() == HORDE)
+ spellId += 5;
+
+ spellId += urand(0, 7);
+ m_caster->CastSpell(m_caster, spellId, true);
return;
}
break;
@@ -1188,7 +1188,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
// If not exist data for dest location - return
if (!m_targets.HasDst())
{
- sLog->outError("Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id);
return;
}
@@ -1437,8 +1437,8 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex)
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
if (m_spellInfo->Id == 8129)
{
- int32 maxDamage = int32(CalculatePctN(m_caster->GetMaxPower(powerType), damage * 2));
- damage = int32(CalculatePctN(unitTarget->GetMaxPower(powerType), damage));
+ int32 maxDamage = int32(CalculatePct(m_caster->GetMaxPower(powerType), damage * 2));
+ damage = int32(CalculatePct(unitTarget->GetMaxPower(powerType), damage));
damage = std::min(damage, maxDamage);
}
@@ -1494,7 +1494,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
- AddPctN(addhealth, 25);
+ AddPct(addhealth, 25);
}
// Swiftmend - consumes Regrowth or Rejuvenation
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
@@ -1514,7 +1514,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
if (!targetAura)
{
- sLog->outError("Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
return;
}
@@ -1553,7 +1553,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
for (Unit::AuraEffectList::const_iterator i = Periodic.begin(); i != Periodic.end(); ++i)
{
if (m_caster->GetGUID() == (*i)->GetCasterGUID())
- AddPctN(addhealth, aurEff->GetAmount());
+ AddPct(addhealth, aurEff->GetAmount());
}
}
}
@@ -1733,8 +1733,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
// send info to the client
- if (pItem)
- player->SendNewItem(pItem, num_to_add, true, bgType == 0);
+ player->SendNewItem(pItem, num_to_add, true, bgType == 0);
// we succeeded in creating at least one item, so a levelup is possible
if (bgType == 0)
@@ -1780,7 +1779,7 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex)
{
if (item_id)
{
- if (!player->HasItemCount(item_id, 1))
+ if (!player->HasItemCount(item_id))
return;
// remove reagent
@@ -1878,20 +1877,20 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
case 31930: // Judgements of the Wise
case 63375: // Improved Stormstrike
case 68082: // Glyph of Seal of Command
- damage = int32(CalculatePctN(unitTarget->GetCreateMana(), damage));
+ damage = int32(CalculatePct(unitTarget->GetCreateMana(), damage));
break;
case 48542: // Revitalize
- damage = int32(CalculatePctN(unitTarget->GetMaxPower(power), damage));
+ damage = int32(CalculatePct(unitTarget->GetMaxPower(power), damage));
break;
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
{
if (Player* player = m_caster->ToPlayer())
if (player->HasSkill(SKILL_ENGINEERING))
- AddPctN(damage, 25);
+ AddPct(damage, 25);
break;
}
case 71132: // Glyph of Shadow Word: Pain
- damage = int32(CalculatePctN(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
+ damage = int32(CalculatePct(unitTarget->GetCreateMana(), 1)); // set 1 as value, missing in dbc
break;
default:
break;
@@ -1974,7 +1973,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
if (maxPower == 0)
return;
- uint32 gain = CalculatePctN(maxPower, damage);
+ uint32 gain = CalculatePct(maxPower, damage);
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
}
@@ -1989,8 +1988,8 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
// Players shouldn't be able to loot gameobjects that are currently despawned
if (!gameObjTarget->isSpawned() && !player->isGameMaster())
{
- sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!",
- player->GetName(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!",
+ player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow());
return;
}
// special case, already has GossipHello inside so return and avoid calling twice
@@ -2003,7 +2002,8 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
if (sScriptMgr->OnGossipHello(player, gameObjTarget))
return;
- gameObjTarget->AI()->GossipHello(player);
+ if (gameObjTarget->AI()->GossipHello(player))
+ return;
switch (gameObjTarget->GetGoType())
{
@@ -2088,7 +2088,8 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
bg->EventPlayerClickedOnFlag(player, gameObjTarget);
return;
}
- }else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && gameObjTarget->GetOwner())
+ }
+ else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && gameObjTarget->GetOwner())
{
gameObjTarget->SetLootState(GO_JUST_DEACTIVATED);
return;
@@ -2125,7 +2126,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
if (gameObjTarget)
SendLoot(guid, LOOT_SKINNING);
- else
+ else if (itemTarget)
itemTarget->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED);
// not allow use skill grow at item base open
@@ -2287,7 +2288,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB);
if (!properties)
{
- sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);
return;
}
@@ -2399,13 +2400,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
// randomize position for multiple summons
m_caster->GetRandomPoint(*destTarget, radius, pos);
- summon = m_originalCaster->SummonCreature(entry, *destTarget, summonType, duration);
+ summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration);
if (!summon)
continue;
if (properties->Category == SUMMON_CATEGORY_ALLY)
{
- summon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_originalCaster->GetGUID());
+ summon->SetOwnerGUID(m_originalCaster->GetGUID());
summon->setFaction(m_originalCaster->getFaction());
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
}
@@ -2432,12 +2433,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
return;
// The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
- uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED;
- if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()))
- spell = spellProto->Id;
+ uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue());
+ if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
+ spellId = spellInfo->Id;
// Hard coded enter vehicle spell
- m_originalCaster->CastSpell(summon, spell, true);
+ m_originalCaster->CastSpell(summon, spellId, true);
uint32 faction = properties->Faction;
if (!faction)
@@ -2797,9 +2799,9 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex)
if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && 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(), p_caster->GetSession()->GetAccountId(),
+ p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(),
- item_owner->GetName(), item_owner->GetSession()->GetAccountId());
+ item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
@@ -2848,7 +2850,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
}
if (!add_socket)
{
- sLog->outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.",
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.",
m_spellInfo->Id, SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET);
return;
}
@@ -2862,9 +2864,9 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && 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(), p_caster->GetSession()->GetAccountId(),
+ p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(),
- item_owner->GetName(), item_owner->GetSession()->GetAccountId());
+ item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
@@ -2914,14 +2916,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
case 10: spell_id = 36758; break; // 14%
case 11: spell_id = 36760; break; // 20%
default:
- sLog->outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage);
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
- sLog->outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
return;
}
@@ -2948,14 +2950,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
if (!enchant_id)
{
- sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex);
return;
}
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant)
{
- sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id);
return;
}
@@ -2996,9 +2998,9 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)
if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && 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(), p_caster->GetSession()->GetAccountId(),
+ p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(),
itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(),
- item_owner->GetName(), item_owner->GetSession()->GetAccountId());
+ item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId());
}
// remove old enchanting before applying new if equipped
@@ -3363,7 +3365,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING))
{
if (AuraEffect const* rendAndTear = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 0))
- AddPctN(totalDamagePercentMod, rendAndTear->GetAmount());
+ AddPct(totalDamagePercentMod, rendAndTear->GetAmount());
}
break;
}
@@ -3381,7 +3383,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
{
// Glyph of Plague Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(58657, EFFECT_0))
- AddPctN(totalDamagePercentMod, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, aurEff->GetAmount());
break;
}
// Blood Strike
@@ -3390,13 +3392,13 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(bonusPct, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, bonusPct);
// Glyph of Blood Strike
if (m_caster->GetAuraEffect(59332, EFFECT_0))
if (unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
- AddPctN(totalDamagePercentMod, 20);
+ AddPct(totalDamagePercentMod, 20);
break;
}
// Death Strike
@@ -3405,7 +3407,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
// Glyph of Death Strike
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(59336, EFFECT_0))
if (uint32 runic = std::min<uint32>(m_caster->GetPower(POWER_RUNIC_POWER), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()))
- AddPctN(totalDamagePercentMod, runic);
+ AddPct(totalDamagePercentMod, runic);
break;
}
// Obliterate (12.5% more damage per disease)
@@ -3421,14 +3423,14 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), consumeDiseases) / 2.0f;
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(bonusPct, aurEff->GetAmount());
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
// Blood-Caked Strike - Blood-Caked Blade
if (m_spellInfo->SpellIconID == 1736)
{
- AddPctF(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
+ AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f);
break;
}
// Heart Strike
@@ -3437,9 +3439,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
float bonusPct = m_spellInfo->Effects[EFFECT_2].CalcValue() * unitTarget->GetDiseasesByCaster(m_caster->GetGUID());
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(64736, EFFECT_0))
- AddPctF(bonusPct, aurEff->GetAmount());
+ AddPct(bonusPct, aurEff->GetAmount());
- AddPctF(totalDamagePercentMod, bonusPct);
+ AddPct(totalDamagePercentMod, bonusPct);
break;
}
break;
@@ -3461,7 +3463,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
normalized = true;
break;
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
- ApplyPctN(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
+ ApplyPct(weaponDamagePercentMod, CalculateDamage(j, unitTarget));
break;
default:
break; // not weapon damage effect, just skip
@@ -3584,8 +3586,8 @@ void Spell::EffectInterruptCast(SpellEffIndex effIndex)
{
if (m_originalCaster)
{
- int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false, 1 << effIndex);
- unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), duration/*GetSpellDuration(m_spellInfo)*/);
+ int32 duration = m_spellInfo->GetDuration();
+ unitTarget->ProhibitSpellSchool(curSpellInfo->GetSchoolMask(), unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effIndex));
}
ExecuteLogEffectInterruptCast(effIndex, unitTarget, curSpellInfo->Id);
unitTarget->InterruptSpell(CurrentSpellTypes(i), false);
@@ -3632,36 +3634,10 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
// Wild object not have owner and check clickable by players
map->AddToMap(pGameObj);
- if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
- {
- Player* player = m_caster->ToPlayer();
- Battleground* bg = player->GetBattleground();
-
- switch (pGameObj->GetMapId())
- {
- case 489: //WS
- {
- if (bg && bg->GetTypeID(true) == BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS)
- {
- uint32 team = ALLIANCE;
-
- if (player->GetTeam() == team)
- team = HORDE;
-
- ((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
- }
- break;
- }
- case 566: //EY
- {
- if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS)
- {
- ((BattlegroundEY*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID());
- }
- break;
- }
- }
- }
+ if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP)
+ if (Player* player = m_caster->ToPlayer())
+ if (Battleground* bg = player->GetBattleground())
+ bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeam() == ALLIANCE ? TEAM_HORDE: TEAM_ALLIANCE);
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
@@ -3953,7 +3929,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
const char *gender = "his";
if (m_caster->getGender() > 0)
gender = "her";
- sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName(), gender, gender, urand(1, 10), urand(1, 10));
+ sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName().c_str(), gender, gender, urand(1, 10), urand(1, 10));
m_caster->MonsterTextEmote(buf, 0);
break;
}
@@ -3964,7 +3940,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
const char *gender = "his";
if (m_caster->getGender() > 0)
gender = "her";
- sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName(), gender, urand(1, 6), urand(1, 6));
+ sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName().c_str(), gender, urand(1, 6), urand(1, 6));
m_caster->MonsterTextEmote(buf, 0);
break;
}
@@ -4149,6 +4125,8 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
return;
}
case 59317: // Teleporting
+ {
+
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4160,20 +4138,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->CastSpell(unitTarget, 59314, true);
return;
- // random spell learn instead placeholder
- case 60893: // Northrend Alchemy Research
- case 61177: // Northrend Inscription Research
- case 61288: // Minor Inscription Research
- case 61756: // Northrend Inscription Research (FAST QA VERSION)
- case 64323: // Book of Glyph Mastery
- {
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
- return;
-
- // learn random explicit discovery recipe (if any)
- if (uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, m_caster->ToPlayer()))
- m_caster->ToPlayer()->learnSpell(discoveredSpell, false);
- return;
}
case 62482: // Grab Crate
{
@@ -4207,7 +4171,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 31893: spell_heal = 48084; break;
case 31883: spell_heal = 48085; break;
default:
- sLog->outError("Unknown Lightwell spell caster %u", m_caster->GetEntry());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown Lightwell spell caster %u", m_caster->GetEntry());
return;
}
@@ -4292,17 +4256,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
unitTarget->CastSpell(unitTarget, spellTarget[urand(0, 4)], true);
break;
}
- case 64142: // Upper Deck - Create Foam Sword
- if (unitTarget->GetTypeId() != TYPEID_PLAYER)
- return;
- Player* player = unitTarget->ToPlayer();
- static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0};
- // player can only have one of these items
- for (uint32 const* itr = &itemId[0]; *itr; ++itr)
- if (player->HasItemCount(*itr, 1, true))
- return;
- DoCreateItem(effIndex, itemId[urand(0, 4)]);
- return;
}
break;
}
@@ -4324,7 +4277,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 57774: spellId1 = 20185; break; // Judgement of Light
case 53408: spellId1 = 20186; break; // Judgement of Wisdom
default:
- sLog->outError("Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id);
return;
}
// all seals have aura dummy in 2 effect
@@ -4597,7 +4550,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/)
Player* target = (Player*)m_caster;
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell Effect: Stuck");
- sLog->outDetail("Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", target->GetName(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
+ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", target->GetName().c_str(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
if (target->isInFlight())
return;
@@ -4783,16 +4736,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- Player* player = (Player*)unitTarget;
- uint16 currentDrunk = player->GetDrunkValue();
- uint16 drunkMod = damage * 256;
- if (currentDrunk + drunkMod > 0xFFFF)
+ Player* player = unitTarget->ToPlayer();
+ uint8 currentDrunk = player->GetDrunkValue();
+ uint8 drunkMod = damage;
+ if (currentDrunk + drunkMod > 100)
{
- currentDrunk = 0xFFFF;
- player->CastSpell(player, 67468, false);
+ currentDrunk = 100;
+ if (rand_chance() < 25.0f)
+ player->CastSpell(player, 67468, false); // Drunken Vomit
}
else
currentDrunk += drunkMod;
+
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}
@@ -4958,7 +4913,7 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
return;
uint32 health = target->CountPctFromMaxHealth(damage);
- uint32 mana = CalculatePctN(target->GetMaxPower(POWER_MANA), damage);
+ uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);
ExecuteLogEffectResurrect(effIndex, target);
@@ -5027,25 +4982,17 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
Player* player = unitTarget->ToPlayer();
- int32 rep_change = damage;
-
- uint32 faction_id = m_spellInfo->Effects[effIndex].MiscValue;
+ int32 repChange = damage;
- FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
+ uint32 factionId = m_spellInfo->Effects[effIndex].MiscValue;
+ FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
return;
- if (RepRewardRate const* repData = sObjectMgr->GetRepRewardRate(faction_id))
- {
- rep_change = int32((float)rep_change * repData->spell_rate);
- }
-
- // Bonus from spells that increase reputation gain
- float bonus = rep_change * player->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN) / 100.0f; // 10%
- rep_change += (int32)bonus;
+ repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
- player->GetReputationMgr().ModifyReputation(factionEntry, rep_change);
+ player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
}
void Spell::EffectQuestComplete(SpellEffIndex effIndex)
@@ -5108,7 +5055,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
{
health = m_caster->CountPctFromMaxHealth(damage);
if (m_caster->GetMaxPower(POWER_MANA) > 0)
- mana = CalculatePctN(m_caster->GetMaxPower(POWER_MANA), damage);
+ mana = CalculatePct(m_caster->GetMaxPower(POWER_MANA), damage);
}
Player* player = m_caster->ToPlayer();
@@ -5204,6 +5151,10 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss())
return;
+ // Spells with SPELL_EFFECT_KNOCK_BACK(like Thunderstorm) can't knoback target if target has ROOT/STUN
+ if (unitTarget->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED))
+ return;
+
// Typhoon
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags[1] & 0x01000000)
{
@@ -5421,12 +5372,12 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
if (spellInfo)
{
mana += spellInfo->ManaCost;
- mana += int32(CalculatePctU(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
+ mana += int32(CalculatePct(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
}
totem->ToTotem()->UnSummon();
}
}
- ApplyPctN(mana, damage);
+ ApplyPct(mana, damage);
if (mana)
m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true);
}
@@ -5441,11 +5392,11 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
int32 slot = m_spellInfo->Effects[effIndex].MiscValue;
- // FIXME: some spells effects have value -1/-2
- // Possibly its mean -1 all player equipped items and -2 all items
+ // -1 means all player equipped items and -2 all items
if (slot < 0)
{
unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1));
+ ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, -1, -1);
return;
}
@@ -5454,9 +5405,10 @@ void Spell::EffectDurabilityDamage(SpellEffIndex effIndex)
return;
if (Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
+ {
unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage);
-
- ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, slot, damage);
+ ExecuteLogEffectDurabilityDamage(effIndex, unitTarget, item->GetEntry(), slot);
+ }
}
void Spell::EffectDurabilityDamagePCT(SpellEffIndex effIndex)
@@ -5510,7 +5462,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (!goinfo)
{
- sLog->outErrorDb("Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id);
return;
}
@@ -5614,7 +5566,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
ExecuteLogEffectSummonObject(effIndex, pGameObj);
- sLog->outStaticDebug("AddObject at SpellEfects.cpp EffectTransmitted");
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AddObject at SpellEfects.cpp EffectTransmitted");
//m_caster->AddGameObject(pGameObj);
//m_ObjToDel.push_back(pGameObj);
@@ -6157,7 +6109,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex)
if (!sSoundEntriesStore.LookupEntry(soundid))
{
- sLog->outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
return;
}
@@ -6201,6 +6153,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
case 58730: // Restricted Flight Area
case 58600: // Restricted Flight Area
unitTarget->ToPlayer()->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
+ unitTarget->PlayDirectSound(9417); // Fel Reaver sound
break;
}
@@ -6208,7 +6161,7 @@ void Spell::EffectPlayerNotification(SpellEffIndex effIndex)
if (!sSoundEntriesStore.LookupEntry(soundid))
{
- sLog->outError("EffectPlayerNotification: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "EffectPlayerNotification: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);
return;
}
@@ -6311,51 +6264,38 @@ void Spell::EffectBind(SpellEffIndex effIndex)
Player* player = unitTarget->ToPlayer();
- uint32 area_id;
- WorldLocation loc;
- if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB)
- {
- SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id);
- if (!st)
- {
- sLog->outError("Spell::EffectBind - unknown teleport coordinates for spell ID %u", m_spellInfo->Id);
- return;
- }
+ WorldLocation homeLoc;
+ uint32 areaId = player->GetAreaId();
- loc.m_mapId = st->target_mapId;
- loc.m_positionX = st->target_X;
- loc.m_positionY = st->target_Y;
- loc.m_positionZ = st->target_Z;
- loc.m_orientation = st->target_Orientation;
- area_id = player->GetAreaId();
- }
+ if (m_spellInfo->Effects[effIndex].MiscValue)
+ areaId = m_spellInfo->Effects[effIndex].MiscValue;
+
+ if (m_targets.HasDst())
+ homeLoc.WorldRelocate(*destTarget);
else
{
- player->GetPosition(&loc);
- area_id = player->GetAreaId();
+ player->GetPosition(&homeLoc);
+ homeLoc.m_mapId = player->GetMapId();
}
- player->SetHomebind(loc, area_id);
+ player->SetHomebind(homeLoc, areaId);
// binding
WorldPacket data(SMSG_BINDPOINTUPDATE, (4+4+4+4+4));
- data << float(loc.m_positionX);
- data << float(loc.m_positionY);
- data << float(loc.m_positionZ);
- data << uint32(loc.m_mapId);
- data << uint32(area_id);
+ data << float(homeLoc.GetPositionX());
+ data << float(homeLoc.GetPositionY());
+ data << float(homeLoc.GetPositionZ());
+ data << uint32(homeLoc.GetMapId());
+ data << uint32(areaId);
player->SendDirectMessage(&data);
- sLog->outStaticDebug("New homebind X : %f", loc.m_positionX);
- sLog->outStaticDebug("New homebind Y : %f", loc.m_positionY);
- sLog->outStaticDebug("New homebind Z : %f", loc.m_positionZ);
- sLog->outStaticDebug("New homebind MapId : %u", loc.m_mapId);
- sLog->outStaticDebug("New homebind AreaId : %u", area_id);
+ sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u",
+ homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId);
// zone update
data.Initialize(SMSG_PLAYERBOUND, 8+4);
data << uint64(player->GetGUID());
- data << uint32(area_id);
+ data << uint32(areaId);
player->SendDirectMessage(&data);
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 16584086245..fcfa441455e 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -21,6 +21,8 @@
#include "Spell.h"
#include "DBCStores.h"
#include "ConditionMgr.h"
+#include "Player.h"
+#include "Battleground.h"
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
{
@@ -361,7 +363,7 @@ bool SpellEffectInfo::IsAura() const
bool SpellEffectInfo::IsAura(AuraType aura) const
{
- return IsAura() && ApplyAuraName == aura;
+ return IsAura() && ApplyAuraName == uint32(aura);
}
bool SpellEffectInfo::IsTargetingArea() const
@@ -497,9 +499,14 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
if (!HasRadius())
return 0.0f;
- float radius = RadiusEntry->radiusMax;
- if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
- modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
+ float radius = RadiusEntry->RadiusMin;
+ if (caster)
+ {
+ radius += RadiusEntry->RadiusPerLevel * caster->getLevel();
+ radius = std::min(radius, RadiusEntry->RadiusMax);
+ if (Player* modOwner = caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
+ }
return radius;
}
@@ -1020,7 +1027,7 @@ bool SpellInfo::IsPassiveStackableWithRanks() const
bool SpellInfo::IsMultiSlotAura() const
{
- return IsPassive() || Id == 44413;
+ return IsPassive() || Id == 40075 || Id == 44413; // No other way to make 40075 have more than 1 copy of aura
}
bool SpellInfo::IsDeathPersistent() const
@@ -1127,10 +1134,6 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* aura) const
bool SpellInfo::CanDispelAura(SpellInfo const* aura) const
{
- // These auras (like ressurection sickness) can't be dispelled
- if (aura->Attributes & SPELL_ATTR0_NEGATIVE_1)
- return false;
-
// These spells (like Mass Dispel) can dispell all auras
if (Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
return true;
@@ -1262,7 +1265,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const
shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
if (!shapeInfo)
{
- sLog->outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
return SPELL_CAST_OK;
}
actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells
@@ -2017,7 +2020,7 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
// Else drain all power
if (PowerType < MAX_POWERS)
return caster->GetPower(Powers(PowerType));
- sLog->outError("SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id);
return 0;
}
@@ -2030,23 +2033,23 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
{
// health as power used
case POWER_HEALTH:
- powerCost += int32(CalculatePctU(caster->GetCreateHealth(), ManaCostPercentage));
+ powerCost += int32(CalculatePct(caster->GetCreateHealth(), ManaCostPercentage));
break;
case POWER_MANA:
- powerCost += int32(CalculatePctU(caster->GetCreateMana(), ManaCostPercentage));
+ powerCost += int32(CalculatePct(caster->GetCreateMana(), ManaCostPercentage));
break;
case POWER_RAGE:
case POWER_FOCUS:
case POWER_ENERGY:
case POWER_HAPPINESS:
- powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
+ powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
break;
case POWER_RUNE:
case POWER_RUNIC_POWER:
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Not implemented yet!");
break;
default:
- sLog->outError("CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id);
return 0;
}
}
@@ -2205,14 +2208,15 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELLFAMILY_GENERIC:
switch (Id)
{
+ case 29214: // Wrath of the Plaguebringer
case 34700: // Allergic Reaction
+ case 54836: // Wrath of the Plaguebringer
case 61987: // Avenging Wrath Marker
case 61988: // Divine Shield exclude aura
- case 62532: // Conservator's Grip
return false;
+ case 30877: // Tag Murloc
case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny
- case 30877: // Tag Murloc
case 62344: // Fists of Stone
return true;
default:
@@ -2298,6 +2302,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELL_EFFECT_HEAL_PCT:
case SPELL_EFFECT_ENERGIZE_PCT:
return true;
+ case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
+ return false;
// non-positive aura use
case SPELL_EFFECT_APPLY_AURA:
@@ -2339,7 +2345,7 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
continue;
// if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs
- if (_IsPositiveTarget(spellTriggeredProto->Effects[i].TargetA.GetTarget(), spellTriggeredProto->Effects[effIndex].TargetB.GetTarget()) && !spellTriggeredProto->_IsPositiveEffect(i, true))
+ if (_IsPositiveTarget(spellTriggeredProto->Effects[i].TargetA.GetTarget(), spellTriggeredProto->Effects[i].TargetB.GetTarget()) && !spellTriggeredProto->_IsPositiveEffect(i, true))
return false;
}
}
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 54430cd7116..2d53c7d8ace 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -67,7 +67,7 @@ enum SpellCastTargetFlags
| TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_DEAD | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER,
TARGET_FLAG_GAMEOBJECT_MASK = TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM,
TARGET_FLAG_CORPSE_MASK = TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY,
- TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM,
+ TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM
};
enum SpellTargetSelectionCategories
@@ -77,7 +77,7 @@ enum SpellTargetSelectionCategories
TARGET_SELECT_CATEGORY_CHANNEL,
TARGET_SELECT_CATEGORY_NEARBY,
TARGET_SELECT_CATEGORY_CONE,
- TARGET_SELECT_CATEGORY_AREA,
+ TARGET_SELECT_CATEGORY_AREA
};
enum SpellTargetReferenceTypes
@@ -87,7 +87,7 @@ enum SpellTargetReferenceTypes
TARGET_REFERENCE_TYPE_TARGET,
TARGET_REFERENCE_TYPE_LAST,
TARGET_REFERENCE_TYPE_SRC,
- TARGET_REFERENCE_TYPE_DEST,
+ TARGET_REFERENCE_TYPE_DEST
};
enum SpellTargetObjectTypes
@@ -103,7 +103,7 @@ enum SpellTargetObjectTypes
TARGET_OBJECT_TYPE_CORPSE,
// only for effect target type
TARGET_OBJECT_TYPE_CORPSE_ENEMY,
- TARGET_OBJECT_TYPE_CORPSE_ALLY,
+ TARGET_OBJECT_TYPE_CORPSE_ALLY
};
enum SpellTargetCheckTypes
@@ -115,7 +115,7 @@ enum SpellTargetCheckTypes
TARGET_CHECK_PARTY,
TARGET_CHECK_RAID,
TARGET_CHECK_RAID_CLASS,
- TARGET_CHECK_PASSENGER,
+ TARGET_CHECK_PASSENGER
};
enum SpellTargetDirectionTypes
@@ -130,14 +130,14 @@ enum SpellTargetDirectionTypes
TARGET_DIR_BACK_LEFT,
TARGET_DIR_FRONT_LEFT,
TARGET_DIR_RANDOM,
- TARGET_DIR_ENTRY,
+ TARGET_DIR_ENTRY
};
enum SpellEffectImplicitTargetTypes
{
EFFECT_IMPLICIT_TARGET_NONE = 0,
EFFECT_IMPLICIT_TARGET_EXPLICIT,
- EFFECT_IMPLICIT_TARGET_CASTER,
+ EFFECT_IMPLICIT_TARGET_CASTER
};
// Spell clasification
@@ -165,7 +165,7 @@ enum SpellSpecificType
SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25,
SPELL_SPECIFIC_WARRIOR_ENRAGE = 26,
SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27,
- SPELL_SPECIFIC_HAND = 28,
+ SPELL_SPECIFIC_HAND = 28
};
enum SpellCustomAttributes
@@ -187,7 +187,7 @@ enum SpellCustomAttributes
SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000,
SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000,
- SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
+ SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2
};
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType);
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index d40c08f1c4c..3eefd969eed 100755..100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -30,6 +30,9 @@
#include "CreatureAI.h"
#include "MapManager.h"
#include "BattlegroundIC.h"
+#include "BattlefieldWG.h"
+#include "BattlefieldMgr.h"
+#include "Player.h"
bool IsPrimaryProfessionSkill(uint32 skill)
{
@@ -72,9 +75,15 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto,
// Pet charge effects (Infernal Awakening, Demon Charge)
if (spellproto->SpellVisual[0] == 2816 && spellproto->SpellIconID == 15)
return DIMINISHING_CONTROLLED_STUN;
+ // Frost Tomb
+ else if (spellproto->Id == 48400)
+ return DIMINISHING_NONE;
// Gnaw
else if (spellproto->Id == 47481)
return DIMINISHING_CONTROLLED_STUN;
+ // ToC Icehowl Arctic Breath
+ else if (spellproto->SpellVisual[0] == 14153)
+ return DIMINISHING_NONE;
break;
}
// Event spells
@@ -368,9 +377,9 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (msg)
{
if (player)
- ChatHandler(player).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
+ ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
else
- sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
+ sLog->outError(LOG_FILTER_SQL, "Craft spell %u not have create item entry.", spellInfo->Id);
}
return false;
}
@@ -382,9 +391,9 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (msg)
{
if (player)
- ChatHandler(player).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
else
- sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
+ sLog->outError(LOG_FILTER_SQL, "Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
}
return false;
}
@@ -400,9 +409,9 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (msg)
{
if (player)
- ChatHandler(player).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ ChatHandler(player->GetSession()).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
else
- sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
}
return false;
}
@@ -420,9 +429,9 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
if (msg)
{
if (player)
- ChatHandler(player).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
+ ChatHandler(player->GetSession()).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
else
- sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
+ sLog->outError(LOG_FILTER_SQL, "Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
}
return false;
}
@@ -454,7 +463,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
uint32 mode = uint32(caster->GetMap()->GetSpawnMode());
if (mode >= MAX_DIFFICULTY)
{
- sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId);
return spellId; //return source spell
}
@@ -477,7 +486,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con
if (difficultyEntry->SpellID[mode] <= 0)
{
- sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
+ sLog->outError(LOG_FILTER_SQL, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode);
return spellId;
}
@@ -640,7 +649,7 @@ SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id)
return SpellSpellGroupMapBounds(mSpellSpellGroup.lower_bound(spell_id), mSpellSpellGroup.upper_bound(spell_id));
}
-uint32 SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
+bool SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
{
SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid);
for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr)
@@ -1056,12 +1065,9 @@ SpellAreaMapBounds SpellMgr::GetSpellAreaMapBounds(uint32 spell_id) const
return SpellAreaMapBounds(mSpellAreaMap.lower_bound(spell_id), mSpellAreaMap.upper_bound(spell_id));
}
-SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const
+SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestMapBounds(uint32 quest_id) const
{
- if (active)
- return SpellAreaForQuestMapBounds(mSpellAreaForActiveQuestMap.lower_bound(quest_id), mSpellAreaForActiveQuestMap.upper_bound(quest_id));
- else
- return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id), mSpellAreaForQuestMap.upper_bound(quest_id));
+ return SpellAreaForQuestMapBounds(mSpellAreaForQuestMap.lower_bound(quest_id), mSpellAreaForQuestMap.upper_bound(quest_id));
}
SpellAreaForQuestMapBounds SpellMgr::GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const
@@ -1094,11 +1100,11 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
if (questStart) // not in expected required quest state
- if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
+ if (!player || (((1 << player->GetQuestStatus(questStart)) & questStartStatus) == 0))
return false;
if (questEnd) // not in expected forbidden quest state
- if (!player || player->GetQuestRewardStatus(questEnd))
+ if (!player || (((1 << player->GetQuestStatus(questEnd)) & questEndStatus) == 0))
return false;
if (auraSpell) // not have expected aura
@@ -1120,10 +1126,20 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
break;
}
+ case 58730: // No fly Zone - Wintergrasp
+ {
+ if (!player)
+ return false;
+
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+ if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
+ return false;
+ break;
+ }
case 68719: // Oil Refinery - Isle of Conquest.
case 68720: // Quarry - Isle of Conquest.
{
- if (player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
+ if (!player || player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground())
return false;
uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
@@ -1135,6 +1151,46 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
}
+ case 56618: // Horde Controls Factory Phase Shift
+ case 56617: // Alliance Controls Factory Phase Shift
+ {
+ if (!player)
+ return false;
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+
+ if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
+ return false;
+
+ // team that controls the workshop in the specified area
+ uint32 team = bf->GetData(newArea);
+
+ if (team == TEAM_HORDE)
+ return spellId == 56618;
+ else if (team == TEAM_ALLIANCE)
+ return spellId == 56617;
+ }
+ break;
+ case 57940: // Essence of Wintergrasp - Northrend
+ case 58045: // Essence of Wintergrasp - Wintergrasp
+ {
+ if (!player)
+ return false;
+
+ if (Battlefield* battlefieldWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ return battlefieldWG->IsEnabled() && (player->GetTeamId() == battlefieldWG->GetDefenderTeam()) && !battlefieldWG->IsWarTime();
+ break;
+ }
+ case 74411: // Battleground - Dampening
+ {
+ if (!player)
+ return false;
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
+ return bf->IsWarTime();
+ break;
+ }
+
}
return true;
@@ -1155,8 +1211,8 @@ void SpellMgr::LoadSpellRanks()
if (!result)
{
- sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
+
return;
}
@@ -1195,13 +1251,13 @@ void SpellMgr::LoadSpellRanks()
SpellInfo const* first = GetSpellInfo(lastSpell);
if (!first)
{
- sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell);
continue;
}
// check if chain is long enough
if (rankChain.size() < 2)
{
- sLog->outErrorDb("There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell);
+ sLog->outError(LOG_FILTER_SQL, "There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell);
continue;
}
int32 curRank = 0;
@@ -1212,14 +1268,14 @@ void SpellMgr::LoadSpellRanks()
SpellInfo const* spell = GetSpellInfo(itr->first);
if (!spell)
{
- sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell);
valid = false;
break;
}
++curRank;
if (itr->second != curRank)
{
- sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank);
valid = false;
break;
}
@@ -1251,8 +1307,8 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
- sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SpellMgr::LoadSpellRequired()
@@ -1267,8 +1323,8 @@ void SpellMgr::LoadSpellRequired()
if (!result)
{
- sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty.");
+
return;
}
@@ -1284,26 +1340,26 @@ void SpellMgr::LoadSpellRequired()
SpellInfo const* spell = GetSpellInfo(spell_id);
if (!spell)
{
- sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
+ sLog->outError(LOG_FILTER_SQL, "spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
continue;
}
SpellInfo const* req_spell = GetSpellInfo(spell_req);
if (!req_spell)
{
- sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
+ sLog->outError(LOG_FILTER_SQL, "req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
continue;
}
if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
{
- sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
+ sLog->outError(LOG_FILTER_SQL, "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
continue;
}
if (IsSpellRequiringSpell(spell_id, spell_req))
{
- sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
+ sLog->outError(LOG_FILTER_SQL, "duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
continue;
}
@@ -1312,8 +1368,8 @@ void SpellMgr::LoadSpellRequired()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SpellMgr::LoadSpellLearnSkills()
@@ -1350,8 +1406,7 @@ void SpellMgr::LoadSpellLearnSkills()
}
}
- sLog->outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLearnSpells()
@@ -1364,8 +1419,7 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
return;
}
@@ -1383,19 +1437,19 @@ void SpellMgr::LoadSpellLearnSpells()
if (!GetSpellInfo(spell_id))
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` does not exist", spell_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` does not exist", spell_id);
continue;
}
if (!GetSpellInfo(node.spell))
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` learning not existed spell %u", spell_id, node.spell);
continue;
}
if (GetTalentSpellCost(node.spell))
{
- sLog->outErrorDb("Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_learn_spell` attempt learning talent spell %u, skipped", spell_id, node.spell);
continue;
}
@@ -1437,7 +1491,7 @@ void SpellMgr::LoadSpellLearnSpells()
{
if (itr->second.spell == dbc_node.spell)
{
- sLog->outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.",
+ sLog->outError(LOG_FILTER_SQL, "Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.",
spell, dbc_node.spell);
found = true;
break;
@@ -1453,8 +1507,7 @@ void SpellMgr::LoadSpellLearnSpells()
}
}
- sLog->outString(">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellTargetPositions()
@@ -1467,8 +1520,7 @@ void SpellMgr::LoadSpellTargetPositions()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
- sLog->outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
return;
}
@@ -1490,20 +1542,20 @@ void SpellMgr::LoadSpellTargetPositions()
MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
if (!mapEntry)
{
- sLog->outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId);
continue;
}
if (st.target_X==0 && st.target_Y==0 && st.target_Z==0)
{
- sLog->outErrorDb("Spell (ID:%u) target coordinates not provided.", Spell_ID);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target coordinates not provided.", Spell_ID);
continue;
}
SpellInfo const* spellInfo = GetSpellInfo(Spell_ID);
if (!spellInfo)
{
- sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
+ sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID);
continue;
}
@@ -1518,7 +1570,7 @@ void SpellMgr::LoadSpellTargetPositions()
uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z);
if (area_id != uint32(spellInfo->Effects[i].MiscValue))
{
- sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id);
+ sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id);
break;
}
}
@@ -1529,7 +1581,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
if (!found)
{
- sLog->outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID);
+ sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID);
continue;
}
@@ -1573,8 +1625,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
}*/
- sLog->outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroups()
@@ -1588,8 +1639,7 @@ void SpellMgr::LoadSpellGroups()
QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
if (!result)
{
- sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
return;
}
@@ -1602,7 +1652,7 @@ void SpellMgr::LoadSpellGroups()
uint32 group_id = fields[0].GetUInt32();
if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX)
{
- sLog->outErrorDb("SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id);
+ sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` is in core range, but is not defined in core!", group_id);
continue;
}
int32 spell_id = fields[1].GetInt32();
@@ -1618,7 +1668,7 @@ void SpellMgr::LoadSpellGroups()
{
if (groups.find(abs(itr->second)) == groups.end())
{
- sLog->outErrorDb("SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second));
+ sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group` does not exist", abs(itr->second));
mSpellGroupSpell.erase(itr++);
}
else
@@ -1630,12 +1680,12 @@ void SpellMgr::LoadSpellGroups()
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_group` does not exist", itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_group` does not exist", itr->second);
mSpellGroupSpell.erase(itr++);
}
else if (spellInfo->GetRank() > 1)
{
- sLog->outErrorDb("Spell %u listed in `spell_group` is not first rank of spell", itr->second);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_group` is not first rank of spell", itr->second);
mSpellGroupSpell.erase(itr++);
}
else
@@ -1655,8 +1705,7 @@ void SpellMgr::LoadSpellGroups()
}
}
- sLog->outString(">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroupStackRules()
@@ -1669,8 +1718,7 @@ void SpellMgr::LoadSpellGroupStackRules()
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
- sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
return;
}
@@ -1683,7 +1731,7 @@ void SpellMgr::LoadSpellGroupStackRules()
uint8 stack_rule = fields[1].GetInt8();
if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX)
{
- sLog->outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule);
+ sLog->outError(LOG_FILTER_SQL, "SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule);
continue;
}
@@ -1691,7 +1739,7 @@ void SpellMgr::LoadSpellGroupStackRules()
if (spellGroup.first == spellGroup.second)
{
- sLog->outErrorDb("SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id);
+ sLog->outError(LOG_FILTER_SQL, "SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id);
continue;
}
@@ -1700,8 +1748,7 @@ void SpellMgr::LoadSpellGroupStackRules()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellProcEvents()
@@ -1714,8 +1761,7 @@ void SpellMgr::LoadSpellProcEvents()
QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
return;
}
@@ -1730,7 +1776,7 @@ void SpellMgr::LoadSpellProcEvents()
SpellInfo const* spell = GetSpellInfo(entry);
if (!spell)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` does not exist", entry);
continue;
}
@@ -1753,7 +1799,7 @@ void SpellMgr::LoadSpellProcEvents()
{
if (spe.procFlags == 0)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
continue;
}
customProc++;
@@ -1762,10 +1808,10 @@ void SpellMgr::LoadSpellProcEvents()
} while (result->NextRow());
if (customProc)
- sLog->outString(">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void SpellMgr::LoadSpellProcs()
@@ -1778,8 +1824,7 @@ void SpellMgr::LoadSpellProcs()
QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
if (!result)
{
- sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
return;
}
@@ -1800,7 +1845,7 @@ void SpellMgr::LoadSpellProcs()
SpellInfo const* spellEntry = GetSpellInfo(spellId);
if (!spellEntry)
{
- sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` does not exist", spellId);
continue;
}
@@ -1808,7 +1853,7 @@ void SpellMgr::LoadSpellProcs()
{
if (GetFirstSpellInChain(spellId) != uint32(spellId))
{
- sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32());
continue;
}
}
@@ -1835,7 +1880,7 @@ void SpellMgr::LoadSpellProcs()
{
if (mSpellProcMap.find(spellId) != mSpellProcMap.end())
{
- sLog->outErrorDb("Spell %u listed in `spell_proc` has duplicate entry in the table", spellId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_proc` has duplicate entry in the table", spellId);
break;
}
SpellProcEntry procEntry = SpellProcEntry(baseProcEntry);
@@ -1850,47 +1895,47 @@ void SpellMgr::LoadSpellProcs()
// validate data
if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask);
if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName);
if (procEntry.chance < 0)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId);
procEntry.chance = 0;
}
if (procEntry.ratePerMinute < 0)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId);
procEntry.ratePerMinute = 0;
}
if (cooldown < 0)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId);
procEntry.cooldown = 0;
}
if (procEntry.chance == 0 && procEntry.ratePerMinute == 0)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId);
if (procEntry.charges > 99)
{
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId);
procEntry.charges = 99;
}
if (!procEntry.typeMask)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId);
if (procEntry.spellTypeMask & ~PROC_SPELL_PHASE_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask);
if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK)))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId);
if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId);
if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask);
if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId);
if (procEntry.hitMask & ~PROC_HIT_MASK_ALL)
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask);
if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH)))))
- sLog->outErrorDb("`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId);
+ sLog->outError(LOG_FILTER_SQL, "`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId);
mSpellProcMap[spellId] = procEntry;
@@ -1905,8 +1950,7 @@ void SpellMgr::LoadSpellProcs()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellBonusess()
@@ -1919,8 +1963,7 @@ void SpellMgr::LoadSpellBonusess()
QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if (!result)
{
- sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
return;
}
@@ -1933,7 +1976,7 @@ void SpellMgr::LoadSpellBonusess()
SpellInfo const* spell = GetSpellInfo(entry);
if (!spell)
{
- sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_bonus_data` does not exist", entry);
continue;
}
@@ -1946,8 +1989,7 @@ void SpellMgr::LoadSpellBonusess()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellThreats()
@@ -1960,8 +2002,7 @@ void SpellMgr::LoadSpellThreats()
QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
if (!result)
{
- sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
return;
}
@@ -1974,7 +2015,7 @@ void SpellMgr::LoadSpellThreats()
if (!GetSpellInfo(entry))
{
- sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_threat` does not exist", entry);
continue;
}
@@ -1987,8 +2028,7 @@ void SpellMgr::LoadSpellThreats()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSkillLineAbilityMap()
@@ -2009,8 +2049,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
++count;
}
- sLog->outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellPetAuras()
@@ -2023,8 +2062,7 @@ void SpellMgr::LoadSpellPetAuras()
QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
if (!result)
{
- sLog->outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
return;
}
@@ -2046,21 +2084,21 @@ void SpellMgr::LoadSpellPetAuras()
SpellInfo const* spellInfo = GetSpellInfo(spell);
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_pet_auras` does not exist", spell);
continue;
}
if (spellInfo->Effects[eff].Effect != SPELL_EFFECT_DUMMY &&
(spellInfo->Effects[eff].Effect != SPELL_EFFECT_APPLY_AURA ||
spellInfo->Effects[eff].ApplyAuraName != SPELL_AURA_DUMMY))
{
- sLog->outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
continue;
}
SpellInfo const* spellInfo2 = GetSpellInfo(aura);
if (!spellInfo2)
{
- sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura);
+ sLog->outError(LOG_FILTER_SQL, "Aura %u listed in `spell_pet_auras` does not exist", aura);
continue;
}
@@ -2071,8 +2109,7 @@ void SpellMgr::LoadSpellPetAuras()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Fill custom data about enchancments
@@ -2112,8 +2149,7 @@ void SpellMgr::LoadEnchantCustomAttr()
}
}
- sLog->outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellEnchantProcData()
@@ -2126,8 +2162,7 @@ void SpellMgr::LoadSpellEnchantProcData()
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
return;
}
@@ -2141,7 +2176,7 @@ void SpellMgr::LoadSpellEnchantProcData()
SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
if (!ench)
{
- sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
+ sLog->outError(LOG_FILTER_SQL, "Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
continue;
}
@@ -2156,8 +2191,7 @@ void SpellMgr::LoadSpellEnchantProcData()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLinked()
@@ -2170,8 +2204,7 @@ void SpellMgr::LoadSpellLinked()
QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
return;
}
@@ -2187,13 +2220,13 @@ void SpellMgr::LoadSpellLinked()
SpellInfo const* spellInfo = GetSpellInfo(abs(trigger));
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger));
continue;
}
spellInfo = GetSpellInfo(abs(effect));
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_linked_spell` does not exist", abs(effect));
continue;
}
@@ -2209,8 +2242,7 @@ void SpellMgr::LoadSpellLinked()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadPetLevelupSpellMap()
@@ -2266,8 +2298,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
}
}
- sLog->outString(">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
}
bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells)
@@ -2351,10 +2382,9 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outString(">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString("Loading summonable creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates...");
oldMSTime = getMSTime();
// different summon spells
@@ -2395,8 +2425,7 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outString(">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellAreas()
@@ -2405,17 +2434,15 @@ void SpellMgr::LoadSpellAreas()
mSpellAreaMap.clear(); // need for reload case
mSpellAreaForQuestMap.clear();
- mSpellAreaForActiveQuestMap.clear();
mSpellAreaForQuestEndMap.clear();
mSpellAreaForAuraMap.clear();
- // 0 1 2 3 4 5 6 7 8
- QueryResult result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
-
+ // 0 1 2 3 4 5 6 7 8 9
+ QueryResult result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_status, quest_end_status, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
if (!result)
{
- sLog->outString(">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
+
return;
}
@@ -2429,12 +2456,13 @@ void SpellMgr::LoadSpellAreas()
spellArea.spellId = spell;
spellArea.areaId = fields[1].GetUInt32();
spellArea.questStart = fields[2].GetUInt32();
- spellArea.questStartCanActive = fields[3].GetBool();
- spellArea.questEnd = fields[4].GetUInt32();
- spellArea.auraSpell = fields[5].GetInt32();
- spellArea.raceMask = fields[6].GetUInt32();
- spellArea.gender = Gender(fields[7].GetUInt8());
- spellArea.autocast = fields[8].GetBool();
+ spellArea.questStartStatus = fields[3].GetUInt32();
+ spellArea.questEndStatus = fields[4].GetUInt32();
+ spellArea.questEnd = fields[5].GetUInt32();
+ spellArea.auraSpell = fields[6].GetInt32();
+ spellArea.raceMask = fields[7].GetUInt32();
+ spellArea.gender = Gender(fields[8].GetUInt8());
+ spellArea.autocast = fields[9].GetBool();
if (SpellInfo const* spellInfo = GetSpellInfo(spell))
{
@@ -2443,7 +2471,7 @@ void SpellMgr::LoadSpellAreas()
}
else
{
- sLog->outErrorDb("Spell %u listed in `spell_area` does not exist", spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` does not exist", spell);
continue;
}
@@ -2466,26 +2494,26 @@ void SpellMgr::LoadSpellAreas()
continue;
// duplicate by requirements
- ok =false;
+ ok = false;
break;
}
if (!ok)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` already listed with similar requirements.", spell);
continue;
}
}
if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId))
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId);
continue;
}
if (spellArea.questStart && !sObjectMgr->GetQuestTemplate(spellArea.questStart))
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart);
continue;
}
@@ -2493,13 +2521,7 @@ void SpellMgr::LoadSpellAreas()
{
if (!sObjectMgr->GetQuestTemplate(spellArea.questEnd))
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd);
- continue;
- }
-
- if (spellArea.questEnd == spellArea.questStart && !spellArea.questStartCanActive)
- {
- sLog->outErrorDb("Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell, spellArea.questEnd);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd);
continue;
}
}
@@ -2509,13 +2531,13 @@ void SpellMgr::LoadSpellAreas()
SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell));
if (!spellInfo)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell));
continue;
}
if (uint32(abs(spellArea.auraSpell)) == spellArea.spellId)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell));
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell));
continue;
}
@@ -2535,7 +2557,7 @@ void SpellMgr::LoadSpellAreas()
if (chain)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
continue;
}
@@ -2551,7 +2573,7 @@ void SpellMgr::LoadSpellAreas()
if (chain)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell);
continue;
}
}
@@ -2559,13 +2581,13 @@ void SpellMgr::LoadSpellAreas()
if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask);
continue;
}
if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE)
{
- sLog->outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender);
+ sLog->outError(LOG_FILTER_SQL, "Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender);
continue;
}
@@ -2577,12 +2599,7 @@ void SpellMgr::LoadSpellAreas()
// for search at quest start/reward
if (spellArea.questStart)
- {
- if (spellArea.questStartCanActive)
- mSpellAreaForActiveQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart, sa));
- else
- mSpellAreaForQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart, sa));
- }
+ mSpellAreaForQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart, sa));
// for search at quest start/reward
if (spellArea.questEnd)
@@ -2595,8 +2612,7 @@ void SpellMgr::LoadSpellAreas()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellInfoStore()
@@ -2612,8 +2628,7 @@ void SpellMgr::LoadSpellInfoStore()
mSpellInfoMap[i] = new SpellInfo(spellEntry);
}
- sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::UnloadSpellInfoStore()
@@ -2749,6 +2764,10 @@ void SpellMgr::LoadSpellCustomAttr()
switch (spellInfo->Id)
{
+ case 60256:
+ //Crashes client on pressing ESC (Maybe because of ReqSpellFocus and GameObject)
+ spellInfo->AttributesEx4 &= ~SPELL_ATTR4_TRIGGERED;
+ break;
case 1776: // Gouge
case 1777:
case 8629:
@@ -2925,8 +2944,7 @@ void SpellMgr::LoadSpellCustomAttr()
CreatureAI::FillAISpellInfo();
- sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadDbcDataCorrections()
@@ -2960,6 +2978,19 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->Id)
{
+ case 53096: // Quetz'lun's Judgment
+ spellInfo->MaxAffectedTargets = 1;
+ break;
+ case 42730:
+ spellInfo->EffectTriggerSpell[EFFECT_1] = 42739;
+ break;
+ case 59735:
+ spellInfo->EffectTriggerSpell[EFFECT_1] = 59736;
+ break;
+ case 52611: // Summon Skeletons
+ case 52612: // Summon Skeletons
+ spellInfo->EffectMiscValueB[0] = 64;
+ break;
case 40244: // Simon Game Visual
case 40245: // Simon Game Visual
case 40246: // Simon Game Visual
@@ -3241,9 +3272,21 @@ void SpellMgr::LoadDbcDataCorrections()
// this needs research on modifier applying rules, does not seem to be in Attributes fields
spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000);
break;
- case 63163: // Apply Enchanted Bridle (Argent Tournament)
- spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1
- spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0)
+ case 64949: // Idol of the Flourishing Life
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x00000000, 0x02000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 34231: // Libram of the Lightbringer
+ case 60792: // Libram of Tolerance
+ case 64956: // Libram of the Resolute
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x80000000, 0x00000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
+ break;
+ case 28851: // Libram of Light
+ case 28853: // Libram of Divinity
+ case 32403: // Blessed Book of Nagrand
+ spellInfo->EffectSpellClassMask[EFFECT_0] = flag96(0x40000000, 0x00000000, 0x00000000);
+ spellInfo->EffectApplyAuraName[EFFECT_0] = SPELL_AURA_ADD_FLAT_MODIFIER;
break;
case 45602: // Ride Carpet
spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)"
@@ -3272,6 +3315,13 @@ void SpellMgr::LoadDbcDataCorrections()
case 70650: // Death Knight T10 Tank 2P Bonus
spellInfo->EffectApplyAuraName[0] = SPELL_AURA_ADD_PCT_MODIFIER;
break;
+ case 71838: // Drain Life - Bryntroll Normal
+ case 71839: // Drain Life - Bryntroll Heroic
+ spellInfo->AttributesEx2 |= SPELL_ATTR2_CANT_CRIT;
+ break;
+ case 34471: // The Beast Within
+ spellInfo->AttributesEx5 |= SPELL_ATTR5_USABLE_WHILE_CONFUSED | SPELL_ATTR5_USABLE_WHILE_FEARED | SPELL_ATTR5_USABLE_WHILE_STUNNED;
+ break;
// ULDUAR SPELLS
//
case 62374: // Pursued (Flame Leviathan)
@@ -3351,7 +3401,7 @@ void SpellMgr::LoadDbcDataCorrections()
break;
case 69055: // Saber Lash (Lord Marrowgar)
case 70814: // Saber Lash (Lord Marrowgar)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_5_YARDS; // 5yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_5_YARDS; // 5yd
break;
case 69075: // Bone Storm (Lord Marrowgar)
case 70834: // Bone Storm (Lord Marrowgar)
@@ -3361,7 +3411,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 71160: // Plague Stench (Stinky)
case 71161: // Plague Stench (Stinky)
case 71123: // Decimate (Stinky & Precious)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd
break;
case 72378: // Blood Nova (Deathbringer Saurfang)
case 73058: // Blood Nova (Deathbringer Saurfang)
@@ -3379,7 +3429,7 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->Effect[2] = 0;
break;
case 70460: // Coldflame Jets (Traps after Saurfang)
- spellInfo->DurationIndex = 1; // 10 seconds
+ spellInfo->DurationIndex = 1; // 10 seconds
break;
case 71412: // Green Ooze Summon (Professor Putricide)
case 71415: // Orange Ooze Summon (Professor Putricide)
@@ -3388,6 +3438,9 @@ void SpellMgr::LoadDbcDataCorrections()
case 71159: // Awaken Plagued Zombies
spellInfo->DurationIndex = 21;
break;
+ case 70530: // Volatile Ooze Beam Protection (Professor Putricide)
+ spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA; // for an unknown reason this was SPELL_EFFECT_APPLY_AREA_AURA_RAID
+ break;
// THIS IS HERE BECAUSE COOLDOWN ON CREATURE PROCS IS NOT IMPLEMENTED
case 71604: // Mutated Strength (Professor Putricide)
case 72673: // Mutated Strength (Professor Putricide)
@@ -3399,7 +3452,7 @@ void SpellMgr::LoadDbcDataCorrections()
case 72464: // Mutated Plague (Professor Putricide)
case 72506: // Mutated Plague (Professor Putricide)
case 72507: // Mutated Plague (Professor Putricide)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 70911: // Unbound Plague (Professor Putricide) (needs target selection script)
case 72854: // Unbound Plague (Professor Putricide) (needs target selection script)
@@ -3410,7 +3463,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_50000_YARDS; // another missing radius
break;
case 71708: // Empowered Flare (Blood Prince Council)
case 72785: // Empowered Flare (Blood Prince Council)
@@ -3432,6 +3485,10 @@ void SpellMgr::LoadDbcDataCorrections()
case 71085: // Mana Void (periodic aura)
spellInfo->DurationIndex = 9; // 30 seconds (missing)
break;
+ case 72015: // Frostbolt Volley (only heroic)
+ case 72016: // Frostbolt Volley (only heroic)
+ spellInfo->EffectRadiusIndex[2] = EFFECT_RADIUS_40_YARDS;
+ break;
case 70936: // Summon Suppressor (needs target selection script)
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_TARGET_ANY;
spellInfo->EffectImplicitTargetB[0] = 0;
@@ -3459,62 +3516,62 @@ void SpellMgr::LoadDbcDataCorrections()
case 73708: // Defile
case 73709: // Defile
case 73710: // Defile
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
- spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 69030: // Val'kyr Target Search
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
- spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 69198: // Raging Spirit Visual
- spellInfo->rangeIndex = 13; // 50000yd
+ spellInfo->rangeIndex = 13; // 50000yd
break;
case 73654: // Harvest Souls
case 74295: // Harvest Souls
case 74296: // Harvest Souls
case 74297: // Harvest Souls
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
- spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd
- spellInfo->EffectRadiusIndex[2] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[2] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 73655: // Harvest Soul
spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS;
break;
case 73540: // Summon Shadow Trap
- spellInfo->DurationIndex = 23; // 90 seconds
+ spellInfo->DurationIndex = 23; // 90 seconds
break;
case 73530: // Shadow Trap (visual)
- spellInfo->DurationIndex = 28; // 5 seconds
+ spellInfo->DurationIndex = 28; // 5 seconds
break;
case 73529: // Shadow Trap
- spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_10_YARDS; // 10yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_10_YARDS; // 10yd
break;
case 74282: // Shadow Trap (searcher)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_3_YARDS; // 3yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_3_YARDS; // 3yd
break;
case 72595: // Restore Soul
case 73650: // Restore Soul
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 74086: // Destroy Soul
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
break;
case 74302: // Summon Spirit Bomb
case 74342: // Summon Spirit Bomb
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
spellInfo->MaxAffectedTargets = 1;
break;
case 74341: // Summon Spirit Bomb
case 74343: // Summon Spirit Bomb
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_200_YARDS; // 200yd
spellInfo->MaxAffectedTargets = 3;
break;
case 73579: // Summon Spirit Bomb
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_25_YARDS; // 25yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_25_YARDS; // 25yd
break;
case 72350: // Fury of Frostmourne
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
- spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 75127: // Kill Frostmourne Players
case 72351: // Fury of Frostmourne
@@ -3522,19 +3579,39 @@ void SpellMgr::LoadDbcDataCorrections()
case 72429: // Mass Resurrection
case 73159: // Play Movie
case 73582: // Trigger Vile Spirit (Inside, Heroic)
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 72376: // Raise Dead
spellInfo->MaxAffectedTargets = 3;
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_50000_YARDS; // 50000yd
break;
case 71809: // Jump
- spellInfo->rangeIndex = 3; // 20yd
- spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_25_YARDS; // 25yd
+ spellInfo->rangeIndex = 3; // 20yd
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_25_YARDS; // 25yd
break;
case 72405: // Broken Frostmourne
- spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
+ spellInfo->EffectRadiusIndex[1] = EFFECT_RADIUS_200_YARDS; // 200yd
+ break;
+ // ENDOF ICECROWN CITADEL SPELLS
+ //
+ // RUBY SANCTUM SPELLS
+ //
+ case 74769: // Twilight Cutter
+ case 77844: // Twilight Cutter
+ case 77845: // Twilight Cutter
+ case 77846: // Twilight Cutter
+ spellInfo->EffectRadiusIndex[0] = EFFECT_RADIUS_100_YARDS; // 100yd
+ break;
+ case 75509: // Twilight Mending
+ spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE;
+ spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS;
break;
+ case 75888: // Awaken Flames
+ case 75889: // Awaken Flames
+ spellInfo->AttributesEx |= SPELL_ATTR1_CANT_TARGET_SELF;
+ break;
+ // ENDOF RUBY SANCTUM SPELLS
+ //
case 40055: // Introspection
case 40165: // Introspection
case 40166: // Introspection
@@ -3545,6 +3622,13 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->manaCost = 0;
spellInfo->manaPerSecond = 0;
break;
+ // OCULUS SPELLS
+ // The spells below are here, because their effect 1 is giving warning, because the triggered spell is not found in dbc and is missing from encounter sniff.
+ case 49462: // Call Ruby Drake
+ case 49461: // Call Amber Drake
+ case 49345: // Call Emerald Drake
+ spellInfo->Effect[1] = 0;
+ break;
default:
break;
}
@@ -3569,6 +3653,5 @@ void SpellMgr::LoadDbcDataCorrections()
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
properties->Type = SUMMON_TYPE_TOTEM;
- sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index dcf3c38fe4f..cec9d4650f5 100755..100644
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -38,8 +38,8 @@ enum SpellCategories
SPELLCATEGORY_HEALTH_MANA_POTIONS = 4,
SPELLCATEGORY_DEVOUR_MAGIC = 12,
SPELLCATEGORY_JUDGEMENT = 1210, // Judgement (seal trigger)
- SPELLCATEGORY_FOOD = 11,
- SPELLCATEGORY_DRINK = 59,
+ SPELLCATEGORY_FOOD = 11,
+ SPELLCATEGORY_DRINK = 59
};
//SpellFamilyFlags
@@ -85,7 +85,7 @@ enum SpellFamilyFlag
SPELLFAMILYFLAG_DK_DEATH_COIL = 0x00002000,
// TODO: Figure out a more accurate name for the following familyflag(s)
- SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS = 0x04000000, // Seems to be linked to most totems and some totem effects
+ SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS = 0x04000000 // Seems to be linked to most totems and some totem effects
};
@@ -96,7 +96,7 @@ enum SpellLinkedType
SPELL_LINK_CAST = 0, // +: cast; -: remove
SPELL_LINK_HIT = 1 * 200000,
SPELL_LINK_AURA = 2 * 200000, // +: aura; -: immune
- SPELL_LINK_REMOVE = 0,
+ SPELL_LINK_REMOVE = 0
};
@@ -177,7 +177,7 @@ enum ProcFlags
| PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
| PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_TAKEN_DAMAGE,
- REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK,
+ REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK
};
#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
@@ -261,12 +261,12 @@ enum ProcFlagsHit
PROC_HIT_REFLECT = 0x0000800,
PROC_HIT_INTERRUPT = 0x0001000, // (not used atm)
PROC_HIT_FULL_BLOCK = 0x0002000,
- PROC_HIT_MASK_ALL = 0x2FFF,
+ PROC_HIT_MASK_ALL = 0x2FFF
};
enum ProcAttributes
{
- PROC_ATTR_REQ_EXP_OR_HONOR = 0x0000010,
+ PROC_ATTR_REQ_EXP_OR_HONOR = 0x0000010
};
struct SpellProcEventEntry
@@ -322,12 +322,12 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
enum SpellGroup
{
- SPELL_GROUP_NONE = 0,
- SPELL_GROUP_ELIXIR_BATTLE = 1,
- SPELL_GROUP_ELIXIR_GUARDIAN = 2,
- SPELL_GROUP_ELIXIR_UNSTABLE = 3,
+ SPELL_GROUP_NONE = 0,
+ SPELL_GROUP_ELIXIR_BATTLE = 1,
+ SPELL_GROUP_ELIXIR_GUARDIAN = 2,
+ SPELL_GROUP_ELIXIR_UNSTABLE = 3,
SPELL_GROUP_ELIXIR_SHATTRATH = 4,
- SPELL_GROUP_CORE_RANGE_MAX = 5,
+ SPELL_GROUP_CORE_RANGE_MAX = 5
};
#define SPELL_GROUP_DB_RANGE_MIN 1000
@@ -342,11 +342,12 @@ typedef std::pair<SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_
enum SpellGroupStackRule
{
- SPELL_GROUP_STACK_RULE_DEFAULT = 0,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
+ SPELL_GROUP_STACK_RULE_DEFAULT = 0,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1,
SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2,
- SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3,
+ SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT = 3
};
+
#define SPELL_GROUP_STACK_RULE_MAX 4
typedef std::map<SpellGroup, SpellGroupStackRule> SpellGroupStackMap;
@@ -441,7 +442,7 @@ class PetAura
typedef UNORDERED_MAP<uint32, uint32> PetAuraMap;
public:
- PetAura()
+ PetAura() : removeOnChangePet(false), damage(0)
{
auras.clear();
}
@@ -494,7 +495,8 @@ struct SpellArea
int32 auraSpell; // spell aura must be applied for spell apply)if possitive) and it must not be applied in other case
uint32 raceMask; // can be applied only to races
Gender gender; // can be applied only to gender
- bool questStartCanActive; // if true then quest start can be active (not only rewarded)
+ uint32 questStartStatus; // QuestStatus that quest_start must have in order to keep the spell
+ uint32 questEndStatus; // QuestStatus that the quest_end must have in order to keep the spell (if the quest_end's status is different than this, the spell will be dropped)
bool autocast; // if true then auto applied at area enter, in other case just allowed to cast
// helpers
@@ -642,7 +644,7 @@ class SpellMgr
// Spell Groups table
SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds(uint32 spell_id) const;
- uint32 IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const;
+ bool IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const;
SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds(SpellGroup group_id) const;
void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>& foundSpells) const;
@@ -680,7 +682,7 @@ class SpellMgr
// Spell area
SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const;
- SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id, bool active) const;
+ SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id) const;
SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const;
SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const;
SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const;
@@ -739,7 +741,6 @@ class SpellMgr
EnchantCustomAttribute mEnchantCustomAttr;
SpellAreaMap mSpellAreaMap;
SpellAreaForQuestMap mSpellAreaForQuestMap;
- SpellAreaForQuestMap mSpellAreaForActiveQuestMap;
SpellAreaForQuestMap mSpellAreaForQuestEndMap;
SpellAreaForAuraMap mSpellAreaForAuraMap;
SpellAreaForAreaMap mSpellAreaForAreaMap;
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index d0ae6fe3098..f7ab6e22f2e 100755..100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -25,7 +25,7 @@ bool _SpellScript::_Validate(SpellInfo const* entry)
{
if (!Validate(entry))
{
- sLog->outError("TSCR: Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` did not pass Validate() function of script `%s` - script will be not added to the spell", entry->Id, m_scriptName->c_str());
return false;
}
return true;
@@ -247,10 +247,14 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff
return !area;
case TARGET_REFERENCE_TYPE_TARGET: // BOTH
return true;
+ default:
+ break;
}
break;
}
break;
+ default:
+ break;
}
return false;
@@ -282,27 +286,27 @@ bool SpellScript::_Validate(SpellInfo const* entry)
{
for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<ObjectAreaTargetSelectHandler>::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<ObjectTargetSelectHandler>::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
return _SpellScript::_Validate(entry);
}
@@ -410,7 +414,7 @@ Unit* SpellScript::GetHitUnit()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->unitTarget;
@@ -420,7 +424,7 @@ Creature* SpellScript::GetHitCreature()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
if (m_spell->unitTarget)
@@ -433,7 +437,7 @@ Player* SpellScript::GetHitPlayer()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
if (m_spell->unitTarget)
@@ -446,7 +450,7 @@ Item* SpellScript::GetHitItem()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->itemTarget;
@@ -456,7 +460,7 @@ GameObject* SpellScript::GetHitGObj()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->gameObjTarget;
@@ -466,7 +470,7 @@ WorldLocation* SpellScript::GetHitDest()
{
if (!IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
return m_spell->destTarget;
@@ -476,7 +480,7 @@ int32 SpellScript::GetHitDamage()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return 0;
}
return m_spell->m_damage;
@@ -486,7 +490,7 @@ void SpellScript::SetHitDamage(int32 damage)
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_spell->m_damage = damage;
@@ -496,7 +500,7 @@ int32 SpellScript::GetHitHeal()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return 0;
}
return m_spell->m_healing;
@@ -506,7 +510,7 @@ void SpellScript::SetHitHeal(int32 heal)
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_spell->m_healing = heal;
@@ -516,7 +520,7 @@ Aura* SpellScript::GetHitAura()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return NULL;
}
if (!m_spell->m_spellAura)
@@ -530,7 +534,7 @@ void SpellScript::PreventHitAura()
{
if (!IsInTargetHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
if (m_spell->m_spellAura)
@@ -541,7 +545,7 @@ void SpellScript::PreventHitEffect(SpellEffIndex effIndex)
{
if (!IsInHitPhase() && !IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_hitPreventEffectMask |= 1 << effIndex;
@@ -552,7 +556,7 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex)
{
if (!IsInHitPhase() && !IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
m_hitPreventDefaultEffectMask |= 1 << effIndex;
@@ -562,7 +566,7 @@ int32 SpellScript::GetEffectValue()
{
if (!IsInEffectHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId);
return 0;
}
return m_spell->damage;
@@ -593,7 +597,7 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
{
if (!IsInCheckCastHook())
{
- sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId);
return;
}
@@ -609,67 +613,71 @@ bool AuraScript::_Validate(SpellInfo const* entry)
{
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
if (!entry->HasAreaAuraEffect())
- sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
+ sLog->outError(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)
if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
- sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<AuraDispelHandler>::iterator itr = AfterDispel.begin(); itr != AfterDispel.end(); ++itr)
if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())
- sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectPeriodicHandler>::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectUpdatePeriodicHandler>::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectCalcAmountHandler>::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectCalcPeriodicHandler>::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectCalcSpellModHandler>::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectAbsorbHandler>::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectAbsorbHandler>::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectManaShieldHandler>::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
for (std::list<EffectManaShieldHandler>::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
- sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
+
+ for (std::list<EffectSplitHandler>::iterator itr = OnEffectSplit.begin(); itr != OnEffectSplit.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog->outError(LOG_FILTER_TSCR, "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str());
return _SpellScript::_Validate(entry);
}
@@ -799,6 +807,17 @@ void AuraScript::EffectManaShieldHandler::Call(AuraScript* auraScript, AuraEffec
(auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, absorbAmount);
}
+AuraScript::EffectSplitHandler::EffectSplitHandler(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex)
+ : AuraScript::EffectBase(_effIndex, SPELL_AURA_SPLIT_DAMAGE_PCT)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+}
+
+void AuraScript::EffectSplitHandler::Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount)
+{
+ (auraScript->*pEffectHandlerScript)(aurEff, dmgInfo, splitAmount);
+}
+
bool AuraScript::_Load(Aura* aura)
{
m_aura = aura;
@@ -833,6 +852,7 @@ bool AuraScript::_IsDefaultActionPrevented()
case AURA_SCRIPT_HOOK_EFFECT_REMOVE:
case AURA_SCRIPT_HOOK_EFFECT_PERIODIC:
case AURA_SCRIPT_HOOK_EFFECT_ABSORB:
+ case AURA_SCRIPT_HOOK_EFFECT_SPLIT:
return m_defaultActionPrevented;
default:
ASSERT(false && "AuraScript::_IsDefaultActionPrevented is called in a wrong place");
@@ -848,10 +868,11 @@ void AuraScript::PreventDefaultAction()
case AURA_SCRIPT_HOOK_EFFECT_REMOVE:
case AURA_SCRIPT_HOOK_EFFECT_PERIODIC:
case AURA_SCRIPT_HOOK_EFFECT_ABSORB:
+ case AURA_SCRIPT_HOOK_EFFECT_SPLIT:
m_defaultActionPrevented = true;
break;
default:
- sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
break;
}
}
@@ -1029,9 +1050,10 @@ Unit* AuraScript::GetTarget() const
case AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB:
case AURA_SCRIPT_HOOK_EFFECT_MANASHIELD:
case AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD:
+ case AURA_SCRIPT_HOOK_EFFECT_SPLIT:
return m_auraApplication->GetTarget();
default:
- sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
+ sLog->outError(LOG_FILTER_TSCR, "Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId);
}
return NULL;
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 376e7f18edc..26dda4d2327 100755..100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -47,7 +47,7 @@ enum SpellScriptState
SPELL_SCRIPT_STATE_NONE = 0,
SPELL_SCRIPT_STATE_REGISTRATION,
SPELL_SCRIPT_STATE_LOADING,
- SPELL_SCRIPT_STATE_UNLOADING,
+ SPELL_SCRIPT_STATE_UNLOADING
};
#define SPELL_SCRIPT_STATE_END SPELL_SCRIPT_STATE_UNLOADING + 1
@@ -72,6 +72,8 @@ class _SpellScript
{
public:
EffectHook(uint8 _effIndex);
+ virtual ~EffectHook() { }
+
uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry);
bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex);
virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0;
@@ -83,7 +85,7 @@ class _SpellScript
class EffectNameCheck
{
public:
- EffectNameCheck(uint16 _effName) {effName = _effName;};
+ EffectNameCheck(uint16 _effName) { effName = _effName; }
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
private:
@@ -118,7 +120,7 @@ class _SpellScript
virtual bool Load() { return true; }
// Function called when script is destroyed
// use for: deallocating memory allocated by script
- virtual void Unload() {}
+ virtual void Unload() { }
};
// SpellScript interface - enum used for runtime checks of script function calls
@@ -136,7 +138,7 @@ enum SpellScriptHookType
SPELL_SCRIPT_HOOK_CHECK_CAST,
SPELL_SCRIPT_HOOK_BEFORE_CAST,
SPELL_SCRIPT_HOOK_ON_CAST,
- SPELL_SCRIPT_HOOK_AFTER_CAST,
+ SPELL_SCRIPT_HOOK_AFTER_CAST
};
#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT_HIT
@@ -423,9 +425,10 @@ enum AuraScriptHookType
AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB,
AURA_SCRIPT_HOOK_EFFECT_MANASHIELD,
AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD,
+ AURA_SCRIPT_HOOK_EFFECT_SPLIT,
AURA_SCRIPT_HOOK_CHECK_AREA_TARGET,
AURA_SCRIPT_HOOK_DISPEL,
- AURA_SCRIPT_HOOK_AFTER_DISPEL,
+ AURA_SCRIPT_HOOK_AFTER_DISPEL
/*AURA_SCRIPT_HOOK_APPLY,
AURA_SCRIPT_HOOK_REMOVE, */
};
@@ -449,6 +452,7 @@ class AuraScript : public _SpellScript
typedef void(CLASSNAME::*AuraEffectCalcPeriodicFnType)(AuraEffect const*, bool &, int32 &); \
typedef void(CLASSNAME::*AuraEffectCalcSpellModFnType)(AuraEffect const*, SpellModifier* &); \
typedef void(CLASSNAME::*AuraEffectAbsorbFnType)(AuraEffect*, DamageInfo &, uint32 &); \
+ typedef void(CLASSNAME::*AuraEffectSplitFnType)(AuraEffect*, DamageInfo &, uint32 &); \
AURASCRIPT_FUNCTION_TYPE_DEFINES(AuraScript)
@@ -540,6 +544,14 @@ class AuraScript : public _SpellScript
private:
AuraEffectAbsorbFnType pEffectHandlerScript;
};
+ class EffectSplitHandler : public EffectBase
+ {
+ public:
+ EffectSplitHandler(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex);
+ void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & splitAmount);
+ private:
+ AuraEffectSplitFnType pEffectHandlerScript;
+ };
#define AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
class CheckAreaTargetFunction : public AuraScript::CheckAreaTargetHandler { public: CheckAreaTargetFunction(AuraCheckAreaTargetFnType _pHandlerScript) : AuraScript::CheckAreaTargetHandler((AuraScript::AuraCheckAreaTargetFnType)_pHandlerScript) {} }; \
@@ -552,6 +564,7 @@ class AuraScript : public _SpellScript
class EffectApplyHandlerFunction : public AuraScript::EffectApplyHandler { public: EffectApplyHandlerFunction(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode) : AuraScript::EffectApplyHandler((AuraScript::AuraEffectApplicationModeFnType)_pEffectHandlerScript, _effIndex, _effName, _mode) {} }; \
class EffectAbsorbFunction : public AuraScript::EffectAbsorbHandler { public: EffectAbsorbFunction(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectAbsorbHandler((AuraScript::AuraEffectAbsorbFnType)_pEffectHandlerScript, _effIndex) {} }; \
class EffectManaShieldFunction : public AuraScript::EffectManaShieldHandler { public: EffectManaShieldFunction(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectManaShieldHandler((AuraScript::AuraEffectAbsorbFnType)_pEffectHandlerScript, _effIndex) {} }; \
+ class EffectSplitFunction : public AuraScript::EffectSplitHandler { public: EffectSplitFunction(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectSplitHandler((AuraScript::AuraEffectSplitFnType)_pEffectHandlerScript, _effIndex) {} }; \
#define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
@@ -571,11 +584,11 @@ class AuraScript : public _SpellScript
class ScriptStateStore
{
public:
- uint8 _currentScriptState;
AuraApplication const* _auraApplication;
+ uint8 _currentScriptState;
bool _defaultActionPrevented;
ScriptStateStore(uint8 currentScriptState, AuraApplication const* auraApplication, bool defaultActionPrevented)
- : _currentScriptState(currentScriptState), _auraApplication(auraApplication), _defaultActionPrevented(defaultActionPrevented)
+ : _auraApplication(auraApplication), _currentScriptState(currentScriptState), _defaultActionPrevented(defaultActionPrevented)
{}
};
typedef std::stack<ScriptStateStore> ScriptStateStack;
@@ -676,6 +689,12 @@ class AuraScript : public _SpellScript
// where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
HookList<EffectManaShieldHandler> AfterEffectManaShield;
+ // executed when the caster of some spell with split dmg aura gets damaged through it
+ // example: OnEffectSplit += AuraEffectSplitFn(class::function, EffectIndexSpecifier);
+ // where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount);
+ HookList<EffectSplitHandler> OnEffectSplit;
+ #define AuraEffectSplitFn(F, I) EffectSplitFunction(&F, I)
+
// AuraScript interface - hook/effect execution manipulators
// prevents default action of a hook from being executed (works only while called in a hook which default action can be prevented)
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index 2f79eaff06a..89b75fd1695 100755..100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -34,14 +34,14 @@ class CreatureTextBuilder
size_t operator()(WorldPacket* data, LocaleConstant locale) const
{
- std::string text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale);
- char const* localizedName = _source->GetNameForLocaleIdx(locale);
+ std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale);
+ std::string const& localizedName = _source->GetNameForLocaleIdx(locale);
*data << uint8(_msgType);
*data << uint32(_language);
*data << uint64(_source->GetGUID());
*data << uint32(1); // 2.1.0
- *data << uint32(strlen(localizedName)+1);
+ *data << uint32(localizedName.size() + 1);
*data << localizedName;
size_t whisperGUIDpos = data->wpos();
*data << uint64(_targetGUID); // Unit Target
@@ -65,6 +65,47 @@ class CreatureTextBuilder
uint64 _targetGUID;
};
+class PlayerTextBuilder
+{
+ public:
+ PlayerTextBuilder(WorldObject* obj, WorldObject* speaker, ChatMsg msgtype, uint8 textGroup, uint32 id, uint32 language, uint64 targetGUID)
+ : _source(obj), _talker(speaker), _msgType(msgtype), _textGroup(textGroup), _textId(id), _language(language), _targetGUID(targetGUID)
+ {
+ }
+
+ size_t operator()(WorldPacket* data, LocaleConstant locale) const
+ {
+ std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale);
+
+ *data << uint8(_msgType);
+ *data << uint32(_language);
+ *data << uint64(_talker->GetGUID());
+ *data << uint32(1); // 2.1.0
+ *data << uint32(_talker->GetName().size() + 1);
+ *data << _talker->GetName();
+ size_t whisperGUIDpos = data->wpos();
+ *data << uint64(_targetGUID); // Unit Target
+ if (_targetGUID && !IS_PLAYER_GUID(_targetGUID))
+ {
+ *data << uint32(1); // target name length
+ *data << uint8(0); // target name
+ }
+ *data << uint32(text.length() + 1);
+ *data << text;
+ *data << uint8(0); // ChatTag
+
+ return whisperGUIDpos;
+ }
+
+ WorldObject* _source;
+ WorldObject* _talker;
+ ChatMsg _msgType;
+ uint8 _textGroup;
+ uint32 _textId;
+ uint32 _language;
+ uint64 _targetGUID;
+};
+
void CreatureTextMgr::LoadCreatureTexts()
{
uint32 oldMSTime = getMSTime();
@@ -77,8 +118,8 @@ void CreatureTextMgr::LoadCreatureTexts()
if (!result)
{
- sLog->outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
+
return;
}
@@ -104,25 +145,25 @@ void CreatureTextMgr::LoadCreatureTexts()
if (temp.sound)
{
if (!sSoundEntriesStore.LookupEntry(temp.sound)){
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
if (!GetLanguageDescByID(temp.lang))
{
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
if (temp.emote)
{
if (!sEmotesStore.LookupEntry(temp.emote))
{
- sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
temp.emote = EMOTE_ONESHOT_NONE;
}
}
@@ -136,8 +177,8 @@ void CreatureTextMgr::LoadCreatureTexts()
++textCount;
} while (result->NextRow());
- sLog->outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
+
}
void CreatureTextMgr::LoadCreatureTextLocales()
@@ -166,11 +207,11 @@ void CreatureTextMgr::LoadCreatureTextLocales()
++textCount;
} while (result->NextRow());
- sLog->outString(">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
+
}
-uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/)
+uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/)
{
if (!source)
return 0;
@@ -178,7 +219,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry());
if (sList == mTextMap.end())
{
- sLog->outErrorDb("CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName(), source->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName().c_str(), source->GetEntry());
return 0;
}
@@ -186,7 +227,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
CreatureTextHolder::const_iterator itr = textHolder.find(textGroup);
if (itr == textHolder.end())
{
- sLog->outErrorDb("CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry());
return 0;
}
@@ -261,8 +302,16 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp
if (iter->emote)
SendEmote(finalSource, iter->emote);
- CreatureTextBuilder builder(finalSource, finalType, iter->group, iter->id, finalLang, whisperGuid);
- SendChatPacket(finalSource, builder, finalType, whisperGuid, range, team, gmOnly);
+ if (srcPlr)
+ {
+ PlayerTextBuilder builder(source, finalSource, finalType, iter->group, iter->id, finalLang, whisperGuid);
+ SendChatPacket(finalSource, builder, finalType, whisperGuid, range, team, gmOnly);
+ }
+ else
+ {
+ CreatureTextBuilder builder(finalSource, finalType, iter->group, iter->id, finalLang, whisperGuid);
+ SendChatPacket(finalSource, builder, finalType, whisperGuid, range, team, gmOnly);
+ }
if (isEqualChanced || (!isEqualChanced && totalChance == 100.0f))
SetRepeatId(source, textGroup, iter->id);
@@ -288,7 +337,7 @@ float CreatureTextMgr::GetRangeForChatType(ChatMsg msgType) const
return dist;
}
-void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly)
+void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, CreatureTextRange range, Team team, bool gmOnly)
{
if (!sound || !source)
return;
@@ -298,7 +347,7 @@ void CreatureTextMgr::SendSound(Creature* source, uint32 sound, ChatMsg msgType,
SendNonChatPacket(source, &data, msgType, whisperGuid, range, team, gmOnly);
}
-void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const
+void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, uint64 whisperGuid, CreatureTextRange range, Team team, bool gmOnly) const
{
float dist = GetRangeForChatType(msgType);
@@ -383,7 +432,7 @@ void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id)
if (std::find(repeats.begin(), repeats.end(), id) == repeats.end())
repeats.push_back(id);
else
- sLog->outErrorDb("CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry(), uint32(id));
+ sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry(), uint32(id));
}
CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup)
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index 8ed0b01fcd5..df6dd7fe4f3 100755..100644
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
@@ -22,6 +22,7 @@
#include "GridNotifiers.h"
#include "ObjectAccessor.h"
#include "SharedDefines.h"
+#include "Opcodes.h"
struct CreatureTextEntry
{
@@ -37,7 +38,7 @@ struct CreatureTextEntry
uint32 sound;
};
-enum TextRange
+enum CreatureTextRange
{
TEXT_RANGE_NORMAL = 0,
TEXT_RANGE_AREA = 1,
@@ -89,21 +90,21 @@ class CreatureTextMgr
void LoadCreatureTextLocales();
CreatureTextMap const& GetTextMap() const { return mTextMap; }
- void SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly);
+ void SendSound(Creature* source, uint32 sound, ChatMsg msgType, uint64 whisperGuid, CreatureTextRange range, Team team, bool gmOnly);
void SendEmote(Unit* source, uint32 emote);
//if sent, returns the 'duration' of the text else 0 if error
- uint32 SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid = 0, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, TextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL);
+ uint32 SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid = 0, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL);
bool TextExist(uint32 sourceEntry, uint8 textGroup);
std::string GetLocalizedChatString(uint32 entry, uint8 textGroup, uint32 id, LocaleConstant locale) const;
template<class Builder>
- void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, uint64 whisperGuid = 0, TextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
+ void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, uint64 whisperGuid = 0, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const;
private:
CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup);
void SetRepeatId(Creature* source, uint8 textGroup, uint8 id);
- void SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const;
+ void SendNonChatPacket(WorldObject* source, WorldPacket* data, ChatMsg msgType, uint64 whisperGuid, CreatureTextRange range, Team team, bool gmOnly) const;
float GetRangeForChatType(ChatMsg msgType) const;
CreatureTextMap mTextMap;
@@ -172,7 +173,7 @@ class CreatureTextLocalizer
};
template<class Builder>
-void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const
+void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, uint64 whisperGuid, CreatureTextRange range, Team team, bool gmOnly) const
{
if (!source)
return;
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index e43d6ca5443..3f0e608ec14 100755..100644
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -20,10 +20,13 @@
#include "TicketMgr.h"
#include "DatabaseEnv.h"
#include "Log.h"
+#include "Language.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Chat.h"
#include "World.h"
+#include "Player.h"
+#include "Opcodes.h"
inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; }
@@ -31,45 +34,32 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; }
// GM ticket
GmTicket::GmTicket() { }
-GmTicket::GmTicket(Player* player, WorldPacket& recv_data) : _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED)
+GmTicket::GmTicket(Player* player, WorldPacket& recvData) : _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _haveTicket(false)
{
_id = sTicketMgr->GenerateTicketId();
_playerName = player->GetName();
_playerGuid = player->GetGUID();
uint32 mapId;
- recv_data >> mapId; // Map is sent as UInt32!
+ recvData >> mapId; // Map is sent as UInt32!
_mapId = mapId;
- recv_data >> _posX;
- recv_data >> _posY;
- recv_data >> _posZ;
- recv_data >> _message;
+ recvData >> _posX;
+ recvData >> _posY;
+ recvData >> _posZ;
+ recvData >> _message;
uint32 needResponse;
- recv_data >> needResponse;
- _needResponse = (needResponse == 17); // Requires GM response. 17 = true, 1 = false (17 is default)
- uint8 unk1;
- recv_data >> unk1; // Requests further GM interaction on a ticket to which a GM has already responded
-
- recv_data.rfinish();
- /*
- recv_data >> uint32(count); // text lines
- for (int i = 0; i < count; i++)
- recv_data >> uint32();
-
- if (something)
- recv_data >> uint32();
- else
- compressed uint32 + string;
- */
+ recvData >> needResponse;
+ _needResponse = (needResponse == 17); // Requires GM response. 17 = true, 1 = false (17 is default)
+ recvData >> _haveTicket; // Requests further GM interaction on a ticket to which a GM has already responded. Basically means "has a new ticket"
}
GmTicket::~GmTicket() { }
bool GmTicket::LoadFromDB(Field* fields)
{
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
+ // ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket
uint8 index = 0;
_id = fields[ index].GetUInt32();
_playerGuid = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER);
@@ -84,9 +74,11 @@ bool GmTicket::LoadFromDB(Field* fields)
_closedBy = fields[++index].GetInt32();
_assignedTo = MAKE_NEW_GUID(fields[++index].GetUInt32(), 0, HIGHGUID_PLAYER);
_comment = fields[++index].GetString();
+ _response = fields[++index].GetString();
_completed = fields[++index].GetBool();
_escalatedStatus = GMTicketEscalationStatus(fields[++index].GetUInt8());
_viewed = fields[++index].GetBool();
+ _haveTicket = fields[++index].GetBool();
return true;
}
@@ -109,9 +101,11 @@ void GmTicket::SaveToDB(SQLTransaction& trans) const
stmt->setInt32 (++index, GUID_LOPART(_closedBy));
stmt->setUInt32(++index, GUID_LOPART(_assignedTo));
stmt->setString(++index, _comment);
+ stmt->setString(++index, _response);
stmt->setBool (++index, _completed);
stmt->setUInt8 (++index, uint8(_escalatedStatus));
stmt->setBool (++index, _viewed);
+ stmt->setBool (++index, _haveTicket);
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
@@ -125,6 +119,10 @@ void GmTicket::DeleteFromDB()
void GmTicket::WritePacket(WorldPacket& data) const
{
+ data << uint32(GMTICKET_STATUS_HASTEXT);
+ data << uint32(_id);
+ data << _message;
+ data << uint8(_haveTicket);
data << GetAge(_lastModifiedTime);
if (GmTicket* ticket = sTicketMgr->GetOldestOpenTicket())
data << GetAge(ticket->GetLastModifiedTime());
@@ -223,6 +221,20 @@ void GmTicket::TeleportTo(Player* player) const
player->TeleportTo(_mapId, _posX, _posY, _posZ, 0.0f, 0);
}
+void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log)
+{
+ std::stringstream ss(log);
+ std::stringstream newss;
+ std::string line;
+ while (std::getline(ss, line))
+ {
+ newss << secsToTimeString(time.front()) << ": " << line << "\n";
+ time.pop_front();
+ }
+
+ _chatLog = newss.str();
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
// Ticket manager
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(NULL)) { }
@@ -263,8 +275,8 @@ void TicketMgr::LoadTickets()
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outString(">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
+
return;
}
@@ -290,8 +302,8 @@ void TicketMgr::LoadTickets()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
void TicketMgr::LoadSurveys()
@@ -303,8 +315,8 @@ void TicketMgr::LoadSurveys()
if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys"))
_lastSurveyId = (*result)[0].GetUInt32();
- sLog->outString(">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
}
void TicketMgr::AddTicket(GmTicket* ticket)
@@ -365,26 +377,12 @@ void TicketMgr::ShowEscalatedList(ChatHandler& handler) const
void TicketMgr::SendTicket(WorldSession* session, GmTicket* ticket) const
{
- uint32 status = GMTICKET_STATUS_DEFAULT;
- std::string message;
- if (ticket)
- {
- message = ticket->GetMessage();
- status = GMTICKET_STATUS_HASTEXT;
- }
-
- WorldPacket data(SMSG_GMTICKET_GETTICKET, (4 + 4 + (ticket ? message.length() + 1 + 4 + 4 + 4 + 1 + 1 : 0)));
- data << uint32(status); // standard 0x0A, 0x06 if text present
- data << uint32(ticket ? ticket->GetId() : 0); // ticketID
+ WorldPacket data(SMSG_GMTICKET_GETTICKET, (ticket ? (4 + 4 + 1 + 4 + 4 + 4 + 1 + 1) : 4));
if (ticket)
- {
- data << message.c_str(); // ticket text
- data << uint8(0x7); // ticket category; why is this hardcoded? does it make a diff re: client?
-
- // we've got the easy stuff done by now.
- // Now we need to go through the client logic for displaying various levels of ticket load
ticket->WritePacket(data);
- }
+ else
+ data << uint32(GMTICKET_STATUS_DEFAULT);
+
session->SendPacket(&data);
}
diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h
index be8b4063d84..7e6768b96b2 100755..100644
--- a/src/server/game/Tickets/TicketMgr.h
+++ b/src/server/game/Tickets/TicketMgr.h
@@ -29,13 +29,13 @@ class ChatHandler;
enum GMTicketSystemStatus
{
GMTICKET_QUEUE_STATUS_DISABLED = 0,
- GMTICKET_QUEUE_STATUS_ENABLED = 1,
+ GMTICKET_QUEUE_STATUS_ENABLED = 1
};
enum GMTicketStatus
{
GMTICKET_STATUS_HASTEXT = 0x06,
- GMTICKET_STATUS_DEFAULT = 0x0A,
+ GMTICKET_STATUS_DEFAULT = 0x0A
};
enum GMTicketResponse
@@ -45,7 +45,7 @@ enum GMTicketResponse
GMTICKET_RESPONSE_CREATE_ERROR = 3,
GMTICKET_RESPONSE_UPDATE_SUCCESS = 4,
GMTICKET_RESPONSE_UPDATE_ERROR = 5,
- GMTICKET_RESPONSE_TICKET_DELETED = 9,
+ GMTICKET_RESPONSE_TICKET_DELETED = 9
};
// from Blizzard LUA:
@@ -58,14 +58,14 @@ enum GMTicketEscalationStatus
TICKET_UNASSIGNED = 0,
TICKET_ASSIGNED = 1,
TICKET_IN_ESCALATION_QUEUE = 2,
- TICKET_ESCALATED_ASSIGNED = 3,
+ TICKET_ESCALATED_ASSIGNED = 3
};
// from blizzard lua
enum GMTicketOpenedByGMStatus
{
GMTICKET_OPENEDBYGM_STATUS_NOT_OPENED = 0, // ticket has never been opened by a gm
- GMTICKET_OPENEDBYGM_STATUS_OPENED = 1, // ticket has been opened by a gm
+ GMTICKET_OPENEDBYGM_STATUS_OPENED = 1 // ticket has been opened by a gm
};
enum LagReportType
@@ -82,7 +82,7 @@ class GmTicket
{
public:
GmTicket();
- explicit GmTicket(Player* player, WorldPacket& recv_data);
+ explicit GmTicket(Player* player, WorldPacket& recvData);
~GmTicket();
bool IsClosed() const { return _closedBy; }
@@ -94,8 +94,8 @@ public:
uint32 GetId() const { return _id; }
Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); }
- std::string GetPlayerName() const { return _playerName; }
- std::string GetMessage() const { return _message; }
+ std::string const& GetPlayerName() const { return _playerName; }
+ std::string const& GetMessage() const { return _message; }
Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); }
uint64 GetAssignedToGUID() const { return _assignedTo; }
std::string GetAssignedToName() const
@@ -120,16 +120,16 @@ public:
_escalatedStatus = TICKET_ASSIGNED;
}
void SetClosedBy(const int64& value) { _closedBy = value; }
- void SetMessage(const std::string& message)
+ void SetMessage(std::string const& message)
{
_message = message;
_lastModifiedTime = uint64(time(NULL));
}
- void SetComment(const std::string& comment) { _comment = comment; }
+ void SetComment(std::string const& comment) { _comment = comment; }
void SetViewed() { _viewed = true; }
void SetUnassigned();
- void AppendResponse(const std::string& response) { _response += response; }
+ void AppendResponse(std::string const& response) { _response += response; }
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
@@ -142,6 +142,9 @@ public:
std::string FormatMessageString(ChatHandler& handler, bool detailed = false) const;
std::string FormatMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName) const;
+ void SetChatLog(std::list<uint32> time, std::string const& log);
+ std::string const& GetChatLog() const { return _chatLog; }
+
private:
uint32 _id;
uint64 _playerGuid;
@@ -160,7 +163,9 @@ private:
GMTicketEscalationStatus _escalatedStatus;
bool _viewed;
bool _needResponse; // TODO: find out the use of this, and then store it in DB
+ bool _haveTicket;
std::string _response;
+ std::string _chatLog; // No need to store in db, will be refreshed every session client side
};
typedef std::map<uint32, GmTicket*> GmTicketList;
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index b734d90b040..a342388f583 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -17,6 +17,7 @@
*/
#include "Common.h"
+#include "AchievementMgr.h"
#include "CharacterDatabaseCleaner.h"
#include "World.h"
#include "Database/DatabaseEnv.h"
@@ -29,7 +30,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
if (!sWorld->getBoolConfig(CONFIG_CLEAN_CHARACTER_DB))
return;
- sLog->outString("Cleaning character database...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Cleaning character database...");
uint32 oldMSTime = getMSTime();
@@ -63,8 +64,8 @@ void CharacterDatabaseCleaner::CleanDatabase()
sWorld->SetCleaningFlags(flags);
- sLog->outString(">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
}
void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32))
@@ -72,7 +73,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
QueryResult result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table);
if (!result)
{
- sLog->outString("Table %s is empty.", table);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Table %s is empty.", table);
return;
}
@@ -108,7 +109,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
bool CharacterDatabaseCleaner::AchievementProgressCheck(uint32 criteria)
{
- return sAchievementCriteriaStore.LookupEntry(criteria);
+ return sAchievementMgr->GetAchievementCriteria(criteria);
}
void CharacterDatabaseCleaner::CleanCharacterAchievementProgress()
diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp
index 476a19b6885..57986243879 100644
--- a/src/server/game/Tools/PlayerDump.cpp
+++ b/src/server/game/Tools/PlayerDump.cpp
@@ -22,6 +22,7 @@
#include "UpdateFields.h"
#include "ObjectMgr.h"
#include "AccountMgr.h"
+#include "World.h"
#define DUMP_TABLE_COUNT 27
struct DumpTable
@@ -117,7 +118,7 @@ std::string gettablename(std::string &str)
return str.substr(s, e-s);
}
-bool changenth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false)
+bool changenth(std::string &str, int n, char const* with, bool insert = false, bool nonzero = false)
{
std::string::size_type s, e;
if (!findnth(str, n, s, e))
@@ -142,7 +143,7 @@ std::string getnth(std::string &str, int n)
return str.substr(s, e-s);
}
-bool changetoknth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false)
+bool changetoknth(std::string &str, int n, char const* with, bool insert = false, bool nonzero = false)
{
std::string::size_type s = 0, e = 0;
if (!findtoknth(str, n, s, e))
@@ -198,7 +199,7 @@ std::string CreateDumpString(char const* tableName, QueryResult result)
{
if (!tableName || !result) return "";
std::ostringstream ss;
- ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
+ ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
Field* fields = result->Fetch();
for (uint32 i = 0; i < result->GetFieldCount(); ++i)
{
@@ -320,7 +321,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const*tabl
case DTT_CHARACTER:
{
if (result->GetFieldCount() <= 68) // avoid crashes on next check
- sLog->outCrash("PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table.");
+ sLog->outFatal(LOG_FILTER_GENERAL, "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table.");
if (result->Fetch()[68].GetUInt32()) // characters.deleteInfos_Account - if filled error
return false;
@@ -395,7 +396,7 @@ void fixNULLfields(std::string &line)
}
}
-DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid)
+DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, std::string name, uint32 guid)
{
uint32 charcount = AccountMgr::GetCharactersCount(account);
if (charcount >= 10)
@@ -457,6 +458,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
uint8 gender = GENDER_NONE;
uint8 race = RACE_NONE;
uint8 playerClass = 0;
+ uint8 level = 1;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
while (!feof(fin))
@@ -496,7 +498,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
std::string tn = gettablename(line);
if (tn.empty())
{
- sLog->outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
@@ -513,7 +515,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
if (i == DUMP_TABLE_COUNT)
{
- sLog->outError("LoadPlayerDump: Unknown table: '%s'!", tn.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "LoadPlayerDump: Unknown table: '%s'!", tn.c_str());
ROLLBACK(DUMP_FILE_BROKEN);
}
@@ -531,6 +533,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
race = uint8(atol(getnth(line, 4).c_str()));
playerClass = uint8(atol(getnth(line, 5).c_str()));
gender = uint8(atol(getnth(line, 6).c_str()));
+ level = uint8(atol(getnth(line, 7).c_str()));
if (name == "")
{
// check if the original name already exists
@@ -662,7 +665,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
break;
}
default:
- sLog->outError("Unknown dump table type: %u", type);
+ sLog->outError(LOG_FILTER_GENERAL, "Unknown dump table type: %u", type);
break;
}
@@ -674,7 +677,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
CharacterDatabase.CommitTransaction(trans);
// in case of name conflict player has to rename at login anyway
- sWorld->AddCharacterNameData(guid, name, gender, race, playerClass);
+ sWorld->AddCharacterNameData(guid, name, gender, race, playerClass, level);
sObjectMgr->_hiItemGuid += items.size();
sObjectMgr->_mailId += mails.size();
diff --git a/src/server/game/Tools/PlayerDump.h b/src/server/game/Tools/PlayerDump.h
index b5655328507..321649fc485 100755..100644
--- a/src/server/game/Tools/PlayerDump.h
+++ b/src/server/game/Tools/PlayerDump.h
@@ -48,7 +48,7 @@ enum DumpTableType
DTT_ITEM_GIFT, // <- item guids // character_gifts
DTT_PET, // -> pet guids collection // character_pet
- DTT_PET_TABLE, // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
+ DTT_PET_TABLE // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
};
enum DumpReturn
@@ -73,7 +73,7 @@ class PlayerDumpWriter : public PlayerDump
PlayerDumpWriter() {}
bool GetDump(uint32 guid, std::string& dump);
- DumpReturn WriteDump(const std::string& file, uint32 guid);
+ DumpReturn WriteDump(std::string const& file, uint32 guid);
private:
typedef std::set<uint32> GUIDs;
@@ -91,8 +91,7 @@ class PlayerDumpReader : public PlayerDump
public:
PlayerDumpReader() {}
- DumpReturn LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid);
+ DumpReturn LoadDump(std::string const& file, uint32 account, std::string name, uint32 guid);
};
#endif
-
diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp
index 54e56174b1a..06f8454fda7 100644
--- a/src/server/game/Warden/Warden.cpp
+++ b/src/server/game/Warden/Warden.cpp
@@ -105,9 +105,8 @@ void Warden::Update()
// Kick player if client response delays more than set in config
if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS)
{
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u, latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), _session->GetLatency(), _session->GetRemoteAddress().c_str(),
- secsToTimeString(maxClientResponseDelay, true).c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
+ _session->GetPlayerInfo().c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str());
_session->KickPlayer();
}
else
@@ -152,13 +151,28 @@ bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 le
}
}
+struct keyData {
+ union
+ {
+ struct
+ {
+ uint8 bytes[20];
+ } bytes;
+
+ struct
+ {
+ uint32 ints[5];
+ } ints;
+ };
+};
+
uint32 Warden::BuildChecksum(const uint8* data, uint32 length)
{
- uint8 hash[20];
- SHA1(data, length, hash);
+ keyData hash;
+ SHA1(data, length, hash.bytes.bytes);
uint32 checkSum = 0;
for (uint8 i = 0; i < 5; ++i)
- checkSum = checkSum ^ *(uint32*)(&hash[0] + i * 4);
+ checkSum = checkSum ^ hash.ints.ints[i];
return checkSum;
}
diff --git a/src/server/game/Warden/Warden.h b/src/server/game/Warden/Warden.h
index d16890b31b9..7a8f0f52315 100644
--- a/src/server/game/Warden/Warden.h
+++ b/src/server/game/Warden/Warden.h
@@ -54,7 +54,7 @@ enum WardenCheckType
DRIVER_CHECK = 0x71, // 113: uint Seed + byte[20] SHA1 + byte driverNameIndex (check to ensure driver isn't loaded)
TIMING_CHECK = 0x57, // 87: empty (check to ensure GetTickCount() isn't detoured)
PROC_CHECK = 0x7E, // 126: uint Seed + byte[20] SHA1 + byte moluleNameIndex + byte procNameIndex + uint Offset + byte Len (check to ensure proc isn't detoured)
- MODULE_CHECK = 0xD9, // 217: uint Seed + byte[20] SHA1 (check to ensure module isn't injected)
+ MODULE_CHECK = 0xD9 // 217: uint Seed + byte[20] SHA1 (check to ensure module isn't injected)
};
#if defined(__GNUC__)
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index 0677758439f..f6daba76c1a 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -43,8 +43,8 @@ void WardenCheckMgr::LoadWardenChecks()
// Check if Warden is enabled by config before loading anything
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
- sLog->outString(">> Warden disabled, loading checks skipped.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped.");
+
return;
}
@@ -52,8 +52,8 @@ void WardenCheckMgr::LoadWardenChecks()
if (!result)
{
- sLog->outString(">> Loaded 0 Warden checks. DB table `warden_checks` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!");
+
return;
}
@@ -145,8 +145,8 @@ void WardenCheckMgr::LoadWardenChecks()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u warden checks.", count);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count);
+
}
void WardenCheckMgr::LoadWardenOverrides()
@@ -154,8 +154,8 @@ void WardenCheckMgr::LoadWardenOverrides()
// Check if Warden is enabled by config before loading anything
if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED))
{
- sLog->outString(">> Warden disabled, loading check overrides skipped.");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped.");
+
return;
}
@@ -164,8 +164,8 @@ void WardenCheckMgr::LoadWardenOverrides()
if (!result)
{
- sLog->outString(">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!");
+
return;
}
@@ -182,10 +182,10 @@ void WardenCheckMgr::LoadWardenOverrides()
// Check if action value is in range (0-2, see WardenActions enum)
if (action > WARDEN_ACTION_BAN)
- sLog->outError("Warden check override action out of range (ID: %u, action: %u)", checkId, action);
+ sLog->outError(LOG_FILTER_WARDEN, "Warden check override action out of range (ID: %u, action: %u)", checkId, action);
// Check if check actually exists before accessing the CheckStore vector
else if (checkId > CheckStore.size())
- sLog->outError("Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action);
+ sLog->outError(LOG_FILTER_WARDEN, "Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action);
else
{
CheckStore[checkId]->Action = WardenActions(action);
@@ -194,8 +194,8 @@ void WardenCheckMgr::LoadWardenOverrides()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u warden action overrides.", count);
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_WARDEN, ">> 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 3cc95b9f3f7..c6ce33fe131 100644
--- a/src/server/game/Warden/WardenMac.cpp
+++ b/src/server/game/Warden/WardenMac.cpp
@@ -114,17 +114,32 @@ void WardenMac::RequestHash()
_session->SendPacket(&pkt);
}
+struct keyData {
+ union
+ {
+ struct
+ {
+ uint8 bytes[16];
+ } bytes;
+
+ struct
+ {
+ int ints[4];
+ } ints;
+ };
+};
+
void WardenMac::HandleHashResult(ByteBuffer &buff)
{
// test
int keyIn[4];
- uint8 mod_seed[16] = { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE };
+ keyData mod_seed = { { { { 0x4D, 0x80, 0x8D, 0x2C, 0x77, 0xD9, 0x05, 0xC4, 0x1A, 0x63, 0x80, 0xEC, 0x08, 0x58, 0x6A, 0xFE } } } };
for (int i = 0; i < 4; ++i)
{
- keyIn[i] = *(int*)(&mod_seed[0] + i * 4);
+ keyIn[i] = mod_seed.ints.ints[i];
}
int keyOut[4];
@@ -152,9 +167,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp
index 9aa439ec8c0..3d5f27f6a31 100644
--- a/src/server/game/Warden/WardenWin.cpp
+++ b/src/server/game/Warden/WardenWin.cpp
@@ -156,9 +156,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed hash reply. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
@@ -343,9 +341,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length))
{
buff.rpos(buff.wpos());
- sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed checksum. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
@@ -356,9 +352,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
// TODO: test it.
if (result == 0x00)
{
- sLog->outDebug(LOG_FILTER_WARDEN, "TIMING CHECK FAIL result 0x00");
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed timing check. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), Penalty().c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
@@ -500,9 +494,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (checkFailed > 0)
{
WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed);
-
- sLog->outWarden("WARDEN: Player %s (guid: %u, account: %u) failed Warden check %u. Action: %s",
- _session->GetPlayerName(), _session->GetGuidLow(), _session->GetAccountId(), checkFailed, Penalty(check).c_str());
+ sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerInfo().c_str(), checkFailed, Penalty(check).c_str());
}
// Set hold off timer, minimum timer should at least be 1 second
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index 965e6bf3805..e119ebf5f2e 100755..100644
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
@@ -28,6 +28,7 @@
#include "ObjectMgr.h"
#include "Util.h"
#include "ScriptMgr.h"
+#include "Opcodes.h"
/// Create the Weather object
Weather::Weather(uint32 zone, WeatherData const* weatherChances)
@@ -37,7 +38,7 @@ Weather::Weather(uint32 zone, WeatherData const* weatherChances)
m_type = WEATHER_TYPE_FINE;
m_grade = 0;
- sLog->outDetail("WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS)));
+ sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE*IN_MILLISECONDS)));
}
/// Launch a weather update
@@ -97,7 +98,7 @@ bool Weather::ReGenerate()
static char const* seasonName[WEATHER_SEASONS] = { "spring", "summer", "fall", "winter" };
- sLog->outDetail("Generating a change in %s weather for zone %u.", seasonName[season], m_zone);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Generating a change in %s weather for zone %u.", seasonName[season], m_zone);
if ((u < 60) && (m_grade < 0.33333334f)) // Get fair
{
@@ -258,7 +259,7 @@ bool Weather::UpdateWeather()
wthstr = "fine";
break;
}
- sLog->outDetail("Change the weather of zone %u to %s.", m_zone, wthstr);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Change the weather of zone %u to %s.", m_zone, wthstr);
sScriptMgr->OnWeatherChange(this, state, m_grade);
return true;
diff --git a/src/server/game/Weather/Weather.h b/src/server/game/Weather/Weather.h
index dadd1151a53..59bff95d7ea 100755..100644
--- a/src/server/game/Weather/Weather.h
+++ b/src/server/game/Weather/Weather.h
@@ -57,7 +57,7 @@ enum WeatherState
WEATHER_STATE_HEAVY_SANDSTORM = 42,
WEATHER_STATE_THUNDERS = 86,
WEATHER_STATE_BLACKRAIN = 90,
- WEATHER_STATE_BLACKSNOW = 106,
+ WEATHER_STATE_BLACKSNOW = 106
};
/// Weather for one zone
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index bb8fadf08bc..c96ec1742cf 100755..100644
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -25,6 +25,9 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "AutoPtr.h"
+#include "Player.h"
+#include "WorldPacket.h"
+#include "Opcodes.h"
namespace WeatherMgr
{
@@ -93,8 +96,8 @@ void LoadWeatherData()
if (!result)
{
- sLog->outErrorDb(">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
- sLog->outString();
+ sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 weather definitions. DB table `game_weather` is empty.");
+
return;
}
@@ -115,19 +118,19 @@ void LoadWeatherData()
if (wzc.data[season].rainChance > 100)
{
wzc.data[season].rainChance = 25;
- sLog->outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season);
+ sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season);
}
if (wzc.data[season].snowChance > 100)
{
wzc.data[season].snowChance = 25;
- sLog->outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season);
+ sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season);
}
if (wzc.data[season].stormChance > 100)
{
wzc.data[season].stormChance = 25;
- sLog->outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season);
+ sLog->outError(LOG_FILTER_SQL, "Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season);
}
}
@@ -137,8 +140,8 @@ void LoadWeatherData()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ 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/Weather/WeatherMgr.h b/src/server/game/Weather/WeatherMgr.h
index 768cd2dca17..768cd2dca17 100755..100644
--- a/src/server/game/Weather/WeatherMgr.h
+++ b/src/server/game/Weather/WeatherMgr.h
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 3aee1dc429e..7824a72c4d3 100755..100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -77,6 +77,7 @@
#include "WardenCheckMgr.h"
#include "Warden.h"
#include "CalendarMgr.h"
+#include "BattlefieldMgr.h"
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
@@ -267,7 +268,7 @@ void World::AddSession_(WorldSession* s)
{
AddQueuedPlayer (s);
UpdateMaxSessionCounters();
- sLog->outDetail("PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
+ sLog->outInfo(LOG_FILTER_GENERAL, "PlayerQueue: Account id %u is in Queue Position (%u).", s->GetAccountId(), ++QueueSize);
return;
}
@@ -284,7 +285,7 @@ void World::AddSession_(WorldSession* s)
float popu = (float)GetActiveSessionCount(); // updated number of users on the server
popu /= pLimit;
popu *= 2;
- sLog->outDetail("Server Population (%f).", popu);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Server Population (%f).", popu);
}
}
@@ -395,11 +396,10 @@ void World::LoadConfigSettings(bool reload)
{
if (!ConfigMgr::Load())
{
- sLog->outError("World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str());
return;
}
-
- sLog->ReloadConfig(); // Reload log levels and filters
+ sLog->LoadFromConfig();
}
///- Read the player limit and the Message of the day from the config file
@@ -419,27 +419,27 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1);
if (rate_values[RATE_HEALTH] < 0)
{
- sLog->outError("Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
rate_values[RATE_HEALTH] = 1;
}
rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1);
if (rate_values[RATE_POWER_MANA] < 0)
{
- sLog->outError("Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
rate_values[RATE_POWER_MANA] = 1;
}
rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1);
rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1);
if (rate_values[RATE_POWER_RAGE_LOSS] < 0)
{
- sLog->outError("Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
rate_values[RATE_POWER_RAGE_LOSS] = 1;
}
rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1);
if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0)
{
- sLog->outError("Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1;
}
rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f);
@@ -463,7 +463,7 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f);
if (rate_values[RATE_REPAIRCOST] < 0.0f)
{
- sLog->outError("Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
rate_values[RATE_REPAIRCOST] = 0.0f;
}
rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f);
@@ -500,13 +500,13 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)
{
- sLog->outError("Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
rate_values[RATE_TALENT] = 1.0f;
}
rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f);
if (rate_values[RATE_MOVESPEED] < 0)
{
- sLog->outError("Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
rate_values[RATE_MOVESPEED] = 1.0f;
}
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED];
@@ -515,12 +515,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f);
if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE)
{
- sLog->outError("TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE;
}
else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE)
{
- sLog->outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE;
}
@@ -528,12 +528,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f)
{
- sLog->outError("DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f)
{
- sLog->outError("DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f;
@@ -541,25 +541,25 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f)
{
- sLog->outError("DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f;
}
///- Read other configuration items from the config file
@@ -569,7 +569,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1);
if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9)
{
- sLog->outError("Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
m_int_configs[CONFIG_COMPRESSION] = 1;
}
m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true);
@@ -593,14 +593,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0);
if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL)
{
- sLog->outError("PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0;
}
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
{
- sLog->outError("GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
}
if (reload)
@@ -609,7 +609,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100);
if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
{
- sLog->outError("MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY;
}
if (reload)
@@ -621,7 +621,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
if (val != m_int_configs[CONFIG_PORT_WORLD])
- sLog->outError("WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
}
else
m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
@@ -640,7 +640,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("GameType", 0);
if (val != m_int_configs[CONFIG_GAME_TYPE])
- sLog->outError("GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
}
else
m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0);
@@ -649,12 +649,13 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
if (val != m_int_configs[CONFIG_REALM_ZONE])
- sLog->outError("RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
}
else
m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = ConfigMgr::GetBoolDefault("AllowTwoSide.Accounts", true);
+ m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR]= ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Calendar", false);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT] = ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Chat", false);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Channel", false);
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = ConfigMgr::GetBoolDefault("AllowTwoSide.Interaction.Group", false);
@@ -671,21 +672,21 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2);
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
{
- sLog->outError("MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2);
if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME)
{
- sLog->outError("MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2);
if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME)
{
- sLog->outError("MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
m_int_configs[CONFIG_MIN_PET_NAME] = 2;
}
@@ -696,7 +697,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10);
if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError("CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10;
}
@@ -704,14 +705,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50);
if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM])
{
- sLog->outError("CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM];
}
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1);
if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
}
@@ -720,7 +721,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0);
if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)
{
- sLog->outError("SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
m_int_configs[CONFIG_SKIP_CINEMATICS] = 0;
}
@@ -728,14 +729,14 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
- sLog->outError("MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
}
else
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL)
{
- sLog->outError("MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL;
}
@@ -744,25 +745,25 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1);
if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1)
{
- sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1;
}
else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55);
if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1)
{
- sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55;
}
else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
@@ -770,12 +771,12 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0);
if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
{
- sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
}
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT)
{
- sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT);
m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT;
}
@@ -783,20 +784,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000);
if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0)
{
- sLog->outError("MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0;
}
m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0);
if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0)
{
- sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0);
m_int_configs[CONFIG_START_HONOR_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS])
{
- sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS];
}
@@ -804,20 +805,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000);
if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0)
{
- sLog->outError("MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0;
}
m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0);
if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0)
{
- sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0);
m_int_configs[CONFIG_START_ARENA_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS])
{
- sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS];
}
@@ -825,7 +826,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60);
if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError("RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60);
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60;
}
@@ -845,7 +846,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9);
if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9)
{
- sLog->outError("MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9;
}
@@ -860,13 +861,13 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1);
if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL])
{
- sLog->outError("GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL];
}
else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL)
{
- sLog->outError("GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL;
}
m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false);
@@ -881,7 +882,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10);
if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0)
{
- sLog->outError("UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
m_int_configs[CONFIG_UPTIME_UPDATE] = 10;
}
if (reload)
@@ -894,7 +895,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10);
if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0)
{
- sLog->outError("LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10;
}
if (reload)
@@ -903,7 +904,7 @@ void World::LoadConfigSettings(bool reload)
m_timers[WUPDATE_CLEANDB].Reset();
}
m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
- sLog->outString("Will clear `logs` table of entries older than %i seconds every %u minutes.",
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.",
m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100);
@@ -928,7 +929,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2);
if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
{
- sLog->outError("MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
}
@@ -943,7 +944,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("Expansion", 1);
if (val != m_int_configs[CONFIG_EXPANSION])
- sLog->outError("Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
}
else
m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1);
@@ -975,10 +976,17 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6);
if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
{
- sLog->outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
}
+ m_int_configs[CONFIG_GUILD_RESET_HOUR] = ConfigMgr::GetIntDefault("Guild.ResetHour", 6);
+ if (m_int_configs[CONFIG_GUILD_RESET_HOUR] > 23)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "Guild.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]);
+ m_int_configs[CONFIG_GUILD_RESET_HOUR] = 6;
+ }
+
m_bool_configs[CONFIG_DETECT_POS_COLLISION] = ConfigMgr::GetBoolDefault("DetectPosCollision", true);
m_bool_configs[CONFIG_RESTRICTED_LFG_CHANNEL] = ConfigMgr::GetBoolDefault("Channel.RestrictedLfg", true);
@@ -1042,10 +1050,10 @@ void World::LoadConfigSettings(bool reload)
if (clientCacheId > 0)
{
m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId;
- sLog->outString("Client cache version set to: %u", clientCacheId);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId);
}
else
- sLog->outError("ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
+ 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);
@@ -1061,12 +1069,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE;
}
@@ -1074,12 +1082,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError("Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE;
}
@@ -1087,12 +1095,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError("Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError("Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE;
}
@@ -1113,12 +1121,12 @@ void World::LoadConfigSettings(bool reload)
if (reload)
{
if (dataPath != m_dataPath)
- sLog->outError("DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
}
else
{
m_dataPath = dataPath;
- sLog->outString("Using DataDir %s", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str());
}
m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0);
@@ -1129,19 +1137,19 @@ void World::LoadConfigSettings(bool reload)
std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", "");
if (!enableHeight)
- sLog->outError("VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS);
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str());
- sLog->outString("WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
- sLog->outString("WORLD: VMap data directory is: %svmaps", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str());
m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49);
m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true);
m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false);
if (m_bool_configs[CONFIG_START_ALL_SPELLS])
- sLog->outString("WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!");
+ sLog->outWarn(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!");
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0);
m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false);
m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false);
@@ -1181,7 +1189,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_WARDEN_CLIENT_RESPONSE_DELAY] = ConfigMgr::GetIntDefault("Warden.ClientResponseDelay", 600);
// Dungeon finder
- m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = ConfigMgr::GetBoolDefault("DungeonFinder.Enable", false);
+ m_int_configs[CONFIG_LFG_OPTIONSMASK] = ConfigMgr::GetIntDefault("DungeonFinder.OptionsMask", 1);
// DBC_ItemAttributes
m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = ConfigMgr::GetBoolDefault("DBC.EnforceItemAttributes", true);
@@ -1193,6 +1201,11 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_AUTOBROADCAST] = ConfigMgr::GetBoolDefault("AutoBroadcast.On", false);
m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = ConfigMgr::GetIntDefault("AutoBroadcast.Center", 0);
m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL] = ConfigMgr::GetIntDefault("AutoBroadcast.Timer", 60000);
+ if (reload)
+ {
+ m_timers[WUPDATE_AUTOBROADCAST].SetInterval(m_int_configs[CONFIG_AUTOBROADCAST_INTERVAL]);
+ m_timers[WUPDATE_AUTOBROADCAST].Reset();
+ }
// MySQL ping time interval
m_int_configs[CONFIG_DB_PING_INTERVAL] = ConfigMgr::GetIntDefault("MaxPingTime", 30);
@@ -1202,6 +1215,14 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true);
// call ScriptMgr if we're reloading the configuration
+ 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);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
+ m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30);
+ m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150);
+ m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
+
if (reload)
sScriptMgr->OnConfigLoad(reload);
}
@@ -1237,7 +1258,7 @@ void World::SetInitialWorldSettings()
!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{
- sLog->outError("Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
exit(1);
}
@@ -1248,8 +1269,8 @@ void World::SetInitialWorldSettings()
sGameEventMgr->Initialize();
///- Loading strings. Getting no records means core load has to be canceled because no error message can be output.
- sLog->outString();
- sLog->outString("Loading Trinity strings...");
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings...");
if (!sObjectMgr->LoadTrinityStrings())
exit(1); // Error message displayed in function already
@@ -1273,36 +1294,36 @@ void World::SetInitialWorldSettings()
CharacterDatabase.Execute(stmt);
///- Load the DBC files
- sLog->outString("Initialize data stores...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize data stores...");
LoadDBCStores(m_dataPath);
DetectDBCLang();
- sLog->outString("Loading spell dbc data corrections...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell dbc data corrections...");
sSpellMgr->LoadDbcDataCorrections();
- sLog->outString("Loading SpellInfo store...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store...");
sSpellMgr->LoadSpellInfoStore();
- sLog->outString("Loading SkillLineAbilityMultiMap Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data...");
sSpellMgr->LoadSkillLineAbilityMap();
- sLog->outString("Loading spell custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell custom attributes...");
sSpellMgr->LoadSpellCustomAttr();
- sLog->outString("Loading GameObject models...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObject models...");
LoadGameObjectModelList();
- sLog->outString("Loading Script Names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Names...");
sObjectMgr->LoadScriptNames();
- sLog->outString("Loading Instance Template...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Instance Template...");
sObjectMgr->LoadInstanceTemplate();
// Must be called before `creature_respawn`/`gameobject_respawn` tables
- sLog->outString("Loading instances...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading instances...");
sInstanceSaveMgr->LoadInstances();
- sLog->outString("Loading Localization strings...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Localization strings...");
uint32 oldMSTime = getMSTime();
sObjectMgr->LoadCreatureLocales();
sObjectMgr->LoadGameObjectLocales();
@@ -1315,354 +1336,356 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadPointOfInterestLocales();
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
- sLog->outString(">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
+
- sLog->outString("Loading Page Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts...");
sObjectMgr->LoadPageTexts();
- sLog->outString("Loading Game Object Templates..."); // must be after LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr->LoadGameObjectTemplate();
- sLog->outString("Loading Spell Rank Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data...");
sSpellMgr->LoadSpellRanks();
- sLog->outString("Loading Spell Required Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data...");
sSpellMgr->LoadSpellRequired();
- sLog->outString("Loading Spell Group types...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types...");
sSpellMgr->LoadSpellGroups();
- sLog->outString("Loading Spell Learn Skills...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills...");
sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
- sLog->outString("Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
- sLog->outString("Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
- sLog->outString("Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
- sLog->outString("Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
- sLog->outString("Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
- sLog->outString("Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
- sLog->outString("Loading NPC Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts...");
sObjectMgr->LoadGossipText();
- sLog->outString("Loading Enchant Spells Proc datas...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas...");
sSpellMgr->LoadSpellEnchantProcData();
- sLog->outString("Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
- sLog->outString("Loading Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Disables");
DisableMgr::LoadDisables(); // must be before loading quests and items
- sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
sObjectMgr->LoadItemTemplates();
- sLog->outString("Loading Item set names..."); // must be after LoadItemPrototypes
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes
sObjectMgr->LoadItemSetNames();
- sLog->outString("Loading Creature Model Based Info Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data...");
sObjectMgr->LoadCreatureModelInfo();
- sLog->outString("Loading Equipment templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");
sObjectMgr->LoadEquipmentTemplates();
- sLog->outString("Loading Creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates...");
sObjectMgr->LoadCreatureTemplates();
- sLog->outString("Loading Creature template addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons...");
sObjectMgr->LoadCreatureTemplateAddons();
- sLog->outString("Loading Reputation Reward Rates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates...");
sObjectMgr->LoadReputationRewardRate();
- sLog->outString("Loading Creature Reputation OnKill Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data...");
sObjectMgr->LoadReputationOnKill();
- sLog->outString("Loading Reputation Spillover Data..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data...");
sObjectMgr->LoadReputationSpilloverTemplate();
- sLog->outString("Loading Points Of Interest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data...");
sObjectMgr->LoadPointsOfInterest();
- sLog->outString("Loading Creature Base Stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats...");
sObjectMgr->LoadCreatureClassLevelStats();
- sLog->outString("Loading Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data...");
sObjectMgr->LoadCreatures();
- sLog->outString("Loading pet levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells...");
sSpellMgr->LoadPetLevelupSpellMap();
- sLog->outString("Loading pet default spells additional to levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells...");
sSpellMgr->LoadPetDefaultSpells();
- sLog->outString("Loading Creature Addon Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data...");
sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
- sLog->outString("Loading Gameobject Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data...");
sObjectMgr->LoadGameobjects();
- sLog->outString("Loading Creature Linked Respawn...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn...");
sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
- sLog->outString("Loading Weather Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Weather Data...");
WeatherMgr::LoadWeatherData();
- sLog->outString("Loading Quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests...");
sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
- sLog->outString("Checking Quest Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables");
DisableMgr::CheckQuestDisables(); // must be after loading quests
- sLog->outString("Loading Quest POI");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest POI");
sObjectMgr->LoadQuestPOI();
- sLog->outString("Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations...");
sObjectMgr->LoadQuestRelations(); // must be after quest load
- sLog->outString("Loading Objects Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data...");
sPoolMgr->LoadFromDB();
- sLog->outString("Loading Game Event Data..."); // must be after loading pools fully
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully
sGameEventMgr->LoadFromDB();
- sLog->outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
sObjectMgr->LoadNPCSpellClickSpells();
- sLog->outString("Loading Vehicle Template Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories...");
sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outString("Loading Vehicle Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories...");
sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outString("Loading Dungeon boss data...");
- sObjectMgr->LoadInstanceEncounters();
-
- sLog->outString("Loading LFG rewards...");
- sLFGMgr->LoadRewards();
-
- sLog->outString("Loading SpellArea Data..."); // must be after quest load
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load
sSpellMgr->LoadSpellAreas();
- sLog->outString("Loading AreaTrigger definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
- sLog->outString("Loading Access Requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements...");
sObjectMgr->LoadAccessRequirements(); // must be after item template load
- sLog->outString("Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
- sLog->outString("Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
- sLog->outString("Loading AreaTrigger script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names...");
sObjectMgr->LoadAreaTriggerScripts();
- sLog->outString("Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG entrance positions..."); // Must be after areatriggers
+ sLFGMgr->LoadLFGDungeons();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data...");
+ sObjectMgr->LoadInstanceEncounters();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards...");
+ sLFGMgr->LoadRewards();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
- sLog->outString("Loading spell pet auras...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
- sLog->outString("Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
- sLog->outString("Loading enchant custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes...");
sSpellMgr->LoadEnchantCustomAttr();
- sLog->outString("Loading linked spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading linked spells...");
sSpellMgr->LoadSpellLinked();
- sLog->outString("Loading Player Create Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data...");
sObjectMgr->LoadPlayerInfo();
- sLog->outString("Loading Exploration BaseXP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data...");
sObjectMgr->LoadExplorationBaseXP();
- sLog->outString("Loading Pet Name Parts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts...");
sObjectMgr->LoadPetNames();
CharacterDatabaseCleaner::CleanDatabase();
- sLog->outString("Loading the max pet number...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading the max pet number...");
sObjectMgr->LoadPetNumber();
- sLog->outString("Loading pet level stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet level stats...");
sObjectMgr->LoadPetLevelInfo();
- sLog->outString("Loading Player Corpses...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses...");
sObjectMgr->LoadCorpses();
- sLog->outString("Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
// Loot tables
LoadLootTables();
- sLog->outString("Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
- sLog->outString("Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
- sLog->outString("Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
- sLog->outString("Loading Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievements...");
sAchievementMgr->LoadAchievementReferenceList();
- sLog->outString("Loading Achievement Criteria Lists...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists...");
sAchievementMgr->LoadAchievementCriteriaList();
- sLog->outString("Loading Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
- sLog->outString("Loading Achievement Rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards...");
sAchievementMgr->LoadRewards();
- sLog->outString("Loading Achievement Reward Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales...");
sAchievementMgr->LoadRewardLocales();
- sLog->outString("Loading Completed Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements...");
sAchievementMgr->LoadCompletedAchievements();
// Delete expired auctions before loading
- sLog->outString("Deleting expired auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions...");
sAuctionMgr->DeleteExpiredAuctionsAtStartup();
///- Load dynamic data tables from the database
- sLog->outString("Loading Item Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions...");
sAuctionMgr->LoadAuctionItems();
- sLog->outString("Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Auctions...");
sAuctionMgr->LoadAuctions();
sGuildMgr->LoadGuilds();
- sLog->outString("Loading ArenaTeams...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams...");
sArenaTeamMgr->LoadArenaTeams();
- sLog->outString("Loading Groups...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Groups...");
sGroupMgr->LoadGroups();
- sLog->outString("Loading ReservedNames...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames...");
sObjectMgr->LoadReservedPlayersNames();
- sLog->outString("Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
- sLog->outString("Loading BattleMasters...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters...");
sBattlegroundMgr->LoadBattleMastersEntry();
- sLog->outString("Loading GameTeleports...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports...");
sObjectMgr->LoadGameTele();
- sLog->outString("Loading Gossip menu...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu...");
sObjectMgr->LoadGossipMenu();
- sLog->outString("Loading Gossip menu options...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options...");
sObjectMgr->LoadGossipMenuItems();
- sLog->outString("Loading Vendors...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vendors...");
sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
- sLog->outString("Loading Trainers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trainers...");
sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate
- sLog->outString("Loading Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Waypoints...");
sWaypointMgr->Load();
- sLog->outString("Loading SmartAI Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints...");
sSmartWaypointMgr->LoadFromDB();
- sLog->outString("Loading Creature Formations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations...");
sFormationMgr->LoadCreatureFormations();
- sLog->outString("Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
LoadWorldStates();
- sLog->outString("Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Conditions...");
sConditionMgr->LoadConditions();
- sLog->outString("Loading faction change achievement pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs...");
sObjectMgr->LoadFactionChangeAchievements();
- sLog->outString("Loading faction change spell pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs...");
sObjectMgr->LoadFactionChangeSpells();
- sLog->outString("Loading faction change item pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs...");
sObjectMgr->LoadFactionChangeItems();
- sLog->outString("Loading faction change reputation pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs...");
sObjectMgr->LoadFactionChangeReputations();
- sLog->outString("Loading GM tickets...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change title pairs...");
+ sObjectMgr->LoadFactionChangeTitles();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets...");
sTicketMgr->LoadTickets();
- sLog->outString("Loading GM surveys...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM surveys...");
sTicketMgr->LoadSurveys();
- sLog->outString("Loading client addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading client addons...");
AddonMgr::LoadFromDB();
///- Handle outdated emails (delete/return)
- sLog->outString("Returning old mails...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Returning old mails...");
sObjectMgr->ReturnOrDeleteOldMails(false);
- sLog->outString("Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts...");
LoadAutobroadcasts();
///- Load and initialize scripts
- sObjectMgr->LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadWaypointScripts();
- sLog->outString("Loading Scripts text locales..."); // must be after Load*Scripts calls
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls
sObjectMgr->LoadDbScriptStrings();
- sLog->outString("Loading CreatureEventAI Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts...");
sEventAIMgr->LoadCreatureEventAI_Texts();
- sLog->outString("Loading CreatureEventAI Summons...");
- sEventAIMgr->LoadCreatureEventAI_Summons();
-
- sLog->outString("Loading CreatureEventAI Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
- sLog->outString("Loading spell script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell script names...");
sObjectMgr->LoadSpellScriptNames();
- sLog->outString("Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
- sLog->outString("Loading Creature Text Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales...");
sCreatureTextMgr->LoadCreatureTextLocales();
- sLog->outString("Initializing Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initializing Scripts...");
sScriptMgr->Initialize();
sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
- sLog->outString("Validating spell scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Validating spell scripts...");
sObjectMgr->ValidateSpellScripts();
- sLog->outString("Loading SmartAI scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
- sLog->outString("Loading Calendar data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Calendar data...");
sCalendarMgr->LoadFromDB();
///- Initialize game time and timers
- sLog->outString("Initialize game time and timers");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers");
m_gameTime = time(NULL);
m_startTime = m_gameTime;
@@ -1689,17 +1712,16 @@ void World::SetInitialWorldSettings()
mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
//1440
mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
- sLog->outDetail("Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
///- Initilize static helper structures
AIRegistry::Initialize();
- Player::InitVisibleBits();
///- Initialize MapManager
- sLog->outString("Starting Map System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Map System");
sMapMgr->Initialize();
- sLog->outString("Starting Game Event system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Game Event system...");
uint32 nextGameEvent = sGameEventMgr->StartSystem();
m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
@@ -1709,61 +1731,61 @@ void World::SetInitialWorldSettings()
// Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
Channel::CleanOldChannelsInDB();
- sLog->outString("Starting Arena Season...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Arena Season...");
sGameEventMgr->StartArenaSeason();
sTicketMgr->Initialize();
///- Initialize Battlegrounds
- sLog->outString("Starting Battleground System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System");
sBattlegroundMgr->CreateInitialBattlegrounds();
sBattlegroundMgr->InitAutomaticArenaPointDistribution();
///- Initialize outdoor pvp
- sLog->outString("Starting Outdoor PvP System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System");
sOutdoorPvPMgr->InitOutdoorPvP();
- sLog->outString("Loading Transports...");
+ ///- Initialize Battlefield
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battlefield System");
+ sBattlefieldMgr->InitBattlefield();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports...");
sMapMgr->LoadTransports();
- sLog->outString("Loading Transport NPCs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transport NPCs...");
sMapMgr->LoadTransportNPCs();
///- Initialize Warden
- sLog->outString("Loading Warden Checks..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks...");
sWardenCheckMgr->LoadWardenChecks();
- sLog->outString("Loading Warden Action Overrides..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides...");
sWardenCheckMgr->LoadWardenOverrides();
- sLog->outString("Deleting expired bans...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired bans...");
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
- sLog->outString("Calculate next daily quest reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time...");
InitDailyQuestResetTime();
- sLog->outString("Calculate next weekly quest reset time..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time...");
InitWeeklyQuestResetTime();
- sLog->outString("Calculate random battleground reset time..." );
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next monthly quest reset time...");
+ InitMonthlyQuestResetTime();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time...");
InitRandomBGResetTime();
- LoadCharacterNameData();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate Guild cap reset time...");
+ InitGuildResetTime();
- // possibly enable db logging; avoid massive startup spam by doing it here.
- if (sLog->GetLogDBLater())
- {
- sLog->outString("Enabling database logging...");
- sLog->SetLogDBLater(false);
- sLog->SetLogDB(true);
- }
- else
- sLog->SetLogDB(false);
+ LoadCharacterNameData();
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
- sLog->outString();
- sLog->outString("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
- sLog->outString();
+
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
+ sLog->EnableDBAppenders();
}
void World::DetectDBCLang()
@@ -1772,7 +1794,7 @@ void World::DetectDBCLang()
if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
{
- sLog->outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
m_lang_confid = LOCALE_enUS;
}
@@ -1800,14 +1822,14 @@ void World::DetectDBCLang()
if (default_locale >= TOTAL_LOCALES)
{
- sLog->outError("Unable to determine your DBC Locale! (corrupt DBC?)");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)");
exit(1);
}
m_defaultDbcLocale = LocaleConstant(default_locale);
- sLog->outString("Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
+
}
void World::RecordTimeDiff(const char *text, ...)
@@ -1830,7 +1852,7 @@ void World::RecordTimeDiff(const char *text, ...)
va_start(ap, text);
vsnprintf(str, 256, text, ap);
va_end(ap);
- sLog->outDetail("Difftime %s: %u.", str, diff);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Difftime %s: %u.", str, diff);
}
m_currentTime = thisTime;
@@ -1846,8 +1868,8 @@ void World::LoadAutobroadcasts()
if (!result)
{
- sLog->outString(">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
+
return;
}
@@ -1864,8 +1886,8 @@ void World::LoadAutobroadcasts()
++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
/// Update the World !
@@ -1877,7 +1899,7 @@ void World::Update(uint32 diff)
{
if (m_updateTimeSum > m_int_configs[CONFIG_INTERVAL_LOG_UPDATE])
{
- sLog->outBasic("Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Update time diff: %u. Players online: %u.", m_updateTimeSum / m_updateTimeCount, GetActiveSessionCount());
m_updateTimeSum = m_updateTime;
m_updateTimeCount = 1;
}
@@ -1907,12 +1929,20 @@ void World::Update(uint32 diff)
m_NextDailyQuestReset += DAY;
}
+ /// Handle weekly quests reset time
if (m_gameTime > m_NextWeeklyQuestReset)
ResetWeeklyQuests();
+ /// Handle monthly quests reset time
+ if (m_gameTime > m_NextMonthlyQuestReset)
+ ResetMonthlyQuests();
+
if (m_gameTime > m_NextRandomBGReset)
ResetRandomBG();
+ if (m_gameTime > m_NextGuildReset)
+ ResetGuildCap();
+
/// <ul><li> Handle auctions when the timer has passed
if (m_timers[WUPDATE_AUCTIONS].Passed())
{
@@ -1997,6 +2027,9 @@ void World::Update(uint32 diff)
sOutdoorPvPMgr->Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
+ sBattlefieldMgr->Update(diff);
+ RecordTimeDiff("BattlefieldMgr");
+
///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed())
{
@@ -2031,7 +2064,7 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_PINGDB].Passed())
{
m_timers[WUPDATE_PINGDB].Reset();
- sLog->outDetail("Ping MySQL to keep connection alive");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive");
CharacterDatabase.KeepAlive();
LoginDatabase.KeepAlive();
WorldDatabase.KeepAlive();
@@ -2251,7 +2284,7 @@ void World::KickAllLess(AccountTypes sec)
}
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
-BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author)
+BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author)
{
uint32 duration_secs = TimeStringToSecs(duration);
PreparedQueryResult resultAccounts = PreparedQueryResult(NULL); //used for kicking
@@ -2329,7 +2362,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string dura
}
/// Remove a ban from an account or IP address
-bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP)
+bool World::RemoveBanAccount(BanMode mode, std::string const& nameOrIP)
{
PreparedStatement* stmt = NULL;
if (mode == BAN_IP)
@@ -2358,9 +2391,9 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP)
}
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
-BanReturn World::BanCharacter(std::string name, std::string duration, std::string reason, std::string author)
+BanReturn World::BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author)
{
- Player* pBanned = sObjectAccessor->FindPlayerByName(name.c_str());
+ Player* pBanned = sObjectAccessor->FindPlayerByName(name);
uint32 guid = 0;
uint32 duration_secs = TimeStringToSecs(duration);
@@ -2399,9 +2432,9 @@ BanReturn World::BanCharacter(std::string name, std::string duration, std::strin
}
/// Remove a ban from a character
-bool World::RemoveBanCharacter(std::string name)
+bool World::RemoveBanCharacter(std::string const& name)
{
- Player* pBanned = sObjectAccessor->FindPlayerByName(name.c_str());
+ Player* pBanned = sObjectAccessor->FindPlayerByName(name);
uint32 guid = 0;
/// Pick a player to ban if not online
@@ -2505,7 +2538,7 @@ void World::ShutdownMsg(bool show, Player* player)
ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME;
SendServerMessage(msgid, str.c_str(), player);
- sLog->outStaticDebug("Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str());
+ sLog->outDebug(LOG_FILTER_GENERAL, "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str());
}
}
@@ -2523,7 +2556,7 @@ void World::ShutdownCancel()
m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
SendServerMessage(msgid);
- sLog->outStaticDebug("Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
+ sLog->outDebug(LOG_FILTER_GENERAL, "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));
sScriptMgr->OnShutdownCancel();
}
@@ -2579,7 +2612,7 @@ void World::ProcessCliCommands()
CliCommandHolder* command = NULL;
while (cliCmdQueue.next(command))
{
- sLog->outDetail("CLI command under processing...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "CLI command under processing...");
zprint = command->m_print;
callbackArg = command->m_callbackArg;
CliHandler handler(callbackArg, zprint);
@@ -2620,7 +2653,7 @@ void World::SendAutoBroadcast()
sWorld->SendGlobalMessage(&data);
}
- sLog->outDetail("AutoBroadcast: '%s'", msg.c_str());
+ sLog->outDebug(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str());
}
void World::UpdateRealmCharCount(uint32 accountId)
@@ -2693,6 +2726,13 @@ void World::InitDailyQuestResetTime()
m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime;
}
+void World::InitMonthlyQuestResetTime()
+{
+ time_t wstime = uint64(sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME));
+ time_t curtime = time(NULL);
+ m_NextMonthlyQuestReset = wstime < curtime ? curtime : time_t(wstime);
+}
+
void World::InitRandomBGResetTime()
{
time_t bgtime = uint64(sWorld->getWorldState(WS_BG_DAILY_RESET_TIME));
@@ -2720,9 +2760,36 @@ void World::InitRandomBGResetTime()
sWorld->setWorldState(WS_BG_DAILY_RESET_TIME, uint64(m_NextRandomBGReset));
}
+void World::InitGuildResetTime()
+{
+ time_t gtime = uint64(getWorldState(WS_GUILD_DAILY_RESET_TIME));
+ if (!gtime)
+ m_NextGuildReset = time_t(time(NULL)); // game time not yet init
+
+ // generate time by config
+ time_t curTime = time(NULL);
+ tm localTm = *localtime(&curTime);
+ localTm.tm_hour = getIntConfig(CONFIG_GUILD_RESET_HOUR);
+ localTm.tm_min = 0;
+ localTm.tm_sec = 0;
+
+ // current day reset time
+ time_t nextDayResetTime = mktime(&localTm);
+
+ // next reset time before current moment
+ if (curTime >= nextDayResetTime)
+ nextDayResetTime += DAY;
+
+ // normalize reset time
+ m_NextGuildReset = gtime < curTime ? nextDayResetTime - DAY : nextDayResetTime;
+
+ if (!gtime)
+ sWorld->setWorldState(WS_GUILD_DAILY_RESET_TIME, uint64(m_NextGuildReset));
+}
+
void World::ResetDailyQuests()
{
- sLog->outDetail("Daily quests reset for all characters.");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Daily quests reset for all characters.");
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_DAILY);
CharacterDatabase.Execute(stmt);
@@ -2756,6 +2823,8 @@ void World::SetPlayerSecurityLimit(AccountTypes _sec)
void World::ResetWeeklyQuests()
{
+ sLog->outInfo(LOG_FILTER_GENERAL, "Weekly quests reset for all characters.");
+
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_WEEKLY);
CharacterDatabase.Execute(stmt);
@@ -2770,6 +2839,57 @@ void World::ResetWeeklyQuests()
sPoolMgr->ChangeWeeklyQuests();
}
+void World::ResetMonthlyQuests()
+{
+ sLog->outInfo(LOG_FILTER_GENERAL, "Monthly quests reset for all characters.");
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY);
+ CharacterDatabase.Execute(stmt);
+
+ for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ if (itr->second->GetPlayer())
+ itr->second->GetPlayer()->ResetMonthlyQuestStatus();
+
+ time_t mostRecentQuestTime = 0;
+
+ // generate time
+ time_t curTime = time(NULL);
+ tm localTm = *localtime(&curTime);
+
+ int month = localTm.tm_mon;
+ int year = localTm.tm_year;
+
+ ++month;
+
+ // month 11 is december, next is january (0)
+ if (month > 11)
+ {
+ month = 0;
+ year += 1;
+ }
+
+ // reset time for next month
+ localTm.tm_year = year;
+ localTm.tm_mon = month;
+ localTm.tm_mday = 1; // don't know if we really need config option for day / hour
+ localTm.tm_hour = 0;
+ localTm.tm_min = 0;
+ localTm.tm_sec = 0;
+
+ 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;
+
+ sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(m_NextMonthlyQuestReset));
+}
+
void World::ResetEventSeasonalQuests(uint16 event_id)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_SEASONAL);
@@ -2783,7 +2903,7 @@ void World::ResetEventSeasonalQuests(uint16 event_id)
void World::ResetRandomBG()
{
- sLog->outDetail("Random BG status reset for all characters.");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Random BG status reset for all characters.");
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_BATTLEGROUND_RANDOM);
CharacterDatabase.Execute(stmt);
@@ -2796,6 +2916,15 @@ void World::ResetRandomBG()
sWorld->setWorldState(WS_BG_DAILY_RESET_TIME, uint64(m_NextRandomBGReset));
}
+void World::ResetGuildCap()
+{
+ sLog->outInfo(LOG_FILTER_GENERAL, "Guild Daily Cap reset.");
+
+ m_NextGuildReset = time_t(m_NextGuildReset + DAY);
+ sWorld->setWorldState(WS_GUILD_DAILY_RESET_TIME, uint64(m_NextGuildReset));
+ sGuildMgr->ResetTimes();
+}
+
void World::UpdateMaxSessionCounters()
{
m_maxActiveSessionCount = std::max(m_maxActiveSessionCount, uint32(m_sessions.size()-m_QueuedPlayer.size()));
@@ -2847,8 +2976,8 @@ void World::LoadWorldStates()
if (!result)
{
- sLog->outString(">> Loaded 0 world states. DB table `worldstates` is empty!");
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!");
+
return;
}
@@ -2862,8 +2991,8 @@ void World::LoadWorldStates()
}
while (result->NextRow());
- sLog->outString(">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
- sLog->outString();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+
}
// Setting a worldstate will save it to DB
@@ -2919,12 +3048,12 @@ void World::ProcessQueryCallbacks()
void World::LoadCharacterNameData()
{
- sLog->outString("Loading character name data");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data");
- QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL");
+ QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class, level FROM characters WHERE deleteDate IS NULL");
if (!result)
{
- sLog->outError("No character name data loaded, empty query");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "No character name data loaded, empty query");
return;
}
@@ -2934,20 +3063,21 @@ void World::LoadCharacterNameData()
{
Field* fields = result->Fetch();
AddCharacterNameData(fields[0].GetUInt32(), fields[1].GetString(),
- fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/);
+ fields[3].GetUInt8() /*gender*/, fields[2].GetUInt8() /*race*/, fields[4].GetUInt8() /*class*/, fields[5].GetUInt8() /*level*/);
++count;
} while (result->NextRow());
- sLog->outString("Loaded name data for %u characters", count);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count);
}
-void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass)
+void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level)
{
CharacterNameData& data = _characterNameDataMap[guid];
data.m_name = name;
data.m_race = race;
data.m_gender = gender;
data.m_class = playerClass;
+ data.m_level = level;
}
void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8 gender /*= GENDER_NONE*/, uint8 race /*= RACE_NONE*/)
@@ -2965,6 +3095,15 @@ void World::UpdateCharacterNameData(uint32 guid, std::string const& name, uint8
itr->second.m_race = race;
}
+void World::UpdateCharacterNameDataLevel(uint32 guid, uint8 level)
+{
+ std::map<uint32, CharacterNameData>::iterator itr = _characterNameDataMap.find(guid);
+ if (itr == _characterNameDataMap.end())
+ return;
+
+ itr->second.m_level = level;
+}
+
CharacterNameData const* World::GetCharacterNameData(uint32 guid) const
{
std::map<uint32, CharacterNameData>::const_iterator itr = _characterNameDataMap.find(guid);
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index f0dbc3c84ad..1ac9b153dfd 100755..100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -55,14 +55,14 @@ enum ServerMessageType
enum ShutdownMask
{
SHUTDOWN_MASK_RESTART = 1,
- SHUTDOWN_MASK_IDLE = 2,
+ SHUTDOWN_MASK_IDLE = 2
};
enum ShutdownExitCode
{
SHUTDOWN_EXIT_CODE = 0,
ERROR_EXIT_CODE = 1,
- RESTART_EXIT_CODE = 2,
+ RESTART_EXIT_CODE = 2
};
/// Timers for different object refresh rates
@@ -91,6 +91,7 @@ enum WorldBoolConfigs
CONFIG_GRID_UNLOAD,
CONFIG_STATS_SAVE_ONLY_ON_LOGOUT,
CONFIG_ALLOW_TWO_SIDE_ACCOUNTS,
+ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL,
CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP,
@@ -154,7 +155,6 @@ enum WorldBoolConfigs
CONFIG_CHATLOG_PUBLIC,
CONFIG_CHATLOG_ADDON,
CONFIG_CHATLOG_BGROUND,
- CONFIG_DUNGEON_FINDER_ENABLE,
CONFIG_AUTOBROADCAST,
CONFIG_ALLOW_TICKETS,
CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES,
@@ -164,6 +164,7 @@ enum WorldBoolConfigs
CONFIG_QUEST_IGNORE_AUTO_ACCEPT,
CONFIG_QUEST_IGNORE_AUTO_COMPLETE,
CONFIG_WARDEN_ENABLED,
+ CONFIG_WINTERGRASP_ENABLE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -302,6 +303,7 @@ enum WorldIntConfigs
CONFIG_GUILD_BANK_EVENT_LOG_COUNT,
CONFIG_MIN_LEVEL_STAT_SAVE,
CONFIG_RANDOM_BG_RESET_HOUR,
+ CONFIG_GUILD_RESET_HOUR,
CONFIG_CHARDELETE_KEEP_DAYS,
CONFIG_CHARDELETE_METHOD,
CONFIG_CHARDELETE_MIN_LEVEL,
@@ -311,6 +313,7 @@ enum WorldIntConfigs
CONFIG_DB_PING_INTERVAL,
CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION,
CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS,
+ CONFIG_LFG_OPTIONSMASK,
CONFIG_MAX_INSTANCES_PER_HOUR,
CONFIG_WARDEN_CLIENT_RESPONSE_DELAY,
CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF,
@@ -318,6 +321,12 @@ enum WorldIntConfigs
CONFIG_WARDEN_CLIENT_BAN_DURATION,
CONFIG_WARDEN_NUM_MEM_CHECKS,
CONFIG_WARDEN_NUM_OTHER_CHECKS,
+ CONFIG_WINTERGRASP_PLR_MAX,
+ CONFIG_WINTERGRASP_PLR_MIN,
+ CONFIG_WINTERGRASP_PLR_MIN_LVL,
+ CONFIG_WINTERGRASP_BATTLETIME,
+ CONFIG_WINTERGRASP_NOBATTLETIME,
+ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH,
INT_CONFIG_VALUE_COUNT
};
@@ -401,18 +410,18 @@ enum BillingPlanFlags
SESSION_USAGE = 0x10,
SESSION_TIME_MIXTURE = 0x20,
SESSION_RESTRICTED = 0x40,
- SESSION_ENABLE_CAIS = 0x80,
+ SESSION_ENABLE_CAIS = 0x80
};
/// Type of server, this is values from second column of Cfg_Configs.dbc
enum RealmType
{
- REALM_TYPE_NORMAL = 0,
- REALM_TYPE_PVP = 1,
- REALM_TYPE_NORMAL2 = 4,
- REALM_TYPE_RP = 6,
- REALM_TYPE_RPPVP = 8,
- REALM_TYPE_FFA_PVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
+ REALM_TYPE_NORMAL = 0,
+ REALM_TYPE_PVP = 1,
+ REALM_TYPE_NORMAL2 = 4,
+ REALM_TYPE_RP = 6,
+ REALM_TYPE_RPPVP = 8,
+ REALM_TYPE_FFA_PVP = 16 // custom, free for all pvp mode like arena PvP in all zones except rest activated places and sanctuaries
// replaced by REALM_PVP in realm list
};
@@ -460,43 +469,10 @@ enum RealmZone
enum WorldStates
{
- WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly reset time
- WS_BG_DAILY_RESET_TIME = 20003 // Next daily BG reset time
-};
-
-// DB scripting commands
-enum ScriptCommands
-{
- SCRIPT_COMMAND_TALK = 0, // source/target = Creature, target = any, datalong = talk type (0=say, 1=whisper, 2=yell, 3=emote text, 4=boss emote text), datalong2 & 1 = player talk (instead of creature), dataint = string_id
- SCRIPT_COMMAND_EMOTE = 1, // source/target = Creature, datalong = emote id, datalong2 = 0: set emote state; > 0: play emote state
- SCRIPT_COMMAND_FIELD_SET = 2, // source/target = Creature, datalong = field id, datalog2 = value
- SCRIPT_COMMAND_MOVE_TO = 3, // source/target = Creature, datalong2 = time to reach, x/y/z = destination
- SCRIPT_COMMAND_FLAG_SET = 4, // source/target = Creature, datalong = field id, datalog2 = bitmask
- SCRIPT_COMMAND_FLAG_REMOVE = 5, // source/target = Creature, datalong = field id, datalog2 = bitmask
- SCRIPT_COMMAND_TELEPORT_TO = 6, // source/target = Creature/Player (see datalong2), datalong = map_id, datalong2 = 0: Player; 1: Creature, x/y/z = destination, o = orientation
- SCRIPT_COMMAND_QUEST_EXPLORED = 7, // target/source = Player, target/source = GO/Creature, datalong = quest id, datalong2 = distance or 0
- SCRIPT_COMMAND_KILL_CREDIT = 8, // target/source = Player, datalong = creature entry, datalong2 = 0: personal credit, 1: group credit
- SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = WorldObject (summoner), datalong = GO guid, datalong2 = despawn delay
- SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = WorldObject (summoner), datalong = creature entry, datalong2 = despawn delay, x/y/z = summon position, o = orientation
- SCRIPT_COMMAND_OPEN_DOOR = 11, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15)
- SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15)
- SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = Unit, target = GO
- SCRIPT_COMMAND_REMOVE_AURA = 14, // source (datalong2 != 0) or target (datalong2 == 0) = Unit, datalong = spell id
- SCRIPT_COMMAND_CAST_SPELL = 15, // source and/or target = Unit, datalong2 = cast direction (0: s->t 1: s->s 2: t->t 3: t->s 4: s->creature with dataint entry), dataint & 1 = triggered flag
- SCRIPT_COMMAND_PLAY_SOUND = 16, // source = WorldObject, target = none/Player, datalong = sound id, datalong2 (bitmask: 0/1=anyone/player, 0/2=without/with distance dependency, so 1|2 = 3 is target with distance dependency)
- SCRIPT_COMMAND_CREATE_ITEM = 17, // target/source = Player, datalong = item entry, datalong2 = amount
- SCRIPT_COMMAND_DESPAWN_SELF = 18, // target/source = Creature, datalong = despawn delay
-
- SCRIPT_COMMAND_LOAD_PATH = 20, // source = Unit, datalong = path id, datalong2 = is repeatable
- SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT = 21, // source = WorldObject (if present used as a search center), datalong = script id, datalong2 = unit lowguid, dataint = script table to use (see ScriptsType)
- SCRIPT_COMMAND_KILL = 22, // source/target = Creature, dataint = remove corpse attribute
-
- // TrinityCore only
- SCRIPT_COMMAND_ORIENTATION = 30, // source = Unit, target (datalong > 0) = Unit, datalong = > 0 turn source to face target, o = orientation
- SCRIPT_COMMAND_EQUIP = 31, // soucre = Creature, datalong = equipment id
- SCRIPT_COMMAND_MODEL = 32, // source = Creature, datalong = model id
- SCRIPT_COMMAND_CLOSE_GOSSIP = 33, // source = Player
- SCRIPT_COMMAND_PLAYMOVIE = 34 // source = Player, datalong = movie id
+ WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly reset time
+ WS_BG_DAILY_RESET_TIME = 20003, // Next daily BG reset time
+ WS_MONTHLY_QUEST_RESET_TIME = 20004, // Next monthly reset time
+ WS_GUILD_DAILY_RESET_TIME = 20006, // Next guild cap reset time
};
/// Storage class for commands issued for delayed execution
@@ -530,6 +506,7 @@ struct CharacterNameData
uint8 m_class;
uint8 m_race;
uint8 m_gender;
+ uint8 m_level;
};
/// The World
@@ -596,19 +573,19 @@ class World
void SetAllowMovement(bool allow) { m_allowMovement = allow; }
/// Set a new Message of the Day
- void SetMotd(const std::string& motd);
+ void SetMotd(std::string const& motd);
/// Get the current Message of the Day
const char* GetMotd() const;
/// Set the string for new characters (first login)
- void SetNewCharString(std::string str) { m_newCharString = str; }
+ void SetNewCharString(std::string const& str) { m_newCharString = str; }
/// Get the string for new characters (first login)
- const std::string& GetNewCharString() const { return m_newCharString; }
+ std::string const& GetNewCharString() const { return m_newCharString; }
LocaleConstant GetDefaultDbcLocale() const { return m_defaultDbcLocale; }
/// Get the path where data (dbc, maps) are stored on disk
- std::string GetDataPath() const { return m_dataPath; }
+ std::string const& GetDataPath() const { return m_dataPath; }
/// When server started?
time_t const& GetStartTime() const { return m_startTime; }
@@ -711,10 +688,10 @@ class World
void KickAll();
void KickAllLess(AccountTypes sec);
- BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
- bool RemoveBanAccount(BanMode mode, std::string nameOrIP);
- BanReturn BanCharacter(std::string name, std::string duration, std::string reason, std::string author);
- bool RemoveBanCharacter(std::string name);
+ BanReturn BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author);
+ bool RemoveBanAccount(BanMode mode, std::string const& nameOrIP);
+ BanReturn BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author);
+ bool RemoveBanCharacter(std::string const& name);
// for max speed access
static float GetMaxVisibleDistanceOnContinents() { return m_MaxVisibleDistanceOnContinents; }
@@ -751,8 +728,9 @@ class World
bool isEventKillStart;
CharacterNameData const* GetCharacterNameData(uint32 guid) const;
- void AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass);
+ 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); }
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
@@ -765,10 +743,14 @@ class World
void InitDailyQuestResetTime();
void InitWeeklyQuestResetTime();
+ void InitMonthlyQuestResetTime();
void InitRandomBGResetTime();
+ void InitGuildResetTime();
void ResetDailyQuests();
void ResetWeeklyQuests();
+ void ResetMonthlyQuests();
void ResetRandomBG();
+ void ResetGuildCap();
private:
static ACE_Atomic_Op<ACE_Thread_Mutex, bool> m_stopEvent;
static uint8 m_ExitCode;
@@ -828,7 +810,9 @@ class World
// next daily quests and random bg reset time
time_t m_NextDailyQuestReset;
time_t m_NextWeeklyQuestReset;
+ time_t m_NextMonthlyQuestReset;
time_t m_NextRandomBGReset;
+ time_t m_NextGuildReset;
//Player Queue
Queue m_QueuedPlayer;
diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt
index 792fdeb3e7b..8e636ee1208 100644
--- a/src/server/scripts/CMakeLists.txt
+++ b/src/server/scripts/CMakeLists.txt
@@ -9,18 +9,11 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Enable precompiled headers when using the GCC compiler.
-if( USE_SCRIPTPCH )
- include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}
- )
-endif()
-if( USE_SCRIPTPCH AND MSVC )
- set(scripts_STAT_SRCS
- PrecompiledHeaders/ScriptPCH.cpp
- PrecompiledHeaders/ScriptPCH.h
- )
-endif()
+if (USE_SCRIPTPCH)
+ set(scripts_STAT_PCH_HDR PrecompiledHeaders/ScriptPCH.h)
+ set(scripts_STAT_PCH_SRC PrecompiledHeaders/ScriptPCH.cpp)
+endif ()
message(STATUS "SCRIPT PREPARATIONS")
include(Spells/CMakeLists.txt)
@@ -44,6 +37,7 @@ if(SCRIPTS)
include(Kalimdor/CMakeLists.txt)
include(Outland/CMakeLists.txt)
include(Northrend/CMakeLists.txt)
+ include(Events/CMakeLists.txt)
endif()
message(STATUS "SCRIPT PREPARATION COMPLETE")
@@ -80,6 +74,8 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/AI/ScriptedAI
${CMAKE_SOURCE_DIR}/src/server/game/AI/SmartScripts
${CMAKE_SOURCE_DIR}/src/server/game/AuctionHouse
+ ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield
+ ${CMAKE_SOURCE_DIR}/src/server/game/Battlefield/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds
${CMAKE_SOURCE_DIR}/src/server/game/Battlegrounds/Zones
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
@@ -145,15 +141,14 @@ include_directories(
${MYSQL_INCLUDE_DIR}
)
-add_library(scripts STATIC ${scripts_STAT_SRCS})
+add_library(scripts STATIC
+ ${scripts_STAT_SRCS}
+ ${scripts_STAT_PCH_SRC}
+)
add_dependencies(scripts revision.h)
# Generate precompiled header
-if( USE_SCRIPTPCH )
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_precompiled_header(scripts ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/ScriptPCH.h)
- elseif(MSVC)
- add_native_precompiled_header(scripts ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/ScriptPCH)
- endif()
+if (USE_SCRIPTPCH)
+ add_cxx_pch(scripts ${scripts_STAT_PCH_HDR} ${scripts_STAT_PCH_SRC})
endif()
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index 915d94c420c..a65324a9f42 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -13,9 +13,12 @@ set(scripts_STAT_SRCS
Commands/cs_account.cpp
Commands/cs_achievement.cpp
Commands/cs_ban.cpp
+ Commands/cs_bf.cpp
Commands/cs_cast.cpp
Commands/cs_character.cpp
+ Commands/cs_cheat.cpp
Commands/cs_debug.cpp
+ Commands/cs_disable.cpp
Commands/cs_event.cpp
Commands/cs_gm.cpp
Commands/cs_go.cpp
@@ -24,8 +27,10 @@ set(scripts_STAT_SRCS
Commands/cs_honor.cpp
Commands/cs_instance.cpp
Commands/cs_learn.cpp
+ Commands/cs_lfg.cpp
Commands/cs_list.cpp
Commands/cs_lookup.cpp
+ Commands/cs_message.cpp
Commands/cs_misc.cpp
Commands/cs_modify.cpp
Commands/cs_npc.cpp
@@ -33,13 +38,13 @@ set(scripts_STAT_SRCS
Commands/cs_reload.cpp
Commands/cs_reset.cpp
Commands/cs_tele.cpp
+ Commands/cs_ticket.cpp
Commands/cs_server.cpp
Commands/cs_titles.cpp
Commands/cs_wp.cpp
# Commands/cs_pdump.cpp
# Commands/cs_channel.cpp
# Commands/cs_pet.cpp
-# Commands/cs_ticket.cpp
# Commands/cs_aura.cpp
# Commands/cs_unaura.cpp
# Commands/cs_nameannounce.cpp
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index b52102479b5..9269bbb07ee 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -22,9 +22,11 @@ Comment: All account related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
#include "AccountMgr.h"
#include "Chat.h"
+#include "Language.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class account_commandscript : public CommandScript
{
@@ -38,7 +40,7 @@ public:
{ "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL },
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL },
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand accountCommandTable[] =
{
@@ -50,12 +52,12 @@ public:
{ "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable },
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL },
{ "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "account", SEC_PLAYER, true, NULL, "", accountCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
@@ -110,7 +112,11 @@ public:
case AOR_OK:
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
if (handler->GetSession())
- sLog->outChar("Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ {
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
+ handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
+ }
break;
case AOR_NAME_TOO_LONG:
handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
@@ -232,8 +238,8 @@ public:
}
else
handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str());
-
- } while (result->NextRow());
+ }
+ while (result->NextRow());
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR);
return true;
@@ -377,7 +383,6 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
}
// Let set addon state only for lesser (strong) security level
@@ -535,8 +540,8 @@ public:
///- Get the command line arguments
char* account = strtok((char*)args, " ");
- char* password = strtok(NULL, " ");
- char* passwordConfirmation = strtok(NULL, " ");
+ char* password = strtok(NULL, " ");
+ char* passwordConfirmation = strtok(NULL, " ");
if (!account || !password || !passwordConfirmation)
return false;
@@ -589,7 +594,6 @@ public:
handler->SetSentErrorMessage(true);
return false;
}
-
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp
index 7667e79ece7..9a84a4c4cbc 100644
--- a/src/server/scripts/Commands/cs_achievement.cpp
+++ b/src/server/scripts/Commands/cs_achievement.cpp
@@ -22,8 +22,11 @@ Comment: All achievement related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
+#include "AchievementMgr.h"
#include "Chat.h"
+#include "Language.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class achievement_commandscript : public CommandScript
{
@@ -67,7 +70,7 @@ public:
return false;
}
- if (AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievementId))
+ if (AchievementEntry const* achievementEntry = sAchievementMgr->GetAchievement(achievementId))
target->CompletedAchievement(achievementEntry);
return true;
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index b84a7e5544a..3d340f3aaea 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -22,11 +22,13 @@ Comment: All ban related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "Chat.h"
#include "AccountMgr.h"
+#include "Chat.h"
+#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class ban_commandscript : public CommandScript
{
@@ -107,7 +109,7 @@ public:
return false;
}
- switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : ""))
+ switch (sWorld->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
{
case BAN_SUCCESS:
{
@@ -183,7 +185,7 @@ public:
break;
}
- switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : ""))
+ switch (sWorld->BanAccount(mode, nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName().c_str() : ""))
{
case BAN_SUCCESS:
if (atoi(durationStr) > 0)
diff --git a/src/server/scripts/Commands/cs_bf.cpp b/src/server/scripts/Commands/cs_bf.cpp
new file mode 100644
index 00000000000..7284e6ad6b7
--- /dev/null
+++ b/src/server/scripts/Commands/cs_bf.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2008-2011 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: bf_commandscript
+%Complete: 100
+Comment: All bf related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "BattlefieldMgr.h"
+
+class bf_commandscript : public CommandScript
+{
+public:
+ bf_commandscript() : CommandScript("bf_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand battlefieldcommandTable[] =
+ {
+ { "start", SEC_ADMINISTRATOR, false, &HandleBattlefieldStart, "", NULL },
+ { "stop", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnd, "", NULL },
+ { "switch", SEC_ADMINISTRATOR, false, &HandleBattlefieldSwitch, "", NULL },
+ { "timer", SEC_ADMINISTRATOR, false, &HandleBattlefieldTimer, "", NULL },
+ { "enable", SEC_ADMINISTRATOR, false, &HandleBattlefieldEnable, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "bf", SEC_ADMINISTRATOR, false, NULL, "", battlefieldcommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleBattlefieldStart(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->StartBattle();
+
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command start used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldEnd(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->EndBattle(true);
+
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldEnable(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ if (bf->IsEnabled())
+ {
+ bf->ToggleBattlefield(false);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
+ }
+ else
+ {
+ bf->ToggleBattlefield(true);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
+ }
+
+ return true;
+ }
+
+ static bool HandleBattlefieldSwitch(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->EndBattle(false);
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
+
+ return true;
+ }
+
+ static bool HandleBattlefieldTimer(ChatHandler* handler, const char* args)
+ {
+ uint32 battleid = 0;
+ uint32 time = 0;
+ char* battleid_str = strtok((char*)args, " ");
+ if (!battleid_str)
+ return false;
+ char* time_str = strtok(NULL, " ");
+ if (!time_str)
+ return false;
+
+ battleid = atoi(battleid_str);
+
+ time = atoi(time_str);
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(battleid);
+
+ if (!bf)
+ return false;
+
+ bf->SetTimer(time * IN_MILLISECONDS);
+ bf->SendInitWorldStatesToAll();
+ if (battleid == 1)
+ handler->SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
+
+ return true;
+ }
+};
+
+void AddSC_bf_commandscript()
+{
+ new bf_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp
index 33983411427..7539ebd2b0c 100644
--- a/src/server/scripts/Commands/cs_cast.cpp
+++ b/src/server/scripts/Commands/cs_cast.cpp
@@ -24,6 +24,9 @@ EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
+#include "Creature.h"
+#include "Language.h"
+#include "Player.h"
class cast_commandscript : public CommandScript
{
@@ -33,7 +36,7 @@ public:
ChatCommand* GetCommands() const
{
static ChatCommand castCommandTable[] =
- {
+ {
{ "back", SEC_ADMINISTRATOR, false, &HandleCastBackCommand, "", NULL },
{ "dist", SEC_ADMINISTRATOR, false, &HandleCastDistCommand, "", NULL },
{ "self", SEC_ADMINISTRATOR, false, &HandleCastSelfCommand, "", NULL },
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index a40b586f8c8..f8db39e0338 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -22,10 +22,13 @@ Comment: All character related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "Chat.h"
#include "AccountMgr.h"
+#include "Chat.h"
#include "ObjectMgr.h"
+#include "PlayerDump.h"
+#include "Player.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
class character_commandscript : public CommandScript
{
@@ -34,6 +37,12 @@ public:
ChatCommand* GetCommands() const
{
+ static ChatCommand pdumpCommandTable[] =
+ {
+ { "load", SEC_ADMINISTRATOR, true, &HandlePDumpLoadCommand, "", NULL },
+ { "write", SEC_ADMINISTRATOR, true, &HandlePDumpWriteCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
static ChatCommand characterDeletedCommandTable[] =
{
{ "delete", SEC_CONSOLE, true, &HandleCharacterDeletedDeleteCommand, "", NULL },
@@ -48,7 +57,7 @@ public:
{ "customize", SEC_GAMEMASTER, true, &HandleCharacterCustomizeCommand, "", NULL },
{ "changefaction", SEC_GAMEMASTER, true, &HandleCharacterChangeFactionCommand, "", NULL },
{ "changerace", SEC_GAMEMASTER, true, &HandleCharacterChangeRaceCommand, "", NULL },
- { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable},
+ { "deleted", SEC_GAMEMASTER, true, NULL, "", characterDeletedCommandTable },
{ "erase", SEC_CONSOLE, true, &HandleCharacterEraseCommand, "", NULL },
{ "level", SEC_ADMINISTRATOR, true, &HandleCharacterLevelCommand, "", NULL },
{ "rename", SEC_GAMEMASTER, true, &HandleCharacterRenameCommand, "", NULL },
@@ -59,9 +68,11 @@ public:
static ChatCommand commandTable[] =
{
- { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable},
+ { "character", SEC_GAMEMASTER, true, NULL, "", characterCommandTable },
+ { "levelup", SEC_ADMINISTRATOR, false, &HandleLevelUpCommand, "", NULL },
+ { "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
{ NULL, 0, false, NULL, "", NULL }
- };
+ };
return commandTable;
}
@@ -103,14 +114,14 @@ public:
if (!normalizePlayerName(searchString))
return false;
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
- stmt->setString(0, searchString);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME);
+ stmt->setString(0, searchString);
result = CharacterDatabase.Query(stmt);
}
}
else
{
- stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO);
result = CharacterDatabase.Query(stmt);
}
@@ -128,7 +139,7 @@ public:
// account name will be empty for not existed account
AccountMgr::GetName(info.accountId, info.accountName);
- info.deleteDate = time_t(fields[3].GetUInt32());
+ info.deleteDate = time_t(fields[3].GetUInt32());
foundList.push_back(info);
}
while (result->NextRow());
@@ -215,7 +226,35 @@ public:
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA);
stmt->setUInt32(0, delInfo.lowGuid);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
- sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8());
+ sWorld->AddCharacterNameData(delInfo.lowGuid, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8());
+ }
+
+ static void HandleCharacterLevel(Player* player, uint64 playerGuid, uint32 oldLevel, uint32 newLevel, ChatHandler* handler)
+ {
+ if (player)
+ {
+ player->GiveLevel(newLevel);
+ player->InitTalentForLevel();
+ player->SetUInt32Value(PLAYER_XP, 0);
+
+ if (handler->needReportToTarget(player))
+ {
+ if (oldLevel == newLevel)
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_PROGRESS_RESET, handler->GetNameLink().c_str());
+ else if (oldLevel < newLevel)
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_UP, handler->GetNameLink().c_str(), newLevel);
+ else // if (oldlevel > newlevel)
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_LEVEL_DOWN, handler->GetNameLink().c_str(), newLevel);
+ }
+ }
+ else
+ {
+ // Update level and reset XP, everything else will be updated at login
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
+ stmt->setUInt8(0, uint8(newLevel));
+ stmt->setUInt32(1, GUID_LOPART(playerGuid));
+ CharacterDatabase.Execute(stmt);
+ }
}
static bool HandleCharacterTitlesCommand(ChatHandler* handler, char const* args)
@@ -228,7 +267,7 @@ public:
return false;
LocaleConstant loc = handler->GetSessionDbcLocale();
- char const* targetName = target->GetName();
+ char const* targetName = target->GetName().c_str();
char const* knownStr = handler->GetTrinityString(LANG_KNOWN);
// Search in CharTitles.dbc
@@ -326,7 +365,7 @@ public:
if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
newlevel = STRONG_MAX_LEVEL;
- handler->HandleCharacterLevel(target, targetGuid, oldlevel, newlevel);
+ HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including player == NULL
{
std::string nameLink = handler->playerLink(targetName);
@@ -644,7 +683,7 @@ public:
uint64 characterGuid;
uint32 accountId;
- Player* player = sObjectAccessor->FindPlayerByName(characterName.c_str());
+ Player* player = sObjectAccessor->FindPlayerByName(characterName);
if (player)
{
characterGuid = player->GetGUID();
@@ -671,6 +710,214 @@ public:
return true;
}
+
+ static bool HandleLevelUpCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* levelStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &levelStr);
+
+ // exception opt second arg: .character level $name
+ if (levelStr && isalpha(levelStr[0]))
+ {
+ nameStr = levelStr;
+ levelStr = NULL; // current level will used
+ }
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ int32 oldlevel = target ? target->getLevel() : Player::GetLevelFromDB(targetGuid);
+ int32 addlevel = levelStr ? atoi(levelStr) : 1;
+ int32 newlevel = oldlevel + addlevel;
+
+ if (newlevel < 1)
+ newlevel = 1;
+
+ if (newlevel > STRONG_MAX_LEVEL) // hardcoded maximum level
+ newlevel = STRONG_MAX_LEVEL;
+
+ HandleCharacterLevel(target, targetGuid, oldlevel, newlevel, handler);
+
+ if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) // including chr == NULL
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_YOU_CHANGE_LVL, nameLink.c_str(), newlevel);
+ }
+
+ return true;
+ }
+
+ static bool HandlePDumpLoadCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* fileStr = strtok((char*)args, " ");
+ if (!fileStr)
+ return false;
+
+ char* accountStr = strtok(NULL, " ");
+ if (!accountStr)
+ return false;
+
+ std::string accountName = accountStr;
+ if (!AccountMgr::normalizeString(accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 accountId = AccountMgr::GetId(accountName);
+ if (!accountId)
+ {
+ accountId = atoi(accountStr); // use original string
+ if (!accountId)
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!AccountMgr::GetName(accountId, accountName))
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ char* guidStr = NULL;
+ char* nameStr = strtok(NULL, " ");
+
+ std::string name;
+ if (nameStr)
+ {
+ name = nameStr;
+ // normalize the name if specified and check if it exists
+ if (!normalizePlayerName(name))
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (ObjectMgr::CheckPlayerName(name, true) != CHAR_NAME_SUCCESS)
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_NAME);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ guidStr = strtok(NULL, " ");
+ }
+
+ uint32 guid = 0;
+
+ if (guidStr)
+ {
+ guid = uint32(atoi(guidStr));
+ if (!guid)
+ {
+ handler->PSendSysMessage(LANG_INVALID_CHARACTER_GUID);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ {
+ handler->PSendSysMessage(LANG_CHARACTER_GUID_IN_USE, guid);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ switch (PlayerDumpReader().LoadDump(fileStr, accountId, name, guid))
+ {
+ case DUMP_SUCCESS:
+ handler->PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
+ break;
+ case DUMP_FILE_OPEN_ERROR:
+ handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_FILE_BROKEN:
+ handler->PSendSysMessage(LANG_DUMP_BROKEN, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_TOO_MANY_CHARS:
+ handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, accountName.c_str(), accountId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandlePDumpWriteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* fileStr = strtok((char*)args, " ");
+ char* playerStr = strtok(NULL, " ");
+
+ if (!fileStr || !playerStr)
+ return false;
+
+ uint64 guid;
+ // character name can't start from number
+ if (isNumeric(playerStr))
+ guid = MAKE_NEW_GUID(atoi(playerStr), 0, HIGHGUID_PLAYER);
+ else
+ {
+ std::string name = handler->extractPlayerNameFromLink(playerStr);
+ if (name.empty())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ guid = sObjectMgr->GetPlayerGUIDByName(name);
+ }
+
+ if (!sObjectMgr->GetPlayerAccountIdByGUID(guid))
+ {
+ handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ switch (PlayerDumpWriter().WriteDump(fileStr, uint32(guid)))
+ {
+ case DUMP_SUCCESS:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_SUCCESS);
+ break;
+ case DUMP_FILE_OPEN_ERROR:
+ handler->PSendSysMessage(LANG_FILE_OPEN_FAIL, fileStr);
+ handler->SetSentErrorMessage(true);
+ return false;
+ case DUMP_CHARACTER_DELETED:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
+ handler->SetSentErrorMessage(true);
+ return false;
+ default:
+ handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
};
void AddSC_character_commandscript()
diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp
new file mode 100644
index 00000000000..026177ece6d
--- /dev/null
+++ b/src/server/scripts/Commands/cs_cheat.cpp
@@ -0,0 +1,300 @@
+/*
+ * Copyright (C) 2008-2012 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: cheat_commandscript
+%Complete: 100
+Comment: All cheat related commands
+Category: commandscripts
+EndScriptData */
+
+#include "Chat.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+
+class cheat_commandscript : public CommandScript
+{
+public:
+ cheat_commandscript() : CommandScript("cheat_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+
+ static ChatCommand cheatCommandTable[] =
+ {
+ { "god", SEC_GAMEMASTER, false, &HandleGodModeCheatCommand, "", NULL },
+ { "casttime", SEC_GAMEMASTER, false, &HandleCasttimeCheatCommand, "", NULL },
+ { "cooldown", SEC_GAMEMASTER, false, &HandleCoolDownCheatCommand, "", NULL },
+ { "power", SEC_GAMEMASTER, false, &HandlePowerCheatCommand, "", NULL },
+ { "waterwalk", SEC_GAMEMASTER, false, &HandleWaterWalkCheatCommand, "", NULL },
+ { "status", SEC_GAMEMASTER, false, &HandleCheatStatusCommand, "", NULL },
+ { "taxi", SEC_GAMEMASTER, false, &HandleTaxiCheatCommand, "", NULL },
+ { "explore", SEC_GAMEMASTER, false, &HandleExploreCheatCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "cheat", SEC_GAMEMASTER, false, NULL, "", cheatCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleGodModeCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_GOD)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_GOD);
+ handler->SendSysMessage("Godmode is OFF. You can take damage.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_GOD);
+ handler->SendSysMessage("Godmode is ON. You won't take damage.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleCasttimeCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_CASTTIME)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_CASTTIME);
+ handler->SendSysMessage("CastTime Cheat is OFF. Your spells will have a casttime.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_CASTTIME);
+ handler->SendSysMessage("CastTime Cheat is ON. Your spells won't have a casttime.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleCoolDownCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_COOLDOWN)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_COOLDOWN);
+ handler->SendSysMessage("Cooldown Cheat is OFF. You are on the global cooldown.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_COOLDOWN);
+ handler->SendSysMessage("Cooldown Cheat is ON. You are not on the global cooldown.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandlePowerCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_POWER)) ? "off" : "on";
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_POWER);
+ handler->SendSysMessage("Power Cheat is OFF. You need mana/rage/energy to use spells.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_POWER);
+ handler->SendSysMessage("Power Cheat is ON. You don't need mana/rage/energy to use spells.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleCheatStatusCommand(ChatHandler* handler, const char* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ const char* enabled = "enabled";
+ const char* disabled = "disabled";
+
+ handler->SendSysMessage(LANG_COMMAND_CHEAT_STATUS);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_GOD, player->GetCommandStatus(CHEAT_GOD) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_CD, player->GetCommandStatus(CHEAT_COOLDOWN) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_CT, player->GetCommandStatus(CHEAT_CASTTIME) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_POWER, player->GetCommandStatus(CHEAT_POWER) ? enabled : disabled);
+ handler->PSendSysMessage(LANG_COMMAND_CHEAT_WW, player->GetCommandStatus(CHEAT_WATERWALK) ? enabled : disabled);
+ return true;
+ }
+
+ static bool HandleWaterWalkCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!handler->GetSession() && !handler->GetSession()->GetPlayer())
+ return false;
+
+ std::string argstr = (char*)args;
+
+ if (!*args)
+ {
+ argstr = (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK)) ? "off" : "on";
+ if (handler->GetSession()->GetPlayer()->GetCommandStatus(CHEAT_WATERWALK))
+ argstr = "off";
+ else
+ argstr = "on";
+ }
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_WATERWALK);
+ handler->GetSession()->GetPlayer()->SetMovement(MOVE_LAND_WALK); // OFF
+ handler->SendSysMessage("Waterwalking is OFF. You can't walk on water.");
+ return true;
+ }
+ else if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_WATERWALK);
+ handler->GetSession()->GetPlayer()->SetMovement(MOVE_WATER_WALK); // ON
+ handler->SendSysMessage("Waterwalking is ON. You can walk on water.");
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool HandleTaxiCheatCommand(ChatHandler* handler, const char* args)
+ {
+ if (!*args)
+ {
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argstr = (char*)args;
+
+ Player* chr = handler->getSelectedPlayer();
+
+ if (!chr)
+ chr = handler->GetSession()->GetPlayer();
+ else if (handler->HasLowerSecurity(chr, 0)) // check online security
+ return false;
+
+ if (argstr == "on")
+ {
+ chr->SetTaxiCheater(true);
+ handler->PSendSysMessage(LANG_YOU_GIVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, handler->GetNameLink().c_str());
+ return true;
+ }
+
+ if (argstr == "off")
+ {
+ chr->SetTaxiCheater(false);
+ handler->PSendSysMessage(LANG_YOU_REMOVE_TAXIS, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ static bool HandleExploreCheatCommand(ChatHandler* handler, const char *args)
+ {
+ if (!*args)
+ return false;
+
+ int flag = atoi((char*)args);
+
+ Player* chr = handler->getSelectedPlayer();
+ if (chr == NULL)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (flag != 0)
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_ALL, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_ALL, handler->GetNameLink().c_str());
+ }
+ else
+ {
+ handler->PSendSysMessage(LANG_YOU_SET_EXPLORE_NOTHING, handler->GetNameLink(chr).c_str());
+ if (handler->needReportToTarget(chr))
+ ChatHandler(chr->GetSession()).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING, handler->GetNameLink().c_str());
+ }
+
+ for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
+ {
+ if (flag != 0)
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
+ else
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
+ }
+
+ return true;
+ }
+};
+
+void AddSC_cheat_commandscript()
+{
+ new cheat_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index c7bcde01e9b..956d9ac3376 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -31,6 +31,7 @@ EndScriptData */
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "GossipDef.h"
+#include "Language.h"
#include <fstream>
@@ -410,14 +411,14 @@ public:
}
else
{
- sLog->outError("Sending opcode that has unknown type '%s'", type.c_str());
+ sLog->outError(LOG_FILTER_GENERAL, "Sending opcode that has unknown type '%s'", type.c_str());
break;
}
}
sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending opcode %u", data.GetOpcode());
data.hexlike();
player->GetSession()->SendPacket(&data);
- handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName());
+ handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str());
return true;
}
@@ -496,7 +497,9 @@ public:
if (!target)
return false;
- handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", target->GetName(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient");
+ handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s",
+ target->GetName().c_str(), target->GetGUIDLow(), target->GetDBTableGUIDLow(),
+ target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient");
return true;
}
@@ -796,17 +799,17 @@ public:
if (!target || target->isTotem() || target->isPet())
return false;
- std::list<HostileReference*>& threatList = target->getThreatManager().getThreatList();
- std::list<HostileReference*>::iterator itr;
+ ThreatContainer::StorageType const &threatList = target->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator itr;
uint32 count = 0;
- handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName(), target->GetGUIDLow());
+ handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName().c_str(), target->GetGUIDLow());
for (itr = threatList.begin(); itr != threatList.end(); ++itr)
{
Unit* unit = (*itr)->getTarget();
if (!unit)
continue;
++count;
- handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat());
+ handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUIDLow(), (*itr)->getThreat());
}
handler->SendSysMessage("End of threat list.");
return true;
@@ -819,13 +822,13 @@ public:
target = handler->GetSession()->GetPlayer();
HostileReference* ref = target->getHostileRefManager().getFirst();
uint32 count = 0;
- handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName(), target->GetGUIDLow());
+ handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName().c_str(), target->GetGUIDLow());
while (ref)
{
if (Unit* unit = ref->getSource()->getOwner())
{
++count;
- handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), ref->getThreat());
+ handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat());
}
ref = ref->next();
}
@@ -1047,7 +1050,7 @@ public:
static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/)
{
if (Unit* unit = handler->getSelectedUnit())
- handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not ");
+ handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName().c_str(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not ");
return true;
}
@@ -1325,7 +1328,7 @@ public:
{
Player* player = handler->GetSession()->GetPlayer();
- sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+ sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
return true;
diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp
new file mode 100644
index 00000000000..cf0b1f08e53
--- /dev/null
+++ b/src/server/scripts/Commands/cs_disable.cpp
@@ -0,0 +1,375 @@
+/*
+ * Copyright (C) 2008-2012 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: disable_commandscript
+%Complete: 100
+Comment: All disable related commands
+Category: commandscripts
+EndScriptData */
+
+#include "DisableMgr.h"
+#include "AchievementMgr.h"
+#include "Chat.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+#include "OutdoorPvP.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "SpellMgr.h"
+
+class disable_commandscript : public CommandScript
+{
+public:
+ disable_commandscript() : CommandScript("disable_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand removeDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleRemoveDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleRemoveDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleRemoveDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleRemoveDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleRemoveDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleRemoveDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleRemoveDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand addDisableCommandTable[] =
+ {
+ { "spell", SEC_ADMINISTRATOR, true, &HandleAddDisableSpellCommand, "", NULL },
+ { "quest", SEC_ADMINISTRATOR, true, &HandleAddDisableQuestCommand, "", NULL },
+ { "map", SEC_ADMINISTRATOR, true, &HandleAddDisableMapCommand, "", NULL },
+ { "battleground", SEC_ADMINISTRATOR, true, &HandleAddDisableBattlegroundCommand, "", NULL },
+ { "achievement_criteria", SEC_ADMINISTRATOR, true, &HandleAddDisableAchievementCriteriaCommand, "", NULL },
+ { "outdoorpvp", SEC_ADMINISTRATOR, true, &HandleAddDisableOutdoorPvPCommand, "", NULL },
+ { "vmap", SEC_ADMINISTRATOR, true, &HandleAddDisableVmapCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand disableCommandTable[] =
+ {
+ { "add", SEC_ADMINISTRATOR, true, NULL, "", addDisableCommandTable },
+ { "remove", SEC_ADMINISTRATOR, true, NULL, "", removeDisableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "disable", SEC_ADMINISTRATOR, false, NULL, "", disableCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleAddDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ char* flagsStr = strtok(NULL, " ");
+ uint8 flags = flagsStr ? uint8(atoi(flagsStr)) : 0;
+
+ char* commentStr = strtok(NULL, "");
+ if (!commentStr)
+ return false;
+
+ std::string disableComment = commentStr;
+ uint32 entry = uint32(atoi(entryStr));
+
+ std::string disableTypeStr = "";
+
+ switch (disableType)
+ {
+ case DISABLE_TYPE_SPELL:
+ {
+ if (!sSpellMgr->GetSpellInfo(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "spell";
+ break;
+ }
+ case DISABLE_TYPE_QUEST:
+ {
+ if (!sObjectMgr->GetQuestTemplate(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "quest";
+ break;
+ }
+ case DISABLE_TYPE_MAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "map";
+ break;
+ }
+ case DISABLE_TYPE_BATTLEGROUND:
+ {
+ if (!sBattlemasterListStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_BATTLEGROUND_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "battleground";
+ break;
+ }
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ {
+ if (!sAchievementMgr->GetAchievementCriteria(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "achievement criteria";
+ break;
+ }
+ case DISABLE_TYPE_OUTDOORPVP:
+ {
+ if (entry > MAX_OUTDOORPVP_TYPES)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NO_OUTDOOR_PVP_FORUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "outdoorpvp";
+ break;
+ }
+ case DISABLE_TYPE_VMAP:
+ {
+ if (!sMapStore.LookupEntry(entry))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_NOMAPFOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ disableTypeStr = "vmap";
+ break;
+ }
+ default:
+ break;
+ }
+
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (result)
+ {
+ handler->PSendSysMessage("This %s (Id: %u) is already disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ stmt->setUInt16(2, flags);
+ stmt->setString(3, disableComment);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Add Disabled %s (Id: %u) for reason %s", disableTypeStr.c_str(), entry, disableComment.c_str());
+ return true;
+ }
+
+ static bool HandleAddDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleAddDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleAddDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleAddDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleAddDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleAddDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ HandleAddDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ return true;
+ }
+
+ static bool HandleAddDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+
+ static bool HandleRemoveDisables(ChatHandler* handler, char const* args, uint8 disableType)
+ {
+ char* entryStr = strtok((char*)args, " ");
+ if (!entryStr || !atoi(entryStr))
+ return false;
+
+ uint32 entry = uint32(atoi(entryStr));
+
+ std::string disableTypeStr = "";
+
+ switch (disableType)
+ {
+ case DISABLE_TYPE_SPELL:
+ disableTypeStr = "spell";
+ break;
+ case DISABLE_TYPE_QUEST:
+ disableTypeStr = "quest";
+ break;
+ case DISABLE_TYPE_MAP:
+ disableTypeStr = "map";
+ break;
+ case DISABLE_TYPE_BATTLEGROUND:
+ disableTypeStr = "battleground";
+ break;
+ case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
+ disableTypeStr = "achievement criteria";
+ break;
+ case DISABLE_TYPE_OUTDOORPVP:
+ disableTypeStr = "outdoorpvp";
+ break;
+ case DISABLE_TYPE_VMAP:
+ disableTypeStr = "vmap";
+ break;
+ }
+
+ PreparedStatement* stmt = NULL;
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->PSendSysMessage("This %s (Id: %u) is not disabled.", disableTypeStr.c_str(), entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_DISABLES);
+ stmt->setUInt32(0, entry);
+ stmt->setUInt8(1, disableType);
+ WorldDatabase.Execute(stmt);
+
+ handler->PSendSysMessage("Remove Disabled %s (Id: %u)", disableTypeStr.c_str(), entry);
+ return true;
+ }
+
+ static bool HandleRemoveDisableSpellCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_SPELL);
+ }
+
+ static bool HandleRemoveDisableQuestCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_QUEST);
+ }
+
+ static bool HandleRemoveDisableMapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleAddDisables(handler, args, DISABLE_TYPE_MAP);
+ }
+
+ static bool HandleRemoveDisableBattlegroundCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_BATTLEGROUND);
+ }
+
+ static bool HandleRemoveDisableAchievementCriteriaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_ACHIEVEMENT_CRITERIA);
+ }
+
+ static bool HandleRemoveDisableOutdoorPvPCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_OUTDOORPVP);
+ }
+
+ static bool HandleRemoveDisableVmapCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ return HandleRemoveDisables(handler, args, DISABLE_TYPE_VMAP);
+ }
+};
+
+void AddSC_disable_commandscript()
+{
+ new disable_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_event.cpp b/src/server/scripts/Commands/cs_event.cpp
index 4f6acd7b629..b0a646b7288 100644
--- a/src/server/scripts/Commands/cs_event.cpp
+++ b/src/server/scripts/Commands/cs_event.cpp
@@ -22,9 +22,11 @@ Comment: All event related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "GameEventMgr.h"
#include "Chat.h"
+#include "GameEventMgr.h"
+#include "Language.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class event_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp
index 3dfc6f9c7e8..b46f99eaa8f 100644
--- a/src/server/scripts/Commands/cs_gm.cpp
+++ b/src/server/scripts/Commands/cs_gm.cpp
@@ -26,7 +26,10 @@ EndScriptData */
#include "ObjectMgr.h"
#include "Chat.h"
#include "AccountMgr.h"
+#include "Language.h"
#include "World.h"
+#include "Player.h"
+#include "Opcodes.h"
class gm_commandscript : public CommandScript
{
@@ -133,16 +136,17 @@ public:
handler->SendSysMessage(LANG_GMS_ON_SRV);
handler->SendSysMessage("========================");
}
- char const* name = itr->second->GetName();
+ std::string const& name = itr->second->GetName();
+ uint8 size = name.size();
uint8 security = itrSec;
- uint8 max = ((16 - strlen(name)) / 2);
+ uint8 max = ((16 - size) / 2);
uint8 max2 = max;
- if ((max + max2 + strlen(name)) == 16)
+ if ((max + max2 + size) == 16)
max2 = max - 1;
if (handler->GetSession())
- handler->PSendSysMessage("| %s GMLevel %u", name, security);
+ handler->PSendSysMessage("| %s GMLevel %u", name.c_str(), security);
else
- handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name, max2, " ", security);
+ handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name.c_str(), max2, " ", security);
}
}
if (footer)
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index f7371884da2..6d75e63d053 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -27,6 +27,8 @@ EndScriptData */
#include "MapManager.h"
#include "TicketMgr.h"
#include "Chat.h"
+#include "Language.h"
+#include "Player.h"
class go_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 232aad9f21c..c9f07c90259 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -28,6 +28,9 @@ EndScriptData */
#include "PoolMgr.h"
#include "MapManager.h"
#include "Chat.h"
+#include "Language.h"
+#include "Player.h"
+#include "Opcodes.h"
class gobject_commandscript : public CommandScript
{
@@ -133,7 +136,7 @@ public:
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
{
// report to DB errors log as in loading case
- sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId);
+ sLog->outError(LOG_FILTER_SQL, "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId);
handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId);
handler->SetSentErrorMessage(true);
return false;
@@ -201,8 +204,8 @@ public:
float z = player->GetPositionZ();
float ang = player->GetOrientation();
- float rot2 = sin(ang/2);
- float rot3 = cos(ang/2);
+ float rot2 = std::sin(ang/2);
+ float rot3 = std::cos(ang/2);
uint32 objectId = atoi(id);
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index 65e3daaaebc..73955a6b9b2 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -22,11 +22,12 @@ Comment: All guild related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
#include "Chat.h"
+#include "Language.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "ObjectAccessor.h"
+#include "ScriptMgr.h"
class guild_commandscript : public CommandScript
{
@@ -51,7 +52,7 @@ public:
};
return commandTable;
}
-
+
/** \brief GM command level 3 - Create a guild.
*
* This command allows a GM (level 3) to create a guild.
diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp
index 4edc5f6fea0..c1d9229ccd3 100644
--- a/src/server/scripts/Commands/cs_honor.cpp
+++ b/src/server/scripts/Commands/cs_honor.cpp
@@ -22,9 +22,11 @@ Comment: All honor related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "Chat.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class honor_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
index f51727af2ef..ffd8a5a7cf7 100644
--- a/src/server/scripts/Commands/cs_instance.cpp
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
#include "MapManager.h"
+#include "Player.h"
class instance_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp
index ae573577d7e..9c383153d46 100644
--- a/src/server/scripts/Commands/cs_learn.cpp
+++ b/src/server/scripts/Commands/cs_learn.cpp
@@ -22,11 +22,14 @@ Comment: All learn related commands
Category: commandscripts
EndScriptData */
+#include "Chat.h"
#include "ScriptMgr.h"
#include "ObjectMgr.h"
+#include "Language.h"
#include "SpellMgr.h"
-#include "Chat.h"
#include "SpellInfo.h"
+#include "Player.h"
+#include "Pet.h"
class learn_commandscript : public CommandScript
{
@@ -37,35 +40,36 @@ public:
{
static ChatCommand learnAllMyCommandTable[] =
{
- { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL },
- { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL },
- { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL },
- { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "class", SEC_ADMINISTRATOR, false, &HandleLearnAllMyClassCommand, "", NULL },
+ { "pettalents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyPetTalentsCommand, "", NULL },
+ { "spells", SEC_ADMINISTRATOR, false, &HandleLearnAllMySpellsCommand, "", NULL },
+ { "talents", SEC_ADMINISTRATOR, false, &HandleLearnAllMyTalentsCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand learnAllCommandTable[] =
{
- { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable },
- { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL },
- { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL },
- { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL },
- { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL },
- { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "my", SEC_ADMINISTRATOR, false, NULL, "", learnAllMyCommandTable },
+ { "gm", SEC_GAMEMASTER, false, &HandleLearnAllGMCommand, "", NULL },
+ { "crafts", SEC_GAMEMASTER, false, &HandleLearnAllCraftsCommand, "", NULL },
+ { "default", SEC_MODERATOR, false, &HandleLearnAllDefaultCommand, "", NULL },
+ { "lang", SEC_MODERATOR, false, &HandleLearnAllLangCommand, "", NULL },
+ { "recipes", SEC_GAMEMASTER, false, &HandleLearnAllRecipesCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand learnCommandTable[] =
{
- { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable },
- { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "all", SEC_ADMINISTRATOR, false, NULL, "", learnAllCommandTable },
+ { "", SEC_ADMINISTRATOR, false, &HandleLearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
- { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { "learn", SEC_MODERATOR, false, NULL, "", learnCommandTable },
+ { "unlearn", SEC_ADMINISTRATOR, false, &HandleUnLearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
};
return commandTable;
}
@@ -466,6 +470,41 @@ public:
player->learnSpell(skillLine->spellId, false);
}
}
+
+ static bool HandleUnLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ char const* allStr = strtok(NULL, " ");
+ bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (allRanks)
+ spellId = sSpellMgr->GetFirstSpellInChain (spellId);
+
+ if (target->HasSpell(spellId))
+ target->removeSpell(spellId, false, !allRanks);
+ else
+ handler->SendSysMessage(LANG_FORGET_SPELL);
+
+ if (GetTalentSpellCost(spellId))
+ target->SendTalentsInfoData(false);
+
+ return true;
+ }
};
void AddSC_learn_commandscript()
diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp
new file mode 100644
index 00000000000..c4da37d032c
--- /dev/null
+++ b/src/server/scripts/Commands/cs_lfg.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2008-2012 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 "ScriptMgr.h"
+#include "Chat.h"
+#include "Language.h"
+#include "LFGMgr.h"
+#include "Group.h"
+#include "Player.h"
+
+void GetPlayerInfo(ChatHandler* handler, Player* player)
+{
+ if (!player)
+ return;
+
+ uint64 guid = player->GetGUID();
+ LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid);
+
+ std::string const& state = sLFGMgr->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());
+}
+
+class lfg_commandscript : public CommandScript
+{
+public:
+ lfg_commandscript() : CommandScript("lfg_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand lfgCommandTable[] =
+ {
+ { "player", SEC_GAMEMASTER, false, &HandleLfgPlayerInfoCommand, "", NULL },
+ { "group", SEC_GAMEMASTER, false, &HandleLfgGroupInfoCommand, "", NULL },
+ { "queue", SEC_GAMEMASTER, false, &HandleLfgQueueInfoCommand, "", NULL },
+ { "clean", SEC_ADMINISTRATOR, false, &HandleLfgCleanCommand, "", NULL },
+ { "options", SEC_ADMINISTRATOR, false, &HandleLfgOptionsCommand, "", NULL },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "lfg", SEC_GAMEMASTER, false, NULL, "", lfgCommandTable },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleLfgPlayerInfoCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+ std::string playerName;
+ if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ return false;
+
+ GetPlayerInfo(handler, target);
+ return true;
+ }
+
+ static bool HandleLfgGroupInfoCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+ std::string playerName;
+ if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ return false;
+
+ Group* grp = target->GetGroup();
+ if (!grp)
+ {
+ handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, playerName.c_str());
+ return true;
+ }
+
+ uint64 guid = grp->GetGUID();
+ std::string const& state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid));
+ handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(),
+ state.c_str(), sLFGMgr->GetDungeon(guid));
+
+ for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
+ GetPlayerInfo(handler, itr->getSource());
+
+ return true;
+ }
+
+ static bool HandleLfgOptionsCommand(ChatHandler* handler, char const* args)
+ {
+ int32 options = -1;
+ if (char* str = strtok((char*)args, " "))
+ {
+ int32 tmp = atoi(str);
+ if (tmp > -1)
+ options = tmp;
+ }
+
+ if (options != -1)
+ {
+ sLFGMgr->SetOptions(options);
+ handler->PSendSysMessage(LANG_LFG_OPTIONS_CHANGED);
+ }
+ handler->PSendSysMessage(LANG_LFG_OPTIONS, sLFGMgr->GetOptions());
+ return true;
+ }
+
+ static bool HandleLfgQueueInfoCommand(ChatHandler* handler, char const* args)
+ {
+ handler->SendSysMessage(sLFGMgr->DumpQueueInfo(*args).c_str());
+ return true;
+ }
+
+ static bool HandleLfgCleanCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->PSendSysMessage(LANG_LFG_CLEAN);
+ sLFGMgr->Clean();
+ return true;
+ }
+};
+
+void AddSC_lfg_commandscript()
+{
+ new lfg_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 5c16a0963d3..977369d1405 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -25,8 +25,10 @@ EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
#include "SpellAuraEffects.h"
+#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Player.h"
class list_commandscript : public CommandScript
{
diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp
index 0e814034434..c265cd1faa5 100644
--- a/src/server/scripts/Commands/cs_lookup.cpp
+++ b/src/server/scripts/Commands/cs_lookup.cpp
@@ -22,12 +22,15 @@ Comment: All lookup related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "Chat.h"
#include "AccountMgr.h"
+#include "Chat.h"
#include "GameEventMgr.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Player.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
+#include "SpellInfo.h"
class lookup_commandscript : public CommandScript
{
@@ -222,7 +225,7 @@ public:
return true;
}
-
+
static bool HandleLookupEventCommand(ChatHandler* handler, char const* args)
{
if (!*args)
@@ -660,7 +663,7 @@ public:
{
QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId());
- switch (status)
+ switch (status)
{
case QUEST_STATUS_COMPLETE:
statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
@@ -708,7 +711,7 @@ public:
{
QuestStatus status = target->GetQuestStatus(qInfo->GetQuestId());
- switch (status)
+ switch (status)
{
case QUEST_STATUS_COMPLETE:
statusStr = handler->GetTrinityString(LANG_COMMAND_QUEST_COMPLETE);
@@ -1081,7 +1084,7 @@ public:
Player* target = handler->getSelectedPlayer();
// title name have single string arg for player name
- char const* targetName = target ? target->GetName() : "NAME";
+ char const* targetName = target ? target->GetName().c_str() : "NAME";
std::string namePart = args;
std::wstring wNamePart;
@@ -1160,105 +1163,68 @@ public:
{
if (!*args)
return false;
- /*
+
std::string namePart = args;
std::wstring wNamePart;
- // converting string that we try to find to lower case
if (!Utf8toWStr(namePart, wNamePart))
return false;
wstrToLower(wNamePart);
- bool found = false;
+ uint32 counter = 0;
+ uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
+ uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
// search in Map.dbc
for (uint32 id = 0; id < sMapStore.GetNumRows(); id++)
{
- MapEntry const* MapInfo = sMapStore.LookupEntry(id);
- if (MapInfo)
+ if (MapEntry const* mapInfo = sMapStore.LookupEntry(id))
{
- uint8 locale = handler->GetSession() ? handler->GetSession()->GetSessionDbcLocale() : sWorld->GetDefaultDbcLocale();
-
- std::string name = MapInfo->name[locale];
+ std::string name = mapInfo->name[locale];
if (name.empty())
continue;
- if (!Utf8FitTo(name, wNamePart))
+ if (Utf8FitTo(name, wNamePart) && locale < TOTAL_LOCALES)
{
- locale = LOCALE_enUS;
- for (; locale < TOTAL_LOCALES; locale++)
+ if (maxResults && counter == maxResults)
{
- if (handler->GetSession() && locale == handler->GetSession()->GetSessionDbcLocale())
- continue;
-
- name = MapInfo->name[locale];
- if (name.empty())
- continue;
-
- if (Utf8FitTo(name, wNamePart))
- break;
+ handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults);
+ return true;
}
- }
- if (locale < TOTAL_LOCALES)
- {
- // send map in "id - [name][Continent][Instance/Battleground/Arena][Raid reset time:][Heroic reset time:][Mountable]" format
std::ostringstream ss;
+ ss << id << " - [" << name << ']';
- if (handler->GetSession())
- ss << id << " - |cffffffff|Hmap:" << id << "|h[" << name << ']';
- else // console
- ss << id << " - [" << name << ']';
-
- if (MapInfo->IsContinent())
+ if (mapInfo->IsContinent())
ss << handler->GetTrinityString(LANG_CONTINENT);
- switch (MapInfo->map_type)
+ switch (mapInfo->map_type)
{
- case MAP_INSTANCE: ss << handler->GetTrinityString(LANG_INSTANCE); break;
- case MAP_BATTLEGROUND: ss << handler->GetTrinityString(LANG_BATTLEGROUND); break;
- case MAP_ARENA: ss << handler->GetTrinityString(LANG_ARENA); break;
+ case MAP_INSTANCE:
+ ss << handler->GetTrinityString(LANG_INSTANCE);
+ break;
+ case MAP_RAID:
+ ss << handler->GetTrinityString(LANG_RAID);
+ break;
+ case MAP_BATTLEGROUND:
+ ss << handler->GetTrinityString(LANG_BATTLEGROUND);
+ break;
+ case MAP_ARENA:
+ ss << handler->GetTrinityString(LANG_ARENA);
+ break;
}
- if (MapInfo->IsRaid())
- ss << handler->GetTrinityString(LANG_RAID);
-
- if (MapInfo->SupportsHeroicMode())
- ss << handler->GetTrinityString(LANG_HEROIC);
-
- uint32 ResetTimeRaid = MapInfo->resetTimeRaid;
-
- std::string ResetTimeRaidStr;
- if (ResetTimeRaid)
- ResetTimeRaidStr = secsToTimeString(ResetTimeRaid, true, false);
-
- uint32 ResetTimeHeroic = MapInfo->resetTimeHeroic;
- std::string ResetTimeHeroicStr;
- if (ResetTimeHeroic)
- ResetTimeHeroicStr = secsToTimeString(ResetTimeHeroic, true, false);
-
- if (MapInfo->IsMountAllowed())
- ss << handler->GetTrinityString(LANG_MOUNTABLE);
-
- if (ResetTimeRaid && !ResetTimeHeroic)
- handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str());
- else if (!ResetTimeRaid && ResetTimeHeroic)
- handler->PSendSysMessage(ss.str().c_str(), ResetTimeHeroicStr.c_str());
- else if (ResetTimeRaid && ResetTimeHeroic)
- handler->PSendSysMessage(ss.str().c_str(), ResetTimeRaidStr.c_str(), ResetTimeHeroicStr.c_str());
- else
- handler->SendSysMessage(ss.str().c_str());
+ handler->SendSysMessage(ss.str().c_str());
- if (!found)
- found = true;
+ ++counter;
}
}
}
- if (!found)
+ if (!counter)
handler->SendSysMessage(LANG_COMMAND_NOMAPFOUND);
- */
+
return true;
}
@@ -1315,7 +1281,7 @@ public:
static bool HandleLookupPlayerEmailCommand(ChatHandler* handler, char const* args)
{
if (!*args)
- return false;
+ return false;
std::string email = strtok((char*)args, " ");
char* limitStr = strtok(NULL, " ");
diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp
new file mode 100644
index 00000000000..30c94442c51
--- /dev/null
+++ b/src/server/scripts/Commands/cs_message.cpp
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2008-2012 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: message_commandscript
+%Complete: 100
+Comment: All message related commands
+Category: commandscripts
+EndScriptData */
+
+#include "ScriptMgr.h"
+#include "Chat.h"
+#include "ChannelMgr.h"
+#include "Language.h"
+#include "Player.h"
+
+class message_commandscript : public CommandScript
+{
+public:
+ message_commandscript() : CommandScript("message_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand channelSetCommandTable[] =
+ {
+ { "ownership", SEC_ADMINISTRATOR, false, &HandleChannelSetOwnership, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand channelCommandTable[] =
+ {
+ { "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
+ { "nameannounce", SEC_MODERATOR, true, &HandleNameAnnounceCommand, "", NULL },
+ { "gmnameannounce", SEC_MODERATOR, true, &HandleGMNameAnnounceCommand, "", NULL },
+ { "announce", SEC_MODERATOR, true, &HandleAnnounceCommand, "", NULL },
+ { "gmannounce", SEC_MODERATOR, true, &HandleGMAnnounceCommand, "", NULL },
+ { "notify", SEC_MODERATOR, true, &HandleNotifyCommand, "", NULL },
+ { "gmnotify", SEC_MODERATOR, true, &HandleGMNotifyCommand, "", NULL },
+ { "whispers", SEC_MODERATOR, false, &HandleWhispersCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleChannelSetOwnership(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+ char const* channelStr = strtok((char*)args, " ");
+ char const* argStr = strtok(NULL, "");
+
+ if (!channelStr || !argStr)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Channel* channcel = NULL;
+
+ if (ChannelMgr* cMgr = ChannelMgr::forTeam(player->GetTeam()))
+ channcel = cMgr->GetChannel(channelStr, player);
+
+ if (strcmp(argStr, "on") == 0)
+ {
+ if (channcel)
+ channcel->SetOwnership(true);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
+ stmt->setUInt8 (0, 1);
+ stmt->setString(1, channelStr);
+ CharacterDatabase.Execute(stmt);
+ handler->PSendSysMessage(LANG_CHANNEL_ENABLE_OWNERSHIP, channelStr);
+ }
+ else if (strcmp(argStr, "off") == 0)
+ {
+ if (channcel)
+ channcel->SetOwnership(false);
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_OWNERSHIP);
+ stmt->setUInt8 (0, 0);
+ stmt->setString(1, channelStr);
+ CharacterDatabase.Execute(stmt);
+ handler->PSendSysMessage(LANG_CHANNEL_DISABLE_OWNERSHIP, channelStr);
+ }
+ else
+ return false;
+
+ return true;
+ }
+
+ static bool HandleNameAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name("Console");
+ if (WorldSession* session = handler->GetSession())
+ name = session->GetPlayer()->GetName();
+
+ sWorld->SendWorldText(LANG_ANNOUNCE_COLOR, name.c_str(), args);
+ return true;
+ }
+
+ static bool HandleGMNameAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name("Console");
+ if (WorldSession* session = handler->GetSession())
+ name = session->GetPlayer()->GetName();
+
+ sWorld->SendGMText(LANG_GM_ANNOUNCE_COLOR, name.c_str(), args);
+ return true;
+ }
+ // global announce
+ static bool HandleAnnounceCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char buff[2048];
+ sprintf(buff, handler->GetTrinityString(LANG_SYSTEMMESSAGE), args);
+ sWorld->SendServerMessage(SERVER_MSG_STRING, buff);
+ return true;
+ }
+ // announce to logged in GMs
+ static bool HandleGMAnnounceCommand(ChatHandler* /*handler*/, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ sWorld->SendGMText(LANG_GM_BROADCAST, args);
+ return true;
+ }
+ // notification player at the screen
+ static bool HandleNotifyCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string str = handler->GetTrinityString(LANG_GLOBAL_NOTIFY);
+ str += args;
+
+ WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
+ data << str;
+ sWorld->SendGlobalMessage(&data);
+
+ return true;
+ }
+ // notification GM at the screen
+ static bool HandleGMNotifyCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string str = handler->GetTrinityString(LANG_GM_NOTIFY);
+ str += args;
+
+ WorldPacket data(SMSG_NOTIFICATION, (str.size()+1));
+ data << str;
+ sWorld->SendGlobalGMMessage(&data);
+
+ return true;
+ }
+ // Enable\Dissable accept whispers (for GM)
+ static bool HandleWhispersCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, handler->GetSession()->GetPlayer()->isAcceptWhispers() ? handler->GetTrinityString(LANG_ON) : handler->GetTrinityString(LANG_OFF));
+ return true;
+ }
+
+ std::string argStr = (char*)args;
+ // whisper on
+ if (argStr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetAcceptWhispers(true);
+ handler->SendSysMessage(LANG_COMMAND_WHISPERON);
+ return true;
+ }
+
+ // whisper off
+ if (argStr == "off")
+ {
+ // Remove all players from the Gamemaster's whisper whitelist
+ handler->GetSession()->GetPlayer()->ClearWhisperWhiteList();
+ handler->GetSession()->GetPlayer()->SetAcceptWhispers(false);
+ handler->SendSysMessage(LANG_COMMAND_WHISPEROFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+};
+
+void AddSC_message_commandscript()
+{
+ new message_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 7c431566f52..c701c4f350c 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1,160 +1,2796 @@
-/*
- * Copyright (C) 2008-2012 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 "ScriptPCH.h"
-#include "Chat.h"
-#include "ObjectAccessor.h"
-#include "ScriptMgr.h"
-#include "CellImpl.h"
-
-class misc_commandscript : public CommandScript
-{
-public:
- misc_commandscript() : CommandScript("misc_commandscript") { }
-
- ChatCommand* GetCommands() const
- {
- static ChatCommand commandTable[] =
- {
- { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
- { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
-
- static bool HandleDevCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
- {
- if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
- handler->GetSession()->SendNotification(LANG_DEV_ON);
- else
- handler->GetSession()->SendNotification(LANG_DEV_OFF);
- return true;
- }
-
- std::string argstr = (char*)args;
-
- if (argstr == "on")
- {
- handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
- handler->GetSession()->SendNotification(LANG_DEV_ON);
- return true;
- }
-
- if (argstr == "off")
- {
- handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
- handler->GetSession()->SendNotification(LANG_DEV_OFF);
- return true;
- }
-
- handler->SendSysMessage(LANG_USE_BOL);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- static bool HandleGPSCommand(ChatHandler* handler, char const* args)
- {
- WorldObject* object = NULL;
- if (*args)
- {
- uint64 guid = handler->extractGuidFromLink((char*)args);
- if (guid)
- object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
-
- if (!object)
- {
- handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
- else
- {
- object = handler->getSelectedUnit();
-
- if (!object)
- {
- handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
- handler->SetSentErrorMessage(true);
- return false;
- }
- }
-
- CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
- Cell cell(cellCoord);
-
- uint32 zoneId, areaId;
- object->GetZoneAndAreaId(zoneId, areaId);
-
- MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
- AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
- AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
-
- float zoneX = object->GetPositionX();
- float zoneY = object->GetPositionY();
-
- Map2ZoneCoordinates(zoneX, zoneY, zoneId);
-
- Map const* map = object->GetMap();
- float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
- float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
-
- GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
-
- // 63? WHY?
- int gridX = 63 - gridCoord.x_coord;
- int gridY = 63 - gridCoord.y_coord;
-
- uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
- uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
-
- if (haveVMap)
- {
- if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
- handler->PSendSysMessage("You are outdoors");
- else
- handler->PSendSysMessage("You are indoors");
- }
- else
- handler->PSendSysMessage("no VMAP available for area info");
-
- handler->PSendSysMessage(LANG_MAP_POSITION,
- object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
- zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
- object->GetPhaseMask(),
- object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
- cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
- zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
-
- LiquidData liquidStatus;
- ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
-
- if (status)
- handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
-
- return true;
- }
-};
-
-void AddSC_misc_commandscript()
-{
- new misc_commandscript();
-}
+/*
+ * Copyright (C) 2008-2012 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 "Chat.h"
+#include "ScriptMgr.h"
+#include "AccountMgr.h"
+#include "ArenaTeamMgr.h"
+#include "CellImpl.h"
+#include "GridNotifiers.h"
+#include "Group.h"
+#include "InstanceSaveMgr.h"
+#include "Language.h"
+#include "MovementGenerator.h"
+#include "ObjectAccessor.h"
+#include "Opcodes.h"
+#include "SpellAuras.h"
+#include "TargetedMovementGenerator.h"
+#include "WeatherMgr.h"
+#include "ace/INET_Addr.h"
+#include "Player.h"
+#include "Pet.h"
+
+class misc_commandscript : public CommandScript
+{
+public:
+ misc_commandscript() : CommandScript("misc_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand groupCommandTable[] =
+ {
+ { "leader", SEC_ADMINISTRATOR, false, &HandleGroupLeaderCommand, "", NULL },
+ { "disband", SEC_ADMINISTRATOR, false, &HandleGroupDisbandCommand, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, false, &HandleGroupRemoveCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand petCommandTable[] =
+ {
+ { "create", SEC_GAMEMASTER, false, &HandleCreatePetCommand, "", NULL },
+ { "learn", SEC_GAMEMASTER, false, &HandlePetLearnCommand, "", NULL },
+ { "unlearn", SEC_GAMEMASTER, false, &HandlePetUnlearnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand sendCommandTable[] =
+ {
+ { "items", SEC_ADMINISTRATOR, true, &HandleSendItemsCommand, "", NULL },
+ { "mail", SEC_MODERATOR, true, &HandleSendMailCommand, "", NULL },
+ { "message", SEC_ADMINISTRATOR, true, &HandleSendMessageCommand, "", NULL },
+ { "money", SEC_ADMINISTRATOR, true, &HandleSendMoneyCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { "gps", SEC_ADMINISTRATOR, false, &HandleGPSCommand, "", NULL },
+ { "aura", SEC_ADMINISTRATOR, false, &HandleAuraCommand, "", NULL },
+ { "unaura", SEC_ADMINISTRATOR, false, &HandleUnAuraCommand, "", NULL },
+ { "appear", SEC_MODERATOR, false, &HandleAppearCommand, "", NULL },
+ { "summon", SEC_MODERATOR, false, &HandleSummonCommand, "", NULL },
+ { "groupsummon", SEC_MODERATOR, false, &HandleGroupSummonCommand, "", NULL },
+ { "commands", SEC_PLAYER, true, &HandleCommandsCommand, "", NULL },
+ { "die", SEC_ADMINISTRATOR, false, &HandleDieCommand, "", NULL },
+ { "revive", SEC_ADMINISTRATOR, true, &HandleReviveCommand, "", NULL },
+ { "dismount", SEC_PLAYER, false, &HandleDismountCommand, "", NULL },
+ { "guid", SEC_GAMEMASTER, false, &HandleGUIDCommand, "", NULL },
+ { "help", SEC_PLAYER, true, &HandleHelpCommand, "", NULL },
+ { "itemmove", SEC_GAMEMASTER, false, &HandleItemMoveCommand, "", NULL },
+ { "cooldown", SEC_ADMINISTRATOR, false, &HandleCooldownCommand, "", NULL },
+ { "distance", SEC_ADMINISTRATOR, false, &HandleGetDistanceCommand, "", NULL },
+ { "recall", SEC_MODERATOR, false, &HandleRecallCommand, "", NULL },
+ { "save", SEC_PLAYER, false, &HandleSaveCommand, "", NULL },
+ { "saveall", SEC_MODERATOR, true, &HandleSaveAllCommand, "", NULL },
+ { "kick", SEC_GAMEMASTER, true, &HandleKickPlayerCommand, "", NULL },
+ { "unstuck", SEC_PLAYER, true, &HandleUnstuckCommand, "", NULL },
+ { "linkgrave", SEC_ADMINISTRATOR, false, &HandleLinkGraveCommand, "", NULL },
+ { "neargrave", SEC_ADMINISTRATOR, false, &HandleNearGraveCommand, "", NULL },
+ { "showarea", SEC_ADMINISTRATOR, false, &HandleShowAreaCommand, "", NULL },
+ { "hidearea", SEC_ADMINISTRATOR, false, &HandleHideAreaCommand, "", NULL },
+ { "additem", SEC_ADMINISTRATOR, false, &HandleAddItemCommand, "", NULL },
+ { "additemset", SEC_ADMINISTRATOR, false, &HandleAddItemSetCommand, "", NULL },
+ { "bank", SEC_ADMINISTRATOR, false, &HandleBankCommand, "", NULL },
+ { "wchange", SEC_ADMINISTRATOR, false, &HandleChangeWeather, "", NULL },
+ { "maxskill", SEC_ADMINISTRATOR, false, &HandleMaxSkillCommand, "", NULL },
+ { "setskill", SEC_ADMINISTRATOR, false, &HandleSetSkillCommand, "", NULL },
+ { "pinfo", SEC_GAMEMASTER, true, &HandlePInfoCommand, "", NULL },
+ { "respawn", SEC_ADMINISTRATOR, false, &HandleRespawnCommand, "", NULL },
+ { "send", SEC_MODERATOR, true, NULL, "", sendCommandTable },
+ { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
+ { "mute", SEC_MODERATOR, true, &HandleMuteCommand, "", NULL },
+ { "unmute", SEC_MODERATOR, true, &HandleUnmuteCommand, "", NULL },
+ { "movegens", SEC_ADMINISTRATOR, false, &HandleMovegensCommand, "", NULL },
+ { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL },
+ { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL },
+ { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL },
+ { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL },
+ { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL },
+ { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL },
+ { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL },
+ { "listfreeze", SEC_MODERATOR, false, &HandleListFreezeCommand, "", NULL },
+ { "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
+ { "possess", SEC_ADMINISTRATOR, false, HandlePossessCommand, "", NULL },
+ { "unpossess", SEC_ADMINISTRATOR, false, HandleUnPossessCommand, "", NULL },
+ { "bindsight", SEC_ADMINISTRATOR, false, HandleBindSightCommand, "", NULL },
+ { "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "", NULL },
+ { "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleDevCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ else
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ std::string argstr = (char*)args;
+
+ if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ return true;
+ }
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ static bool HandleGPSCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* object = NULL;
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ object = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ object = handler->getSelectedUnit();
+
+ if (!object)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ CellCoord cellCoord = Trinity::ComputeCellCoord(object->GetPositionX(), object->GetPositionY());
+ Cell cell(cellCoord);
+
+ uint32 zoneId, areaId;
+ object->GetZoneAndAreaId(zoneId, areaId);
+
+ MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
+
+ float zoneX = object->GetPositionX();
+ float zoneY = object->GetPositionY();
+
+ Map2ZoneCoordinates(zoneX, zoneY, zoneId);
+
+ Map const* map = object->GetMap();
+ float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+
+ GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
+
+ // 63? WHY?
+ int gridX = 63 - gridCoord.x_coord;
+ int gridY = 63 - gridCoord.y_coord;
+
+ uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+
+ if (haveVMap)
+ {
+ if (map->IsOutdoors(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()))
+ handler->PSendSysMessage("You are outdoors");
+ else
+ handler->PSendSysMessage("You are indoors");
+ }
+ else
+ handler->PSendSysMessage("no VMAP available for area info");
+
+ handler->PSendSysMessage(LANG_MAP_POSITION,
+ object->GetMapId(), (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"),
+ object->GetPhaseMask(),
+ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(),
+ cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(),
+ zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
+
+ LiquidData liquidStatus;
+ ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
+
+ if (status)
+ handler->PSendSysMessage(LANG_LIQUID_STATUS, liquidStatus.level, liquidStatus.depth_level, liquidStatus.entry, liquidStatus.type_flags, status);
+
+ return true;
+ }
+
+ static bool HandleAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
+
+ return true;
+ }
+
+ static bool HandleUnAuraCommand(ChatHandler* handler, char const* args)
+ {
+ Unit* target = handler->getSelectedUnit();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string argstr = args;
+ if (argstr == "all")
+ {
+ target->RemoveAllAuras();
+ return true;
+ }
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+ if (!spellId)
+ return false;
+
+ target->RemoveAurasDueToSpell(spellId);
+
+ return true;
+ }
+ // Teleport to Player
+ static bool HandleAppearCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->SendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ std::string chrNameLink = handler->playerLink(targetName);
+
+ Map* map = target->GetMap();
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (_player->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
+ _player->LeaveBattleground(false); // Note: should be changed so _player gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ _player->SetBattlegroundId(target->GetBattlegroundId(), target->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!_player->GetMap()->IsBattlegroundOrArena())
+ _player->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ // we have to go to instance, and can go to player only if:
+ // 1) we are in his group (either as leader or as member)
+ // 2) we are not bound to any group and have GM mode on
+ if (_player->GetGroup())
+ {
+ // we are in group, we can go only if we are in the player group
+ if (_player->GetGroup() != target->GetGroup())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ // we are not in group, let's verify our GM mode
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_INST_GM, chrNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // if the player or the player's group is bound to another instance
+ // the player will not be bound to another one
+ InstancePlayerBind* bind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(map->IsRaid()));
+ if (!bind)
+ {
+ Group* group = _player->GetGroup();
+ // if no bind exists, create a solo bind
+ InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind
+ if (!gBind)
+ if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId()))
+ _player->BindToInstance(save, !save->CanReset());
+ }
+
+ if (map->IsRaid())
+ _player->SetRaidDifficulty(target->GetRaidDifficulty());
+ else
+ _player->SetDungeonDifficulty(target->GetDungeonDifficulty());
+ }
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ // to point to see at target with same orientation
+ float x, y, z;
+ target->GetContactPoint(_player, x, y, z);
+
+ _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
+ _player->SetPhaseMask(target->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
+
+ // to point where player stay (if loaded)
+ float x, y, z, o;
+ uint32 map;
+ bool in_flight;
+ if (!Player::LoadPositionFromDB(map, x, y, z, o, in_flight, targetGuid))
+ return false;
+
+ // stop flight if need
+ if (_player->isInFlight())
+ {
+ _player->GetMotionMaster()->MovementExpired();
+ _player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ _player->SaveRecallPosition();
+
+ _player->TeleportTo(map, x, y, z, _player->GetOrientation());
+ }
+
+ return true;
+ }
+ // Summon Player
+ static bool HandleSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ Player* _player = handler->GetSession()->GetPlayer();
+ if (target == _player || targetGuid == _player->GetGUID())
+ {
+ handler->PSendSysMessage(LANG_CANT_TELEPORT_SELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target)
+ {
+ std::string nameLink = handler->playerLink(targetName);
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* map = handler->GetSession()->GetPlayer()->GetMap();
+
+ if (map->IsBattlegroundOrArena())
+ {
+ // only allow if gm mode is on
+ if (!_player->isGameMaster())
+ {
+ handler->PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ // if both players are in different bgs
+ else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
+ target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
+
+ // all's well, set bg id
+ // when porting out from the bg, it will be reset to 0
+ target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId());
+ // remember current position as entry point for return at bg end teleportation
+ if (!target->GetMap()->IsBattlegroundOrArena())
+ target->SetBattlegroundEntryPoint();
+ }
+ else if (map->IsDungeon())
+ {
+ Map* destMap = target->GetMap();
+
+ if (destMap->Instanceable() && destMap->GetInstanceId() != map->GetInstanceId())
+ target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
+
+ // we are in an instance, and can only summon players in our group with us as leader
+ if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
+ (target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), "");
+ if (handler->needReportToTarget(target))
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->playerLink(_player->GetName()).c_str());
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ target->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetObjectSize());
+ target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
+ target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
+ }
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_SUMMONING, nameLink.c_str(), handler->GetTrinityString(LANG_OFFLINE));
+
+ // in point where GM stay
+ Player::SavePositionInDB(handler->GetSession()->GetPlayer()->GetMapId(),
+ handler->GetSession()->GetPlayer()->GetPositionX(),
+ handler->GetSession()->GetPlayer()->GetPositionY(),
+ handler->GetSession()->GetPlayer()->GetPositionZ(),
+ handler->GetSession()->GetPlayer()->GetOrientation(),
+ handler->GetSession()->GetPlayer()->GetZoneId(),
+ targetGuid);
+ }
+
+ return true;
+ }
+ // Summon group of player
+ static bool HandleGroupSummonCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ Group* group = target->GetGroup();
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!group)
+ {
+ handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Map* gmMap = handler->GetSession()->GetPlayer()->GetMap();
+ bool toInstance = gmMap->Instanceable();
+
+ // we are in instance, and can summon only player in our group with us as lead
+ if (toInstance && (
+ !handler->GetSession()->GetPlayer()->GetGroup() || (group->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
+ (handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID())))
+ // the last check is a bit excessive, but let it be, just in case
+ {
+ handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player* player = itr->getSource();
+
+ if (!player || player == handler->GetSession()->GetPlayer() || !player->GetSession())
+ continue;
+
+ // check online security
+ if (handler->HasLowerSecurity(player, 0))
+ return false;
+
+ std::string plNameLink = handler->GetNameLink(player);
+
+ if (player->IsBeingTeleported() == true)
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (toInstance)
+ {
+ Map* playerMap = player->GetMap();
+
+ if (playerMap->Instanceable() && playerMap->GetInstanceId() != gmMap->GetInstanceId())
+ {
+ // cannot summon from instance to instance
+ handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
+ if (handler->needReportToTarget(player))
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_SUMMONED_BY, handler->GetNameLink().c_str());
+
+ // stop flight if need
+ if (player->isInFlight())
+ {
+ player->GetMotionMaster()->MovementExpired();
+ player->CleanupAfterTaxiFlight();
+ }
+ // save only in non-flight case
+ else
+ player->SaveRecallPosition();
+
+ // before GM
+ float x, y, z;
+ handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
+ player->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
+ }
+
+ return true;
+ }
+
+ static bool HandleCommandsCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ return true;
+ }
+
+ static bool HandleDieCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* target = handler->getSelectedUnit();
+
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (target->isAlive())
+ {
+ if (sWorld->getBoolConfig(CONFIG_DIE_COMMAND_MODE))
+ handler->GetSession()->GetPlayer()->Kill(target);
+ else
+ handler->GetSession()->GetPlayer()->DealDamage(target, target->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ }
+
+ return true;
+ }
+
+ static bool HandleReviveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid))
+ return false;
+
+ if (target)
+ {
+ target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f);
+ target->SpawnCorpseBones();
+ target->SaveToDB();
+ }
+ else
+ // will resurrected at login without corpse
+ sObjectAccessor->ConvertCorpseForPlayer(targetGuid);
+
+ return true;
+ }
+
+ static bool HandleDismountCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // If player is not mounted, so go out :)
+ if (!player->IsMounted())
+ {
+ handler->SendSysMessage(LANG_CHAR_NON_MOUNTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->isInFlight())
+ {
+ handler->SendSysMessage(LANG_YOU_IN_FLIGHT);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->Dismount();
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ return true;
+ }
+
+ static bool HandleGUIDCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
+
+ if (guid == 0)
+ {
+ handler->SendSysMessage(LANG_NO_SELECTION);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_OBJECT_GUID, GUID_LOPART(guid), GUID_HIPART(guid));
+ return true;
+ }
+
+ static bool HandleHelpCommand(ChatHandler* handler, char const* args)
+ {
+ char const* cmd = strtok((char*)args, " ");
+ if (!cmd)
+ {
+ handler->ShowHelpForCommand(handler->getCommandTable(), "help");
+ handler->ShowHelpForCommand(handler->getCommandTable(), "");
+ }
+ else
+ {
+ if (!handler->ShowHelpForCommand(handler->getCommandTable(), cmd))
+ handler->SendSysMessage(LANG_NO_HELP_CMD);
+ }
+
+ return true;
+ }
+ // move item to other slot
+ static bool HandleItemMoveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* param1 = strtok((char*)args, " ");
+ if (!param1)
+ return false;
+
+ char const* param2 = strtok(NULL, " ");
+ if (!param2)
+ return false;
+
+ uint8 srcSlot = uint8(atoi(param1));
+ uint8 dstSlot = uint8(atoi(param2));
+
+ if (srcSlot == dstSlot)
+ return true;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
+ return false;
+
+ if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
+ return false;
+
+ uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
+ uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
+
+ handler->GetSession()->GetPlayer()->SwapItem(src, dst);
+
+ return true;
+ }
+
+ static bool HandleCooldownCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string nameLink = handler->GetNameLink(target);
+
+ if (!*args)
+ {
+ target->RemoveAllSpellCooldown();
+ handler->PSendSysMessage(LANG_REMOVEALL_COOLDOWN, nameLink.c_str());
+ }
+ else
+ {
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellIid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellIid)
+ return false;
+
+ if (!sSpellMgr->GetSpellInfo(spellIid))
+ {
+ handler->PSendSysMessage(LANG_UNKNOWN_SPELL, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->RemoveSpellCooldown(spellIid, true);
+ handler->PSendSysMessage(LANG_REMOVE_COOLDOWN, spellIid, target == handler->GetSession()->GetPlayer() ? handler->GetTrinityString(LANG_YOU) : nameLink.c_str());
+ }
+ return true;
+ }
+
+ static bool HandleGetDistanceCommand(ChatHandler* handler, char const* args)
+ {
+ WorldObject* obj = NULL;
+
+ if (*args)
+ {
+ uint64 guid = handler->extractGuidFromLink((char*)args);
+ if (guid)
+ obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*handler->GetSession()->GetPlayer(), guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+ else
+ {
+ obj = handler->getSelectedUnit();
+
+ if (!obj)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ handler->PSendSysMessage(LANG_DISTANCE, handler->GetSession()->GetPlayer()->GetDistance(obj), handler->GetSession()->GetPlayer()->GetDistance2d(obj), handler->GetSession()->GetPlayer()->GetExactDist(obj), handler->GetSession()->GetPlayer()->GetExactDist2d(obj));
+ return true;
+ }
+ // Teleport player to last position
+ static bool HandleRecallCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (target->IsBeingTeleported())
+ {
+ handler->PSendSysMessage(LANG_IS_TELEPORTED, handler->GetNameLink(target).c_str());
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // stop flight if need
+ if (target->isInFlight())
+ {
+ target->GetMotionMaster()->MovementExpired();
+ target->CleanupAfterTaxiFlight();
+ }
+
+ target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
+ return true;
+ }
+
+ static bool HandleSaveCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // save GM account without delay and output message
+ if (!AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ {
+ if (Player* target = handler->getSelectedPlayer())
+ target->SaveToDB();
+ else
+ player->SaveToDB();
+ handler->SendSysMessage(LANG_PLAYER_SAVED);
+ return true;
+ }
+
+ // save if the player has last been saved over 20 seconds ago
+ uint32 saveInterval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
+ if (saveInterval == 0 || (saveInterval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= saveInterval - 20 * IN_MILLISECONDS))
+ player->SaveToDB();
+
+ return true;
+ }
+
+ // Save all players in the world
+ static bool HandleSaveAllCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sObjectAccessor->SaveAllPlayers();
+ handler->SendSysMessage(LANG_PLAYERS_SAVED);
+ return true;
+ }
+
+ // kick player
+ static bool HandleKickPlayerCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+ std::string playerName;
+ if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName))
+ return false;
+
+ if (handler->GetSession() && target == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_KICKSELF);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
+ sWorld->SendWorldText(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+ else
+ handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
+
+ target->GetSession()->KickPlayer();
+
+ return true;
+ }
+
+ static bool HandleUnstuckCommand(ChatHandler* handler, char const* args)
+ {
+ //No args required for players
+ if (handler->GetSession() && AccountMgr::IsPlayerAccount(handler->GetSession()->GetSecurity()))
+ {
+ // 7355: "Stuck"
+ if (Player* player = handler->GetSession()->GetPlayer())
+ player->CastSpell(player, 7355, false);
+ return true;
+ }
+
+ if (!*args)
+ return false;
+
+ char* player_str = strtok((char*)args, " ");
+ if (!player_str)
+ return false;
+
+ std::string location_str = "inn";
+ if (char const* loc = strtok(NULL, " "))
+ location_str = loc;
+
+ Player* player = NULL;
+ if (!handler->extractPlayerTarget(player_str, &player))
+ return false;
+
+ if (player->isInFlight() || player->isInCombat())
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(7355);
+ if (!spellInfo)
+ return false;
+
+ if (Player* caster = handler->GetSession()->GetPlayer())
+ Spell::SendCastResult(caster, spellInfo, 0, SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
+
+ return false;
+ }
+
+ if (location_str == "inn")
+ {
+ player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
+ return true;
+ }
+
+ if (location_str == "graveyard")
+ {
+ player->RepopAtGraveyard();
+ return true;
+ }
+
+ if (location_str == "startzone")
+ {
+ player->TeleportTo(player->GetStartPosition());
+ return true;
+ }
+
+ //Not a supported argument
+ return false;
+
+ }
+
+ static bool HandleLinkGraveCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* px = strtok((char*)args, " ");
+ if (!px)
+ return false;
+
+ uint32 graveyardId = uint32(atoi(px));
+
+ uint32 team;
+
+ char* px2 = strtok(NULL, " ");
+
+ if (!px2)
+ team = 0;
+ else if (strncmp(px2, "horde", 6) == 0)
+ team = HORDE;
+ else if (strncmp(px2, "alliance", 9) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ WorldSafeLocsEntry const* graveyard = sWorldSafeLocsStore.LookupEntry(graveyardId);
+
+ if (!graveyard)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ uint32 zoneId = player->GetZoneId();
+
+ AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
+ if (!areaEntry || areaEntry->zone !=0)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (sObjectMgr->AddGraveYardLink(graveyardId, zoneId, team))
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDLINKED, graveyardId, zoneId);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDALRLINKED, graveyardId, zoneId);
+
+ return true;
+ }
+
+ static bool HandleNearGraveCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 team;
+
+ size_t argStr = strlen(args);
+
+ if (!*args)
+ team = 0;
+ else if (strncmp((char*)args, "horde", argStr) == 0)
+ team = HORDE;
+ else if (strncmp((char*)args, "alliance", argStr) == 0)
+ team = ALLIANCE;
+ else
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zone_id = player->GetZoneId();
+
+ WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveYard(
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
+
+ if (graveyard)
+ {
+ uint32 graveyardId = graveyard->ID;
+
+ GraveYardData const* data = sObjectMgr->FindGraveYardData(graveyardId, zone_id);
+ if (!data)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDERROR, graveyardId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ team = data->team;
+
+ std::string team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_NOTEAM);
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDNEAREST, graveyardId, team_name.c_str(), zone_id);
+ }
+ else
+ {
+ std::string team_name;
+
+ if (team == 0)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ANY);
+ else if (team == HORDE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_HORDE);
+ else if (team == ALLIANCE)
+ team_name = handler->GetTrinityString(LANG_COMMAND_GRAVEYARD_ALLIANCE);
+
+ if (team == ~uint32(0))
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAVEYARDS, zone_id);
+ else
+ handler->PSendSysMessage(LANG_COMMAND_ZONENOGRAFACTION, zone_id, team_name.c_str());
+ }
+
+ return true;
+ }
+
+ static bool HandleShowAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
+
+ handler->SendSysMessage(LANG_EXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleHideAreaCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 area = GetAreaFlagByAreaID(atoi((char*)args));
+ int32 offset = area / 32;
+ uint32 val = uint32((1 << (area % 32)));
+
+ if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
+ playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
+
+ handler->SendSysMessage(LANG_UNEXPLORE_AREA);
+ return true;
+ }
+
+ static bool HandleAddItemCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 itemId = 0;
+
+ if (args[0] == '[') // [name] manual form
+ {
+ char const* itemNameStr = strtok((char*)args, "]");
+
+ if (itemNameStr && itemNameStr[0])
+ {
+ std::string itemName = itemNameStr+1;
+ WorldDatabase.EscapeString(itemName);
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME);
+ stmt->setString(0, itemName);
+ PreparedQueryResult result = WorldDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, itemNameStr+1);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ itemId = result->Fetch()->GetUInt32();
+ }
+ else
+ return false;
+ }
+ else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
+ {
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitem");
+ if (!id)
+ return false;
+ itemId = uint32(atol(id));
+ }
+
+ char const* ccount = strtok(NULL, " ");
+
+ int32 count = 1;
+
+ if (ccount)
+ count = strtol(ccount, NULL, 10);
+
+ if (count == 0)
+ count = 1;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEM), itemId, count);
+
+ ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
+ if (!itemTemplate)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Subtract
+ if (count < 0)
+ {
+ playerTarget->DestroyItemCount(itemId, -count, true, false);
+ handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str());
+ return true;
+ }
+
+ // Adding items
+ uint32 noSpaceForCount = 0;
+
+ // check space and find places
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount);
+ if (msg != EQUIP_ERR_OK) // convert to possible store amount
+ count -= noSpaceForCount;
+
+ if (count == 0 || dest.empty()) // can't add any
+ {
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
+ if (Item* item1 = player->GetItemByPos(itr->pos))
+ item1->SetBinding(false);
+
+ if (count > 0 && item)
+ {
+ player->SendNewItem(item, count, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, count, true, false);
+ }
+
+ if (noSpaceForCount > 0)
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itemId, noSpaceForCount);
+
+ return true;
+ }
+
+ static bool HandleAddItemSetCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char const* id = handler->extractKeyFromLink((char*)args, "Hitemset"); // number or [name] Shift-click form |color|Hitemset:itemset_id|h[name]|h|r
+ if (!id)
+ return false;
+
+ uint32 itemSetId = atol(id);
+
+ // prevent generation all items with itemset field value '0'
+ if (itemSetId == 0)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Player* playerTarget = handler->getSelectedPlayer();
+ if (!playerTarget)
+ playerTarget = player;
+
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_ADDITEMSET), itemSetId);
+
+ bool found = false;
+ ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
+ for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
+ {
+ if (itr->second.ItemSet == itemSetId)
+ {
+ found = true;
+ ItemPosCountVec dest;
+ InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1);
+ if (msg == EQUIP_ERR_OK)
+ {
+ Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true);
+
+ // remove binding (let GM give it to another player later)
+ if (player == playerTarget)
+ item->SetBinding(false);
+
+ player->SendNewItem(item, 1, false, true);
+ if (player != playerTarget)
+ playerTarget->SendNewItem(item, 1, true, false);
+ }
+ else
+ {
+ player->SendEquipError(msg, NULL, NULL, itr->second.ItemId);
+ handler->PSendSysMessage(LANG_ITEM_CANNOT_CREATE, itr->second.ItemId, 1);
+ }
+ }
+ }
+
+ if (!found)
+ {
+ handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool HandleBankCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ handler->GetSession()->SendShowBank(handler->GetSession()->GetPlayer()->GetGUID());
+ return true;
+ }
+
+ static bool HandleChangeWeather(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ // Weather is OFF
+ if (!sWorld->getBoolConfig(CONFIG_WEATHER))
+ {
+ handler->SendSysMessage(LANG_WEATHER_DISABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // *Change the weather of a cell
+ char const* px = strtok((char*)args, " ");
+ char const* py = strtok(NULL, " ");
+
+ if (!px || !py)
+ return false;
+
+ uint32 type = uint32(atoi(px)); //0 to 3, 0: fine, 1: rain, 2: snow, 3: sand
+ float grade = float(atof(py)); //0 to 1, sending -1 is instand good weather
+
+ Player* player = handler->GetSession()->GetPlayer();
+ uint32 zoneid = player->GetZoneId();
+
+ Weather* weather = WeatherMgr::FindWeather(zoneid);
+
+ if (!weather)
+ weather = WeatherMgr::AddWeather(zoneid);
+ if (!weather)
+ {
+ handler->SendSysMessage(LANG_NO_WEATHER);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ weather->SetWeather(WeatherType(type), grade);
+
+ return true;
+ }
+
+
+ static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* SelectedPlayer = handler->getSelectedPlayer();
+ if (!SelectedPlayer)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // each skills that have max skill value dependent from level seted to current level max skill value
+ SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
+ return true;
+ }
+
+ static bool HandleSetSkillCommand(ChatHandler* handler, char const* args)
+ {
+ // number or [name] Shift-click form |color|Hskill:skill_id|h[name]|h|r
+ char const* skillStr = handler->extractKeyFromLink((char*)args, "Hskill");
+ if (!skillStr)
+ return false;
+
+ char const* levelStr = strtok(NULL, " ");
+ if (!levelStr)
+ return false;
+
+ char const* maxPureSkill = strtok(NULL, " ");
+
+ int32 skill = atoi(skillStr);
+ if (skill <= 0)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ int32 level = uint32(atol(levelStr));
+
+ Player* target = handler->getSelectedPlayer();
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skill);
+ if (!skillLine)
+ {
+ handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skill);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ std::string tNameLink = handler->GetNameLink(target);
+
+ if (!target->GetSkillValue(skill))
+ {
+ handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint16 max = maxPureSkill ? atol (maxPureSkill) : target->GetPureMaxSkillValue(skill);
+
+ if (level <= 0 || level > max || max <= 0)
+ return false;
+
+ target->SetSkill(skill, target->GetSkillStep(skill), level, max);
+ handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max);
+
+ return true;
+ }
+ // show info of player
+ static bool HandlePInfoCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+
+ uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER);
+
+ if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName))
+ {
+ target = sObjectMgr->GetPlayerByLowGUID(parseGUID);
+ targetGuid = parseGUID;
+ }
+ else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accId = 0;
+ uint32 money = 0;
+ uint32 totalPlayerTime = 0;
+ uint8 level = 0;
+ uint32 latency = 0;
+ uint8 race;
+ uint8 Class;
+ int64 muteTime = 0;
+ int64 banTime = -1;
+ uint32 mapId;
+ uint32 areaId;
+ uint32 phase = 0;
+
+ // get additional information from Player object
+ if (target)
+ {
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ accId = target->GetSession()->GetAccountId();
+ money = target->GetMoney();
+ totalPlayerTime = target->GetTotalPlayedTime();
+ level = target->getLevel();
+ latency = target->GetSession()->GetLatency();
+ race = target->getRace();
+ Class = target->getClass();
+ muteTime = target->GetSession()->m_muteTime;
+ mapId = target->GetMapId();
+ areaId = target->GetAreaId();
+ phase = target->GetPhaseMask();
+ }
+ // get additional information from DB
+ else
+ {
+ // check offline security
+ if (handler->HasLowerSecurity(NULL, targetGuid))
+ return false;
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ return false;
+
+ Field* fields = result->Fetch();
+ totalPlayerTime = fields[0].GetUInt32();
+ level = fields[1].GetUInt8();
+ money = fields[2].GetUInt32();
+ accId = fields[3].GetUInt32();
+ race = fields[4].GetUInt8();
+ Class = fields[5].GetUInt8();
+ mapId = fields[6].GetUInt16();
+ areaId = fields[7].GetUInt16();
+ }
+
+ std::string userName = handler->GetTrinityString(LANG_ERROR);
+ std::string eMail = handler->GetTrinityString(LANG_ERROR);
+ std::string lastIp = handler->GetTrinityString(LANG_ERROR);
+ uint32 security = 0;
+ std::string lastLogin = handler->GetTrinityString(LANG_ERROR);
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
+ stmt->setInt32(0, int32(realmID));
+ stmt->setUInt32(1, accId);
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+
+ if (result)
+ {
+ Field* fields = result->Fetch();
+ userName = fields[0].GetString();
+ security = fields[1].GetUInt8();
+ eMail = fields[2].GetString();
+ muteTime = fields[5].GetUInt64();
+
+ if (eMail.empty())
+ eMail = "-";
+
+ if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security))
+ {
+ lastIp = fields[3].GetString();
+ lastLogin = fields[4].GetString();
+
+ uint32 ip = inet_addr(lastIp.c_str());
+#if TRINITY_ENDIAN == BIGENDIAN
+ EndianConvertReverse(ip);
+#endif
+
+ PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
+
+ stmt->setUInt32(0, ip);
+
+ PreparedQueryResult result2 = WorldDatabase.Query(stmt);
+
+ if (result2)
+ {
+ Field* fields2 = result2->Fetch();
+ lastIp.append(" (");
+ lastIp.append(fields2[0].GetString());
+ lastIp.append(")");
+ }
+ }
+ else
+ {
+ lastIp = "-";
+ lastLogin = "-";
+ }
+ }
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency);
+
+ std::string bannedby = "unknown";
+ std::string banreason = "";
+
+ stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
+ stmt->setUInt32(0, accId);
+ PreparedQueryResult result2 = LoginDatabase.Query(stmt);
+ if (!result2)
+ {
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS);
+ stmt->setUInt32(0, GUID_LOPART(targetGuid));
+ result2 = CharacterDatabase.Query(stmt);
+ }
+
+ if (result2)
+ {
+ Field* fields = result2->Fetch();
+ banTime = int64(fields[1].GetBool() ? 0 : fields[0].GetUInt32());
+ bannedby = fields[2].GetString();
+ banreason = fields[3].GetString();
+ }
+
+ if (muteTime > 0)
+ handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).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());
+
+ std::string raceStr, ClassStr;
+ switch (race)
+ {
+ case RACE_HUMAN:
+ raceStr = "Human";
+ break;
+ case RACE_ORC:
+ raceStr = "Orc";
+ break;
+ case RACE_DWARF:
+ raceStr = "Dwarf";
+ break;
+ case RACE_NIGHTELF:
+ raceStr = "Night Elf";
+ break;
+ case RACE_UNDEAD_PLAYER:
+ raceStr = "Undead";
+ break;
+ case RACE_TAUREN:
+ raceStr = "Tauren";
+ break;
+ case RACE_GNOME:
+ raceStr = "Gnome";
+ break;
+ case RACE_TROLL:
+ raceStr = "Troll";
+ break;
+ case RACE_BLOODELF:
+ raceStr = "Blood Elf";
+ break;
+ case RACE_DRAENEI:
+ raceStr = "Draenei";
+ break;
+ }
+
+ switch (Class)
+ {
+ case CLASS_WARRIOR:
+ ClassStr = "Warrior";
+ break;
+ case CLASS_PALADIN:
+ ClassStr = "Paladin";
+ break;
+ case CLASS_HUNTER:
+ ClassStr = "Hunter";
+ break;
+ case CLASS_ROGUE:
+ ClassStr = "Rogue";
+ break;
+ case CLASS_PRIEST:
+ ClassStr = "Priest";
+ break;
+ case CLASS_DEATH_KNIGHT:
+ ClassStr = "Death Knight";
+ break;
+ case CLASS_SHAMAN:
+ ClassStr = "Shaman";
+ break;
+ case CLASS_MAGE:
+ ClassStr = "Mage";
+ break;
+ case CLASS_WARLOCK:
+ ClassStr = "Warlock";
+ break;
+ case CLASS_DRUID:
+ ClassStr = "Druid";
+ break;
+ }
+
+ std::string timeStr = secsToTimeString(totalPlayerTime, true, true);
+ uint32 gold = money /GOLD;
+ uint32 silv = (money % GOLD) / SILVER;
+ uint32 copp = (money % GOLD) % SILVER;
+ handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp);
+
+ // Add map, zone, subzone and phase to output
+ int locale = handler->GetSessionDbcLocale();
+ std::string areaName = "<unknown>";
+ std::string zoneName = "";
+
+ MapEntry const* map = sMapStore.LookupEntry(mapId);
+
+ AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
+ if (area)
+ {
+ areaName = area->area_name[locale];
+
+ AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
+ if (zone)
+ zoneName = zone->area_name[locale];
+ }
+
+ if (target)
+ {
+ if (!zoneName.empty())
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase);
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase);
+ }
+ else
+ handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str());
+
+ return true;
+ }
+
+ static bool HandleRespawnCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ // accept only explicitly selected target (not implicitly self targeting case)
+ Unit* target = handler->getSelectedUnit();
+ if (player->GetSelection() && target)
+ {
+ if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->isDead())
+ target->ToCreature()->Respawn();
+ return true;
+ }
+
+ CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
+ Cell cell(p);
+ cell.SetNoCreate();
+
+ Trinity::RespawnDo u_do;
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
+
+ TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
+ cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
+
+ return true;
+ }
+ // mute player for some times
+ static bool HandleMuteCommand(ChatHandler* handler, char const* args)
+ {
+ char* nameStr;
+ char* delayStr;
+ handler->extractOptFirstArg((char*)args, &nameStr, &delayStr);
+ if (!delayStr)
+ return false;
+
+ char const* muteReason = strtok(NULL, "\r");
+ std::string muteReasonStr = "No reason";
+ if (muteReason != NULL)
+ muteReasonStr = muteReason;
+
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget(nameStr, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ uint32 notSpeakTime = uint32(atoi(delayStr));
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+
+ if (target)
+ {
+ // Target is online, mute will be in effect right away.
+ 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());
+ }
+ else
+ {
+ // Target is offline, mute will be in effect starting from the next login.
+ int32 muteTime = -int32(notSpeakTime * MINUTE);
+ stmt->setInt64(0, muteTime);
+ }
+
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(target ? LANG_YOU_DISABLE_CHAT : LANG_COMMAND_DISABLE_CHAT_DELAYED, nameLink.c_str(), notSpeakTime, muteReasonStr.c_str());
+
+ return true;
+ }
+
+ // unmute player
+ static bool HandleUnmuteCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ uint32 accountId = target ? target->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+
+ // find only player from same account if any
+ if (!target)
+ if (WorldSession* session = sWorld->FindSession(accountId))
+ target = session->GetPlayer();
+
+ // must have strong lesser security level
+ if (handler->HasLowerSecurity (target, targetGuid, true))
+ return false;
+
+ if (target)
+ {
+ if (target->CanSpeak())
+ {
+ handler->SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ target->GetSession()->m_muteTime = 0;
+ }
+
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
+ stmt->setInt64(0, 0);
+ stmt->setUInt32(1, accountId);
+ LoginDatabase.Execute(stmt);
+
+ if (target)
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
+
+ std::string nameLink = handler->playerLink(targetName);
+
+ handler->PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
+
+ return true;
+ }
+
+
+ static bool HandleMovegensCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_MOVEGENS_LIST, (unit->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), unit->GetGUIDLow());
+
+ MotionMaster* motionMaster = unit->GetMotionMaster();
+ float x, y, z;
+ motionMaster->GetDestination(x, y, z);
+
+ for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
+ {
+ MovementGenerator* movementGenerator = motionMaster->GetMotionSlot(i);
+ if (!movementGenerator)
+ {
+ handler->SendSysMessage("Empty");
+ continue;
+ }
+
+ switch (movementGenerator->GetMovementGeneratorType())
+ {
+ case IDLE_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_IDLE);
+ break;
+ case RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_RANDOM);
+ break;
+ case WAYPOINT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_WAYPOINT);
+ break;
+ case ANIMAL_RANDOM_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_ANIMAL_RANDOM);
+ break;
+ case CONFUSED_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_CONFUSED);
+ break;
+ case CHASE_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<ChaseMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<ChaseMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUIDLow());
+ break;
+ }
+ case FOLLOW_MOTION_TYPE:
+ {
+ Unit* target = NULL;
+ if (unit->GetTypeId() == TYPEID_PLAYER)
+ target = static_cast<FollowMovementGenerator<Player> const*>(movementGenerator)->GetTarget();
+ else
+ target = static_cast<FollowMovementGenerator<Creature> const*>(movementGenerator)->GetTarget();
+
+ if (!target)
+ handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL);
+ else if (target->GetTypeId() == TYPEID_PLAYER)
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUIDLow());
+ else
+ handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUIDLow());
+ break;
+ }
+ case HOME_MOTION_TYPE:
+ {
+ if (unit->GetTypeId() == TYPEID_UNIT)
+ handler->PSendSysMessage(LANG_MOVEGENS_HOME_CREATURE, x, y, z);
+ else
+ handler->SendSysMessage(LANG_MOVEGENS_HOME_PLAYER);
+ break;
+ }
+ case FLIGHT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FLIGHT);
+ break;
+ case POINT_MOTION_TYPE:
+ {
+ handler->PSendSysMessage(LANG_MOVEGENS_POINT, x, y, z);
+ break;
+ }
+ case FLEEING_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_FEAR);
+ break;
+ case DISTRACT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_DISTRACT);
+ break;
+ case EFFECT_MOTION_TYPE:
+ handler->SendSysMessage(LANG_MOVEGENS_EFFECT);
+ break;
+ default:
+ handler->PSendSysMessage(LANG_MOVEGENS_UNKNOWN, movementGenerator->GetMovementGeneratorType());
+ break;
+ }
+ }
+ return true;
+ }
+ /*
+ ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
+ Without this function 3rd party scripting library will get linking errors (unresolved external)
+ when attempting to use the PointMovementGenerator
+ */
+ static bool HandleComeToMeCommand(ChatHandler* handler, char const* args)
+ {
+ char const* newFlagStr = strtok((char*)args, " ");
+ if (!newFlagStr)
+ return false;
+
+ Creature* caster = handler->getSelectedCreature();
+ if (!caster)
+ {
+ handler->SendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Player* player = handler->GetSession()->GetPlayer();
+
+ caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
+
+ return true;
+ }
+
+ static bool HandleDamageCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Unit* target = handler->getSelectedUnit();
+ if (!target || !handler->GetSession()->GetPlayer()->GetSelection())
+ {
+ handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (handler->HasLowerSecurity((Player*)target, 0, false))
+ return false;
+ }
+
+ if (!target->isAlive())
+ return true;
+
+ char* damageStr = strtok((char*)args, " ");
+ if (!damageStr)
+ return false;
+
+ int32 damage_int = atoi((char*)damageStr);
+ if (damage_int <= 0)
+ return true;
+
+ uint32 damage = damage_int;
+
+ char* schoolStr = strtok((char*)NULL, " ");
+
+ // flat melee damage without resistence/etc reduction
+ if (!schoolStr)
+ {
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ if (target != handler->GetSession()->GetPlayer())
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, SPELL_SCHOOL_MASK_NORMAL, damage, 0, 0, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ uint32 school = schoolStr ? atoi((char*)schoolStr) : SPELL_SCHOOL_NORMAL;
+ if (school >= MAX_SPELL_SCHOOL)
+ return false;
+
+ SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);
+
+ if (Unit::IsDamageReducedByArmor(schoolmask))
+ damage = handler->GetSession()->GetPlayer()->CalcArmorReducedDamage(target, damage, NULL, BASE_ATTACK);
+
+ char* spellStr = strtok((char*)NULL, " ");
+
+ // melee damage by specific school
+ if (!spellStr)
+ {
+ uint32 absorb = 0;
+ uint32 resist = 0;
+
+ handler->GetSession()->GetPlayer()->CalcAbsorbResist(target, schoolmask, SPELL_DIRECT_DAMAGE, damage, &absorb, &resist);
+
+ if (damage <= absorb + resist)
+ return true;
+
+ damage -= absorb + resist;
+
+ handler->GetSession()->GetPlayer()->DealDamageMods(target, damage, &absorb);
+ handler->GetSession()->GetPlayer()->DealDamage(target, damage, NULL, DIRECT_DAMAGE, schoolmask, NULL, false);
+ handler->GetSession()->GetPlayer()->SendAttackStateUpdate (HITINFO_AFFECTS_VICTIM, target, 1, schoolmask, damage, absorb, resist, VICTIMSTATE_HIT, 0);
+ return true;
+ }
+
+ // non-melee damage
+
+ // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
+ uint32 spellid = handler->extractSpellIdFromLink((char*)args);
+ if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
+ return false;
+
+ handler->GetSession()->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
+ return true;
+ }
+
+ static bool HandleCombatStopCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target = NULL;
+
+ if (args && strlen(args) > 0)
+ {
+ target = sObjectAccessor->FindPlayerByName(args);
+ if (!target)
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ if (!target)
+ {
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+ }
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ target->CombatStop();
+ target->getHostileRefManager().deleteReferences();
+ return true;
+ }
+
+ static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/)
+ {
+ sArenaTeamMgr->DistributeArenaPoints();
+ return true;
+ }
+
+ static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args)
+ {
+ Player* target;
+ if (!handler->extractPlayerTarget((char*)args, &target))
+ return false;
+
+ // check online security
+ if (handler->HasLowerSecurity(target, 0))
+ return false;
+
+ // Repair items
+ target->DurabilityRepairAll(false, 0, false);
+
+ handler->PSendSysMessage(LANG_YOU_REPAIR_ITEMS, handler->GetNameLink(target).c_str());
+ if (handler->needReportToTarget(target))
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, handler->GetNameLink().c_str());
+
+ return true;
+ }
+
+ // Send mail by command
+ static bool HandleSendMailCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text"
+ Player* target;
+ uint64 targetGuid;
+ std::string targetName;
+ if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ //- TODO: Fix poor design
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+ MailDraft(subject, text)
+ .SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(targetName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ // Send items by mail
+ static bool HandleSendItemsCommand(ChatHandler* handler, char const* args)
+ {
+ // format: name "subject text" "mail text" item1[:count1] item2[:count2] ... item12[:count12]
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char const* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char const* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // extract items
+ typedef std::pair<uint32, uint32> ItemPair;
+ typedef std::list< ItemPair > ItemPairs;
+ ItemPairs items;
+
+ // get all tail string
+ char* tail = strtok(NULL, "");
+
+ // get from tail next item str
+ while (char* itemStr = strtok(tail, " "))
+ {
+ // and get new tail
+ tail = strtok(NULL, "");
+
+ // parse item str
+ char const* itemIdStr = strtok(itemStr, ":");
+ char const* itemCountStr = strtok(NULL, " ");
+
+ uint32 itemId = atoi(itemIdStr);
+ if (!itemId)
+ return false;
+
+ ItemTemplate const* item_proto = sObjectMgr->GetItemTemplate(itemId);
+ if (!item_proto)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 itemCount = itemCountStr ? atoi(itemCountStr) : 1;
+ if (itemCount < 1 || (item_proto->MaxCount > 0 && itemCount > uint32(item_proto->MaxCount)))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, itemCount, itemId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ while (itemCount > item_proto->GetMaxStackSize())
+ {
+ items.push_back(ItemPair(itemId, item_proto->GetMaxStackSize()));
+ itemCount -= item_proto->GetMaxStackSize();
+ }
+
+ items.push_back(ItemPair(itemId, itemCount));
+
+ if (items.size() > MAX_MAIL_ITEMS)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_MAIL_ITEMS_LIMIT, MAX_MAIL_ITEMS);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ }
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ // fill mail
+ MailDraft draft(subject, text);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ for (ItemPairs::const_iterator itr = items.begin(); itr != items.end(); ++itr)
+ {
+ if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0))
+ {
+ item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
+ draft.AddItem(item);
+ }
+ }
+
+ draft.SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send money by mail
+ static bool HandleSendMoneyCommand(ChatHandler* handler, char const* args)
+ {
+ /// format: name "subject text" "mail text" money
+
+ Player* receiver;
+ uint64 receiverGuid;
+ std::string receiverName;
+ if (!handler->extractPlayerTarget((char*)args, &receiver, &receiverGuid, &receiverName))
+ return false;
+
+ char* tail1 = strtok(NULL, "");
+ if (!tail1)
+ return false;
+
+ char* msgSubject = handler->extractQuotedArg(tail1);
+ if (!msgSubject)
+ return false;
+
+ char* tail2 = strtok(NULL, "");
+ if (!tail2)
+ return false;
+
+ char* msgText = handler->extractQuotedArg(tail2);
+ if (!msgText)
+ return false;
+
+ char* moneyStr = strtok(NULL, "");
+ int32 money = moneyStr ? atoi(moneyStr) : 0;
+ if (money <= 0)
+ return false;
+
+ // msgSubject, msgText isn't NUL after prev. check
+ std::string subject = msgSubject;
+ std::string text = msgText;
+
+ // from console show not existed sender
+ MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
+
+ SQLTransaction trans = CharacterDatabase.BeginTransaction();
+
+ MailDraft(subject, text)
+ .AddMoney(money)
+ .SendMailTo(trans, MailReceiver(receiver, GUID_LOPART(receiverGuid)), sender);
+
+ CharacterDatabase.CommitTransaction(trans);
+
+ std::string nameLink = handler->playerLink(receiverName);
+ handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
+ return true;
+ }
+ /// Send a message to a player in game
+ static bool HandleSendMessageCommand(ChatHandler* handler, char const* args)
+ {
+ /// - Find the player
+ Player* player;
+ if (!handler->extractPlayerTarget((char*)args, &player))
+ return false;
+
+ char* msgStr = strtok(NULL, "");
+ if (!msgStr)
+ return false;
+
+ ///- Check that he is not logging out.
+ if (player->GetSession()->isLogingOut())
+ {
+ handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ /// - Send the message
+ // Use SendAreaTriggerMessage for fastest delivery.
+ player->GetSession()->SendAreaTriggerMessage("%s", msgStr);
+ player->GetSession()->SendAreaTriggerMessage("|cffff0000[Message from administrator]:|r");
+
+ // Confirmation message
+ std::string nameLink = handler->GetNameLink(player);
+ handler->PSendSysMessage(LANG_SENDMESSAGE, nameLink.c_str(), msgStr);
+
+ return true;
+ }
+
+ static bool HandleCreatePetCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+ Creature* creatureTarget = handler->getSelectedCreature();
+
+ if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+ {
+ handler->PSendSysMessage(LANG_SELECT_CREATURE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ CreatureTemplate const* creatrueTemplate = sObjectMgr->GetCreatureTemplate(creatureTarget->GetEntry());
+ // Creatures with family 0 crashes the server
+ if (!creatrueTemplate->family)
+ {
+ handler->PSendSysMessage("This creature cannot be tamed. (family id: 0).");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (player->GetPetGUID())
+ {
+ handler->PSendSysMessage("You already have a pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Everything looks OK, create new pet
+ Pet* pet = new Pet(player, HUNTER_PET);
+ if (!pet->CreateBaseAtCreature(creatureTarget))
+ {
+ delete pet;
+ handler->PSendSysMessage("Error 1");
+ return false;
+ }
+
+ creatureTarget->setDeathState(JUST_DIED);
+ creatureTarget->RemoveCorpse();
+ creatureTarget->SetHealth(0); // just for nice GM-mode view
+
+ pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, player->GetGUID());
+ pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, player->getFaction());
+
+ if (!pet->InitStatsForLevel(creatureTarget->getLevel()))
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
+ handler->PSendSysMessage("Error 2");
+ delete pet;
+ return false;
+ }
+
+ // prepare visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel()-1);
+
+ pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
+ // this enables pet details window (Shift+P)
+ pet->InitPetCreateSpells();
+ pet->SetFullHealth();
+
+ pet->GetMap()->AddToMap(pet->ToCreature());
+
+ // visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL, creatureTarget->getLevel());
+
+ player->SetMinion(pet, true);
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ player->PetSpellInitialize();
+
+ return true;
+ }
+
+ static bool HandlePetLearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
+ return false;
+
+ // Check if pet already has it
+ if (pet->HasSpell(spellId))
+ {
+ handler->PSendSysMessage("Pet already has spell: %u", spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // Check if spell is valid
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ pet->learnSpell(spellId);
+
+ handler->PSendSysMessage("Pet has learned spell %u", spellId);
+ return true;
+ }
+
+ static bool HandlePetUnlearnCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->GetSession()->GetPlayer();
+ Pet* pet = player->GetPet();
+ if (!pet)
+ {
+ handler->PSendSysMessage("You have no pet");
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ uint32 spellId = handler->extractSpellIdFromLink((char*)args);
+
+ if (pet->HasSpell(spellId))
+ pet->removeSpell(spellId, false);
+ else
+ handler->PSendSysMessage("Pet doesn't have that spell");
+
+ return true;
+ }
+
+ static bool HandleFreezeCommand(ChatHandler* handler, char const* args)
+ {
+ std::string name;
+ Player* player;
+ char const* TargetName = strtok((char*)args, " "); // get entered name
+ if (!TargetName) // if no name entered use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player) //prevent crash with creature as target
+ {
+ name = player->GetName();
+ normalizePlayerName(name);
+ }
+ }
+ else // if name entered
+ {
+ name = TargetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name);
+ }
+
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ if (player == handler->GetSession()->GetPlayer())
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR);
+ return true;
+ }
+
+ // effect
+ if (player && (player != handler->GetSession()->GetPlayer()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str());
+
+ // stop combat + make player unattackable + duel stop + stop some spells
+ player->setFaction(35);
+ player->CombatStop();
+ if (player->IsNonMeleeSpellCasted(true))
+ player->InterruptNonMeleeSpells(true);
+ player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // if player class = hunter || warlock remove pet if alive
+ if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK))
+ {
+ if (Pet* pet = player->GetPet())
+ {
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ // not let dismiss dead pet
+ if (pet->isAlive())
+ player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
+ }
+ }
+
+ if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454))
+ Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
+
+ // save player
+ player->SaveToDB();
+ }
+
+ return true;
+ }
+
+ static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args)
+ {
+ std::string name;
+ Player* player;
+ char* targetName = strtok((char*)args, " "); // Get entered name
+
+ if (targetName)
+ {
+ name = targetName;
+ normalizePlayerName(name);
+ player = sObjectAccessor->FindPlayerByName(name);
+ }
+ else // If no name was entered - use target
+ {
+ player = handler->getSelectedPlayer();
+ if (player)
+ name = player->GetName();
+ }
+
+ if (player)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+
+ // Reset player faction + allow combat + allow duels
+ player->setFactionForRace(player->getRace());
+ player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ // Remove Freeze spell (allowing movement and spells)
+ player->RemoveAurasDueToSpell(9454);
+
+ // Save player
+ player->SaveToDB();
+ }
+ else
+ {
+ if (targetName)
+ {
+ // Check for offline players
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
+ stmt->setString(0, name);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+
+ // If player found: delete his freeze aura
+ Field* fields = result->Fetch();
+ uint32 lowGuid = fields[0].GetUInt32();
+
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
+ stmt->setUInt32(0, lowGuid);
+ CharacterDatabase.Execute(stmt);
+
+ handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
+ return true;
+ }
+ else
+ {
+ handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
+ return true;
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ // Get names from DB
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
+ PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ if (!result)
+ {
+ handler->SendSysMessage(LANG_COMMAND_NO_FROZEN_PLAYERS);
+ return true;
+ }
+
+ // Header of the names
+ handler->PSendSysMessage(LANG_COMMAND_LIST_FREEZE);
+
+ // Output of the results
+ do
+ {
+ Field* fields = result->Fetch();
+ std::string player = fields[0].GetString();
+ handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
+ }
+ while (result->NextRow());
+
+ return true;
+ }
+
+ static bool HandleGroupLeaderCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group && group->GetLeaderGUID() != guid)
+ {
+ group->ChangeLeader(guid);
+ group->SendUpdate();
+ }
+
+ return true;
+ }
+
+ static bool HandleGroupDisbandCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid))
+ if (group)
+ group->Disband();
+
+ return true;
+ }
+
+ static bool HandleGroupRemoveCommand(ChatHandler* handler, char const* args)
+ {
+ Player* player = NULL;
+ Group* group = NULL;
+ uint64 guid = 0;
+ char* nameStr = strtok((char*)args, " ");
+
+ if (handler->GetPlayerGroupAndGUIDByName(nameStr, player, group, guid, true))
+ if (group)
+ group->RemoveMember(guid);
+
+ return true;
+ }
+
+ static bool HandlePlayAllCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 soundId = atoi((char*)args);
+
+ if (!sSoundEntriesStore.LookupEntry(soundId))
+ {
+ handler->PSendSysMessage(LANG_SOUND_NOT_EXIST, soundId);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ WorldPacket data(SMSG_PLAY_SOUND, 4);
+ data << uint32(soundId) << handler->GetSession()->GetPlayer()->GetGUID();
+ sWorld->SendGlobalMessage(&data);
+
+ handler->PSendSysMessage(LANG_COMMAND_PLAYED_TO_ALL, soundId);
+ return true;
+ }
+
+ static bool HandlePossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 530, true);
+ return true;
+ }
+
+ static bool HandleUnPossessCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ unit = handler->GetSession()->GetPlayer();
+
+ unit->RemoveCharmAuras();
+
+ return true;
+ }
+
+ static bool HandleBindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Unit* unit = handler->getSelectedUnit();
+ if (!unit)
+ return false;
+
+ handler->GetSession()->GetPlayer()->CastSpell(unit, 6277, true);
+ return true;
+ }
+
+ static bool HandleUnbindSightCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ Player* player = handler->GetSession()->GetPlayer();
+
+ if (player->isPossessing())
+ return false;
+
+ player->StopCastingBindSight();
+ return true;
+ }
+};
+
+void AddSC_misc_commandscript()
+{
+ new misc_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 60c5e1cf162..16599e5d892 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -22,9 +22,14 @@ Comment: All modify related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "Chat.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Pet.h"
+#include "Player.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
+
class modify_commandscript : public CommandScript
{
@@ -106,7 +111,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_HP, handler->GetNameLink(target).c_str(), hp, hpm);
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_HP_CHANGED, handler->GetNameLink().c_str(), hp, hpm);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_HP_CHANGED, handler->GetNameLink().c_str(), hp, hpm);
target->SetMaxHealth(hpm);
target->SetHealth(hp);
@@ -144,7 +149,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_MANA, handler->GetNameLink(target).c_str(), mana, manam);
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MANA_CHANGED, handler->GetNameLink().c_str(), mana, manam);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MANA_CHANGED, handler->GetNameLink().c_str(), mana, manam);
target->SetMaxPower(POWER_MANA, manam);
target->SetPower(POWER_MANA, mana);
@@ -193,12 +198,12 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_ENERGY, handler->GetNameLink(target).c_str(), energy/10, energym/10);
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, handler->GetNameLink().c_str(), energy/10, energym/10);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, handler->GetNameLink().c_str(), energy/10, energym/10);
target->SetMaxPower(POWER_ENERGY, energym);
target->SetPower(POWER_ENERGY, energy);
- sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
return true;
}
@@ -244,7 +249,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_RAGE, handler->GetNameLink(target).c_str(), rage/10, ragem/10);
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, handler->GetNameLink().c_str(), rage/10, ragem/10);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, handler->GetNameLink().c_str(), rage/10, ragem/10);
target->SetMaxPower(POWER_RAGE, ragem);
target->SetPower(POWER_RAGE, rage);
@@ -278,7 +283,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_RUNIC_POWER, handler->GetNameLink(target).c_str(), rune/10, runem/10);
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, handler->GetNameLink().c_str(), rune/10, runem/10);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, handler->GetNameLink().c_str(), rune/10, runem/10);
target->SetMaxPower(POWER_RUNIC_POWER, runem);
target->SetPower(POWER_RUNIC_POWER, rune);
@@ -408,7 +413,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, handler->GetNameLink().c_str(), spellflatid, val, mark);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, handler->GetNameLink().c_str(), spellflatid, val, mark);
WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1+1+2+2));
data << uint8(spellflatid);
@@ -504,7 +509,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_ASPEED, ASpeed, targetNameLink.c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, handler->GetNameLink().c_str(), ASpeed);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_ASPEED_CHANGED, handler->GetNameLink().c_str(), ASpeed);
target->SetSpeed(MOVE_WALK, ASpeed, true);
target->SetSpeed(MOVE_RUN, ASpeed, true);
@@ -552,7 +557,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_SPEED, Speed, targetNameLink.c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, handler->GetNameLink().c_str(), Speed);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SPEED_CHANGED, handler->GetNameLink().c_str(), Speed);
target->SetSpeed(MOVE_RUN, Speed, true);
@@ -597,7 +602,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_SWIM_SPEED, Swim, targetNameLink.c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, handler->GetNameLink().c_str(), Swim);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SWIM_SPEED_CHANGED, handler->GetNameLink().c_str(), Swim);
target->SetSpeed(MOVE_SWIM, Swim, true);
@@ -642,7 +647,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_BACK_SPEED, BSpeed, targetNameLink.c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, handler->GetNameLink().c_str(), BSpeed);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, handler->GetNameLink().c_str(), BSpeed);
target->SetSpeed(MOVE_RUN_BACK, BSpeed, true);
@@ -678,7 +683,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_FLY_SPEED, FSpeed, handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, handler->GetNameLink().c_str(), FSpeed);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, handler->GetNameLink().c_str(), FSpeed);
target->SetSpeed(MOVE_FLIGHT, FSpeed, true);
@@ -715,7 +720,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_SIZE, Scale, handler->GetNameLink(player).c_str());
if (handler->needReportToTarget(player))
- (ChatHandler(player)).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale);
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_YOURS_SIZE_CHANGED, handler->GetNameLink().c_str(), Scale);
}
target->SetObjectScale(Scale);
@@ -963,7 +968,7 @@ public:
handler->PSendSysMessage(LANG_YOU_GIVE_MOUNT, handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_MOUNT_GIVED, handler->GetNameLink().c_str());
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_MOUNT_GIVED, handler->GetNameLink().c_str());
target->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP);
target->Mount(mId);
@@ -1002,20 +1007,24 @@ public:
if (handler->HasLowerSecurity(target, 0))
return false;
- int32 addmoney = atoi((char*)args);
+ int32 moneyToAdd = 0;
+ if (strchr(args, 'g') || strchr(args, 's') || strchr(args, 'c'))
+ moneyToAdd = MoneyStringToMoney(std::string(args));
+ else
+ moneyToAdd = atoi(args);
- uint32 moneyuser = target->GetMoney();
+ uint32 targetMoney = target->GetMoney();
- if (addmoney < 0)
+ if (moneyToAdd < 0)
{
- int32 newmoney = int32(moneyuser) + addmoney;
+ int32 newmoney = int32(targetMoney) + moneyToAdd;
- sLog->outDetail(handler->GetTrinityString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney);
if (newmoney <= 0)
{
handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, handler->GetNameLink().c_str());
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_ALL_MONEY_GONE, handler->GetNameLink().c_str());
target->SetMoney(0);
}
@@ -1024,25 +1033,25 @@ public:
if (newmoney > MAX_MONEY_AMOUNT)
newmoney = MAX_MONEY_AMOUNT;
- handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), handler->GetNameLink(target).c_str());
+ handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(addmoney));
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(moneyToAdd));
target->SetMoney(newmoney);
}
}
else
{
- handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, addmoney, handler->GetNameLink(target).c_str());
+ handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, moneyToAdd, handler->GetNameLink(target).c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), addmoney);
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd);
- if (addmoney >=MAX_MONEY_AMOUNT)
+ if (moneyToAdd >= MAX_MONEY_AMOUNT)
target->SetMoney(MAX_MONEY_AMOUNT);
else
- target->ModifyMoney(addmoney);
+ target->ModifyMoney(moneyToAdd);
}
- sLog->outDetail(handler->GetTrinityString(LANG_NEW_MONEY), moneyuser, addmoney, target->GetMoney());
+ sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney());
return true;
}
@@ -1130,20 +1139,15 @@ public:
static bool HandleModifyDrunkCommand(ChatHandler* handler, const char* args)
{
- if (!*args) return false;
+ if (!*args)
+ return false;
- uint32 drunklevel = (uint32)atoi(args);
+ uint8 drunklevel = (uint8)atoi(args);
if (drunklevel > 100)
drunklevel = 100;
- uint16 drunkMod = drunklevel * 0xFFFF / 100;
-
- Player* target = handler->getSelectedPlayer();
- if (!target)
- target = handler->GetSession()->GetPlayer();
-
- if (target)
- target->SetDrunkValue(drunkMod);
+ if (Player* target = handler->getSelectedPlayer())
+ target->SetDrunkValue(drunklevel);
return true;
}
@@ -1379,7 +1383,7 @@ public:
handler->PSendSysMessage(LANG_YOU_CHANGE_GENDER, handler->GetNameLink(target).c_str(), gender_full);
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str());
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_GENDER_CHANGED, gender_full, handler->GetNameLink().c_str());
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 832f7958fc8..28e0744c29d 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -27,8 +27,11 @@ EndScriptData */
#include "Chat.h"
#include "Transport.h"
#include "CreatureGroups.h"
+#include "Language.h"
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
#include "CreatureAI.h"
+#include "Player.h"
+#include "Pet.h"
class npc_commandscript : public CommandScript
{
@@ -47,19 +50,19 @@ public:
{ "weapon", SEC_ADMINISTRATOR, false, &HandleNpcAddWeaponCommand, "", NULL },
//}
{ "", SEC_GAMEMASTER, false, &HandleNpcAddCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand npcDeleteCommandTable[] =
{
{ "item", SEC_GAMEMASTER, false, &HandleNpcDeleteVendorItemCommand, "", NULL },
{ "", SEC_GAMEMASTER, false, &HandleNpcDeleteCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand npcFollowCommandTable[] =
{
{ "stop", SEC_GAMEMASTER, false, &HandleNpcUnFollowCommand, "", NULL },
{ "", SEC_GAMEMASTER, false, &HandleNpcFollowCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand npcSetCommandTable[] =
{
@@ -79,7 +82,7 @@ public:
{ "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL },
{ "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL },
//}
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand npcCommandTable[] =
{
@@ -95,18 +98,18 @@ public:
{ "delete", SEC_GAMEMASTER, false, NULL, "", npcDeleteCommandTable },
{ "follow", SEC_GAMEMASTER, false, NULL, "", npcFollowCommandTable },
{ "set", SEC_GAMEMASTER, false, NULL, "", npcSetCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "npc", SEC_MODERATOR, false, NULL, "", npcCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
//add spawn of creature
- static bool HandleNpcAddCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcAddCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -229,7 +232,7 @@ public:
}
//add move for creature
- static bool HandleNpcAddMoveCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcAddMoveCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -293,7 +296,7 @@ public:
return true;
}
- static bool HandleNpcSetAllowMovementCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleNpcSetAllowMovementCommand(ChatHandler* handler, char const* /*args*/)
{
if (sWorld->getAllowMovement())
{
@@ -308,7 +311,7 @@ public:
return true;
}
- static bool HandleNpcSetEntryCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetEntryCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -333,7 +336,7 @@ public:
}
//change level of creature or pet
- static bool HandleNpcSetLevelCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetLevelCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -374,7 +377,7 @@ public:
return true;
}
- static bool HandleNpcDeleteCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcDeleteCommand(ChatHandler* handler, char const* args)
{
Creature* unit = NULL;
@@ -413,7 +416,7 @@ public:
}
//del item from vendor list
- static bool HandleNpcDeleteVendorItemCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcDeleteVendorItemCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -449,7 +452,7 @@ public:
}
//set faction of creature
- static bool HandleNpcSetFactionIdCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetFactionIdCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -496,7 +499,7 @@ public:
}
//set npcflag of creature
- static bool HandleNpcSetFlagCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetFlagCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -527,7 +530,7 @@ public:
}
//set data of creature for testing scripting
- static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetDataCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -555,12 +558,12 @@ public:
creature->AI()->SetData(data_1, data_2);
std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
- handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str());
+ handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
return true;
}
//npc follow handling
- static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleNpcFollowCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
Creature* creature = handler->getSelectedCreature();
@@ -575,11 +578,11 @@ public:
// Follow player - Using pet's default dist and angle
creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, creature->GetFollowAngle());
- handler->PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName());
+ handler->PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName().c_str());
return true;
}
- static bool HandleNpcInfoCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleNpcInfoCommand(ChatHandler* handler, char const* /*args*/)
{
Creature* target = handler->getSelectedCreature();
@@ -625,7 +628,7 @@ public:
}
//move selected creature
- static bool HandleNpcMoveCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcMoveCommand(ChatHandler* handler, char const* args)
{
uint32 lowguid = 0;
@@ -713,7 +716,7 @@ public:
}
//play npc emote
- static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, char const* args)
{
uint32 emote = atoi((char*)args);
@@ -742,7 +745,7 @@ public:
}
//set model of creature
- static bool HandleNpcSetModelCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetModelCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -778,7 +781,7 @@ public:
* additional parameter: NODEL - so no waypoints are deleted, if you
* change the movement type
*/
- static bool HandleNpcSetMoveTypeCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetMoveTypeCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -804,7 +807,7 @@ public:
if (dontdel_str)
{
- //sLog->outError("DEBUG: All 3 params are set");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: All 3 params are set");
// All 3 params are set
// GUID
@@ -812,7 +815,7 @@ public:
// doNotDEL
if (stricmp(dontdel_str, "NODEL") == 0)
{
- //sLog->outError("DEBUG: doNotDelete = true;");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: doNotDelete = true;");
doNotDelete = true;
}
}
@@ -821,10 +824,10 @@ public:
// Only 2 params - but maybe NODEL is set
if (type_str)
{
- sLog->outError("DEBUG: Only 2 params ");
+ sLog->outError(LOG_FILTER_GENERAL, "DEBUG: Only 2 params ");
if (stricmp(type_str, "NODEL") == 0)
{
- //sLog->outError("DEBUG: type_str, NODEL ");
+ //sLog->outError(LOG_FILTER_GENERAL, "DEBUG: type_str, NODEL ");
doNotDelete = true;
type_str = NULL;
}
@@ -914,7 +917,7 @@ public:
//npc phasemask handling
//change phasemask of creature or pet
- static bool HandleNpcSetPhaseCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetPhaseCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -944,7 +947,7 @@ public:
}
//set spawn dist of creature
- static bool HandleNpcSetSpawnDistCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetSpawnDistCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -990,7 +993,7 @@ public:
}
//spawn time handling
- static bool HandleNpcSetSpawnTimeCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetSpawnTimeCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1030,7 +1033,7 @@ public:
return true;
}
- static bool HandleNpcSayCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSayCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1058,7 +1061,7 @@ public:
}
//show text emote by creature in chat
- static bool HandleNpcTextEmoteCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcTextEmoteCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1078,7 +1081,7 @@ public:
}
//npc unfollow handling
- static bool HandleNpcUnFollowCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleNpcUnFollowCommand(ChatHandler* handler, char const* /*args*/)
{
Player* player = handler->GetSession()->GetPlayer();
Creature* creature = handler->getSelectedCreature();
@@ -1093,7 +1096,7 @@ public:
if (/*creature->GetMotionMaster()->empty() ||*/
creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE)
{
- handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
+ handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
@@ -1102,7 +1105,7 @@ public:
if (mgen->GetTarget() != player)
{
- handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName());
+ handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
handler->SetSentErrorMessage(true);
return false;
}
@@ -1110,12 +1113,12 @@ public:
// reset movement
creature->GetMotionMaster()->MovementExpired(true);
- handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName());
+ handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName().c_str());
return true;
}
// make npc whisper to player
- static bool HandleNpcWhisperCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcWhisperCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1142,7 +1145,7 @@ public:
return true;
}
- static bool HandleNpcYellCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcYellCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1164,7 +1167,7 @@ public:
}
// add creature, temp only
- static bool HandleNpcAddTempSpawnCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcAddTempSpawnCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1184,7 +1187,7 @@ public:
}
//npc tame handling
- static bool HandleNpcTameCommand(ChatHandler* handler, const char* /*args*/)
+ static bool HandleNpcTameCommand(ChatHandler* handler, char const* /*args*/)
{
Creature* creatureTarget = handler->getSelectedCreature();
if (!creatureTarget || creatureTarget->isPet())
@@ -1250,7 +1253,7 @@ public:
return true;
}
- static bool HandleNpcAddFormationCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcAddFormationCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1302,7 +1305,7 @@ public:
return true;
}
- static bool HandleNpcSetLinkCommand(ChatHandler* handler, const char* args)
+ static bool HandleNpcSetLinkCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
@@ -1337,7 +1340,7 @@ public:
}
//TODO: NpcCommands that need to be fixed :
- static bool HandleNpcAddWeaponCommand(ChatHandler* /*handler*/, const char* /*args*/)
+ static bool HandleNpcAddWeaponCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
/*if (!*args)
return false;
@@ -1405,7 +1408,7 @@ public:
return true;
}
- static bool HandleNpcSetNameCommand(ChatHandler* /*handler*/, const char* /*args*/)
+ static bool HandleNpcSetNameCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
/* Temp. disabled
if (!*args)
@@ -1452,7 +1455,7 @@ public:
return true;
}
- static bool HandleNpcSetSubNameCommand(ChatHandler* /*handler*/, const char* /*args*/)
+ static bool HandleNpcSetSubNameCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
/* Temp. disabled
diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 2472a29e595..22d6e0831d6 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -22,9 +22,11 @@ Comment: All quest related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "Chat.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ReputationMgr.h"
+#include "ScriptMgr.h"
class quest_commandscript : public CommandScript
{
@@ -38,12 +40,13 @@ public:
{ "add", SEC_ADMINISTRATOR, false, &HandleQuestAdd, "", NULL },
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "quest", SEC_ADMINISTRATOR, false, NULL, "", questCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
@@ -77,7 +80,7 @@ public:
// check item starting quest (it can work incorrectly if added without item in inventory)
ItemTemplateContainer const* itc = sObjectMgr->GetItemTemplateStore();
- ItemTemplateContainer::const_iterator result = find_if (itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
+ ItemTemplateContainer::const_iterator result = find_if(itc->begin(), itc->end(), Finder<uint32, ItemTemplate>(entry, &ItemTemplate::StartQuest));
if (result != itc->end())
{
@@ -244,6 +247,38 @@ public:
player->CompleteQuest(entry);
return true;
}
+
+ static bool HandleQuestReward(ChatHandler* handler, char const* args)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ // .quest reward #entry
+ // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
+ char* cId = handler->extractKeyFromLink((char*)args, "Hquest");
+ if (!cId)
+ return false;
+
+ uint32 entry = atol(cId);
+
+ Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
+
+ // If player doesn't have the quest
+ if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE)
+ {
+ handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->RewardQuest(quest, 0, player);
+ return true;
+ }
};
void AddSC_quest_commandscript()
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 1c119fdef4c..5b5608f9a26 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -22,22 +22,24 @@ Comment: All reload related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "TicketMgr.h"
-#include "MapManager.h"
+#include "AchievementMgr.h"
+#include "AuctionHouseMgr.h"
+#include "Chat.h"
#include "CreatureEventAIMgr.h"
+#include "CreatureTextMgr.h"
#include "DisableMgr.h"
+#include "Language.h"
#include "LFGMgr.h"
-#include "AuctionHouseMgr.h"
-#include "CreatureTextMgr.h"
-#include "SmartAI.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
+#include "ScriptMgr.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
-#include "Chat.h"
-#include "WaypointManager.h"
+#include "SmartAI.h"
+#include "SpellMgr.h"
+#include "TicketMgr.h"
#include "WardenCheckMgr.h"
+#include "WaypointManager.h"
class reload_commandscript : public CommandScript
{
@@ -78,7 +80,6 @@ public:
{ "config", SEC_ADMINISTRATOR, true, &HandleReloadConfigCommand, "", NULL },
{ "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "", NULL },
{ "creature_ai_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventAIScriptsCommand, "", NULL },
- { "creature_ai_summons", SEC_ADMINISTRATOR, true, &HandleReloadEventAISummonsCommand, "", NULL },
{ "creature_ai_texts", SEC_ADMINISTRATOR, true, &HandleReloadEventAITextsCommand, "", NULL },
{ "creature_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestInvRelationsCommand, "", NULL },
{ "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "", NULL },
@@ -127,7 +128,6 @@ public:
{ "prospecting_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesProspectingCommand, "", NULL },
{ "quest_end_scripts", SEC_ADMINISTRATOR, true, &HandleReloadQuestEndScriptsCommand, "", NULL },
{ "quest_poi", SEC_ADMINISTRATOR, true, &HandleReloadQuestPOICommand, "", NULL },
- { "quest_start_scripts", SEC_ADMINISTRATOR, true, &HandleReloadQuestStartScriptsCommand, "", NULL },
{ "quest_template", SEC_ADMINISTRATOR, true, &HandleReloadQuestTemplateCommand, "", NULL },
{ "reference_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesReferenceCommand, "", NULL },
{ "reserved_name", SEC_ADMINISTRATOR, true, &HandleReloadReservedNameCommand, "", NULL },
@@ -222,7 +222,7 @@ public:
static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables...");
LoadLootTables();
handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -245,7 +245,7 @@ public:
HandleReloadQuestPOICommand(handler, "a");
HandleReloadQuestTemplateCommand(handler, "a");
- sLog->outString("Re-Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quests Relations...");
sObjectMgr->LoadQuestRelations();
handler->SendGlobalGMSysMessage("DB tables `*_questrelation` and `*_involvedrelation` reloaded.");
return true;
@@ -260,11 +260,10 @@ public:
return false;
}
- sLog->outString("Re-Loading Scripts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts...");
HandleReloadGameObjectScriptsCommand(handler, "a");
HandleReloadEventScriptsCommand(handler, "a");
HandleReloadQuestEndScriptsCommand(handler, "a");
- HandleReloadQuestStartScriptsCommand(handler, "a");
HandleReloadSpellScriptsCommand(handler, "a");
handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded.");
HandleReloadDbScriptStringCommand(handler, "a");
@@ -276,7 +275,6 @@ public:
static bool HandleReloadAllEventAICommand(ChatHandler* handler, const char* /*args*/)
{
HandleReloadEventAITextsCommand(handler, "a");
- HandleReloadEventAISummonsCommand(handler, "a");
HandleReloadEventAIScriptsCommand(handler, "a");
return true;
}
@@ -333,7 +331,7 @@ public:
static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading config settings...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading config settings...");
sWorld->LoadConfigSettings(true);
sMapMgr->InitializeVisibilityDistanceInfo();
handler->SendGlobalGMSysMessage("World config settings reloaded.");
@@ -342,7 +340,7 @@ public:
static bool HandleReloadAccessRequirementCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Access Requirement definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Access Requirement definitions...");
sObjectMgr->LoadAccessRequirements();
handler->SendGlobalGMSysMessage("DB table `access_requirement` reloaded.");
return true;
@@ -350,7 +348,7 @@ public:
static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Additional Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Additional Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded.");
return true;
@@ -358,7 +356,7 @@ public:
static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Achievement Reward Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Achievement Reward Data...");
sAchievementMgr->LoadRewards();
handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded.");
return true;
@@ -366,7 +364,7 @@ public:
static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded.");
return true;
@@ -374,7 +372,7 @@ public:
static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading AreaTrigger teleport definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading AreaTrigger teleport definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded.");
return true;
@@ -382,7 +380,7 @@ public:
static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Autobroadcasts...");
sWorld->LoadAutobroadcasts();
handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded.");
return true;
@@ -397,7 +395,7 @@ public:
static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading creature award reputation definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading creature award reputation definitions...");
sObjectMgr->LoadReputationOnKill();
handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded.");
return true;
@@ -408,9 +406,9 @@ public:
if (!*args)
return false;
- Tokens entries(std::string(args), ' ');
+ Tokenizer entries(std::string(args), ' ');
- for (Tokens::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
+ for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr)
{
uint32 entry = uint32(atoi(*itr));
@@ -431,7 +429,7 @@ public:
continue;
}
- sLog->outString("Reloading creature template entry %u", entry);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading creature template entry %u", entry);
Field* fields = result->Fetch();
@@ -467,56 +465,57 @@ public:
cInfo->rangeattacktime = fields[29].GetUInt32();
cInfo->unit_class = fields[30].GetUInt8();
cInfo->unit_flags = fields[31].GetUInt32();
- cInfo->dynamicflags = fields[32].GetUInt32();
- cInfo->family = fields[33].GetUInt8();
- cInfo->trainer_type = fields[34].GetUInt8();
- cInfo->trainer_spell = fields[35].GetUInt32();
- cInfo->trainer_class = fields[36].GetUInt8();
- cInfo->trainer_race = fields[37].GetUInt8();
- cInfo->minrangedmg = fields[38].GetFloat();
- cInfo->maxrangedmg = fields[39].GetFloat();
- cInfo->rangedattackpower = fields[40].GetUInt16();
- cInfo->type = fields[41].GetUInt8();
- cInfo->type_flags = fields[42].GetUInt32();
- cInfo->lootid = fields[43].GetUInt32();
- cInfo->pickpocketLootId = fields[44].GetUInt32();
- cInfo->SkinLootId = fields[45].GetUInt32();
+ cInfo->unit_flags2 = fields[32].GetUInt32();
+ cInfo->dynamicflags = fields[33].GetUInt32();
+ cInfo->family = fields[34].GetUInt8();
+ cInfo->trainer_type = fields[35].GetUInt8();
+ cInfo->trainer_spell = fields[36].GetUInt32();
+ cInfo->trainer_class = fields[37].GetUInt8();
+ cInfo->trainer_race = fields[38].GetUInt8();
+ cInfo->minrangedmg = fields[39].GetFloat();
+ cInfo->maxrangedmg = fields[40].GetFloat();
+ cInfo->rangedattackpower = fields[41].GetUInt16();
+ cInfo->type = fields[42].GetUInt8();
+ cInfo->type_flags = fields[43].GetUInt32();
+ cInfo->lootid = fields[44].GetUInt32();
+ cInfo->pickpocketLootId = fields[45].GetUInt32();
+ cInfo->SkinLootId = fields[46].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- cInfo->resistance[i] = fields[46 + i -1].GetUInt16();
-
- cInfo->spells[0] = fields[52].GetUInt32();
- cInfo->spells[1] = fields[53].GetUInt32();
- cInfo->spells[2] = fields[54].GetUInt32();
- cInfo->spells[3] = fields[55].GetUInt32();
- cInfo->spells[4] = fields[56].GetUInt32();
- cInfo->spells[5] = fields[57].GetUInt32();
- cInfo->spells[6] = fields[58].GetUInt32();
- cInfo->spells[7] = fields[59].GetUInt32();
- cInfo->PetSpellDataId = fields[60].GetUInt32();
- cInfo->VehicleId = fields[61].GetUInt32();
- cInfo->mingold = fields[62].GetUInt32();
- cInfo->maxgold = fields[63].GetUInt32();
- cInfo->AIName = fields[64].GetString();
- cInfo->MovementType = fields[65].GetUInt8();
- cInfo->InhabitType = fields[66].GetUInt8();
- cInfo->HoverHeight = fields[67].GetFloat();
- cInfo->ModHealth = fields[68].GetFloat();
- cInfo->ModMana = fields[69].GetFloat();
- cInfo->ModArmor = fields[70].GetFloat();
- cInfo->RacialLeader = fields[71].GetBool();
- cInfo->questItems[0] = fields[72].GetUInt32();
- cInfo->questItems[1] = fields[73].GetUInt32();
- cInfo->questItems[2] = fields[74].GetUInt32();
- cInfo->questItems[3] = fields[75].GetUInt32();
- cInfo->questItems[4] = fields[76].GetUInt32();
- cInfo->questItems[5] = fields[77].GetUInt32();
- cInfo->movementId = fields[78].GetUInt32();
- cInfo->RegenHealth = fields[79].GetBool();
- cInfo->equipmentId = fields[80].GetUInt32();
- cInfo->MechanicImmuneMask = fields[81].GetUInt32();
- cInfo->flags_extra = fields[82].GetUInt32();
- cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString());
+ cInfo->resistance[i] = fields[47 + i -1].GetUInt16();
+
+ cInfo->spells[0] = fields[53].GetUInt32();
+ cInfo->spells[1] = fields[54].GetUInt32();
+ cInfo->spells[2] = fields[55].GetUInt32();
+ cInfo->spells[3] = fields[56].GetUInt32();
+ cInfo->spells[4] = fields[57].GetUInt32();
+ cInfo->spells[5] = fields[58].GetUInt32();
+ cInfo->spells[6] = fields[59].GetUInt32();
+ cInfo->spells[7] = fields[60].GetUInt32();
+ cInfo->PetSpellDataId = fields[61].GetUInt32();
+ cInfo->VehicleId = fields[62].GetUInt32();
+ cInfo->mingold = fields[63].GetUInt32();
+ cInfo->maxgold = fields[64].GetUInt32();
+ cInfo->AIName = fields[65].GetString();
+ cInfo->MovementType = fields[66].GetUInt8();
+ cInfo->InhabitType = fields[67].GetUInt8();
+ cInfo->HoverHeight = fields[68].GetFloat();
+ cInfo->ModHealth = fields[69].GetFloat();
+ cInfo->ModMana = fields[70].GetFloat();
+ cInfo->ModArmor = fields[71].GetFloat();
+ cInfo->RacialLeader = fields[72].GetBool();
+ cInfo->questItems[0] = fields[73].GetUInt32();
+ cInfo->questItems[1] = fields[74].GetUInt32();
+ cInfo->questItems[2] = fields[75].GetUInt32();
+ cInfo->questItems[3] = fields[76].GetUInt32();
+ cInfo->questItems[4] = fields[77].GetUInt32();
+ 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());
sObjectMgr->CheckCreatureTemplate(cInfo);
}
@@ -527,7 +526,7 @@ public:
static bool HandleReloadCreatureQuestRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`creature_questrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_questrelation`)");
sObjectMgr->LoadCreatureQuestRelations();
handler->SendGlobalGMSysMessage("DB table `creature_questrelation` (creature quest givers) reloaded.");
return true;
@@ -535,7 +534,7 @@ public:
static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Linked Respawns... (`creature_linked_respawn`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Linked Respawns... (`creature_linked_respawn`)");
sObjectMgr->LoadLinkedRespawn();
handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded.");
return true;
@@ -543,7 +542,7 @@ public:
static bool HandleReloadCreatureQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`creature_involvedrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`creature_involvedrelation`)");
sObjectMgr->LoadCreatureInvolvedRelations();
handler->SendGlobalGMSysMessage("DB table `creature_involvedrelation` (creature quest takers) reloaded.");
return true;
@@ -551,7 +550,7 @@ public:
static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `gossip_menu` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu` Table!");
sObjectMgr->LoadGossipMenu();
handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -560,7 +559,7 @@ public:
static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `gossip_menu_option` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `gossip_menu_option` Table!");
sObjectMgr->LoadGossipMenuItems();
handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -569,7 +568,7 @@ public:
static bool HandleReloadGOQuestRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`gameobject_questrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_questrelation`)");
sObjectMgr->LoadGameobjectQuestRelations();
handler->SendGlobalGMSysMessage("DB table `gameobject_questrelation` (gameobject quest givers) reloaded.");
return true;
@@ -577,7 +576,7 @@ public:
static bool HandleReloadGOQuestInvRelationsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading Quests Relations... (`gameobject_involvedrelation`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations... (`gameobject_involvedrelation`)");
sObjectMgr->LoadGameobjectInvolvedRelations();
handler->SendGlobalGMSysMessage("DB table `gameobject_involvedrelation` (gameobject quest takers) reloaded.");
return true;
@@ -585,7 +584,7 @@ public:
static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers();
handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded.");
return true;
@@ -593,12 +592,12 @@ public:
static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Quest Templates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest Templates...");
sObjectMgr->LoadQuests();
handler->SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded.");
/// dependent also from `gameobject` but this table not reloaded anyway
- sLog->outString("Re-Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded.");
return true;
@@ -606,7 +605,7 @@ public:
static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`creature_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`creature_loot_template`)");
LoadLootTemplates_Creature();
LootTemplates_Creature.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded.");
@@ -616,7 +615,7 @@ public:
static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`disenchant_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`disenchant_loot_template`)");
LoadLootTemplates_Disenchant();
LootTemplates_Disenchant.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded.");
@@ -626,7 +625,7 @@ public:
static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`fishing_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`fishing_loot_template`)");
LoadLootTemplates_Fishing();
LootTemplates_Fishing.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded.");
@@ -636,7 +635,7 @@ public:
static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`gameobject_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`gameobject_loot_template`)");
LoadLootTemplates_Gameobject();
LootTemplates_Gameobject.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded.");
@@ -646,7 +645,7 @@ public:
static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`item_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`item_loot_template`)");
LoadLootTemplates_Item();
LootTemplates_Item.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded.");
@@ -656,7 +655,7 @@ public:
static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`milling_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`milling_loot_template`)");
LoadLootTemplates_Milling();
LootTemplates_Milling.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded.");
@@ -666,7 +665,7 @@ public:
static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`pickpocketing_loot_template`)");
LoadLootTemplates_Pickpocketing();
LootTemplates_Pickpocketing.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded.");
@@ -676,7 +675,7 @@ public:
static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`prospecting_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`prospecting_loot_template`)");
LoadLootTemplates_Prospecting();
LootTemplates_Prospecting.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded.");
@@ -686,7 +685,7 @@ public:
static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`mail_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`mail_loot_template`)");
LoadLootTemplates_Mail();
LootTemplates_Mail.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded.");
@@ -696,7 +695,7 @@ public:
static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`reference_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`reference_loot_template`)");
LoadLootTemplates_Reference();
handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded.");
sConditionMgr->LoadConditions(true);
@@ -705,7 +704,7 @@ public:
static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`skinning_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`skinning_loot_template`)");
LoadLootTemplates_Skinning();
LootTemplates_Skinning.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded.");
@@ -715,7 +714,7 @@ public:
static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Loot Tables... (`spell_loot_template`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Loot Tables... (`spell_loot_template`)");
LoadLootTemplates_Spell();
LootTemplates_Spell.CheckLootRefs();
handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded.");
@@ -725,7 +724,7 @@ public:
static bool HandleReloadTrinityStringCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading trinity_string Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading trinity_string Table!");
sObjectMgr->LoadTrinityStrings();
handler->SendGlobalGMSysMessage("DB table `trinity_string` reloaded.");
return true;
@@ -740,7 +739,7 @@ public:
return false;
}
- sLog->outString("Re-Loading warden_action Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading warden_action Table!");
sWardenCheckMgr->LoadWardenOverrides();
handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded.");
return true;
@@ -748,7 +747,7 @@ public:
static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_trainer` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_trainer` Table!");
sObjectMgr->LoadTrainerSpell();
handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded.");
return true;
@@ -756,7 +755,7 @@ public:
static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_vendor` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_vendor` Table!");
sObjectMgr->LoadVendors();
handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded.");
return true;
@@ -764,7 +763,7 @@ public:
static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `points_of_interest` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `points_of_interest` Table!");
sObjectMgr->LoadPointsOfInterest();
handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded.");
return true;
@@ -772,7 +771,7 @@ public:
static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading Quest POI ..." );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Quest POI ..." );
sObjectMgr->LoadQuestPOI();
handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded.");
return true;
@@ -780,7 +779,7 @@ public:
static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading `npc_spellclick_spells` Table!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `npc_spellclick_spells` Table!");
sObjectMgr->LoadNPCSpellClickSpells();
handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded.");
return true;
@@ -788,7 +787,7 @@ public:
static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Loading ReservedNames... (`reserved_name`)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames... (`reserved_name`)");
sObjectMgr->LoadReservedPlayersNames();
handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded.");
return true;
@@ -796,7 +795,7 @@ public:
static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading `reputation_reward_rate` Table!" );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_reward_rate` Table!" );
sObjectMgr->LoadReputationRewardRate();
handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded.");
return true;
@@ -804,7 +803,7 @@ public:
static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading `reputation_spillover_template` Table!" );
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading `reputation_spillover_template` Table!" );
sObjectMgr->LoadReputationSpilloverTemplate();
handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded.");
return true;
@@ -812,7 +811,7 @@ public:
static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded.");
return true;
@@ -820,7 +819,7 @@ public:
static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
handler->SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded.");
return true;
@@ -828,7 +827,7 @@ public:
static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
handler->SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded.");
return true;
@@ -836,7 +835,7 @@ public:
static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading SpellArea Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading SpellArea Data...");
sSpellMgr->LoadSpellAreas();
handler->SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded.");
return true;
@@ -844,7 +843,7 @@ public:
static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Required Data... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Required Data... ");
sSpellMgr->LoadSpellRequired();
handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded.");
return true;
@@ -852,7 +851,7 @@ public:
static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Groups...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Groups...");
sSpellMgr->LoadSpellGroups();
handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded.");
return true;
@@ -860,7 +859,7 @@ public:
static bool HandleReloadSpellLearnSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
handler->SendGlobalGMSysMessage("DB table `spell_learn_spell` reloaded.");
return true;
@@ -868,7 +867,7 @@ public:
static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Linked Spells...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Linked Spells...");
sSpellMgr->LoadSpellLinked();
handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded.");
return true;
@@ -876,7 +875,7 @@ public:
static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
handler->SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded.");
return true;
@@ -884,7 +883,7 @@ public:
static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
handler->SendGlobalGMSysMessage("DB table `spell_proc` (spell proc conditions and data) reloaded.");
return true;
@@ -892,7 +891,7 @@ public:
static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded.");
return true;
@@ -900,7 +899,7 @@ public:
static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
handler->SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded.");
return true;
@@ -908,7 +907,7 @@ public:
static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded.");
return true;
@@ -916,7 +915,7 @@ public:
static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
handler->SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded.");
return true;
@@ -924,7 +923,7 @@ public:
static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Spell pet auras...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded.");
return true;
@@ -932,7 +931,7 @@ public:
static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Page Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Page Texts...");
sObjectMgr->LoadPageTexts();
handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded.");
return true;
@@ -940,7 +939,7 @@ public:
static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded.");
return true;
@@ -948,8 +947,8 @@ public:
static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Item set names...");
- LoadRandomEnchantmentsTable();
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names...");
+ sObjectMgr->LoadItemSetNames();
handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded.");
return true;
}
@@ -964,7 +963,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `gameobject_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `gameobject_scripts`...");
sObjectMgr->LoadGameObjectScripts();
@@ -984,7 +983,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `event_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `event_scripts`...");
sObjectMgr->LoadEventScripts();
@@ -1004,7 +1003,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `waypoint_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `waypoint_scripts`...");
sObjectMgr->LoadWaypointScripts();
@@ -1017,7 +1016,7 @@ public:
static bool HandleReloadWpCommand(ChatHandler* handler, const char* args)
{
if (*args != 'a')
- sLog->outString("Re-Loading Waypoints data from 'waypoints_data'");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Waypoints data from 'waypoints_data'");
sWaypointMgr->Load();
@@ -1030,23 +1029,15 @@ public:
static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Texts from `creature_ai_texts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`...");
sEventAIMgr->LoadCreatureEventAI_Texts();
handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded.");
return true;
}
- static bool HandleReloadEventAISummonsCommand(ChatHandler* handler, const char* /*args*/)
- {
- sLog->outString("Re-Loading Summons from `creature_ai_summons`...");
- sEventAIMgr->LoadCreatureEventAI_Summons();
- handler->SendGlobalGMSysMessage("DB table `creature_ai_summons` reloaded.");
- return true;
- }
-
static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Scripts from `creature_ai_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded.");
return true;
@@ -1062,7 +1053,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `quest_end_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `quest_end_scripts`...");
sObjectMgr->LoadQuestEndScripts();
@@ -1072,26 +1063,6 @@ public:
return true;
}
- static bool HandleReloadQuestStartScriptsCommand(ChatHandler* handler, const char* args)
- {
- if (sScriptMgr->IsScriptScheduled())
- {
- handler->SendSysMessage("DB scripts used currently, please attempt reload later.");
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `quest_start_scripts`...");
-
- sObjectMgr->LoadQuestStartScripts();
-
- if (*args != 'a')
- handler->SendGlobalGMSysMessage("DB table `quest_start_scripts` reloaded.");
-
- return true;
- }
-
static bool HandleReloadSpellScriptsCommand(ChatHandler* handler, const char* args)
{
if (sScriptMgr->IsScriptScheduled())
@@ -1102,7 +1073,7 @@ public:
}
if (*args != 'a')
- sLog->outString("Re-Loading Scripts from `spell_scripts`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `spell_scripts`...");
sObjectMgr->LoadSpellScripts();
@@ -1114,7 +1085,7 @@ public:
static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Script strings from `db_script_string`...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Script strings from `db_script_string`...");
sObjectMgr->LoadDbScriptStrings();
handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded.");
return true;
@@ -1122,7 +1093,7 @@ public:
static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
@@ -1133,7 +1104,7 @@ public:
static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Game Tele coordinates...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Game Tele coordinates...");
sObjectMgr->LoadGameTele();
@@ -1144,9 +1115,9 @@ public:
static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading disables table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading disables table...");
DisableMgr::LoadDisables();
- sLog->outString("Checking quest disables...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Checking quest disables...");
DisableMgr::CheckQuestDisables();
handler->SendGlobalGMSysMessage("DB table `disables` reloaded.");
return true;
@@ -1154,7 +1125,7 @@ public:
static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Achievement Reward Data...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Achievement Reward Data...");
sAchievementMgr->LoadRewardLocales();
handler->SendGlobalGMSysMessage("DB table `locales_achievement_reward` reloaded.");
return true;
@@ -1162,7 +1133,7 @@ public:
static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading lfg dungeon rewards...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading lfg dungeon rewards...");
sLFGMgr->LoadRewards();
handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded.");
return true;
@@ -1170,7 +1141,7 @@ public:
static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Creature ...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature ...");
sObjectMgr->LoadCreatureLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature` reloaded.");
return true;
@@ -1178,7 +1149,7 @@ public:
static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Creature Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Creature Texts...");
sCreatureTextMgr->LoadCreatureTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_creature_text` reloaded.");
return true;
@@ -1186,7 +1157,7 @@ public:
static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Gameobject ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gameobject ... ");
sObjectMgr->LoadGameObjectLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gameobject` reloaded.");
return true;
@@ -1194,7 +1165,7 @@ public:
static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString( "Re-Loading Locales Gossip Menu Option ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Gossip Menu Option ... ");
sObjectMgr->LoadGossipMenuItemsLocales();
handler->SendGlobalGMSysMessage("DB table `locales_gossip_menu_option` reloaded.");
return true;
@@ -1202,7 +1173,7 @@ public:
static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Item ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item ... ");
sObjectMgr->LoadItemLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item` reloaded.");
return true;
@@ -1210,7 +1181,7 @@ public:
static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Item set name... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... ");
sObjectMgr->LoadItemSetNameLocales();
handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded.");
return true;
@@ -1218,7 +1189,7 @@ public:
static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales NPC Text ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... ");
sObjectMgr->LoadNpcTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_npc_text` reloaded.");
return true;
@@ -1226,7 +1197,7 @@ public:
static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Page Text ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Page Text ... ");
sObjectMgr->LoadPageTextLocales();
handler->SendGlobalGMSysMessage("DB table `locales_page_text` reloaded.");
return true;
@@ -1234,7 +1205,7 @@ public:
static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Points Of Interest ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Points Of Interest ... ");
sObjectMgr->LoadPointOfInterestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_points_of_interest` reloaded.");
return true;
@@ -1242,7 +1213,7 @@ public:
static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Locales Quest ... ");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Quest ... ");
sObjectMgr->LoadQuestLocales();
handler->SendGlobalGMSysMessage("DB table `locales_quest` reloaded.");
return true;
@@ -1250,7 +1221,7 @@ public:
static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded.");
return true;
@@ -1259,7 +1230,7 @@ public:
static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/)
{
///- Reload dynamic data tables from the database
- sLog->outString("Re-Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Auctions...");
sAuctionMgr->LoadAuctionItems();
sAuctionMgr->LoadAuctions();
handler->SendGlobalGMSysMessage("Auctions reloaded.");
@@ -1268,7 +1239,7 @@ public:
static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Conditions...");
sConditionMgr->LoadConditions(true);
handler->SendGlobalGMSysMessage("Conditions reloaded.");
return true;
@@ -1276,7 +1247,7 @@ public:
static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
handler->SendGlobalGMSysMessage("Creature Texts reloaded.");
return true;
@@ -1284,7 +1255,7 @@ public:
static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Re-Loading Smart Scripts...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Smart Scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
handler->SendGlobalGMSysMessage("Smart Scripts reloaded.");
return true;
@@ -1292,7 +1263,7 @@ public:
static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Reloading vehicle_accessory table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_accessory table...");
sObjectMgr->LoadVehicleAccessories();
handler->SendGlobalGMSysMessage("Vehicle accessories reloaded.");
return true;
@@ -1300,7 +1271,7 @@ public:
static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/)
{
- sLog->outString("Reloading vehicle_template_accessory table...");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Reloading vehicle_template_accessory table...");
sObjectMgr->LoadVehicleTemplateAccessories();
handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded.");
return true;
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index 88d648773eb..21a22381ae0 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -22,9 +22,13 @@ Comment: All reset related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
+#include "AchievementMgr.h"
#include "Chat.h"
+#include "Language.h"
#include "ObjectAccessor.h"
+#include "Player.h"
+#include "Pet.h"
+#include "ScriptMgr.h"
class reset_commandscript : public CommandScript
{
@@ -60,7 +64,7 @@ public:
return false;
if (target)
- target->GetAchievementMgr().Reset();
+ target->ResetAchievements();
else
AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid));
@@ -82,13 +86,13 @@ public:
return true;
}
-
+
static bool HandleResetStatsOrLevelHelper(Player* player)
{
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass());
if (!classEntry)
{
- sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass());
+ sLog->outError(LOG_FILTER_GENERAL, "Class %u not found in DBC (Wrong DBC files?)", player->getClass());
return false;
}
@@ -168,7 +172,7 @@ public:
{
target->resetSpells(/* bool myClassOnly */);
- ChatHandler(target).SendSysMessage(LANG_RESET_SPELLS);
+ ChatHandler(target->GetSession()).SendSysMessage(LANG_RESET_SPELLS);
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target)
handler->PSendSysMessage(LANG_RESET_SPELLS_ONLINE, handler->GetNameLink(target).c_str());
}
@@ -220,7 +224,7 @@ public:
creature->ToPet()->resetTalents();
owner->ToPlayer()->SendTalentsInfoData(true);
- ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS);
+ ChatHandler(owner->ToPlayer()->GetSession()).SendSysMessage(LANG_RESET_PET_TALENTS);
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != owner->ToPlayer())
handler->PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE, handler->GetNameLink(owner->ToPlayer()).c_str());
}
@@ -236,7 +240,7 @@ public:
{
target->resetTalents(true);
target->SendTalentsInfoData(false);
- ChatHandler(target).SendSysMessage(LANG_RESET_TALENTS);
+ ChatHandler(target->GetSession()).SendSysMessage(LANG_RESET_TALENTS);
if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target)
handler->PSendSysMessage(LANG_RESET_TALENTS_ONLINE, handler->GetNameLink(target).c_str());
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
index 8f10af5fe2a..bb4f9be5ffe 100644
--- a/src/server/scripts/Commands/cs_server.cpp
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -22,11 +22,13 @@ Comment: All server related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
#include "Chat.h"
-#include "SystemConfig.h"
#include "Config.h"
+#include "Language.h"
#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "SystemConfig.h"
class server_commandscript : public CommandScript
{
@@ -67,7 +69,6 @@ public:
{
{ "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "", NULL },
{ "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "", NULL },
- { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "", NULL },
{ "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "", NULL },
{ "closed", SEC_ADMINISTRATOR, true, &HandleServerSetClosedCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
@@ -85,7 +86,6 @@ public:
{ "restart", SEC_ADMINISTRATOR, true, NULL, "", serverRestartCommandTable },
{ "shutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable },
{ "set", SEC_ADMINISTRATOR, true, NULL, "", serverSetCommandTable },
- { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
@@ -379,30 +379,19 @@ public:
}
// Set the level of logging
- static bool HandleServerSetLogFileLevelCommand(ChatHandler* /*handler*/, char const* args)
- {
- if (!*args)
- return false;
-
- char* newLevel = strtok((char*)args, " ");
- if (!newLevel)
- return false;
-
- sLog->SetLogFileLevel(newLevel);
- return true;
- }
-
- // Set the level of logging
static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args)
{
if (!*args)
return false;
- char* newLevel = strtok((char*)args, " ");
- if (!newLevel)
+ char* type = strtok((char*)args, " ");
+ char* name = strtok(NULL, " ");
+ char* level = strtok(NULL, " ");
+
+ if (!type || !name || !level || *name == '\0' || *level == '\0' || (*type != 'a' && *type != 'l'))
return false;
- sLog->SetLogLevel(newLevel);
+ sLog->SetLogLevel(name, level, *type == 'l');
return true;
}
@@ -425,18 +414,6 @@ public:
return true;
}
-
- // toggle sql driver query logging
- static bool HandleServerToggleQueryLogging(ChatHandler* handler, char const* /*args*/)
- {
- sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging());
-
- if (sLog->GetSQLDriverQueryLogging())
- handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED);
- else
- handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED);
- return true;
- }
};
void AddSC_server_commandscript()
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index 8f390d17cd4..756bd75387b 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -22,11 +22,13 @@ Comment: All tele related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
-#include "MapManager.h"
#include "Chat.h"
#include "Group.h"
+#include "Language.h"
+#include "MapManager.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class tele_commandscript : public CommandScript
{
@@ -178,7 +180,7 @@ public:
handler->PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(), "", tele->name.c_str());
if (handler->needReportToTarget(target))
- (ChatHandler(target)).PSendSysMessage(LANG_TELEPORTED_TO_BY, handler->GetNameLink().c_str());
+ ChatHandler(target->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, handler->GetNameLink().c_str());
// stop flight if need
if (target->isInFlight())
@@ -274,7 +276,7 @@ public:
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
if (handler->needReportToTarget(player))
- (ChatHandler(player)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
+ ChatHandler(player->GetSession()).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
// stop flight if need
if (player->isInFlight())
diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp
new file mode 100644
index 00000000000..c2c5a0909d6
--- /dev/null
+++ b/src/server/scripts/Commands/cs_ticket.cpp
@@ -0,0 +1,512 @@
+/*
+ * Copyright (C) 2008-2012 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: ticket_commandscript
+%Complete: 100
+Comment: All ticket related commands
+Category: commandscripts
+EndScriptData */
+
+#include "AccountMgr.h"
+#include "Chat.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "Player.h"
+#include "TicketMgr.h"
+#include "ScriptMgr.h"
+
+class ticket_commandscript : public CommandScript
+{
+public:
+ ticket_commandscript() : CommandScript("ticket_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand ticketResponseCommandTable[] =
+ {
+ { "append", SEC_MODERATOR, true, &HandleGMTicketResponseAppendCommand, "", NULL },
+ { "appendln", SEC_MODERATOR, true, &HandleGMTicketResponseAppendLnCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand ticketCommandTable[] =
+ {
+ { "assign", SEC_GAMEMASTER, true, &HandleGMTicketAssignToCommand, "", NULL },
+ { "close", SEC_MODERATOR, true, &HandleGMTicketCloseByIdCommand, "", NULL },
+ { "closedlist", SEC_MODERATOR, true, &HandleGMTicketListClosedCommand, "", NULL },
+ { "comment", SEC_MODERATOR, true, &HandleGMTicketCommentCommand, "", NULL },
+ { "complete", SEC_MODERATOR, true, &HandleGMTicketCompleteCommand, "", NULL },
+ { "delete", SEC_ADMINISTRATOR, true, &HandleGMTicketDeleteByIdCommand, "", NULL },
+ { "escalate", SEC_MODERATOR, true, &HandleGMTicketEscalateCommand, "", NULL },
+ { "escalatedlist", SEC_GAMEMASTER, true, &HandleGMTicketListEscalatedCommand, "", NULL },
+ { "list", SEC_MODERATOR, true, &HandleGMTicketListCommand, "", NULL },
+ { "onlinelist", SEC_MODERATOR, true, &HandleGMTicketListOnlineCommand, "", NULL },
+ { "reset", SEC_ADMINISTRATOR, true, &HandleGMTicketResetCommand, "", NULL },
+ { "response", SEC_MODERATOR, true, NULL, "", ticketResponseCommandTable },
+ { "togglesystem", SEC_ADMINISTRATOR, true, &HandleToggleGMTicketSystem, "", NULL },
+ { "unassign", SEC_GAMEMASTER, true, &HandleGMTicketUnAssignCommand, "", NULL },
+ { "viewid", SEC_MODERATOR, true, &HandleGMTicketGetByIdCommand, "", NULL },
+ { "viewname", SEC_MODERATOR, true, &HandleGMTicketGetByNameCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "ticket", SEC_MODERATOR, false, NULL, "", ticketCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleGMTicketAssignToCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
+ char* targetStr = strtok(NULL, " ");
+ if (!targetStr)
+ return false;
+
+ std::string target(targetStr);
+ if (!normalizePlayerName(target))
+ return false;
+
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Get target information
+ uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str());
+ uint64 targetAccountId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid);
+ uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccountId, realmID);
+
+ // Target must exist and have administrative rights
+ if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel))
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A);
+ return true;
+ }
+
+ // If already assigned, leave
+ if (ticket->IsAssignedTo(targetGuid))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_B, ticket->GetId());
+ return true;
+ }
+
+ // If assigned to different player other than current, leave
+ //! Console can override though
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str());
+ return true;
+ }
+
+ // Assign ticket
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel));
+ ticket->SaveToDB(trans);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, target.c_str(), NULL, NULL);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+ return true;
+ }
+
+ static bool HandleGMTicketCloseByIdCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Ticket should be assigned to the player who tries to close it.
+ // Console can override though
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId());
+ return true;
+ }
+
+ sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ // Inform player, who submitted this ticket, that it is closed
+ if (Player* submitter = ticket->GetPlayer())
+ {
+ if (submitter->IsInWorld())
+ {
+ WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
+ data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
+ submitter->GetSession()->SendPacket(&data);
+ }
+ }
+ return true;
+ }
+
+ static bool HandleGMTicketCommentCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
+ char* comment = strtok(NULL, "\n");
+ if (!comment)
+ return false;
+
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Cannot comment ticket assigned to someone else
+ //! Console excluded
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetComment(comment);
+ ticket->SaveToDB(trans);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL);
+ msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ return true;
+ }
+
+ static bool HandleGMTicketListClosedCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowClosedList(*handler);
+ return true;
+ }
+
+ static bool HandleGMTicketCompleteCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ if (Player* player = ticket->GetPlayer())
+ if (player->IsInWorld())
+ ticket->SendResponse(player->GetSession());
+
+ sTicketMgr->UpdateLastChange();
+ return true;
+ }
+
+ static bool HandleGMTicketDeleteByIdCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ if (!ticket->IsClosed())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETCLOSEFIRST);
+ return true;
+ }
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console");
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ sTicketMgr->RemoveTicket(ticket->GetId());
+ sTicketMgr->UpdateLastChange();
+
+ if (Player* player = ticket->GetPlayer())
+ {
+ if (player->IsInWorld())
+ {
+ // Force abandon ticket
+ WorldPacket data(SMSG_GMTICKET_DELETETICKET, 4);
+ data << uint32(GMTICKET_RESPONSE_TICKET_DELETED);
+ player->GetSession()->SendPacket(&data);
+ }
+ }
+
+ return true;
+ }
+
+ static bool HandleGMTicketEscalateCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted() || ticket->GetEscalatedStatus() != TICKET_UNASSIGNED)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ ticket->SetEscalatedStatus(TICKET_IN_ESCALATION_QUEUE);
+
+ if (Player* player = ticket->GetPlayer())
+ if (player->IsInWorld())
+ sTicketMgr->SendTicket(player->GetSession(), ticket);
+
+ sTicketMgr->UpdateLastChange();
+ return true;
+ }
+
+ static bool HandleGMTicketListEscalatedCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowEscalatedList(*handler);
+ return true;
+ }
+
+ static bool HandleGMTicketListCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowList(*handler, false);
+ return true;
+ }
+
+ static bool HandleGMTicketListOnlineCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ sTicketMgr->ShowList(*handler, true);
+ return true;
+ }
+
+ static bool HandleGMTicketResetCommand(ChatHandler* handler, char const* /*args*/)
+ {
+ if (sTicketMgr->GetOpenTicketCount())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETPENDING);
+ return true;
+ }
+ else
+ {
+ sTicketMgr->ResetTickets();
+ handler->SendSysMessage(LANG_COMMAND_TICKETRESET);
+ }
+
+ return true;
+ }
+
+ static bool HandleToggleGMTicketSystem(ChatHandler* handler, char const* /*args*/)
+ {
+ bool status = !sTicketMgr->GetStatus();
+ sTicketMgr->SetStatus(status);
+ handler->PSendSysMessage(status ? LANG_ALLOW_TICKETS : LANG_DISALLOW_TICKETS);
+ return true;
+ }
+
+ static bool HandleGMTicketUnAssignCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+ // Ticket must be assigned
+ if (!ticket->IsAssigned())
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETNOTASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ // Get security level of player, whom this ticket is assigned to
+ uint32 security = SEC_PLAYER;
+ Player* assignedPlayer = ticket->GetAssignedPlayer();
+ if (assignedPlayer && assignedPlayer->IsInWorld())
+ security = assignedPlayer->GetSession()->GetSecurity();
+ else
+ {
+ uint64 guid = ticket->GetAssignedToGUID();
+ uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid);
+ security = AccountMgr::GetSecurity(accountId, realmID);
+ }
+
+ // Check security
+ //! If no m_session present it means we're issuing this command from the console
+ uint32 mySecurity = handler->GetSession() ? handler->GetSession()->GetSecurity() : SEC_CONSOLE;
+ if (security > mySecurity)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETUNASSIGNSECURITY);
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetUnassigned();
+ ticket->SaveToDB(trans);
+ sTicketMgr->UpdateLastChange();
+
+ std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(),
+ handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL);
+ handler->SendGlobalGMSysMessage(msg.c_str());
+
+ return true;
+ }
+
+ static bool HandleGMTicketGetByIdCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ uint32 ticketId = atoi(args);
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed() || ticket->IsCompleted())
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetViewed();
+ ticket->SaveToDB(trans);
+
+ handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str());
+ return true;
+ }
+
+ static bool HandleGMTicketGetByNameCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ return false;
+
+ std::string name(args);
+ if (!normalizePlayerName(name))
+ return false;
+
+ // Detect target's GUID
+ uint64 guid = 0;
+ if (Player* player = sObjectAccessor->FindPlayerByName(name))
+ guid = player->GetGUID();
+ else
+ guid = sObjectMgr->GetPlayerGUIDByName(name);
+
+ // Target must exist
+ if (!guid)
+ {
+ handler->SendSysMessage(LANG_NO_PLAYERS_FOUND);
+ return true;
+ }
+
+ // Ticket must exist
+ GmTicket* ticket = sTicketMgr->GetTicketByPlayer(guid);
+ if (!ticket)
+ {
+ handler->SendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->SetViewed();
+ ticket->SaveToDB(trans);
+
+ handler->SendSysMessage(ticket->FormatMessageString(*handler, true).c_str());
+ return true;
+ }
+
+ static bool _HandleGMTicketResponseAppendCommand(char const* args, bool newLine, ChatHandler* handler)
+ {
+ if (!*args)
+ return false;
+
+ char* ticketIdStr = strtok((char*)args, " ");
+ uint32 ticketId = atoi(ticketIdStr);
+
+ char* response = strtok(NULL, "\n");
+ if (!response)
+ return false;
+
+ GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
+ if (!ticket || ticket->IsClosed())
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETNOTEXIST);
+ return true;
+ }
+
+ // Cannot add response to ticket, assigned to someone else
+ //! Console excluded
+ Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL;
+ if (player && ticket->IsAssignedNotTo(player->GetGUID()))
+ {
+ handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId());
+ return true;
+ }
+
+ SQLTransaction trans = SQLTransaction(NULL);
+ ticket->AppendResponse(response);
+ if (newLine)
+ ticket->AppendResponse("\n");
+ ticket->SaveToDB(trans);
+
+ return true;
+ }
+
+ static bool HandleGMTicketResponseAppendCommand(ChatHandler* handler, char const* args)
+ {
+ return _HandleGMTicketResponseAppendCommand(args, false, handler);
+ }
+
+ static bool HandleGMTicketResponseAppendLnCommand(ChatHandler* handler, char const* args)
+ {
+ return _HandleGMTicketResponseAppendCommand(args, true, handler);
+ }
+};
+
+void AddSC_ticket_commandscript()
+{
+ new ticket_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index f35f6baca98..c6e11c930fb 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -22,9 +22,11 @@ Comment: All titles related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
-#include "ObjectMgr.h"
#include "Chat.h"
+#include "Language.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptMgr.h"
class titles_commandscript : public CommandScript
{
@@ -36,7 +38,7 @@ public:
static ChatCommand titlesSetCommandTable[] =
{
{ "mask", SEC_GAMEMASTER, false, &HandleTitlesSetMaskCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand titlesCommandTable[] =
{
@@ -44,17 +46,17 @@ public:
{ "current", SEC_GAMEMASTER, false, &HandleTitlesCurrentCommand, "", NULL },
{ "remove", SEC_GAMEMASTER, false, &HandleTitlesRemoveCommand, "", NULL },
{ "set", SEC_GAMEMASTER, false, NULL, "", titlesSetCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
static ChatCommand commandTable[] =
{
{ "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable },
- { NULL, 0, false, NULL, "", NULL }
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
};
return commandTable;
}
- static bool HandleTitlesCurrentCommand(ChatHandler* handler, const char* args)
+ static bool HandleTitlesCurrentCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = handler->extractKeyFromLink((char*)args, "Htitle");
@@ -99,7 +101,7 @@ public:
return true;
}
- static bool HandleTitlesAddCommand(ChatHandler* handler, const char* args)
+ static bool HandleTitlesAddCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = handler->extractKeyFromLink((char*)args, "Htitle");
@@ -136,9 +138,8 @@ public:
std::string tNameLink = handler->GetNameLink(target);
- char const* targetName = target->GetName();
char titleNameStr[80];
- snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], targetName);
+ snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str());
target->SetTitle(titleInfo);
handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str());
@@ -146,7 +147,7 @@ public:
return true;
}
- static bool HandleTitlesRemoveCommand(ChatHandler* handler, const char* args)
+ static bool HandleTitlesRemoveCommand(ChatHandler* handler, char const* args)
{
// number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r
char* id_p = handler->extractKeyFromLink((char*)args, "Htitle");
@@ -185,9 +186,8 @@ public:
std::string tNameLink = handler->GetNameLink(target);
- char const* targetName = target->GetName();
char titleNameStr[80];
- snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], targetName);
+ snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str());
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str());
@@ -201,7 +201,7 @@ public:
}
//Edit Player KnownTitles
- static bool HandleTitlesSetMaskCommand(ChatHandler* handler, const char* args)
+ static bool HandleTitlesSetMaskCommand(ChatHandler* handler, char const* args)
{
if (!*args)
return false;
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 99ec263b8f9..c0b2938c156 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -22,10 +22,12 @@ Comment: All wp related commands
Category: commandscripts
EndScriptData */
-#include "ScriptMgr.h"
+#include "Chat.h"
+#include "Language.h"
#include "ObjectMgr.h"
+#include "Player.h"
+#include "ScriptMgr.h"
#include "WaypointManager.h"
-#include "Chat.h"
class wp_commandscript : public CommandScript
{
@@ -642,19 +644,13 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
- // wpCreature
- Creature* wpCreature = NULL;
-
if (wpGuid != 0)
- {
- wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- if (wpCreature)
+ if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
wpCreature->AddObjectToRemoveList();
}
- }
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
@@ -681,15 +677,12 @@ public:
Player* chr = handler->GetSession()->GetPlayer();
Map* map = chr->GetMap();
{
- // wpCreature
- Creature* wpCreature = NULL;
// What to do:
// Move the visual spawnpoint
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
- wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
- if (wpCreature)
+ if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -950,7 +943,7 @@ public:
{
wpCreature->SetDisplayId(target->GetDisplayId());
wpCreature->SetObjectScale(0.5f);
- wpCreature->SetLevel(point > STRONG_MAX_LEVEL ? STRONG_MAX_LEVEL : point);
+ wpCreature->SetLevel(std::min<uint32>(point, STRONG_MAX_LEVEL));
}
}
while (result->NextRow());
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
index 75dd99eef97..cef95b607c7 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
@@ -23,8 +24,8 @@ enum Spells
SPELL_CLEAVE = 40504,
SPELL_DEMORALIZING_SHOUT = 23511,
SPELL_ENRAGE = 8599,
- SPELL_WHIRLWIND1 = 15589,
- SPELL_WHIRLWIND2 = 13736,
+ SPELL_WHIRLWIND = 13736,
+
SPELL_NORTH_MARSHAL = 45828,
SPELL_SOUTH_MARSHAL = 45829,
SPELL_STONEHEARTH_MARSHAL = 45830,
@@ -47,38 +48,55 @@ enum Creatures
NPC_WEST_FROSTWOLF_WARMASTER = 14777
};
+enum Events
+{
+ EVENT_CHARGE_TARGET = 1,
+ EVENT_CLEAVE = 2,
+ EVENT_DEMORALIZING_SHOUT = 3,
+ EVENT_WHIRLWIND = 4,
+ EVENT_ENRAGE = 5,
+ EVENT_CHECK_RESET = 6
+};
+
+struct SpellPair
+{
+ uint32 npcEntry;
+ uint32 spellId;
+};
+
+uint8 const MAX_SPELL_PAIRS = 8;
+SpellPair const _auraPairs[MAX_SPELL_PAIRS] =
+{
+ { NPC_NORTH_MARSHAL, SPELL_NORTH_MARSHAL },
+ { NPC_SOUTH_MARSHAL, SPELL_SOUTH_MARSHAL },
+ { NPC_STONEHEARTH_MARSHAL, SPELL_STONEHEARTH_MARSHAL },
+ { NPC_ICEWING_MARSHAL, SPELL_ICEWING_MARSHAL },
+ { NPC_EAST_FROSTWOLF_WARMASTER, SPELL_EAST_FROSTWOLF_WARMASTER },
+ { NPC_WEST_FROSTWOLF_WARMASTER, SPELL_WEST_FROSTWOLF_WARMASTER },
+ { NPC_TOWER_POINT_WARMASTER, SPELL_TOWER_POINT_WARMASTER },
+ { NPC_ICEBLOOD_WARMASTER, SPELL_ICEBLOOD_WARMASTER }
+};
+
class mob_av_marshal_or_warmaster : public CreatureScript
{
public:
-
- mob_av_marshal_or_warmaster()
- : CreatureScript("mob_av_marshal_or_warmaster") {}
+ mob_av_marshal_or_warmaster() : CreatureScript("mob_av_marshal_or_warmaster") { }
struct mob_av_marshal_or_warmasterAI : public ScriptedAI
{
- mob_av_marshal_or_warmasterAI(Creature* creature) : ScriptedAI(creature) {}
-
- uint32 ChargeTimer;
- uint32 CleaveTimer;
- uint32 DemoralizingShoutTimer;
- uint32 Whirlwind1Timer;
- uint32 Whirlwind2Timer;
- uint32 EnrageTimer;
- uint32 ResetTimer;
-
- bool bHasAura;
+ mob_av_marshal_or_warmasterAI(Creature* creature) : ScriptedAI(creature) { }
void Reset()
{
- ChargeTimer = urand(2 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);
- CleaveTimer = urand(1 * IN_MILLISECONDS, 11 * IN_MILLISECONDS);
- DemoralizingShoutTimer = urand(2 * IN_MILLISECONDS, 2 * IN_MILLISECONDS);
- Whirlwind1Timer = urand(1 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);
- Whirlwind2Timer = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
- EnrageTimer = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
- ResetTimer = 5 * IN_MILLISECONDS;
-
- bHasAura = false;
+ events.Reset();
+ events.ScheduleEvent(EVENT_CHARGE_TARGET, urand(2 * IN_MILLISECONDS, 12 * IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CLEAVE, urand(1 * IN_MILLISECONDS, 11 * IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 2000);
+ events.ScheduleEvent(EVENT_WHIRLWIND, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ENRAGE, urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
+
+ _hasAura = false;
}
void JustRespawned()
@@ -86,90 +104,70 @@ class mob_av_marshal_or_warmaster : public CreatureScript
Reset();
}
- void UpdateAI(const uint32 diff)
+ void UpdateAI(uint32 const diff)
{
- if (!bHasAura)
+ // I have a feeling this isn't blizzlike, but owell, I'm only passing by and cleaning up.
+ if (!_hasAura)
{
- switch (me->GetEntry())
- {
- case NPC_NORTH_MARSHAL:
- DoCast(me, SPELL_NORTH_MARSHAL);
- break;
- case NPC_SOUTH_MARSHAL:
- DoCast(me, SPELL_SOUTH_MARSHAL);
- break;
- case NPC_STONEHEARTH_MARSHAL:
- DoCast(me, SPELL_STONEHEARTH_MARSHAL);
- break;
- case NPC_ICEWING_MARSHAL:
- DoCast(me, SPELL_ICEWING_MARSHAL);
- break;
- case NPC_EAST_FROSTWOLF_WARMASTER:
- DoCast(me, SPELL_EAST_FROSTWOLF_WARMASTER);
- break;
- case NPC_WEST_FROSTWOLF_WARMASTER:
- DoCast(me, SPELL_WEST_FROSTWOLF_WARMASTER);
- break;
- case NPC_ICEBLOOD_WARMASTER:
- DoCast(me, SPELL_ICEBLOOD_WARMASTER);
- break;
- case NPC_TOWER_POINT_WARMASTER:
- DoCast(me, SPELL_TOWER_POINT_WARMASTER);
- break;
- }
+ for (uint8 i = 0; i < MAX_SPELL_PAIRS; ++i)
+ if (_auraPairs[i].npcEntry == me->GetEntry())
+ DoCast(me, _auraPairs[i].spellId);
- bHasAura = true;
+ _hasAura = true;
}
if (!UpdateVictim())
return;
- if (ChargeTimer <= diff)
- {
- DoCast(me->getVictim(), SPELL_CHARGE);
- ChargeTimer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
- } else ChargeTimer -= diff;
-
- if (CleaveTimer <= diff)
- {
- DoCast(me->getVictim(), SPELL_CLEAVE);
- CleaveTimer = urand(10 * IN_MILLISECONDS, 16 * IN_MILLISECONDS);
- } else CleaveTimer -= diff;
-
- if (DemoralizingShoutTimer <= diff)
- {
- DoCast(me->getVictim(), SPELL_DEMORALIZING_SHOUT);
- DemoralizingShoutTimer = urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS);
- } else DemoralizingShoutTimer -= diff;
+ events.Update(diff);
- if (Whirlwind1Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_WHIRLWIND1);
- Whirlwind1Timer = urand(6 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
- } else Whirlwind1Timer -= diff;
-
- if (Whirlwind2Timer <= diff)
- {
- DoCast(me->getVictim(), SPELL_WHIRLWIND2);
- Whirlwind2Timer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
- } else Whirlwind2Timer -= diff;
-
- if (EnrageTimer <= diff)
- {
- DoCast(me->getVictim(), SPELL_ENRAGE);
- EnrageTimer = urand(10 * IN_MILLISECONDS, 30 * IN_MILLISECONDS);
- }else EnrageTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- // check if creature is not outside of building
- if (ResetTimer <= diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
- EnterEvadeMode();
- ResetTimer = 5 * IN_MILLISECONDS;
- } else ResetTimer -= diff;
+ switch (eventId)
+ {
+ case EVENT_CHARGE_TARGET:
+ DoCast(me->getVictim(), SPELL_CHARGE);
+ events.ScheduleEvent(EVENT_CHARGE, urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS));
+ break;
+ case EVENT_CLEAVE:
+ DoCast(me->getVictim(), SPELL_CLEAVE);
+ events.ScheduleEvent(EVENT_CLEAVE, urand(10 * IN_MILLISECONDS, 16 * IN_MILLISECONDS));
+ break;
+ case EVENT_DEMORALIZING_SHOUT:
+ DoCast(me, SPELL_DEMORALIZING_SHOUT);
+ events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, urand(10 * IN_MILLISECONDS, 15 * IN_MILLISECONDS));
+ break;
+ case EVENT_WHIRLWIND:
+ DoCast(me, SPELL_WHIRLWIND);
+ events.ScheduleEvent(EVENT_WHIRLWIND, urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS));
+ break;
+ case EVENT_ENRAGE:
+ DoCast(me, SPELL_ENRAGE);
+ events.ScheduleEvent(EVENT_ENRAGE, urand(10 * IN_MILLISECONDS, 30 * IN_MILLISECONDS));
+ break;
+ case EVENT_CHECK_RESET:
+ {
+ Position const& _homePosition = me->GetHomePosition();
+ if (me->GetDistance2d(_homePosition.GetPositionX(), _homePosition.GetPositionY()) > 50.0f)
+ {
+ EnterEvadeMode();
+ return;
+ }
+ events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
+ break;
+ }
+ }
+ }
DoMeleeAttackIfReady();
}
+
+ private:
+ EventMap events;
+ bool _hasAura;
};
CreatureAI* GetAI(Creature* creature) const
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
index 93de16fc80b..e776194652d 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
index 8b2a95be977..47091c162d9 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
index da53cffc99d..0c1eb6e6d30 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
index 3960351d395..af61c723ca3 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp
@@ -15,14 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Yells
{
YELL_AGGRO = 0,
YELL_EVADE = 1,
- YELL_RESPAWN1 = -1810010, // no creature_text
- YELL_RESPAWN2 = -1810011, // no creature_text
+ //YELL_RESPAWN1 = -1810010, // Missing in database
+ //YELL_RESPAWN2 = -1810011, // Missing in database
YELL_RANDOM = 2,
YELL_SPELL = 3,
};
@@ -63,12 +64,6 @@ public:
Talk(YELL_AGGRO);
}
- void JustRespawned()
- {
- Reset();
- DoScriptText(RAND(YELL_RESPAWN1, YELL_RESPAWN2), me);
- }
-
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
index 9375cc33f27..5b5787b2ab8 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp
@@ -15,9 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "ScriptedGossip.h"
#include "blackrock_depths.h"
+#include "Player.h"
+#include "WorldSession.h"
//go_shadowforge_brazier
class go_shadowforge_brazier : public GameObjectScript
@@ -97,12 +101,12 @@ public:
// npc_grimstone
enum GrimstoneTexts
{
- SCRIPT_TEXT1 = -1230003,
- SCRIPT_TEXT2 = -1230004,
- SCRIPT_TEXT3 = -1230005,
- SCRIPT_TEXT4 = -1230006,
- SCRIPT_TEXT5 = -1230007,
- SCRIPT_TEXT6 = -1230008
+ SAY_TEXT1 = 0,
+ SAY_TEXT2 = 1,
+ SAY_TEXT3 = 2,
+ SAY_TEXT4 = 3,
+ SAY_TEXT5 = 4,
+ SAY_TEXT6 = 5
};
//TODO: implement quest part of event (different end boss)
@@ -182,12 +186,12 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SCRIPT_TEXT1, me);//2
+ Talk(SAY_TEXT1);
CanWalk = false;
Event_Timer = 5000;
break;
case 1:
- DoScriptText(SCRIPT_TEXT2, me);//4
+ Talk(SAY_TEXT2);
CanWalk = false;
Event_Timer = 5000;
break;
@@ -195,10 +199,10 @@ public:
CanWalk = false;
break;
case 3:
- DoScriptText(SCRIPT_TEXT3, me);//5
+ Talk(SAY_TEXT3);
break;
case 4:
- DoScriptText(SCRIPT_TEXT4, me);//6
+ Talk(SAY_TEXT4);
CanWalk = false;
Event_Timer = 5000;
break;
@@ -207,7 +211,7 @@ public:
{
instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_GRIMSTONE, me);
instance->SetData(TYPE_RING_OF_LAW, DONE);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_grimstone: event reached end and set complete.");
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_grimstone: event reached end and set complete.");
}
break;
}
@@ -268,7 +272,7 @@ public:
switch (EventPhase)
{
case 0:
- DoScriptText(SCRIPT_TEXT5, me);//1
+ Talk(SAY_TEXT5);
HandleGameObject(DATA_ARENA4, false);
Start(false, false);
CanWalk = true;
@@ -303,7 +307,7 @@ public:
case 7:
me->SetVisible(true);
HandleGameObject(DATA_ARENA1, false);
- DoScriptText(SCRIPT_TEXT6, me);//4
+ Talk(SAY_TEXT6);
CanWalk = true;
Event_Timer = 0;
break;
@@ -544,7 +548,7 @@ public:
if (player->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 &&
!player->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) &&
- player->HasItemCount(ITEM_SULFURON_INGOT, 1))
+ player->HasItemCount(ITEM_SULFURON_INGOT))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
}
@@ -1174,7 +1178,7 @@ public:
// npc_rocknot
enum RocknotSays
{
- SAY_GOT_BEER = -1230000
+ SAY_GOT_BEER = 0
};
enum RocknotSpells
@@ -1211,7 +1215,7 @@ public:
//keep track of amount in instance script, returns SPECIAL if amount ok and event in progress
if (instance->GetData(TYPE_BAR) == SPECIAL)
{
- DoScriptText(SAY_GOT_BEER, creature);
+ creature->AI()->Talk(SAY_GOT_BEER);
creature->CastSpell(creature, SPELL_DRUNKEN_RAGE, false);
if (npc_escortAI* escortAI = CAST_AI(npc_rocknot::npc_rocknotAI, creature->AI()))
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
index ff0f1a4cedd..b2031ef0658 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
index 2585796e28e..a07e9059b70 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
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 073c4fde82a..bad4d8735b7 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
@@ -16,13 +16,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blackrock_depths.h"
enum Yells
{
- SAY_AGGRO = -1230001,
- SAY_SLAY = -1230002
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1
};
enum Spells
@@ -62,13 +63,13 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->CallForHelp(VISIBLE_RANGE);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
index 703f684cc9f..15882b30ed2 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
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 b2c93d949c2..055f1eebbac 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
index 63d945ade90..2aab7739d8d 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp
@@ -16,12 +16,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-enum Spells
+enum Grizzle
{
- SPELL_GROUNDTREMOR = 6524,
- SPELL_FRENZY = 28371
+ SPELL_GROUNDTREMOR = 6524,
+ SPELL_FRENZY = 28371,
+ EMOTE_FRENZY_KILL = 0
};
class boss_grizzle : public CreatureScript
@@ -68,7 +70,7 @@ public:
if (Frenzy_Timer <= diff)
{
DoCast(me, SPELL_FRENZY);
- DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
+ Talk(EMOTE_FRENZY_KILL);
Frenzy_Timer = 15000;
} else Frenzy_Timer -= diff;
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 f4f245be4be..b6be72d71e0 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
index 3d2cc627145..c1e00796433 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
index e6f65ab4252..6f665e9efc7 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
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 211930e4f1a..ecdcb4b0b82 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp
@@ -16,8 +16,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "blackrock_depths.h"
+#include "Player.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp
index 03cb077936b..2c2ae3a79c5 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp
@@ -16,7 +16,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "blackrock_depths.h"
#define TIMER_TOMBOFTHESEVEN 15000
@@ -210,7 +212,7 @@ public:
void SetData64(uint32 type, uint64 data)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data);
switch (type)
{
@@ -226,7 +228,7 @@ public:
void SetData(uint32 type, uint32 data)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
switch (type)
{
@@ -271,7 +273,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -296,7 +298,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp
index fdb73fe1196..124743174b6 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp
@@ -222,7 +222,7 @@ public:
}
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
index af0dfd38ae8..d05b6220441 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp
@@ -23,11 +23,13 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+
enum Say
{
- SAY_AGGRO = -1469000,
- SAY_LEASH = -1469001
+ SAY_AGGRO = 0,
+ SAY_LEASH = 1,
};
enum Spells
@@ -67,7 +69,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoZoneInCombat();
}
@@ -108,7 +110,7 @@ public:
} else KnockBack_Timer -= diff;
if (EnterEvadeIfOutOfCombatArea(diff))
- DoScriptText(SAY_LEASH, me);
+ Talk(SAY_LEASH);
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
index a3eb0cea5ad..8f12ab3f2e8 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp
@@ -23,12 +23,13 @@ SDComment: Chromatic Mutation disabled due to lack of core support
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Emotes
{
- EMOTE_FRENZY = -1469002,
- EMOTE_SHIMMER = -1469003
+ EMOTE_FRENZY = 0,
+ EMOTE_SHIMMER = 1,
};
enum Spells
@@ -218,7 +219,7 @@ public:
DoCast(me, spell);
CurrentVurln_Spell = spell;
- DoScriptText(EMOTE_SHIMMER, me);
+ Talk(EMOTE_SHIMMER);
Shimmer_Timer = 45000;
} else Shimmer_Timer -= diff;
@@ -239,14 +240,12 @@ public:
//Affliction_Timer
if (Affliction_Timer <= diff)
{
- std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
- Unit* unit;
if ((*i) && (*i)->getSource())
{
- unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
//Cast affliction
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
@@ -281,7 +280,7 @@ public:
if (Frenzy_Timer <= diff)
{
DoCast(me, SPELL_FRENZY);
- DoScriptText(EMOTE_FRENZY, me);
+ Talk(EMOTE_FRENZY);
Frenzy_Timer = urand(10000, 15000);
} else Frenzy_Timer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
index c91e0fb3303..962e65fb8b0 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp
@@ -23,7 +23,8 @@ SDComment: Shadow of Ebonroc needs core support
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWFLAME 22539
#define SPELL_WINGBUFFET 18500
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
index c2a2350c0e8..4d5f9b214db 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWFLAME 22539
#define SPELL_WINGBUFFET 23339
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
index 41bcb6c5427..b191d2fbb02 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp
@@ -23,11 +23,12 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Emotes
{
- EMOTE_FRENZY = -1469031
+ EMOTE_FRENZY = 0,
};
enum Spells
@@ -92,7 +93,7 @@ public:
//Frenzy_Timer
if (Frenzy_Timer <= diff)
{
- DoScriptText(EMOTE_FRENZY, me);
+ Talk(EMOTE_FRENZY);
DoCast(me, SPELL_FRENZY);
Frenzy_Timer = urand(8000, 10000);
} else Frenzy_Timer -= diff;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
index 5d4cc442a49..5a3c72054b4 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp
@@ -23,26 +23,25 @@ SDComment: Some issues with class calls effecting more than one class
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Say
{
- SAY_AGGRO = -1469007,
- SAY_XHEALTH = -1469008,
- SAY_SHADOWFLAME = -1469009,
- SAY_RAISE_SKELETONS = -1469010,
- SAY_SLAY = -1469011,
- SAY_DEATH = -1469012,
-
- SAY_MAGE = -1469013,
- SAY_WARRIOR = -1469014,
- SAY_DRUID = -1469015,
- SAY_PRIEST = -1469016,
- SAY_PALADIN = -1469017,
- SAY_SHAMAN = -1469018,
- SAY_WARLOCK = -1469019,
- SAY_HUNTER = -1469020,
- SAY_ROGUE = -1469021
+ SAY_RANDOM = 0,
+ SAY_RAISE_SKELETONS = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
+
+ SAY_MAGE = 4,
+ SAY_WARRIOR = 5,
+ SAY_DRUID = 6,
+ SAY_PRIEST = 7,
+ SAY_PALADIN = 8,
+ SAY_SHAMAN = 9,
+ SAY_WARLOCK = 10,
+ SAY_HUNTER = 11,
+ SAY_ROGUE = 12,
};
enum Spells
@@ -108,17 +107,17 @@ public:
if (rand()%5)
return;
- DoScriptText(SAY_SLAY, me, Victim);
+ Talk(SAY_SLAY, Victim->GetGUID());
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* who)
{
- DoScriptText(RAND(SAY_XHEALTH, SAY_AGGRO, SAY_SHADOWFLAME), me);
+ Talk(SAY_RANDOM);
DoCast(who, SPELL_SHADOWFLAME_INITIAL);
DoZoneInCombat();
@@ -183,39 +182,39 @@ public:
switch (urand(0, 8))
{
case 0:
- DoScriptText(SAY_MAGE, me);
+ Talk(SAY_MAGE);
DoCast(me, SPELL_MAGE);
break;
case 1:
- DoScriptText(SAY_WARRIOR, me);
+ Talk(SAY_WARRIOR);
DoCast(me, SPELL_WARRIOR);
break;
case 2:
- DoScriptText(SAY_DRUID, me);
+ Talk(SAY_DRUID);
DoCast(me, SPELL_DRUID);
break;
case 3:
- DoScriptText(SAY_PRIEST, me);
+ Talk(SAY_PRIEST);
DoCast(me, SPELL_PRIEST);
break;
case 4:
- DoScriptText(SAY_PALADIN, me);
+ Talk(SAY_PALADIN);
DoCast(me, SPELL_PALADIN);
break;
case 5:
- DoScriptText(SAY_SHAMAN, me);
+ Talk(SAY_SHAMAN);
DoCast(me, SPELL_SHAMAN);
break;
case 6:
- DoScriptText(SAY_WARLOCK, me);
+ Talk(SAY_WARLOCK);
DoCast(me, SPELL_WARLOCK);
break;
case 7:
- DoScriptText(SAY_HUNTER, me);
+ Talk(SAY_HUNTER);
DoCast(me, SPELL_HUNTER);
break;
case 8:
- DoScriptText(SAY_ROGUE, me);
+ Talk(SAY_ROGUE);
DoCast(me, SPELL_ROGUE);
break;
}
@@ -227,7 +226,7 @@ public:
if (!Phase3 && HealthBelowPct(20))
{
Phase3 = true;
- DoScriptText(SAY_RAISE_SKELETONS, me);
+ Talk(SAY_RAISE_SKELETONS);
}
DoMeleeAttackIfReady();
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
index 24fc74cc7cb..f4a9fcb5060 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp
@@ -23,16 +23,17 @@ SDComment: Needs additional review. Phase 1 NYI (Grethok the Controller)
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//Razorgore Phase 2 Script
enum Say
{
- SAY_EGGS_BROKEN1 = -1469022,
- SAY_EGGS_BROKEN2 = -1469023,
- SAY_EGGS_BROKEN3 = -1469024,
- SAY_DEATH = -1469025
+ SAY_EGGS_BROKEN1 = 0,
+ SAY_EGGS_BROKEN2 = 1,
+ SAY_EGGS_BROKEN3 = 2,
+ SAY_DEATH = 3,
};
enum Spells
@@ -77,7 +78,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
index eaa8c118f19..6ffe30d2c50 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp
@@ -23,15 +23,18 @@ SDComment: Burning Adrenaline not correctly implemented in core
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
enum Says
{
- SAY_LINE1 = -1469026,
- SAY_LINE2 = -1469027,
- SAY_LINE3 = -1469028,
- SAY_HALFLIFE = -1469029,
- SAY_KILLTARGET = -1469030
+ SAY_LINE1 = 0,
+ SAY_LINE2 = 1,
+ SAY_LINE3 = 2,
+ SAY_HALFLIFE = 3,
+ SAY_KILLTARGET = 4
};
#define GOSSIP_ITEM "Start Event <Needs Gossip Text>"
@@ -127,7 +130,7 @@ public:
PlayerGUID = target->GetGUID();
//10 seconds
- DoScriptText(SAY_LINE1, me);
+ Talk(SAY_LINE1);
SpeechTimer = 10000;
SpeechNum = 0;
@@ -141,7 +144,7 @@ public:
if (rand()%5)
return;
- DoScriptText(SAY_KILLTARGET, me, victim);
+ Talk(SAY_KILLTARGET, victim->GetGUID());
}
void EnterCombat(Unit* /*who*/)
@@ -164,13 +167,13 @@ public:
{
case 0:
//16 seconds till next line
- DoScriptText(SAY_LINE2, me);
+ Talk(SAY_LINE2);
SpeechTimer = 16000;
++SpeechNum;
break;
case 1:
//This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!"
- DoScriptText(SAY_LINE3, me);
+ Talk(SAY_LINE3);
SpeechTimer = 10000;
++SpeechNum;
break;
@@ -195,7 +198,7 @@ public:
// Yell if hp lower than 15%
if (HealthBelowPct(15) && !HasYelled)
{
- DoScriptText(SAY_HALFLIFE, me);
+ Talk(SAY_HALFLIFE);
HasYelled = true;
}
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
index 668b84d38dd..1335f189286 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp
@@ -23,13 +23,16 @@ SDComment: Missing some text, Vael beginning event, and spawns Nef in wrong plac
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
enum Says
{
- SAY_GAMESBEGIN_1 = -1469004,
- SAY_GAMESBEGIN_2 = -1469005,
- SAY_VAEL_INTRO = -1469006 //when he corrupts Vaelastrasz
+ SAY_GAMESBEGIN_1 = 0,
+ SAY_GAMESBEGIN_2 = 1,
+ //SAY_VAEL_INTRO = 2, Not used - when he corrupts Vaelastrasz
};
#define GOSSIP_ITEM_1 "I've made no mistakes."
@@ -98,7 +101,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
- DoScriptText(SAY_GAMESBEGIN_1, creature);
+ creature->AI()->Talk(SAY_GAMESBEGIN_1);
CAST_AI(boss_victor_nefarius::boss_victor_nefariusAI, creature->AI())->BeginEvent(player);
break;
}
@@ -235,7 +238,7 @@ public:
void BeginEvent(Player* target)
{
- DoScriptText(SAY_GAMESBEGIN_2, me);
+ Talk(SAY_GAMESBEGIN_2);
//Trinity::Singleton<MapManager>::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin();
/*
@@ -362,7 +365,7 @@ public:
Nefarian->setFaction(103);
NefarianGUID = Nefarian->GetGUID();
}
- else sLog->outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly.");
+ else sLog->outError(LOG_FILTER_TSCR, "Blackwing Lair: Unable to spawn nefarian properly.");
}
AddSpawnTimer = 4000;
diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp
index 8a9b930aa09..ae518b7c703 100644
--- a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp
@@ -23,4 +23,5 @@ SDComment:
SDCategory: Blackwing Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
index 4885d8620b0..712f7fbe8c5 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp
@@ -21,7 +21,8 @@ SD%Complete:
SDComment: Timers and say taken from acid script
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "deadmines.h"
enum eSpels
@@ -34,7 +35,7 @@ enum eSpels
EQUIP_SWORD = 5191,
EQUIP_MACE = 7230,
- SAY_AGGRO = -1036001
+ SAY_AGGRO = 0,
};
class boss_mr_smite : public CreatureScript
@@ -81,7 +82,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
bool bCheckChances()
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
index 6c6b0647c5f..5ce55307675 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp
@@ -23,9 +23,12 @@ SDComment: Placeholder
SDCategory: Deadmines
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "deadmines.h"
#include "Spell.h"
+#include "Player.h"
+#include "WorldSession.h"
/*#####
# item_Defias_Gunpowder
diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
index a75eda93d1d..1b2beb11351 100644
--- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
+++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp
@@ -23,8 +23,12 @@ SDComment:
SDCategory: Deadmines
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "deadmines.h"
+#include "TemporarySummon.h"
+#include "WorldPacket.h"
+#include "Opcodes.h"
enum Sounds
{
@@ -212,7 +216,7 @@ class instance_deadmines : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -223,7 +227,7 @@ class instance_deadmines : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
@@ -236,16 +240,7 @@ class instance_deadmines : public InstanceMapScript
void DoPlaySound(GameObject* unit, uint32 sound)
{
- WorldPacket data(4);
- data.SetOpcode(SMSG_PLAY_SOUND);
- data << uint32(sound);
- unit->SendMessageToSet(&data, false);
- }
-
- void DoPlaySoundCreature(Unit* unit, uint32 sound)
- {
- WorldPacket data(4);
- data.SetOpcode(SMSG_PLAY_SOUND);
+ WorldPacket data(SMSG_PLAY_SOUND, 4);
data << uint32(sound);
unit->SendMessageToSet(&data, false);
}
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
index b5a7984d945..71cd69caeb5 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp
@@ -22,46 +22,41 @@ SD%Complete: 90%
SDComment: Some visual effects are not implemented.
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "gnomeregan.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
#define GOSSIP_START_EVENT "I am ready to being"
-enum eBlastmasterEmiShortfuse
+enum BlastmasterEmi
{
GOSSIP_TEXT_EMI = 1693,
- SAY_BLASTMASTER_0 = -1090000,
- SAY_BLASTMASTER_1 = -1090001,
- SAY_BLASTMASTER_2 = -1090002,
- SAY_BLASTMASTER_3 = -1090003,
- SAY_BLASTMASTER_4 = -1090004,
- SAY_BLASTMASTER_5 = -1090005,
- SAY_BLASTMASTER_6 = -1090006,
- SAY_BLASTMASTER_7 = -1090007,
- SAY_BLASTMASTER_8 = -1090008,
- SAY_BLASTMASTER_9 = -1090009,
- SAY_BLASTMASTER_10 = -1090010,
- SAY_BLASTMASTER_11 = -1090011,
- SAY_BLASTMASTER_12 = -1090012,
- SAY_BLASTMASTER_13 = -1090013,
- SAY_BLASTMASTER_14 = -1090014,
- SAY_BLASTMASTER_15 = -1090015,
- SAY_BLASTMASTER_16 = -1090016,
- SAY_BLASTMASTER_17 = -1090017,
- SAY_BLASTMASTER_18 = -1090018,
- SAY_BLASTMASTER_19 = -1090019,
- SAY_BLASTMASTER_20 = -1090020,
- SAY_BLASTMASTER_21 = -1090021,
- SAY_BLASTMASTER_22 = -1090022,
- SAY_BLASTMASTER_23 = -1090023,
- SAY_BLASTMASTER_24 = -1090024,
- SAY_BLASTMASTER_25 = -1090025,
- SAY_BLASTMASTER_26 = -1090026,
- SAY_BLASTMASTER_27 = -1090027,
-
- SAY_GRUBBIS = -1090028
+ SAY_BLASTMASTER_0 = 0,
+ SAY_BLASTMASTER_1 = 1,
+ SAY_BLASTMASTER_2 = 2,
+ SAY_BLASTMASTER_3 = 3,
+ SAY_BLASTMASTER_4 = 4,
+ SAY_BLASTMASTER_5 = 5,
+ SAY_BLASTMASTER_6 = 6,
+ SAY_BLASTMASTER_7 = 7,
+ SAY_BLASTMASTER_8 = 8,
+ SAY_BLASTMASTER_9 = 9,
+ SAY_BLASTMASTER_10 = 10,
+ SAY_BLASTMASTER_11 = 11,
+ SAY_BLASTMASTER_12 = 12,
+ SAY_BLASTMASTER_13 = 13,
+ SAY_BLASTMASTER_14 = 14,
+ SAY_BLASTMASTER_15 = 15,
+ SAY_BLASTMASTER_16 = 16,
+ SAY_BLASTMASTER_17 = 17,
+ SAY_BLASTMASTER_18 = 18,
+ SAY_BLASTMASTER_19 = 19,
+
+ SAY_GRUBBIS = 0
};
const Position SpawnPosition[] =
@@ -76,13 +71,16 @@ const Position SpawnPosition[] =
{-552.534f, -110.012f, -153.577f, 0.747f},
{-550.708f, -116.436f, -153.103f, 0.679f},
{-554.030f, -115.983f, -152.635f, 0.695f},
- {-494.595f, -87.516f, 149.116f, 3.344f},
+ {-494.595f, -87.516f, -149.116f, 3.344f},
{-493.349f, -90.845f, -148.882f, 3.717f},
{-491.995f, -87.619f, -148.197f, 3.230f},
{-490.732f, -90.739f, -148.091f, 3.230f},
{-490.554f, -89.114f, -148.055f, 3.230f},
{-495.240f, -90.808f, -149.493f, 3.238f},
- {-494.195f, -89.553f, -149.131f, 3.254f}
+ {-494.195f, -89.553f, -149.131f, 3.254f},
+ {-511.3304f, -139.9622f, -152.4761f, 0.7504908f},
+ {-510.6754f, -139.4371f, -152.6167f, 3.33359f},
+ {-511.8976f, -139.3562f, -152.4785f, 3.961899f}
};
class npc_blastmaster_emi_shortfuse : public CreatureScript
@@ -298,12 +296,12 @@ public:
NextStep(25000, false, 18);
break;
case 13:
- Summon(7);
+ Summon(6);
NextStep(25000, false, 19);
break;
case 14:
SetInFace(false);
- DoScriptText(SAY_BLASTMASTER_26, me);
+ Talk(SAY_BLASTMASTER_17);
SetEscortPaused(true);
NextStep(5000, false, 20);
break;
@@ -316,8 +314,8 @@ public:
{
case 1:
SetEscortPaused(true);
- DoScriptText(SAY_BLASTMASTER_0, me);
- NextStep(1500, true);
+ Talk(SAY_BLASTMASTER_0);
+ NextStep(2000, true);
break;
case 2:
if (!instance)
@@ -366,7 +364,7 @@ public:
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
- DoScriptText(SAY_BLASTMASTER_19, me);
+ Talk(SAY_BLASTMASTER_7);
break;
case 4:
if (GameObject* go = me->SummonGameObject(183410, -542.199f, -96.854f, -155.790f, 0, 0, 0, 0, 0, 1000))
@@ -376,38 +374,37 @@ public:
}
break;
case 5:
- me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
- me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
- me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
- DoScriptText(SAY_BLASTMASTER_15, me);
- break;
- case 6:
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
- case 7:
+ case 6:
if (GameObject* go = me->SummonGameObject(183410, -507.820f, -103.333f, -151.353f, 0, 0, 0, 0, 0, 1000))
{
GoSummonList.push_back(go->GetGUID());
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it!
- Summon(6);
+ Summon(5);
}
break;
- case 8:
+ case 7:
if (GameObject* go = me->SummonGameObject(183410, -511.829f, -86.249f, -151.431f, 0, 0, 0, 0, 0, 1000))
{
GoSummonList.push_back(go->GetGUID());
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it!
}
break;
- case 9:
- if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000))
- DoScriptText(SAY_GRUBBIS, pGrubbis);
+ case 8:
+ if (Creature* grubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000))
+ grubbis->AI()->Talk(SAY_GRUBBIS);
me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
+ case 9:
+ me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[17].GetPositionX(), SpawnPosition[17].GetPositionY(), SpawnPosition[17].GetPositionZ(), SpawnPosition[17].GetOrientation(), 0, 0, 0, 0, 7200);
+ me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[18].GetPositionX(), SpawnPosition[18].GetPositionY(), SpawnPosition[18].GetPositionZ(), SpawnPosition[18].GetOrientation(), 0, 0, 0, 0, 7200);
+ me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[19].GetPositionX(), SpawnPosition[19].GetPositionY(), SpawnPosition[19].GetPositionZ(), SpawnPosition[19].GetOrientation(), 0, 0, 0, 0, 7200);
+ break;
}
}
@@ -420,29 +417,29 @@ public:
switch (uiPhase)
{
case 1:
- DoScriptText(SAY_BLASTMASTER_1, me);
- NextStep(1500, true);
+ Talk(SAY_BLASTMASTER_1);
+ NextStep(2000, true);
break;
case 2:
SetEscortPaused(false);
NextStep(0, false, 0);
break;
case 3:
- DoScriptText(SAY_BLASTMASTER_2, me);
+ Talk(SAY_BLASTMASTER_2);
SetEscortPaused(false);
NextStep(0, false, 0);
break;
case 4:
- DoScriptText(SAY_BLASTMASTER_3, me);
+ Talk(SAY_BLASTMASTER_3);
NextStep(3000, true);
break;
case 5:
- DoScriptText(SAY_BLASTMASTER_4, me);
+ Talk(SAY_BLASTMASTER_4);
NextStep(3000, true);
break;
case 6:
SetInFace(true);
- DoScriptText(SAY_BLASTMASTER_5, me);
+ Talk(SAY_BLASTMASTER_5);
Summon(1);
if (instance)
if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
@@ -450,12 +447,12 @@ public:
NextStep(3000, true);
break;
case 7:
- DoScriptText(SAY_BLASTMASTER_6, me);
+ Talk(SAY_BLASTMASTER_6);
SetEscortPaused(false);
NextStep(0, false, 0);
break;
case 8:
- me->HandleEmoteCommand(EMOTE_STATE_WORK);
+ me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING);
NextStep(25000, true);
break;
case 9:
@@ -464,31 +461,32 @@ public:
break;
case 10:
Summon(4);
+ Talk(SAY_BLASTMASTER_8);
NextStep(0, false);
break;
case 11:
- DoScriptText(SAY_BLASTMASTER_17, me);
+ Talk(SAY_BLASTMASTER_9);
NextStep(5000, true);
break;
case 12:
- DoScriptText(SAY_BLASTMASTER_18, me);
+ Talk(SAY_BLASTMASTER_10);
NextStep(5000, true);
break;
case 13:
- DoScriptText(SAY_BLASTMASTER_20, me);
+ Talk(SAY_BLASTMASTER_11);
CaveDestruction(true);
NextStep(8000, true);
break;
case 14:
- DoScriptText(SAY_BLASTMASTER_21, me);
+ Talk(SAY_BLASTMASTER_12);
NextStep(8500, true);
break;
case 15:
- DoScriptText(SAY_BLASTMASTER_22, me);
+ Talk(SAY_BLASTMASTER_13);
NextStep(2000, true);
break;
case 16:
- DoScriptText(SAY_BLASTMASTER_23, me);
+ Talk(SAY_BLASTMASTER_14);
SetInFace(false);
if (instance)
if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT)))
@@ -497,31 +495,36 @@ public:
break;
case 17:
SetEscortPaused(false);
- DoScriptText(SAY_BLASTMASTER_24, me);
- Summon(6);
+ Talk(SAY_BLASTMASTER_15);
+ Summon(5);
NextStep(0, false);
break;
case 18:
- Summon(7);
+ Summon(6);
NextStep(0, false);
break;
case 19:
SetInFace(false);
- Summon(8);
- DoScriptText(SAY_BLASTMASTER_25, me);
+ Summon(7);
+ Talk(SAY_BLASTMASTER_16);
NextStep(0, false);
break;
case 20:
- DoScriptText(SAY_BLASTMASTER_27, me);
+ Talk(SAY_BLASTMASTER_18);
NextStep(2000, true);
break;
case 21:
- Summon(9);
+ Summon(8);
NextStep(0, false);
break;
case 22:
CaveDestruction(false);
- DoScriptText(SAY_BLASTMASTER_20, me);
+ Talk(SAY_BLASTMASTER_11);
+ NextStep(3000, true);
+ break;
+ case 23:
+ Summon(9);
+ Talk(SAY_BLASTMASTER_19);
NextStep(0, false);
break;
}
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h
index a62cf9f9cae..068ba5d26af 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h
@@ -21,7 +21,8 @@
enum eGameObjects
{
GO_CAVE_IN_LEFT = 146085,
- GO_CAVE_IN_RIGHT = 146086
+ GO_CAVE_IN_RIGHT = 146086,
+ GO_RED_ROCKET = 103820
};
enum eCreatures
diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
index 0bbe787827b..8e126fae588 100644
--- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
+++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "gnomeregan.h"
+#include "Player.h"
#define MAX_ENCOUNTER 1
@@ -112,7 +114,7 @@ public:
}
}
- uint32 GetData(uint32 uiType)
+ uint32 GetData(uint32 uiType) const
{
switch (uiType)
{
@@ -121,7 +123,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiType)
+ uint64 GetData64(uint32 uiType) const
{
switch (uiType)
{
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
index 96bda019f6a..13c70630c7a 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp
@@ -23,25 +23,30 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
-
-#define SAY_AGGRO -1532057
-#define SAY_SUMMON1 -1532058
-#define SAY_SUMMON2 -1532059
-#define SAY_EVOCATE -1532060
-#define SAY_ENRAGE -1532061
-#define SAY_KILL1 -1532062
-#define SAY_KILL2 -1532063
-#define SAY_DEATH -1532064
-
-//Flare spell info
-#define SPELL_ASTRAL_FLARE_PASSIVE 30234 //Visual effect + Flare damage
-
-//Curator spell info
-#define SPELL_HATEFUL_BOLT 30383
-#define SPELL_EVOCATION 30254
-#define SPELL_ENRAGE 30403 //Arcane Infusion: Transforms Curator and adds damage.
-#define SPELL_BERSERK 26662
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+
+enum Curator
+{
+ SAY_AGGRO = 0,
+ SAY_SUMMON = 1,
+ SAY_EVOCATE = 2,
+ SAY_ENRAGE = 3,
+ SAY_KILL = 4,
+ SAY_DEATH = 5,
+
+ //Flare spell info
+ SPELL_ASTRAL_FLARE_PASSIVE = 30234, //Visual effect + Flare damage
+
+ //Curator spell info
+ SPELL_HATEFUL_BOLT = 30383,
+ SPELL_EVOCATION = 30254,
+ SPELL_ENRAGE = 30403, //Arcane Infusion: Transforms Curator and adds damage.
+ SPELL_BERSERK = 26662,
+};
+
+
+
class boss_curator : public CreatureScript
{
@@ -77,17 +82,17 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
@@ -108,7 +113,7 @@ public:
}
//may not be correct SAY (generic hard enrage)
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
me->InterruptNonMeleeSpells(true);
DoCast(me, SPELL_BERSERK);
@@ -150,7 +155,7 @@ public:
//if this get's us below 10%, then we evocate (the 10th should be summoned now)
if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)
{
- DoScriptText(SAY_EVOCATE, me);
+ Talk(SAY_EVOCATE);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_EVOCATION);
Evocating = true;
@@ -161,7 +166,7 @@ public:
{
if (urand(0, 1) == 0)
{
- DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me);
+ Talk(SAY_SUMMON);
}
}
}
@@ -173,7 +178,7 @@ public:
{
Enraged = true;
DoCast(me, SPELL_ENRAGE);
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
}
}
@@ -186,13 +191,11 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1))
DoCast(target, SPELL_HATEFUL_BOLT);
-
} else HatefulBoltTimer -= diff;
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_curator()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
index e19efc7c4e5..026524108b3 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp
@@ -23,21 +23,22 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
-
-#define SAY_AGGRO -1532018
-#define SAY_SLAY1 -1532019
-#define SAY_SLAY2 -1532020
-#define SAY_SLAY3 -1532021
-#define SAY_REPENTANCE1 -1532022
-#define SAY_REPENTANCE2 -1532023
-#define SAY_DEATH -1532024
-
-#define SPELL_REPENTANCE 29511
-#define SPELL_HOLYFIRE 29522
-#define SPELL_HOLYWRATH 32445
-#define SPELL_HOLYGROUND 29512
-#define SPELL_BERSERK 26662
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+
+enum MaidenOfVirtue
+{
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_REPENTANCE = 2,
+ SAY_DEATH = 3,
+
+ SPELL_REPENTANCE = 29511,
+ SPELL_HOLYFIRE = 29522,
+ SPELL_HOLYWRATH = 32445,
+ SPELL_HOLYGROUND = 29512,
+ SPELL_BERSERK = 26662,
+};
class boss_maiden_of_virtue : public CreatureScript
{
@@ -75,17 +76,17 @@ public:
void KilledUnit(Unit* /*Victim*/)
{
if (urand(0, 1) == 0)
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
@@ -108,7 +109,7 @@ public:
if (Repentance_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_REPENTANCE);
- DoScriptText(RAND(SAY_REPENTANCE1, SAY_REPENTANCE2), me);
+ Talk(SAY_REPENTANCE);
Repentance_Timer = urand(25000, 35000); //A little randomness on that spell
} else Repentance_Timer -= diff;
@@ -131,9 +132,7 @@ public:
DoMeleeAttackIfReady();
}
-
};
-
};
void AddSC_boss_maiden_of_virtue()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index d8be6ffc0ca..73fefe210df 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -23,28 +23,29 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
-#define SAY_MIDNIGHT_KILL -1532000
-#define SAY_APPEAR1 -1532001
-#define SAY_APPEAR2 -1532002
-#define SAY_APPEAR3 -1532003
-#define SAY_MOUNT -1532004
-#define SAY_KILL1 -1532005
-#define SAY_KILL2 -1532006
-#define SAY_DISARMED -1532007
-#define SAY_DEATH -1532008
-#define SAY_RANDOM1 -1532009
-#define SAY_RANDOM2 -1532010
-
-#define SPELL_SHADOWCLEAVE 29832
-#define SPELL_INTANGIBLE_PRESENCE 29833
-#define SPELL_BERSERKER_CHARGE 26561 //Only when mounted
-
-#define MOUNTED_DISPLAYID 16040
-
-//Attumen (TODO: Use the summoning spell instead of Creature id. It works, but is not convenient for us)
-#define SUMMON_ATTUMEN 15550
+enum Midnight
+{
+ SAY_MIDNIGHT_KILL = 0,
+ SAY_APPEAR = 1,
+ SAY_MOUNT = 2,
+ SAY_KILL = 3,
+ SAY_DISARMED = 4,
+ SAY_DEATH = 5,
+ SAY_RANDOM = 6,
+
+ SPELL_SHADOWCLEAVE = 29832,
+ SPELL_INTANGIBLE_PRESENCE = 29833,
+ SPELL_BERSERKER_CHARGE = 26561, //Only when mounted
+
+ MOUNTED_DISPLAYID = 16040,
+
+ //Attumen (TODO: Use the summoning spell instead of Creature id. It works, but is not convenient for us)
+ SUMMON_ATTUMEN = 15550,
+};
class boss_attumen : public CreatureScript
{
@@ -92,14 +93,14 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
- if (Unit* pMidnight = Unit::GetUnit(*me, Midnight))
- pMidnight->Kill(pMidnight);
+ Talk(SAY_DEATH);
+ if (Unit* midnight = Unit::GetUnit(*me, Midnight))
+ midnight->Kill(midnight);
}
void UpdateAI(const uint32 diff);
@@ -107,10 +108,9 @@ public:
void SpellHit(Unit* /*source*/, const SpellInfo* spell)
{
if (spell->Mechanic == MECHANIC_DISARM)
- DoScriptText(SAY_DISARMED, me);
+ Talk(SAY_DISARMED);
}
};
-
};
class boss_midnight : public CreatureScript
@@ -148,7 +148,7 @@ public:
if (Phase == 2)
{
if (Unit* unit = Unit::GetUnit(*me, Attumen))
- DoScriptText(SAY_MIDNIGHT_KILL, unit);
+ Talk(SAY_MIDNIGHT_KILL, unit->GetGUID());
}
}
@@ -160,12 +160,12 @@ public:
if (Phase == 1 && HealthBelowPct(95))
{
Phase = 2;
- if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
+ if (Creature* attumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
{
- Attumen = pAttumen->GetGUID();
- pAttumen->AI()->AttackStart(me->getVictim());
- SetMidnight(pAttumen, me->GetGUID());
- DoScriptText(RAND(SAY_APPEAR1, SAY_APPEAR2, SAY_APPEAR3), pAttumen);
+ Attumen = attumen->GetGUID();
+ attumen->AI()->AttackStart(me->getVictim());
+ SetMidnight(attumen, me->GetGUID());
+ Talk(SAY_APPEAR, Attumen);
}
}
else if (Phase == 2 && HealthBelowPct(25))
@@ -203,22 +203,22 @@ public:
void Mount(Unit* pAttumen)
{
- DoScriptText(SAY_MOUNT, pAttumen);
+ Talk(SAY_MOUNT, pAttumen->GetGUID());
Phase = 3;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
float angle = me->GetAngle(pAttumen);
float distance = me->GetDistance2d(pAttumen);
- float newX = me->GetPositionX() + cos(angle)*(distance/2);
- float newY = me->GetPositionY() + sin(angle)*(distance/2);
+ float newX = me->GetPositionX() + std::cos(angle)*(distance/2);
+ float newY = me->GetPositionY() + std::sin(angle)*(distance/2);
float newZ = 50;
//me->Relocate(newX, newY, newZ, angle);
//me->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
distance += 10;
- newX = me->GetPositionX() + cos(angle)*(distance/2);
- newY = me->GetPositionY() + sin(angle)*(distance/2);
+ newX = me->GetPositionX() + std::cos(angle)*(distance/2);
+ newY = me->GetPositionY() + std::sin(angle)*(distance/2);
pAttumen->GetMotionMaster()->Clear();
pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
//pAttumen->Relocate(newX, newY, newZ, -angle);
@@ -231,7 +231,6 @@ public:
CAST_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value;
}
};
-
};
void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
@@ -274,7 +273,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
if (RandomYellTimer <= diff)
{
- DoScriptText(RAND(SAY_RANDOM1, SAY_RANDOM2), me);
+ Talk(SAY_RANDOM);
RandomYellTimer = urand(30000, 60000);
} else RandomYellTimer -= diff;
@@ -283,9 +282,9 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff)
if (ChargeTimer <= diff)
{
Unit* target = NULL;
- std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> target_list;
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
{
target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (target && !target->IsWithinDist(me, ATTACK_DISTANCE, false))
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
index f69cecdb4c3..38eb3289ec4 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp
@@ -23,22 +23,24 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
-#define SAY_AGGRO -1532011
-#define SAY_SPECIAL_1 -1532012
-#define SAY_SPECIAL_2 -1532013
-#define SAY_KILL_1 -1532014
-#define SAY_KILL_2 -1532015
-#define SAY_KILL_3 -1532016
-#define SAY_DEATH -1532017
+enum Moroes
+{
+ SAY_AGGRO = 0,
+ SAY_SPECIAL = 1,
+ SAY_KILL = 2,
+ SAY_DEATH = 3,
+
+ SPELL_VANISH = 29448,
+ SPELL_GARROTE = 37066,
+ SPELL_BLIND = 34694,
+ SPELL_GOUGE = 29425,
+ SPELL_FRENZY = 37023,
+};
-#define SPELL_VANISH 29448
-#define SPELL_GARROTE 37066
-#define SPELL_BLIND 34694
-#define SPELL_GOUGE 29425
-#define SPELL_FRENZY 37023
#define POS_Z 81.73f
@@ -74,8 +76,8 @@ public:
{
boss_moroesAI(Creature* creature) : ScriptedAI(creature)
{
- for (uint8 i = 0; i < 4; ++i)
- AddId[i] = 0;
+ memset(AddId, 0, sizeof(AddId));
+ memset(AddGUID, 0, sizeof(AddGUID));
instance = creature->GetInstanceScript();
}
@@ -104,10 +106,8 @@ public:
Enrage = false;
InVanish = false;
- if (me->GetHealth() > 0)
- {
+ if (me->GetHealth())
SpawnAdds();
- }
if (instance)
instance->SetData(TYPE_MOROES, NOT_STARTED);
@@ -125,19 +125,19 @@ public:
{
StartEvent();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
AddsAttack();
DoZoneInCombat();
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2, SAY_KILL_3), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_MOROES, DONE);
@@ -192,10 +192,9 @@ public:
bool isAddlistEmpty()
{
for (uint8 i = 0; i < 4; ++i)
- {
if (AddId[i] == 0)
return true;
- }
+
return false;
}
@@ -203,12 +202,11 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- Temp->DisappearAndDie();
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ temp->DisappearAndDie();
}
}
}
@@ -217,14 +215,13 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Creature::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
+ Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
{
- Temp->AI()->AttackStart(me->getVictim());
- DoZoneInCombat(Temp);
+ temp->AI()->AttackStart(me->getVictim());
+ DoZoneInCombat(temp);
} else
EnterEvadeMode();
}
@@ -252,13 +249,12 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
- Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = Unit::GetCreature((*me), AddGUID[i]);
- if (Temp && Temp->isAlive())
- if (!Temp->getVictim())
- Temp->AI()->AttackStart(me->getVictim());
+ Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
+ if (temp && temp->isAlive())
+ if (!temp->getVictim())
+ temp->AI()->AttackStart(me->getVictim());
}
}
CheckAdds_Timer = 5000;
@@ -299,7 +295,7 @@ public:
{
if (Wait_Timer <= diff)
{
- DoScriptText(RAND(SAY_SPECIAL_1, SAY_SPECIAL_2), me);
+ Talk(SAY_SPECIAL);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
target->CastSpell(target, SPELL_GARROTE, true);
@@ -312,7 +308,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
struct boss_moroes_guestAI : public ScriptedAI
@@ -340,17 +335,10 @@ struct boss_moroes_guestAI : public ScriptedAI
if (!instance)
return;
- uint64 MoroesGUID = instance->GetData64(DATA_MOROES);
- Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID));
- if (Moroes)
- {
+ if (Creature* Moroes = Unit::GetCreature(*me, instance->GetData64(DATA_MOROES)))
for (uint8 i = 0; i < 4; ++i)
- {
- uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i];
- if (GUID)
+ if (uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i])
GuestGUID[i] = GUID;
- }
- }
}
Unit* SelectGuestTarget()
@@ -464,7 +452,6 @@ public:
} else ShadowWordPain_Timer -= diff;
}
};
-
};
class boss_baron_rafe_dreuger : public CreatureScript
@@ -522,7 +509,6 @@ public:
} else HammerOfJustice_Timer -= diff;
}
};
-
};
class boss_lady_catriona_von_indi : public CreatureScript
@@ -593,7 +579,6 @@ public:
} else DispelMagic_Timer -= diff;
}
};
-
};
class boss_lady_keira_berrybuck : public CreatureScript
@@ -668,7 +653,6 @@ public:
} else Cleanse_Timer -= diff;
}
};
-
};
class boss_lord_robin_daris : public CreatureScript
@@ -725,7 +709,6 @@ public:
} else WhirlWind_Timer -= diff;
}
};
-
};
class boss_lord_crispin_ference : public CreatureScript
@@ -790,7 +773,6 @@ public:
} else ShieldWall_Timer -= diff;
}
};
-
};
void AddSC_boss_moroes()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
index f89abca76cf..37506d9fd0e 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp
@@ -23,20 +23,26 @@ SDComment: Not sure about timing and portals placing
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "Player.h"
-#define EMOTE_PHASE_PORTAL -1532089
-#define EMOTE_PHASE_BANISH -1532090
+enum Netherspite
+{
+ EMOTE_PHASE_PORTAL = 0,
+ EMOTE_PHASE_BANISH = 1,
+
+ SPELL_NETHERBURN_AURA = 30522,
+ SPELL_VOIDZONE = 37063,
+ SPELL_NETHER_INFUSION = 38688,
+ SPELL_NETHERBREATH = 38523,
+ SPELL_BANISH_VISUAL = 39833,
+ SPELL_BANISH_ROOT = 42716,
+ SPELL_EMPOWERMENT = 38549,
+ SPELL_NETHERSPITE_ROAR = 38684,
+};
-#define SPELL_NETHERBURN_AURA 30522
-#define SPELL_VOIDZONE 37063
-#define SPELL_NETHER_INFUSION 38688
-#define SPELL_NETHERBREATH 38523
-#define SPELL_BANISH_VISUAL 39833
-#define SPELL_BANISH_ROOT 42716
-#define SPELL_EMPOWERMENT 38549
-#define SPELL_NETHERSPITE_ROAR 38684
const float PortalCoord[3][3] =
{
@@ -227,7 +233,7 @@ public:
PortalPhase = true;
PortalTimer = 10000;
EmpowermentTimer = 10000;
- DoScriptText(EMOTE_PHASE_PORTAL, me);
+ Talk(EMOTE_PHASE_PORTAL);
}
void SwitchToBanishPhase()
@@ -239,7 +245,7 @@ public:
DestroyPortals();
PhaseTimer = 30000;
PortalPhase = false;
- DoScriptText(EMOTE_PHASE_BANISH, me);
+ Talk(EMOTE_PHASE_BANISH);
for (int i=0; i<3; ++i)
me->RemoveAurasDueToSpell(NetherBuff[i]);
@@ -332,7 +338,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_netherspite()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
index ded5e6903a5..690822203b5 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp
@@ -23,7 +23,8 @@ SDComment: SDComment: Timers may incorrect
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
//phase 1
@@ -412,7 +413,6 @@ public:
}
}
};
-
};
void AddSC_boss_nightbane()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
index 4700ad71fab..845a773c108 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
@@ -23,21 +23,10 @@ SDComment:
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
-
-#define SAY_AGGRO -1532091
-#define SAY_AXE_TOSS1 -1532092
-#define SAY_AXE_TOSS2 -1532093
-#define SAY_SPECIAL1 -1532094
-#define SAY_SPECIAL2 -1532095
-#define SAY_SPECIAL3 -1532096
-#define SAY_SLAY1 -1532097
-#define SAY_SLAY2 -1532098
-#define SAY_SLAY3 -1532099
-#define SAY_SUMMON1 -1532100
-#define SAY_SUMMON2 -1532101
-#define SAY_DEATH -1532102
+#include "SpellInfo.h"
// 18 Coordinates for Infernal spawns
struct InfernalPoint
@@ -69,31 +58,43 @@ static InfernalPoint InfernalPoints[] =
{-10935.7f, -1996.0f}
};
-#define TOTAL_INFERNAL_POINTS 18
-
//Enfeeble is supposed to reduce hp to 1 and then heal player back to full when it ends
//Along with reducing healing and regen while enfeebled to 0%
//This spell effect will only reduce healing
-
-#define SPELL_ENFEEBLE 30843 //Enfeeble during phase 1 and 2
-#define SPELL_ENFEEBLE_EFFECT 41624
-
-#define SPELL_SHADOWNOVA 30852 //Shadownova used during all phases
-#define SPELL_SW_PAIN 30854 //Shadow word pain during phase 1 and 3 (different targeting rules though)
-#define SPELL_THRASH_PASSIVE 12787 //Extra attack chance during phase 2
-#define SPELL_SUNDER_ARMOR 30901 //Sunder armor during phase 2
-#define SPELL_THRASH_AURA 12787 //Passive proc chance for thrash
-#define SPELL_EQUIP_AXES 30857 //Visual for axe equiping
-#define SPELL_AMPLIFY_DAMAGE 39095 //Amplifiy during phase 3
-#define SPELL_CLEAVE 30131 //Same as Nightbane.
-#define SPELL_HELLFIRE 30859 //Infenals' hellfire aura
-#define NETHERSPITE_INFERNAL 17646 //The netherspite infernal creature
-#define MALCHEZARS_AXE 17650 //Malchezar's axes (creatures), summoned during phase 3
-
-#define INFERNAL_MODEL_INVISIBLE 11686 //Infernal Effects
-#define SPELL_INFERNAL_RELAY 30834
-
-#define EQUIP_ID_AXE 33542 //Axes info
+enum PrinceMalchezaar
+{
+ SAY_AGGRO = 0,
+ SAY_AXE_TOSS1 = 1,
+ SAY_AXE_TOSS2 = 2,
+// SAY_SPECIAL1 = 3, Not used, needs to be implemented, but I don't know where it should be used.
+// SAY_SPECIAL2 = 4, Not used, needs to be implemented, but I don't know where it should be used.
+// SAY_SPECIAL3 = 5, Not used, needs to be implemented, but I don't know where it should be used.
+ SAY_SLAY = 6,
+ SAY_SUMMON = 7,
+ SAY_DEATH = 8,
+
+ TOTAL_INFERNAL_POINTS = 18,
+
+ SPELL_ENFEEBLE = 30843, //Enfeeble during phase 1 and 2
+ SPELL_ENFEEBLE_EFFECT = 41624,
+
+ SPELL_SHADOWNOVA = 30852, //Shadownova used during all phases
+ SPELL_SW_PAIN = 30854, //Shadow word pain during phase 1 and 3 (different targeting rules though)
+ SPELL_THRASH_PASSIVE = 12787, //Extra attack chance during phase 2
+ SPELL_SUNDER_ARMOR = 30901, //Sunder armor during phase 2
+ SPELL_THRASH_AURA = 12787, //Passive proc chance for thrash
+ SPELL_EQUIP_AXES = 30857, //Visual for axe equiping
+ SPELL_AMPLIFY_DAMAGE = 39095, //Amplifiy during phase 3
+ SPELL_CLEAVE = 30131, //Same as Nightbane.
+ SPELL_HELLFIRE = 30859, //Infenals' hellfire aura
+ NETHERSPITE_INFERNAL = 17646, //The netherspite infernal creature
+ MALCHEZARS_AXE = 17650, //Malchezar's axes (creatures), summoned during phase 3
+
+ INFERNAL_MODEL_INVISIBLE = 11686, //Infernal Effects
+ SPELL_INFERNAL_RELAY = 30834,
+
+ EQUIP_ID_AXE = 33542, //Axes info
+};
//---------Infernal code first
class netherspite_infernal : public CreatureScript
@@ -168,7 +169,6 @@ public:
void Cleanup();
};
-
};
class boss_malchezaar : public CreatureScript
@@ -186,6 +186,7 @@ public:
boss_malchezaarAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ memset(axes, 0, sizeof(axes));
}
InstanceScript* instance;
@@ -217,7 +218,10 @@ public:
positions.clear();
for (uint8 i = 0; i < 5; ++i)
+ {
enfeeble_targets[i] = 0;
+ enfeeble_health[i] = 0;
+ }
for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i)
positions.push_back(&InfernalPoints[i]);
@@ -228,7 +232,7 @@ public:
SWPainTimer = 20000;
AmplifyDamageTimer = 5000;
Cleave_Timer = 8000;
- InfernalTimer = 45000;
+ InfernalTimer = 40000;
InfernalCleanupTimer = 47000;
AxesTargetSwitchTimer = urand(7500, 20000);
SunderArmorTimer = urand(5000, 10000);
@@ -240,12 +244,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
AxesCleanup();
ClearWeapons();
@@ -261,7 +265,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->HandleGameObject(instance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in
@@ -309,14 +313,14 @@ public:
if (!info)
return;
- std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
std::vector<Unit*> targets;
if (t_list.empty())
return;
//begin + 1, so we don't target the one with the highest threat
- std::list<HostileReference*>::const_iterator itr = t_list.begin();
+ ThreatContainer::StorageType::const_iterator itr = t_list.begin();
std::advance(itr, 1);
for (; itr != t_list.end(); ++itr) //store the threat list in a different container
if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -379,7 +383,7 @@ public:
DoCast(Infernal, SPELL_INFERNAL_RELAY);
}
- DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me);
+ Talk(SAY_SUMMON);
}
void UpdateAI(const uint32 diff)
@@ -411,7 +415,7 @@ public:
DoCast(me, SPELL_EQUIP_AXES);
//text
- DoScriptText(SAY_AXE_TOSS1, me);
+ Talk(SAY_AXE_TOSS1);
//passive thrash aura
DoCast(me, SPELL_THRASH_AURA, true);
@@ -447,7 +451,7 @@ public:
//remove thrash
me->RemoveAurasDueToSpell(SPELL_THRASH_AURA);
- DoScriptText(SAY_AXE_TOSS2, me);
+ Talk(SAY_AXE_TOSS2);
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
for (uint8 i = 0; i < 2; ++i)
@@ -478,14 +482,12 @@ public:
{
DoCast(me->getVictim(), SPELL_SUNDER_ARMOR);
SunderArmorTimer = urand(10000, 18000);
-
} else SunderArmorTimer -= diff;
if (Cleave_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = urand(6000, 12000);
-
} else Cleave_Timer -= diff;
}
else
@@ -597,15 +599,14 @@ public:
positions.push_back(point);
}
};
-
};
void netherspite_infernal::netherspite_infernalAI::Cleanup()
{
- Unit* pMalchezaar = Unit::GetUnit(*me, malchezaar);
+ Creature *pMalchezaar = Unit::GetCreature(*me, malchezaar);
if (pMalchezaar && pMalchezaar->isAlive())
- CAST_AI(boss_malchezaar::boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(me, point);
+ CAST_AI(boss_malchezaar::boss_malchezaarAI, pMalchezaar->AI())->Cleanup(me, point);
}
void AddSC_boss_malchezaar()
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 d95b4aa3ae1..843220663b7 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp
@@ -23,55 +23,54 @@ SDComment: Flame wreath missing cast animation, mods won't triggere.
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
#include "GameObject.h"
+#include "SpellInfo.h"
-#define SAY_AGGRO1 -1532073
-#define SAY_AGGRO2 -1532074
-#define SAY_AGGRO3 -1532075
-#define SAY_FLAMEWREATH1 -1532076
-#define SAY_FLAMEWREATH2 -1532077
-#define SAY_BLIZZARD1 -1532078
-#define SAY_BLIZZARD2 -1532079
-#define SAY_EXPLOSION1 -1532080
-#define SAY_EXPLOSION2 -1532081
-#define SAY_DRINK -1532082 //Low Mana / AoE Pyroblast
-#define SAY_ELEMENTALS -1532083
-#define SAY_KILL1 -1532084
-#define SAY_KILL2 -1532085
-#define SAY_TIMEOVER -1532086
-#define SAY_DEATH -1532087
-#define SAY_ATIESH -1532088 //Atiesh is equipped by a raid member
-
-//Spells
-#define SPELL_FROSTBOLT 29954
-#define SPELL_FIREBALL 29953
-#define SPELL_ARCMISSLE 29955
-#define SPELL_CHAINSOFICE 29991
-#define SPELL_DRAGONSBREATH 29964
-#define SPELL_MASSSLOW 30035
-#define SPELL_FLAME_WREATH 29946
-#define SPELL_AOE_CS 29961
-#define SPELL_PLAYERPULL 32265
-#define SPELL_AEXPLOSION 29973
-#define SPELL_MASS_POLY 29963
-#define SPELL_BLINK_CENTER 29967
-#define SPELL_ELEMENTALS 29962
-#define SPELL_CONJURE 29975
-#define SPELL_DRINK 30024
-#define SPELL_POTION 32453
-#define SPELL_AOE_PYROBLAST 29978
-
-//Creature Spells
-#define SPELL_CIRCULAR_BLIZZARD 29951 //29952 is the REAL circular blizzard that leaves persistant blizzards that last for 10 seconds
-#define SPELL_WATERBOLT 31012
-#define SPELL_SHADOW_PYRO 29978
-
-//Creatures
-#define CREATURE_WATER_ELEMENTAL 17167
-#define CREATURE_SHADOW_OF_ARAN 18254
-#define CREATURE_ARAN_BLIZZARD 17161
+enum ShadeOfAran
+{
+ SAY_AGGRO = 0,
+ SAY_FLAMEWREATH = 1,
+ SAY_BLIZZARD = 2,
+ SAY_EXPLOSION = 3,
+ SAY_DRINK = 4,
+ SAY_ELEMENTALS = 5,
+ SAY_KILL = 6,
+ SAY_TIMEOVER = 7,
+ SAY_DEATH = 8,
+// SAY_ATIESH = 9, Unused
+
+ //Spells
+ SPELL_FROSTBOLT = 29954,
+ SPELL_FIREBALL = 29953,
+ SPELL_ARCMISSLE = 29955,
+ SPELL_CHAINSOFICE = 29991,
+ SPELL_DRAGONSBREATH = 29964,
+ SPELL_MASSSLOW = 30035,
+ SPELL_FLAME_WREATH = 29946,
+ SPELL_AOE_CS = 29961,
+ SPELL_PLAYERPULL = 32265,
+ SPELL_AEXPLOSION = 29973,
+ SPELL_MASS_POLY = 29963,
+ SPELL_BLINK_CENTER = 29967,
+ SPELL_ELEMENTALS = 29962,
+ SPELL_CONJURE = 29975,
+ SPELL_DRINK = 30024,
+ SPELL_POTION = 32453,
+ SPELL_AOE_PYROBLAST = 29978,
+
+ //Creature Spells
+ SPELL_CIRCULAR_BLIZZARD = 29951,
+ SPELL_WATERBOLT = 31012,
+ SPELL_SHADOW_PYRO = 29978,
+
+ //Creatures
+ CREATURE_WATER_ELEMENTAL = 17167,
+ CREATURE_SHADOW_OF_ARAN = 18254,
+ CREATURE_ARAN_BLIZZARD = 17161,
+};
enum SuperSpell
{
@@ -158,12 +157,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL1, SAY_KILL2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
@@ -174,7 +173,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
if (instance)
{
@@ -186,13 +185,13 @@ public:
void FlameWreathEffect()
{
std::vector<Unit*> targets;
- std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
if (t_list.empty())
return;
//store the threat list in a different container
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
//only on alive players
@@ -262,7 +261,7 @@ public:
Drinking = true;
me->InterruptNonMeleeSpells(false);
- DoScriptText(SAY_DRINK, me);
+ Talk(SAY_DRINK);
if (!DrinkInturrupted)
{
@@ -382,7 +381,7 @@ public:
switch (LastSuperSpell)
{
case SUPER_AE:
- DoScriptText(RAND(SAY_EXPLOSION1, SAY_EXPLOSION2), me);
+ Talk(SAY_EXPLOSION);
DoCast(me, SPELL_BLINK_CENTER, true);
DoCast(me, SPELL_PLAYERPULL, true);
@@ -391,7 +390,7 @@ public:
break;
case SUPER_FLAME:
- DoScriptText(RAND(SAY_FLAMEWREATH1, SAY_FLAMEWREATH2), me);
+ Talk(SAY_FLAMEWREATH);
FlameWreathTimer = 20000;
FlameWreathCheckTime = 500;
@@ -404,7 +403,7 @@ public:
break;
case SUPER_BLIZZARD:
- DoScriptText(RAND(SAY_BLIZZARD1, SAY_BLIZZARD2), me);
+ Talk(SAY_BLIZZARD);
if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000))
{
@@ -430,7 +429,7 @@ public:
}
}
- DoScriptText(SAY_ELEMENTALS, me);
+ Talk(SAY_ELEMENTALS);
}
if (BerserkTimer <= diff)
@@ -444,7 +443,7 @@ public:
}
}
- DoScriptText(SAY_TIMEOVER, me);
+ Talk(SAY_TIMEOVER);
BerserkTimer = 60000;
} else BerserkTimer -= diff;
@@ -507,7 +506,6 @@ public:
}
}
};
-
};
class mob_aran_elemental : public CreatureScript
@@ -545,7 +543,6 @@ public:
} else CastTimer -= diff;
}
};
-
};
void AddSC_boss_shade_of_aran()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
index 2f19d2c7fc1..cb5a1b7b914 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp
@@ -23,38 +23,41 @@ SDComment: Complete! Needs adjustments to use spell though.
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "karazhan.h"
+#include "PassiveAI.h"
+
+enum TerestianIllhoof
+{
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_AGGRO = 3,
+ SAY_SACRIFICE = 4,
+ SAY_SUMMON = 5,
+
+ SPELL_SUMMON_DEMONCHAINS = 30120, // Summons demonic chains that maintain the ritual of sacrifice.
+ SPELL_DEMON_CHAINS = 30206, // Instant - Visual Effect
+ SPELL_ENRAGE = 23537, // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min.
+ SPELL_SHADOW_BOLT = 30055, // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage.
+ SPELL_SACRIFICE = 30115, // Teleports and adds the debuff
+ SPELL_BERSERK = 32965, // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley.
+ SPELL_SUMMON_FIENDISIMP = 30184, // Summons a Fiendish Imp.
+ SPELL_SUMMON_IMP = 30066, // Summons Kil'rek
+
+ SPELL_FIENDISH_PORTAL = 30171, // Opens portal and summons Fiendish Portal, 2 sec cast
+ SPELL_FIENDISH_PORTAL_1 = 30179, // Opens portal and summons Fiendish Portal, instant cast
+
+ SPELL_FIREBOLT = 30050, // Blasts a target for 150 Fire damage.
+ SPELL_BROKEN_PACT = 30065, // All damage taken increased by 25%.
+ SPELL_AMPLIFY_FLAMES = 30053, // Increases the Fire damage taken by an enemy by 500 for 25 sec.
+
+ CREATURE_DEMONCHAINS = 17248,
+ CREATURE_FIENDISHIMP = 17267,
+ CREATURE_PORTAL = 17265,
+ CREATURE_KILREK = 17229,
+};
-#define SAY_SLAY1 -1532065
-#define SAY_SLAY2 -1532066
-#define SAY_DEATH -1532067
-#define SAY_AGGRO -1532068
-#define SAY_SACRIFICE1 -1532069
-#define SAY_SACRIFICE2 -1532070
-#define SAY_SUMMON1 -1532071
-#define SAY_SUMMON2 -1532072
-
-#define SPELL_SUMMON_DEMONCHAINS 30120 // Summons demonic chains that maintain the ritual of sacrifice.
-#define SPELL_DEMON_CHAINS 30206 // Instant - Visual Effect
-#define SPELL_ENRAGE 23537 // Increases the caster's attack speed by 50% and the Physical damage it deals by 219 to 281 for 10 min.
-#define SPELL_SHADOW_BOLT 30055 // Hurls a bolt of dark magic at an enemy, inflicting Shadow damage.
-#define SPELL_SACRIFICE 30115 // Teleports and adds the debuff
-#define SPELL_BERSERK 32965 // Increases attack speed by 75%. Periodically casts Shadow Bolt Volley.
-#define SPELL_SUMMON_FIENDISIMP 30184 // Summons a Fiendish Imp.
-#define SPELL_SUMMON_IMP 30066 // Summons Kil'rek
-
-#define SPELL_FIENDISH_PORTAL 30171 // Opens portal and summons Fiendish Portal, 2 sec cast
-#define SPELL_FIENDISH_PORTAL_1 30179 // Opens portal and summons Fiendish Portal, instant cast
-
-#define SPELL_FIREBOLT 30050 // Blasts a target for 150 Fire damage.
-#define SPELL_BROKEN_PACT 30065 // All damage taken increased by 25%.
-#define SPELL_AMPLIFY_FLAMES 30053 // Increases the Fire damage taken by an enemy by 500 for 25 sec.
-
-#define CREATURE_DEMONCHAINS 17248
-#define CREATURE_FIENDISHIMP 17267
-#define CREATURE_PORTAL 17265
-#define CREATURE_KILREK 17229
class mob_kilrek : public CreatureScript
{
@@ -125,7 +128,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class mob_demon_chain : public CreatureScript
@@ -163,7 +165,6 @@ public:
}
}
};
-
};
class mob_fiendish_portal : public CreatureScript
@@ -198,7 +199,6 @@ public:
summons.DespawnAll();
}
};
-
};
#define SPELL_FIREBOLT 30050 // Blasts a target for 181-209 Fire damage.
@@ -243,7 +243,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class boss_terestian_illhoof : public CreatureScript
@@ -321,7 +320,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -333,7 +332,7 @@ public:
if (summoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1)
{
- DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me);
+ Talk(SAY_SUMMON);
SummonedPortals = true;
}
}
@@ -341,7 +340,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -357,7 +356,7 @@ public:
}
}
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_TERESTIAN, DONE);
@@ -380,7 +379,7 @@ public:
{
CAST_AI(mob_demon_chain::mob_demon_chainAI, Chains->AI())->SacrificeGUID = target->GetGUID();
Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
- DoScriptText(RAND(SAY_SACRIFICE1, SAY_SACRIFICE2), me);
+ Talk(SAY_SACRIFICE);
SacrificeTimer = 30000;
}
}
@@ -420,7 +419,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_terestian_illhoof()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
index 6f8121ef5b6..7053cbb3ed7 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
@@ -23,70 +23,79 @@ SDComment: Oz, Hood, and RAJ event implemented. RAJ event requires more testing.
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "karazhan.h"
+#include "Player.h"
+#include "SpellInfo.h"
/***********************************/
/*** OPERA WIZARD OF OZ EVENT *****/
/*********************************/
+enum Says
+{
+ SAY_DOROTHEE_DEATH = 0,
+ SAY_DOROTHEE_SUMMON = 1,
+ SAY_DOROTHEE_TITO_DEATH = 2,
+ SAY_DOROTHEE_AGGRO = 3,
+
+ SAY_ROAR_AGGRO = 0,
+ SAY_ROAR_DEATH = 1,
+ SAY_ROAR_SLAY = 2,
+
+ SAY_STRAWMAN_AGGRO = 0,
+ SAY_STRAWMAN_DEATH = 1,
+ SAY_STRAWMAN_SLAY = 2,
+
+ SAY_TINHEAD_AGGRO = 0,
+ SAY_TINHEAD_DEATH = 1,
+ SAY_TINHEAD_SLAY = 2,
+ EMOTE_RUST = 3,
+
+ SAY_CRONE_AGGRO = 0,
+ SAY_CRONE_DEATH = 1,
+ SAY_CRONE_SLAY = 2,
+};
-#define SAY_DOROTHEE_DEATH -1532025
-#define SAY_DOROTHEE_SUMMON -1532026
-#define SAY_DOROTHEE_TITO_DEATH -1532027
-#define SAY_DOROTHEE_AGGRO -1532028
-
-#define SAY_ROAR_AGGRO -1532029
-#define SAY_ROAR_DEATH -1532030
-#define SAY_ROAR_SLAY -1532031
-
-#define SAY_STRAWMAN_AGGRO -1532032
-#define SAY_STRAWMAN_DEATH -1532033
-#define SAY_STRAWMAN_SLAY -1532034
-
-#define SAY_TINHEAD_AGGRO -1532035
-#define SAY_TINHEAD_DEATH -1532036
-#define SAY_TINHEAD_SLAY -1532037
-#define EMOTE_RUST -1532038
-
-#define SAY_CRONE_AGGRO -1532039
-#define SAY_CRONE_AGGRO2 -1532040
-#define SAY_CRONE_DEATH -1532041
-#define SAY_CRONE_SLAY -1532042
-
-/**** Spells ****/
-// Dorothee
-#define SPELL_WATERBOLT 31012
-#define SPELL_SCREAM 31013
-#define SPELL_SUMMONTITO 31014
-
-// Tito
-#define SPELL_YIPPING 31015
-
-// Strawman
-#define SPELL_BRAIN_BASH 31046
-#define SPELL_BRAIN_WIPE 31069
-#define SPELL_BURNING_STRAW 31075
-
-// Tinhead
-#define SPELL_CLEAVE 31043
-#define SPELL_RUST 31086
-
-// Roar
-#define SPELL_MANGLE 31041
-#define SPELL_SHRED 31042
-#define SPELL_FRIGHTENED_SCREAM 31013
-
-// Crone
-#define SPELL_CHAIN_LIGHTNING 32337
-
-// Cyclone
-#define SPELL_KNOCKBACK 32334
-#define SPELL_CYCLONE_VISUAL 32332
+enum Spells
+{
+ // Dorothee
+ SPELL_WATERBOLT = 31012,
+ SPELL_SCREAM = 31013,
+ SPELL_SUMMONTITO = 31014,
+
+ // Tito
+ SPELL_YIPPING = 31015,
+
+ // Strawman
+ SPELL_BRAIN_BASH = 31046,
+ SPELL_BRAIN_WIPE = 31069,
+ SPELL_BURNING_STRAW = 31075,
+
+ // Tinhead
+ SPELL_CLEAVE = 31043,
+ SPELL_RUST = 31086,
+
+ // Roar
+ SPELL_MANGLE = 31041,
+ SPELL_SHRED = 31042,
+ SPELL_FRIGHTENED_SCREAM = 31013,
+
+ // Crone
+ SPELL_CHAIN_LIGHTNING = 32337,
+
+ // Cyclone
+ SPELL_KNOCKBACK = 32334,
+ SPELL_CYCLONE_VISUAL = 32332,
+};
-/** Creature Entries **/
-#define CREATURE_TITO 17548
-#define CREATURE_CYCLONE 18412
-#define CREATURE_CRONE 18168
+enum Creatures
+{
+ CREATURE_TITO = 17548,
+ CREATURE_CYCLONE = 18412,
+ CREATURE_CRONE = 18168,
+};
void SummonCroneIfReady(InstanceScript* instance, Creature* creature)
{
@@ -144,7 +153,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_DOROTHEE_AGGRO, me);
+ Talk(SAY_DOROTHEE_AGGRO);
}
void JustReachedHome()
@@ -156,7 +165,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DOROTHEE_DEATH, me);
+ Talk(SAY_DOROTHEE_DEATH);
if (instance)
SummonCroneIfReady(instance, me);
@@ -214,7 +223,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class mob_tito : public CreatureScript
@@ -250,7 +258,7 @@ public:
if (Dorothee && Dorothee->isAlive())
{
CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true;
- DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee);
+ Talk(SAY_DOROTHEE_TITO_DEATH, Dorothee->GetGUID());
}
}
}
@@ -269,14 +277,13 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void boss_dorothee::boss_dorotheeAI::SummonTito()
{
if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
{
- DoScriptText(SAY_DOROTHEE_SUMMON, me);
+ Talk(SAY_DOROTHEE_SUMMON);
CAST_AI(mob_tito::mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID();
pTito->AI()->AttackStart(me->getVictim());
SummonedTito = true;
@@ -332,7 +339,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_STRAWMAN_AGGRO, me);
+ Talk(SAY_STRAWMAN_AGGRO);
}
void JustReachedHome()
@@ -355,7 +362,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_STRAWMAN_DEATH, me);
+ Talk(SAY_STRAWMAN_DEATH);
if (instance)
SummonCroneIfReady(instance, me);
@@ -363,7 +370,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_STRAWMAN_SLAY, me);
+ Talk(SAY_STRAWMAN_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -396,7 +403,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class boss_tinhead : public CreatureScript
@@ -435,7 +441,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_TINHEAD_AGGRO, me);
+ Talk(SAY_TINHEAD_AGGRO);
}
void JustReachedHome()
@@ -461,7 +467,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_TINHEAD_DEATH, me);
+ Talk(SAY_TINHEAD_DEATH);
if (instance)
SummonCroneIfReady(instance, me);
@@ -469,7 +475,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_TINHEAD_SLAY, me);
+ Talk(SAY_TINHEAD_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -497,7 +503,7 @@ public:
if (RustTimer <= diff)
{
++RustCount;
- DoScriptText(EMOTE_RUST, me);
+ Talk(EMOTE_RUST);
DoCast(me, SPELL_RUST);
RustTimer = 6000;
} else RustTimer -= diff;
@@ -506,7 +512,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class boss_roar : public CreatureScript
@@ -559,7 +564,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_ROAR_AGGRO, me);
+ Talk(SAY_ROAR_AGGRO);
}
void JustReachedHome()
@@ -569,7 +574,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_ROAR_DEATH, me);
+ Talk(SAY_ROAR_DEATH);
if (instance)
SummonCroneIfReady(instance, me);
@@ -577,7 +582,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_ROAR_SLAY, me);
+ Talk(SAY_ROAR_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -615,7 +620,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class boss_crone : public CreatureScript
@@ -651,16 +655,21 @@ public:
me->DespawnOrUnsummon();
}
+ void KilledUnit(Unit* /*victim*/)
+ {
+ Talk(SAY_CRONE_SLAY);
+ }
+
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_CRONE_AGGRO, SAY_CRONE_AGGRO2), me);
+ Talk(SAY_CRONE_AGGRO);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_CRONE_DEATH, me);
+ Talk(SAY_CRONE_DEATH);
if (instance)
{
@@ -697,7 +706,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class mob_cyclone : public CreatureScript
@@ -741,28 +749,29 @@ public:
} else MoveTimer -= diff;
}
};
-
};
/**************************************/
/**** Opera Red Riding Hood Event* ***/
/************************************/
+enum RedRidingHood
+{
+ SAY_WOLF_AGGRO = 0,
+ SAY_WOLF_SLAY = 1,
+ SAY_WOLF_HOOD = 2,
+ SOUND_WOLF_DEATH = 9275,
+
+ SPELL_LITTLE_RED_RIDING_HOOD = 30768,
+ SPELL_TERRIFYING_HOWL = 30752,
+ SPELL_WIDE_SWIPE = 30761,
-/**** Yells for the Wolf ****/
-#define SAY_WOLF_AGGRO -1532043
-#define SAY_WOLF_SLAY -1532044
-#define SAY_WOLF_HOOD -1532045
-#define SOUND_WOLF_DEATH 9275 //Only sound on death, no text.
+ CREATURE_BIG_BAD_WOLF = 17521,
+};
-/**** Spells For The Wolf ****/
-#define SPELL_LITTLE_RED_RIDING_HOOD 30768
-#define SPELL_TERRIFYING_HOWL 30752
-#define SPELL_WIDE_SWIPE 30761
#define GOSSIP_GRANDMA "What phat lewtz you have grandmother?"
-/**** The Wolf's Entry* ***/
-#define CREATURE_BIG_BAD_WOLF 17521
+
class npc_grandmother : public CreatureScript
{
@@ -790,7 +799,6 @@ public:
return true;
}
-
};
class boss_bigbadwolf : public CreatureScript
@@ -835,7 +843,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_WOLF_AGGRO, me);
+ Talk(SAY_WOLF_AGGRO);
+ }
+
+ void KilledUnit(Unit* /*victim*/)
+ {
+ Talk(SAY_WOLF_SLAY);
}
void JustReachedHome()
@@ -871,7 +884,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
- DoScriptText(SAY_WOLF_HOOD, me);
+ Talk(SAY_WOLF_HOOD);
DoCast(target, SPELL_LITTLE_RED_RIDING_HOOD, true);
TempThreat = DoGetThreat(target);
if (TempThreat)
@@ -913,51 +926,49 @@ public:
DoCast(me->getVictim(), SPELL_WIDE_SWIPE);
SwipeTimer = urand(25000, 30000);
} else SwipeTimer -= diff;
-
}
};
-
};
/**********************************************/
/******** Opera Romeo and Juliet Event* ******/
/********************************************/
-/**** Speech *****/
-#define SAY_JULIANNE_AGGRO -1532046
-#define SAY_JULIANNE_ENTER -1532047
-#define SAY_JULIANNE_DEATH01 -1532048
-#define SAY_JULIANNE_DEATH02 -1532049
-#define SAY_JULIANNE_RESURRECT -1532050
-#define SAY_JULIANNE_SLAY -1532051
-
-#define SAY_ROMULO_AGGRO -1532052
-#define SAY_ROMULO_DEATH -1532053
-#define SAY_ROMULO_ENTER -1532054
-#define SAY_ROMULO_RESURRECT -1532055
-#define SAY_ROMULO_SLAY -1532056
-
-/***** Spells For Julianne *****/
-#define SPELL_BLINDING_PASSION 30890
-#define SPELL_DEVOTION 30887
-#define SPELL_ETERNAL_AFFECTION 30878
-#define SPELL_POWERFUL_ATTRACTION 30889
-#define SPELL_DRINK_POISON 30907
-
-/***** Spells For Romulo ****/
-#define SPELL_BACKWARD_LUNGE 30815
-#define SPELL_DARING 30841
-#define SPELL_DEADLY_SWATHE 30817
-#define SPELL_POISON_THRUST 30822
-
-/**** Other Misc. Spells ****/
-#define SPELL_UNDYING_LOVE 30951
-#define SPELL_RES_VISUAL 24171
-
-/*** Misc. Information ****/
-#define CREATURE_ROMULO 17533
-#define ROMULO_X -10900
-#define ROMULO_Y -1758
+enum JulianneRomulo
+{
+ /**** Speech *****/
+ SAY_JULIANNE_AGGRO = 0,
+ SAY_JULIANNE_ENTER = 1,
+ SAY_JULIANNE_DEATH01 = 2,
+ SAY_JULIANNE_DEATH02 = 3,
+ SAY_JULIANNE_RESURRECT = 4,
+ SAY_JULIANNE_SLAY = 5,
+
+ SAY_ROMULO_AGGRO = 0,
+ SAY_ROMULO_DEATH = 1,
+ SAY_ROMULO_ENTER = 2,
+ SAY_ROMULO_RESURRECT = 3,
+ SAY_ROMULO_SLAY = 4,
+
+ SPELL_BLINDING_PASSION = 30890,
+ SPELL_DEVOTION = 30887,
+ SPELL_ETERNAL_AFFECTION = 30878,
+ SPELL_POWERFUL_ATTRACTION = 30889,
+ SPELL_DRINK_POISON = 30907,
+
+ SPELL_BACKWARD_LUNGE = 30815,
+ SPELL_DARING = 30841,
+ SPELL_DEADLY_SWATHE = 30817,
+ SPELL_POISON_THRUST = 30822,
+
+ SPELL_UNDYING_LOVE = 30951,
+ SPELL_RES_VISUAL = 24171,
+
+ CREATURE_ROMULO = 17533,
+ ROMULO_X = -10900,
+ ROMULO_Y = -1758,
+};
+
enum RAJPhase
{
@@ -975,7 +986,7 @@ void PretendToDie(Creature* creature)
creature->GetMotionMaster()->MovementExpired(false);
creature->GetMotionMaster()->MoveIdle();
creature->SetStandState(UNIT_STAND_STATE_DEAD);
-};
+}
void Resurrect(Creature* target)
{
@@ -990,7 +1001,7 @@ void Resurrect(Creature* target)
}
else
target->GetMotionMaster()->Initialize();
-};
+}
class boss_julianne : public CreatureScript
{
@@ -1084,7 +1095,7 @@ public:
{
if (Spell->Id == SPELL_DRINK_POISON)
{
- DoScriptText(SAY_JULIANNE_DEATH01, me);
+ Talk(SAY_JULIANNE_DEATH01);
DrinkPoisonTimer = 2500;
}
}
@@ -1093,7 +1104,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_JULIANNE_DEATH02, me);
+ Talk(SAY_JULIANNE_DEATH02);
if (instance)
{
@@ -1107,12 +1118,11 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_JULIANNE_SLAY, me);
+ Talk(SAY_JULIANNE_SLAY);
}
void UpdateAI(const uint32 diff);
};
-
};
class boss_romulo : public CreatureScript
@@ -1179,7 +1189,7 @@ public:
if (Phase == PHASE_ROMULO)
{
- DoScriptText(SAY_ROMULO_DEATH, me);
+ Talk(SAY_ROMULO_DEATH);
PretendToDie(me);
IsFakingDeath = true;
Phase = PHASE_BOTH;
@@ -1221,12 +1231,12 @@ public:
}
}
- sLog->outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen.");
+ sLog->outError(LOG_FILTER_TSCR, "boss_romuloAI: DamageTaken reach end of code, that should not happen.");
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_ROMULO_AGGRO, me);
+ Talk(SAY_ROMULO_AGGRO);
if (JulianneGUID)
{
Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
@@ -1248,7 +1258,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_ROMULO_DEATH, me);
+ Talk(SAY_ROMULO_DEATH);
if (instance)
{
@@ -1263,7 +1273,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_ROMULO_SLAY, me);
+ Talk(SAY_ROMULO_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -1278,7 +1288,7 @@ public:
Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath)
{
- DoScriptText(SAY_ROMULO_RESURRECT, me);
+ Talk(SAY_ROMULO_RESURRECT);
Resurrect(Julianne);
CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false;
JulianneDead = false;
@@ -1319,7 +1329,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff)
@@ -1328,7 +1337,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff)
{
if (EntryYellTimer <= diff)
{
- DoScriptText(SAY_JULIANNE_ENTER, me);
+ Talk(SAY_JULIANNE_ENTER);
EntryYellTimer = 0;
} else EntryYellTimer -= diff;
}
@@ -1337,7 +1346,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff)
{
if (AggroYellTimer <= diff)
{
- DoScriptText(SAY_JULIANNE_AGGRO, me);
+ Talk(SAY_JULIANNE_AGGRO);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(16);
AggroYellTimer = 0;
@@ -1399,7 +1408,7 @@ void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff)
Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID));
if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath)
{
- DoScriptText(SAY_JULIANNE_RESURRECT, me);
+ Talk(SAY_JULIANNE_RESURRECT);
Resurrect(Romulo);
CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false;
RomuloDead = false;
@@ -1467,7 +1476,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
if (Phase == PHASE_ROMULO)
{
- sLog->outError("TSCR: boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?");
+ sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: cannot take damage in PHASE_ROMULO, why was i here?");
damage = 0;
return;
}
@@ -1501,7 +1510,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &dama
return;
}
}
- sLog->outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen.");
+ sLog->outError(LOG_FILTER_TSCR, "boss_julianneAI: DamageTaken reach end of code, that should not happen.");
}
void AddSC_bosses_opera()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
index 8e86024f4d8..2937d0ab700 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
@@ -23,7 +23,8 @@ SDComment: Instance Script for Karazhan to help in various encounters. TODO: Gam
SDCategory: Karazhan
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "karazhan.h"
#define MAX_ENCOUNTER 12
@@ -240,7 +241,7 @@ public:
return strSaveData;
}
- uint32 GetData(uint32 uiData)
+ uint32 GetData(uint32 uiData) const
{
switch (uiData)
{
@@ -263,7 +264,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiData)
+ uint64 GetData64(uint32 uiData) const
{
switch (uiData)
{
@@ -287,7 +288,7 @@ public:
return 0;
}
- void Load(const char* chrIn)
+ void Load(char const* chrIn)
{
if (!chrIn)
{
@@ -307,7 +308,6 @@ public:
OUT_LOAD_INST_DATA_COMPLETE;
}
};
-
};
void AddSC_instance_karazhan()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index b37f6913b8d..1fa5cc9c5af 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -29,9 +29,12 @@ npc_berthold
npc_image_of_medivh
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "karazhan.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
# npc_barnesAI
@@ -60,26 +63,26 @@ struct Dialogue
static Dialogue OzDialogue[]=
{
- {-1532103, 6000},
- {-1532104, 18000},
- {-1532105, 9000},
- {-1532106, 15000}
+ {0, 6000},
+ {1, 18000},
+ {2, 9000},
+ {3, 15000}
};
static Dialogue HoodDialogue[]=
{
- {-1532107, 6000},
- {-1532108, 10000},
- {-1532109, 14000},
- {-1532110, 15000}
+ {4, 6000},
+ {5, 10000},
+ {6, 14000},
+ {7, 15000}
};
static Dialogue RAJDialogue[]=
{
- {-1532111, 5000},
- {-1532112, 7000},
- {-1532113, 14000},
- {-1532114, 14000}
+ {8, 5000},
+ {9, 7000},
+ {10, 14000},
+ {11, 14000}
};
// Entries and spawn locations for creatures in Oz event
@@ -222,12 +225,12 @@ public:
}
if (text)
- DoScriptText(text, me);
+ CreatureAI::Talk(text);
}
void PrepareEncounter()
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
+ sLog->outDebug(LOG_FILTER_TSCR, "Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
uint8 index = 0;
uint8 count = 0;
@@ -319,7 +322,6 @@ public:
WipeTimer = 15000;
} else WipeTimer -= diff;
}
-
}
}
};
@@ -342,17 +344,17 @@ public:
case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_OZ;
- sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
+ sLog->outInfo(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_OZ", player->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_HOOD;
- sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
+ sLog->outInfo(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_HOOD", player->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
player->CLOSE_GOSSIP_MENU();
pBarnesAI->m_uiEventId = EVENT_RAJ;
- sLog->outString("TSCR: player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
+ sLog->outInfo(LOG_FILTER_TSCR, "player (GUID " UI64FMTD ") manually set Opera event to EVENT_RAJ", player->GetGUID());
break;
}
@@ -395,7 +397,6 @@ public:
{
return new npc_barnesAI(creature);
}
-
};
/*###
@@ -436,7 +437,6 @@ public:
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
-
};
/*###
@@ -536,7 +536,7 @@ public:
uint32 NextStep(uint32 Step)
{
- Unit* arca = Unit::GetUnit(*me, ArcanagosGUID);
+ Creature* arca = Unit::GetCreature(*me, ArcanagosGUID);
Map* map = me->GetMap();
switch (Step)
{
@@ -546,21 +546,21 @@ public:
return 10000;
case 2:
if (arca)
- CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL, 0);
+ arca->MonsterYell(SAY_DIALOG_ARCANAGOS_2, LANG_UNIVERSAL, 0);
return 20000;
case 3:
me->MonsterYell(SAY_DIALOG_MEDIVH_3, LANG_UNIVERSAL, 0);
return 10000;
case 4:
if (arca)
- CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, 0);
+ arca->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, 0);
return 20000;
case 5:
me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, 0);
return 20000;
case 6:
if (arca)
- CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, 0);
+ arca->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, 0);
return 10000;
case 7:
FireArcanagosTimer = 500;
@@ -578,7 +578,7 @@ public:
return 1000;
case 11:
if (arca)
- CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, 0);
+ arca->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, 0);
return 5000;
case 12:
arca->GetMotionMaster()->MovePoint(0, -11010.82f, -1761.18f, 156.47f);
@@ -611,12 +611,10 @@ public:
return 5000;
default : return 9999999;
}
-
}
void UpdateAI(const uint32 diff)
{
-
if (YellTimer <= diff)
{
if (EventStarted)
@@ -643,7 +641,6 @@ public:
}
}
};
-
};
void AddSC_karazhan()
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
index 08b9a729596..c8a1aa55c7e 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h
@@ -62,6 +62,5 @@ enum OperaEvents
EVENT_RAJ = 3
};
-#define ERROR_INST_DATA(a) sLog->outError("TSCR: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
+#define ERROR_INST_DATA(a) sLog->outError(LOG_FILTER_TSCR, "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
#endif
-
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 4a75370f0e8..84d0cd6b4c4 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -23,49 +23,61 @@ SDComment: Normal and Heroic Support. Issues: Arcane Spheres do not initially fo
SDCategory: Magisters' Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
#include "WorldPacket.h"
+#include "Opcodes.h"
-#define SAY_AGGRO -1585023 //This yell should be done when the room is cleared. For now, set it as a movelineofsight yell.
-#define SAY_PHOENIX -1585024
-#define SAY_FLAMESTRIKE -1585025
-#define SAY_GRAVITY_LAPSE -1585026
-#define SAY_TIRED -1585027
-#define SAY_RECAST_GRAVITY -1585028
-#define SAY_DEATH -1585029
+enum Says
+{
+ SAY_AGGRO = 0, //This yell should be done when the room is cleared. For now, set it as a movelineofsight yell.
+ SAY_PHOENIX = 1,
+ SAY_FLAMESTRIKE = 2,
+ SAY_GRAVITY_LAPSE = 3,
+ SAY_TIRED = 4,
+ SAY_RECAST_GRAVITY = 5,
+ SAY_DEATH = 6
+};
-/*** Spells ***/
-// Phase 1 spells
-#define SPELL_FIREBALL_NORMAL 44189 // Deals 2700-3300 damage at current target
-#define SPELL_FIREBALL_HEROIC 46164 // 4950-6050
+enum Spells
+{
+ // Phase 1 spells
+ SPELL_FIREBALL_NORMAL = 44189, // Deals 2700-3300 damage at current target
+ SPELL_FIREBALL_HEROIC = 46164, // 4950-6050
-#define SPELL_PHOENIX 44194 // Summons a phoenix (Doesn't work?)
-#define SPELL_PHOENIX_BURN 44197 // A spell Phoenix uses to damage everything around
-#define SPELL_REBIRTH_DMG 44196 // DMG if a Phoenix rebirth happen
+ SPELL_PHOENIX = 44194, // Summons a phoenix (Doesn't work?)
+ SPELL_PHOENIX_BURN = 44197, // A spell Phoenix uses to damage everything around
+ SPELL_REBIRTH_DMG = 44196, // DMG if a Phoenix rebirth happen
-#define SPELL_FLAMESTRIKE1_NORMAL 44190 // Damage part
-#define SPELL_FLAMESTRIKE1_HEROIC 46163 // Heroic damage part
-#define SPELL_FLAMESTRIKE2 44191 // Flamestrike indicator before the damage
-#define SPELL_FLAMESTRIKE3 44192 // Summons the trigger + animation (projectile)
+ SPELL_FLAMESTRIKE1_NORMAL = 44190, // Damage part
+ SPELL_FLAMESTRIKE1_HEROIC = 46163, // Heroic damage part
+ SPELL_FLAMESTRIKE2 = 44191, // Flamestrike indicator before the damage
+ SPELL_FLAMESTRIKE3 = 44192, // Summons the trigger + animation (projectile)
-#define SPELL_SHOCK_BARRIER 46165 // Heroic only; 10k damage shield, followed by Pyroblast
-#define SPELL_PYROBLAST 36819 // Heroic only; 45-55k fire damage
+ SPELL_SHOCK_BARRIER = 46165, // Heroic only; 10k damage shield, followed by Pyroblast
+ SPELL_PYROBLAST = 36819, // Heroic only; 45-55k fire damage
// Phase 2 spells
-#define SPELL_GRAVITY_LAPSE_INITIAL 44224 // Cast at the beginning of every Gravity Lapse
-#define SPELL_GRAVITY_LAPSE_CHANNEL 44251 // Channeled; blue beam animation to every enemy in range
-#define SPELL_TELEPORT_CENTER 44218 // Should teleport people to the center. Requires DB entry in spell_target_position.
-#define SPELL_GRAVITY_LAPSE_FLY 44227 // Hastens flyspeed and allows flying for 1 minute. For some reason removes 44226.
-#define SPELL_GRAVITY_LAPSE_DOT 44226 // Knocks up in the air and applies a 300 DPS DoT.
-#define SPELL_ARCANE_SPHERE_PASSIVE 44263 // Passive auras on Arcane Spheres
-#define SPELL_POWER_FEEDBACK 44233 // Stuns him, making him take 50% more damage for 10 seconds. Cast after Gravity Lapse
-
-/*** Creatures ***/
-#define CREATURE_PHOENIX 24674
-#define CREATURE_PHOENIX_EGG 24675
-#define CREATURE_ARCANE_SPHERE 24708
+ SPELL_GRAVITY_LAPSE_INITIAL = 44224, // Cast at the beginning of every Gravity Lapse
+ SPELL_GRAVITY_LAPSE_CHANNEL = 44251, // Channeled; blue beam animation to every enemy in range
+ SPELL_TELEPORT_CENTER = 44218, // Should teleport people to the center. Requires DB entry in spell_target_position.
+ SPELL_GRAVITY_LAPSE_FLY = 44227, // Hastens flyspeed and allows flying for 1 minute. For some reason removes 44226.
+ SPELL_GRAVITY_LAPSE_DOT = 44226, // Knocks up in the air and applies a 300 DPS DoT.
+ SPELL_ARCANE_SPHERE_PASSIVE = 44263, // Passive auras on Arcane Spheres
+ SPELL_POWER_FEEDBACK = 44233 // Stuns him, making him take 50% more damage for 10 seconds. Cast after Gravity Lapse
+};
+
+
+
+enum Creatures
+{
+ CREATURE_PHOENIX = 24674,
+ CREATURE_PHOENIX_EGG = 24675,
+ CREATURE_ARCANE_SPHERE = 24708
+};
+
/** Locations **/
float KaelLocations[3][2]=
@@ -139,27 +151,21 @@ public:
Phase = 0;
if (instance)
- {
instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED);
- instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), true);
- // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
- // Small door opened after event are expected to be closed by default
- }
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (!instance)
return;
- // Open the encounter door
- instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), true);
+ instance->SetData(DATA_KAELTHAS_EVENT, DONE);
// Enable the Translocation Orb Exit
if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ESCAPE_ORB)))
- escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
+ escapeOrb->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
void DamageTaken(Unit* /*done_by*/, uint32 &damage)
@@ -173,35 +179,34 @@ public:
if (!instance)
return;
- //Close the encounter door, open it in JustDied/Reset
- instance->HandleGameObject(instance->GetData64(DATA_KAEL_DOOR), false);
+ instance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS);
}
void MoveInLineOfSight(Unit* who)
{
if (!HasTaunted && me->IsWithinDistInMap(who, 40.0f))
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
HasTaunted = true;
}
ScriptedAI::MoveInLineOfSight(who);
}
- void SetThreatList(Creature* SummonedUnit)
+ void SetThreatList(Creature* summonedUnit)
{
- if (!SummonedUnit)
+ if (!summonedUnit)
return;
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
- for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && unit->isAlive())
{
float threat = me->getThreatManager().getThreat(unit);
- SummonedUnit->AddThreat(unit, threat);
+ summonedUnit->AddThreat(unit, threat);
}
}
}
@@ -211,9 +216,9 @@ public:
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
me->SetPosition(x, y, LOCATION_Z, 0.0f);
- //me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues...
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -224,8 +229,9 @@ public:
void CastGravityLapseKnockUp()
{
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -236,8 +242,9 @@ public:
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
{
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -245,8 +252,7 @@ public:
// Also needs an exception in spell system.
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
// Use packet hack
- WorldPacket data(12);
- data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
+ WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
data.append(unit->GetPackGUID());
data << uint32(0);
unit->SendMessageToSet(&data, true);
@@ -256,8 +262,9 @@ public:
void RemoveGravityLapse()
{
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -265,8 +272,7 @@ public:
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
- WorldPacket data(12);
- data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
+ WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
data.append(unit->GetPackGUID());
data << uint32(0);
unit->SendMessageToSet(&data, true);
@@ -305,7 +311,6 @@ public:
if (PhoenixTimer <= diff)
{
-
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
uint8 random = urand(1, 2);
@@ -320,7 +325,7 @@ public:
Phoenix->AI()->AttackStart(target);
}
- DoScriptText(SAY_PHOENIX, me);
+ Talk(SAY_PHOENIX);
PhoenixTimer = 60000;
} else PhoenixTimer -= diff;
@@ -332,7 +337,7 @@ public:
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
DoCast(target, SPELL_FLAMESTRIKE3, true);
- DoScriptText(SAY_FLAMESTRIKE, me);
+ Talk(SAY_FLAMESTRIKE);
}
FlameStrikeTimer = urand(15000, 25000);
} else FlameStrikeTimer -= diff;
@@ -362,18 +367,14 @@ public:
case 0:
if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse
{
- DoScriptText(SAY_GRAVITY_LAPSE, me);
+ Talk(SAY_GRAVITY_LAPSE);
FirstGravityLapse = false;
if (instance)
- {
- instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_LEFT), true);
- instance->HandleGameObject(instance->GetData64(DATA_KAEL_STATUE_RIGHT), true);
- }
- }else
- {
- DoScriptText(SAY_RECAST_GRAVITY, me);
+ instance->SetData(DATA_KAELTHAS_STATUES, 1);
}
+ else
+ Talk(SAY_RECAST_GRAVITY);
DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL);
GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell
@@ -409,7 +410,6 @@ public:
Orb->AddThreat(target, 1000000.0f);
Orb->AI()->AttackStart(target);
}
-
}
DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL);
@@ -417,7 +417,7 @@ public:
case 4:
me->InterruptNonMeleeSpells(false);
- DoScriptText(SAY_TIRED, me);
+ Talk(SAY_TIRED);
DoCast(me, SPELL_POWER_FEEDBACK);
RemoveGravityLapse();
GravityLapseTimer = 10000;
@@ -430,7 +430,6 @@ public:
}
}
};
-
};
class mob_felkael_flamestrike : public CreatureScript
@@ -472,7 +471,6 @@ public:
} else FlameStrikeTimer -= diff;
}
};
-
};
class mob_felkael_phoenix : public CreatureScript
@@ -521,7 +519,6 @@ public:
{
damage = 0;
return;
-
}
//Don't really die in all phases of Kael'Thas
if (instance && instance->GetData(DATA_KAELTHAS_EVENT) == 0)
@@ -543,9 +540,7 @@ public:
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
-
}
-
}
void JustDied(Unit* /*killer*/)
@@ -555,7 +550,6 @@ public:
void UpdateAI(const uint32 diff)
{
-
//If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg.
if (FakeDeath)
{
@@ -567,7 +561,6 @@ public:
if (Rebirth)
{
-
if (Death_Timer <= diff)
{
me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
@@ -575,7 +568,6 @@ public:
Rebirth = false;
} else Death_Timer -= diff;
}
-
}
if (!UpdateVictim())
@@ -592,7 +584,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class mob_felkael_phoenix_egg : public CreatureScript
@@ -626,10 +617,8 @@ public:
me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
me->Kill(me);
} else HatchTimer -= diff;
-
}
};
-
};
class mob_arcane_sphere : public CreatureScript
@@ -686,7 +675,6 @@ public:
} else ChangeTargetTimer -= diff;
}
};
-
};
void AddSC_boss_felblood_kaelthas()
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 883932fdb9b..b2cf2336024 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -23,7 +23,8 @@ SDComment: No Heroic support yet. Needs further testing. Several scripts for pet
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
struct Speech
@@ -33,25 +34,25 @@ struct Speech
static Speech LackeyDeath[]=
{
- {-1585013},
- {-1585014},
- {-1585015},
- {-1585016},
+ {1},
+ {2},
+ {3},
+ {4},
};
static Speech PlayerDeath[]=
{
- {-1585017},
- {-1585018},
- {-1585019},
- {-1585020},
- {-1585021},
+ {5},
+ {6},
+ {7},
+ {8},
+ {9},
};
enum eEnums
{
- SAY_AGGRO = -1585012,
- SAY_DEATH = -1585022,
+ SAY_AGGRO = 0,
+ SAY_DEATH = 10,
SPELL_DISPEL_MAGIC = 27609,
SPELL_FLASH_HEAL = 17843,
@@ -143,7 +144,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
@@ -215,7 +216,7 @@ public:
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
- DoScriptText(PlayerDeath[PlayersKilled].id, me);
+ Talk(PlayerDeath[PlayersKilled].id);
if (PlayersKilled < 4)
++PlayersKilled;
@@ -223,7 +224,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (!instance)
return;
@@ -330,7 +331,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eHealingPotion
@@ -415,7 +415,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
return;
//should delrissa really yell if dead?
- DoScriptText(LackeyDeath[uiLackeyDeathCount].id, pDelrissa);
+ pDelrissa->AI()->Talk(LackeyDeath[uiLackeyDeathCount].id);
instance->SetData(DATA_DELRISSA_DEATH_COUNT, SPECIAL);
@@ -573,7 +573,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eWarlockSpells
@@ -670,7 +669,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eKickDown
@@ -727,7 +725,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eMageSpells
@@ -834,8 +831,8 @@ public:
if (Blink_Timer <= diff)
{
bool InMeleeRange = false;
- std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
@@ -858,7 +855,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eWarriorSpells
@@ -921,8 +917,8 @@ public:
if (Intercept_Stun_Timer <= diff)
{
bool InMeleeRange = false;
- std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
@@ -978,7 +974,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eHunterSpells
@@ -1102,7 +1097,6 @@ public:
}
}
};
-
};
enum Spells
@@ -1202,7 +1196,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
enum eEngineerSpells
@@ -1297,7 +1290,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
/*
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
index af7deda4545..dcf70b36df6 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp
@@ -23,33 +23,41 @@ SDComment: Heroic and Normal Support. Needs further testing.
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
-#define SAY_AGGRO -1585000
-#define SAY_ENERGY -1585001
-#define SAY_EMPOWERED -1585002
-#define SAY_KILL_1 -1585003
-#define SAY_KILL_2 -1585004
-#define SAY_DEATH -1585005
-#define EMOTE_CRYSTAL -1585006
-
-//Crystal effect spells
-#define SPELL_FEL_CRYSTAL_COSMETIC 44374
-#define SPELL_FEL_CRYSTAL_DUMMY 44329
-#define SPELL_FEL_CRYSTAL_VISUAL 44355
-#define SPELL_MANA_RAGE 44320 // This spell triggers 44321, which changes scale and regens mana Requires an entry in spell_script_target
+enum Says
+{
+ SAY_AGGRO = 0,
+ SAY_ENERGY = 1,
+ SAY_EMPOWERED = 2,
+ SAY_KILL = 3,
+ SAY_DEATH = 4,
+ EMOTE_CRYSTAL = 5
+};
-//Selin's spells
-#define SPELL_DRAIN_LIFE 44294
-#define SPELL_FEL_EXPLOSION 44314
+enum Spells
+{
+ //Crystal effect spells
+ SPELL_FEL_CRYSTAL_COSMETIC = 44374,
+ SPELL_FEL_CRYSTAL_DUMMY = 44329,
+ SPELL_FEL_CRYSTAL_VISUAL = 44355,
+ SPELL_MANA_RAGE = 44320, // This spell triggers 44321, which changes scale and regens mana Requires an entry in spell_script_target
-#define SPELL_DRAIN_MANA 46153 // Heroic only
+ //Selin's spells
+ SPELL_DRAIN_LIFE = 44294,
+ SPELL_FEL_EXPLOSION = 44314,
-#define CRYSTALS_NUMBER 5
-#define DATA_CRYSTALS 6
+ SPELL_DRAIN_MANA = 46153 // Heroic only
+};
-#define CREATURE_FEL_CRYSTAL 24722
+enum Misc
+{
+ CRYSTALS_NUMBER = 5,
+ DATA_CRYSTALS = 6,
+ CREATURE_FEL_CRYSTAL = 24722
+};
class boss_selin_fireheart : public CreatureScript
{
@@ -74,8 +82,9 @@ public:
uint32 size = instance->GetData(DATA_FEL_CRYSTAL_SIZE);
for (uint8 i = 0; i < size; ++i)
{
+ instance->SetData64(DATA_FEL_CRYSTAL, i);
uint64 guid = instance->GetData64(DATA_FEL_CRYSTAL);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Selin: Adding Fel Crystal " UI64FMTD " to list", guid);
+ sLog->outDebug(LOG_FILTER_TSCR, "Selin: Adding Fel Crystal " UI64FMTD " to list", guid);
Crystals.push_back(guid);
}
}
@@ -104,23 +113,19 @@ public:
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Unit* unit = Unit::GetUnit(*me, FelCrystals[i]);
- Unit* unit = Unit::GetUnit(*me, *itr);
- if (unit)
+ if (Creature* creature = Unit::GetCreature(*me, *itr))
{
- if (!unit->isAlive())
- CAST_CRE(unit)->Respawn(); // Let the core handle setting death state, etc.
+ if (!creature->isAlive())
+ creature->Respawn(); // Let the core handle setting death state, etc.
// Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here.
- unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
- instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true);
- // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here)
- // Small door opened after event are expected to be closed by default
// Set Inst data for encounter
instance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
DrainLifeTimer = urand(3000, 7000);
DrainManaTimer = DrainLifeTimer + 5000;
@@ -163,8 +168,8 @@ public:
}
if (CrystalChosen)
{
- DoScriptText(SAY_ENERGY, me);
- DoScriptText(EMOTE_CRYSTAL, me);
+ Talk(SAY_ENERGY);
+ Talk(EMOTE_CRYSTAL);
CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true);
@@ -194,16 +199,14 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
-
+ Talk(SAY_AGGRO);
if (instance)
- instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false);
- //Close the encounter door, open it in JustDied/Reset
+ instance->SetData(DATA_SELIN_EVENT, IN_PROGRESS);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void MovementInform(uint32 type, uint32 id)
@@ -222,7 +225,7 @@ public:
else
{
// Make an error message in case something weird happened here
- sLog->outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned");
+ sLog->outError(LOG_FILTER_TSCR, "Selin Fireheart unable to drain crystal as the crystal is either dead or despawned");
DrainingCrystal = false;
}
}
@@ -230,14 +233,12 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (!instance)
return;
instance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete!
- instance->HandleGameObject(instance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door
- instance->HandleGameObject(instance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in
ShatterRemainingCrystals();
}
@@ -290,7 +291,6 @@ public:
DrainCrystalTimer = urand(20000, 25000);
} else DrainCrystalTimer -= diff;
}
-
}else
{
if (IsDraining)
@@ -300,7 +300,7 @@ public:
IsDraining = false;
DrainingCrystal = false;
- DoScriptText(SAY_EMPOWERED, me);
+ Talk(SAY_EMPOWERED);
Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID);
if (CrystalChosen && CrystalChosen->isAlive())
@@ -318,7 +318,6 @@ public:
DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun.
}
};
-
};
class mob_fel_crystal : public CreatureScript
@@ -361,10 +360,9 @@ public:
}
}
}
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
}
};
-
};
void AddSC_boss_selin_fireheart()
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
index 327c611b2d6..31821623878 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp
@@ -23,16 +23,17 @@ SDComment: Heroic and Normal support. Needs further testing.
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magisters_terrace.h"
enum eEnums
{
- SAY_AGGRO = -1585007,
- SAY_ENERGY = -1585008,
- SAY_OVERLOAD = -1585009,
- SAY_KILL = -1585010,
- EMOTE_DISCHARGE_ENERGY = -1585011,
+ SAY_AGGRO = 0,
+ SAY_ENERGY = 1,
+ SAY_OVERLOAD = 2,
+ SAY_KILL = 3,
+ EMOTE_DISCHARGE_ENERGY = 4,
//is this text for real?
//#define SAY_DEATH "What...happen...ed."
@@ -98,7 +99,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
@@ -109,7 +110,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS);
@@ -143,8 +144,8 @@ public:
else
++IntervalHealthAmount;
- DoScriptText(SAY_ENERGY, me);
- DoScriptText(EMOTE_DISCHARGE_ENERGY, me);
+ Talk(SAY_ENERGY);
+ Talk(EMOTE_DISCHARGE_ENERGY);
if (IsHeroic())
{
@@ -191,7 +192,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class mob_pure_energy : public CreatureScript
@@ -223,7 +223,6 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
void AttackStart(Unit* /*who*/) {}
};
-
};
void AddSC_boss_vexallus()
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
index aa43cb3702f..c142a0c30d7 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp
@@ -23,7 +23,8 @@ SDComment: Designed only for Selin Fireheart
SDCategory: Magister's Terrace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "magisters_terrace.h"
#define MAX_ENCOUNTER 4
@@ -71,8 +72,7 @@ public:
uint32 Encounter[MAX_ENCOUNTER];
uint32 DelrissaDeathCount;
- std::list<uint64> FelCrystals;
- std::list<uint64>::const_iterator CrystalItr;
+ std::vector<uint64> FelCrystals;
uint64 SelinGUID;
uint64 DelrissaGUID;
@@ -83,8 +83,8 @@ public:
uint64 KaelDoorGUID;
uint64 KaelStatue[2];
uint64 EscapeOrbGUID;
-
- bool InitializedItr;
+ uint32 StatuesState;
+ uint8 felCristalIndex;
void Initialize()
{
@@ -104,8 +104,8 @@ public:
KaelStatue[0] = 0;
KaelStatue[1] = 0;
EscapeOrbGUID = 0;
-
- InitializedItr = false;
+ StatuesState = 0;
+ felCristalIndex = 0;
}
bool IsEncounterInProgress() const
@@ -116,7 +116,7 @@ public:
return false;
}
- uint32 GetData(uint32 identifier)
+ uint32 GetData(uint32 identifier) const
{
switch (identifier)
{
@@ -141,21 +141,35 @@ public:
switch (identifier)
{
case DATA_SELIN_EVENT:
+ if (data == DONE)
+ {
+ HandleGameObject(SelinEncounterDoorGUID, true);
+ HandleGameObject(SelinDoorGUID, true);
+ }
+ else if (data == IN_PROGRESS)
+ HandleGameObject(SelinEncounterDoorGUID, false);
+ else if (data == NOT_STARTED)
+ HandleGameObject(SelinEncounterDoorGUID, true);
+
Encounter[0] = data;
break;
case DATA_VEXALLUS_EVENT:
if (data == DONE)
- DoUseDoorOrButton(VexallusDoorGUID);
+ HandleGameObject(VexallusDoorGUID, true);
Encounter[1] = data;
break;
case DATA_DELRISSA_EVENT:
if (data == DONE)
- DoUseDoorOrButton(DelrissaDoorGUID);
+ HandleGameObject(DelrissaDoorGUID, true);
if (data == IN_PROGRESS)
DelrissaDeathCount = 0;
Encounter[2] = data;
break;
case DATA_KAELTHAS_EVENT:
+ if (data == NOT_STARTED || data == DONE)
+ HandleGameObject(KaelDoorGUID, true);
+ else if (data == IN_PROGRESS)
+ HandleGameObject(KaelDoorGUID, false);
Encounter[3] = data;
break;
case DATA_DELRISSA_DEATH_COUNT:
@@ -164,7 +178,14 @@ public:
else
DelrissaDeathCount = 0;
break;
+ case DATA_KAELTHAS_STATUES:
+ HandleGameObject(KaelStatue[0], data);
+ HandleGameObject(KaelStatue[1], data);
+ StatuesState = data;
+ break;
}
+
+ SaveToDB();
}
void OnCreatureCreate(Creature* creature)
@@ -214,54 +235,82 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ std::string GetSaveData()
+ {
+ OUT_SAVE_INST_DATA;
+
+ std::ostringstream saveStream;
+ saveStream << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3] << ' ' << StatuesState;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return saveStream.str();
+ }
+
+ void Load(const char* str)
+ {
+ if (!str)
+ {
+ OUT_LOAD_INST_DATA_FAIL;
+ return;
+ }
+
+ OUT_LOAD_INST_DATA(str);
+
+ std::istringstream loadStream(str);
+
+ for (uint32 i = 0; i < MAX_ENCOUNTER; ++i)
+ {
+ uint32 tmpState;
+ loadStream >> tmpState;
+ if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
+ tmpState = NOT_STARTED;
+ SetData(i, tmpState);
+ }
+
+ loadStream >> StatuesState;
+ SetData(DATA_KAELTHAS_STATUES, StatuesState);
+
+ OUT_LOAD_INST_DATA_COMPLETE;
+ }
+
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
- case DATA_SELIN:
+ case DATA_SELIN:
return SelinGUID;
- case DATA_DELRISSA:
+ case DATA_DELRISSA:
return DelrissaGUID;
- case DATA_VEXALLUS_DOOR:
+ case DATA_VEXALLUS_DOOR:
return VexallusDoorGUID;
- case DATA_SELIN_DOOR:
- return SelinDoorGUID;
- case DATA_SELIN_ENCOUNTER_DOOR:
- return SelinEncounterDoorGUID;
- case DATA_DELRISSA_DOOR:
+ case DATA_DELRISSA_DOOR:
return DelrissaDoorGUID;
- case DATA_KAEL_DOOR:
+ case DATA_KAEL_DOOR:
return KaelDoorGUID;
- case DATA_KAEL_STATUE_LEFT:
+ case DATA_KAEL_STATUE_LEFT:
return KaelStatue[0];
- case DATA_KAEL_STATUE_RIGHT:
+ case DATA_KAEL_STATUE_RIGHT:
return KaelStatue[1];
- case DATA_ESCAPE_ORB:
+ case DATA_ESCAPE_ORB:
return EscapeOrbGUID;
-
case DATA_FEL_CRYSTAL:
- {
- if (FelCrystals.empty())
+ if (FelCrystals.size() < felCristalIndex)
{
- sLog->outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data");
+ sLog->outError(LOG_FILTER_TSCR, "Magisters Terrace: No Fel Crystals loaded in Inst Data");
return 0;
}
- if (!InitializedItr)
- {
- CrystalItr = FelCrystals.begin();
- InitializedItr = true;
- }
-
- uint64 guid = *CrystalItr;
- ++CrystalItr;
- return guid;
- }
+ return FelCrystals.at(felCristalIndex);
}
return 0;
}
- };
+ void SetData64(uint32 identifier, uint64 value)
+ {
+ if (identifier == DATA_FEL_CRYSTAL)
+ felCristalIndex = value;
+ }
+ };
};
void AddSC_instance_magisters_terrace()
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
index ccaaa0ec68d..5925be5f415 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp
@@ -27,7 +27,11 @@ EndScriptData */
npc_kalecgos
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## npc_kalecgos
@@ -138,14 +142,14 @@ public:
if (lList.isEmpty())
return;
- SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(SPELL_ORB_KILL_CREDIT);
+ SpellInfo const* spell = sSpellMgr->GetSpellInfo(SPELL_ORB_KILL_CREDIT);
for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i)
{
if (Player* player = i->getSource())
{
- if (pSpell && pSpell->Effects[0].MiscValue)
- player->KilledMonsterCredit(pSpell->Effects[0].MiscValue, 0);
+ if (spell && spell->Effects[0].MiscValue)
+ player->KilledMonsterCredit(spell->Effects[0].MiscValue, 0);
}
}
}
@@ -168,7 +172,6 @@ public:
}
}
};
-
};
void AddSC_magisters_terrace()
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
index 78aa14b9102..41b847635d7 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h
@@ -20,30 +20,29 @@
#define DEF_MAGISTERS_TERRACE_H
#define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy."
-#endif
enum Data
{
- DATA_SELIN_EVENT = 0,
- DATA_VEXALLUS_EVENT = 1,
- DATA_DELRISSA_EVENT = 2,
- DATA_KAELTHAS_EVENT = 3,
-
- DATA_SELIN = 4,
- DATA_FEL_CRYSTAL = 5,
- DATA_FEL_CRYSTAL_SIZE = 6,
-
- DATA_VEXALLUS_DOOR = 7,
- DATA_SELIN_DOOR = 8,
- DATA_DELRISSA = 9,
- DATA_DELRISSA_DOOR = 10,
- DATA_SELIN_ENCOUNTER_DOOR = 11,
-
- DATA_KAEL_DOOR = 12,
- DATA_KAEL_STATUE_LEFT = 13,
- DATA_KAEL_STATUE_RIGHT = 14,
-
- DATA_DELRISSA_DEATH_COUNT = 15,
-
- DATA_ESCAPE_ORB = 16
+ DATA_SELIN_EVENT,
+ DATA_VEXALLUS_EVENT,
+ DATA_DELRISSA_EVENT,
+ DATA_KAELTHAS_EVENT,
+
+ DATA_SELIN,
+ DATA_FEL_CRYSTAL,
+ DATA_FEL_CRYSTAL_SIZE,
+
+ DATA_VEXALLUS_DOOR,
+ DATA_DELRISSA,
+ DATA_DELRISSA_DOOR,
+
+ DATA_KAEL_DOOR,
+ DATA_KAEL_STATUE_LEFT,
+ DATA_KAEL_STATUE_RIGHT,
+
+ DATA_DELRISSA_DEATH_COUNT,
+ DATA_KAELTHAS_STATUES,
+ DATA_ESCAPE_ORB
};
+
+#endif
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp
index f792b861c99..85a54398511 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp
@@ -28,7 +28,10 @@ EndScriptData */
#include "ScriptedCreature.h"
#include "molten_core.h"
-#define EMOTE_SERVICE -1409000
+enum Emotes
+{
+ EMOTE_SERVICE = 0
+};
enum Spells
{
@@ -76,7 +79,7 @@ class boss_baron_geddon : public CreatureScript
{
me->InterruptNonMeleeSpells(true);
DoCast(me, SPELL_ARMAGEDDON);
- DoScriptText(EMOTE_SERVICE, me);
+ Talk(EMOTE_SERVICE);
return;
}
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
index 84e9957a60c..5e5cc0ffab8 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp
@@ -30,7 +30,7 @@ EndScriptData */
enum Texts
{
- EMOTE_LOWHP = -1409002,
+ EMOTE_LOWHP = 0,
};
enum Spells
@@ -77,7 +77,7 @@ class boss_golemagg : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
{
- if (HealthBelowPct(10) || me->HasAura(SPELL_ENRAGE))
+ if (!HealthBelowPct(10) || me->HasAura(SPELL_ENRAGE))
return;
DoCast(me, SPELL_ENRAGE, true);
@@ -149,7 +149,7 @@ class mob_core_rager : public CreatureScript
if (pGolemagg->isAlive())
{
me->AddAura(SPELL_GOLEMAGG_TRUST, me);
- DoScriptText(EMOTE_LOWHP, me);
+ Talk(EMOTE_LOWHP);
me->SetFullHealth();
}
}
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp
index 65a630a58f7..42952580d54 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp
@@ -30,7 +30,7 @@ EndScriptData */
enum Texts
{
- EMOTE_FRENZY = -1409001,
+ EMOTE_FRENZY = 0
};
enum Spells
@@ -88,7 +88,7 @@ class boss_magmadar : public CreatureScript
switch (eventId)
{
case EVENT_FRENZY:
- DoScriptText(EMOTE_FRENZY, me);
+ Talk(EMOTE_FRENZY);
DoCast(me, SPELL_FRENZY);
events.ScheduleEvent(EVENT_FRENZY, 15000);
break;
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp
index f085e15fcb7..043e5b16330 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp
@@ -28,20 +28,18 @@ EndScriptData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "molten_core.h"
+#include "Player.h"
enum Texts
{
- SAY_AGGRO = -1409003,
- SAY_SPAWN = -1409004,
- SAY_SLAY = -1409005,
- SAY_SPECIAL = -1409006,
- SAY_DEFEAT = -1409007,
-
- SAY_SUMMON_MAJ = -1409008,
- SAY_ARRIVAL1_RAG = -1409009,
- SAY_ARRIVAL2_MAJ = -1409010,
- SAY_ARRIVAL3_RAG = -1409011,
- SAY_ARRIVAL5_RAG = -1409012,
+ SAY_AGGRO = 0,
+ SAY_SPAWN = 1,
+ SAY_SLAY = 2,
+ SAY_SPECIAL = 3,
+ SAY_DEFEAT = 4,
+
+ SAY_SUMMON_MAJ = 5,
+ SAY_ARRIVAL2_MAJ = 6
};
enum Spells
@@ -83,13 +81,13 @@ class boss_majordomo : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
if (urand(0, 99) < 25)
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void EnterCombat(Unit* who)
{
BossAI::EnterCombat(who);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_MAGIC_REFLECTION, 30000);
events.ScheduleEvent(EVENT_DAMAGE_REFLECTION, 15000);
events.ScheduleEvent(EVENT_BLAST_WAVE, 10000);
@@ -110,7 +108,7 @@ class boss_majordomo : public CreatureScript
instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
me->setFaction(35);
me->AI()->EnterEvadeMode();
- DoScriptText(SAY_DEFEAT, me);
+ Talk(SAY_DEFEAT);
_JustDied();
events.ScheduleEvent(EVENT_OUTRO_1, 32000);
return;
@@ -167,7 +165,7 @@ class boss_majordomo : public CreatureScript
instance->instance->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos);
break;
case EVENT_OUTRO_3:
- DoScriptText(SAY_ARRIVAL2_MAJ, me);
+ Talk(SAY_ARRIVAL2_MAJ);
break;
default:
break;
@@ -181,7 +179,7 @@ class boss_majordomo : public CreatureScript
if (action == ACTION_START_RAGNAROS)
{
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- DoScriptText(SAY_SUMMON_MAJ, me);
+ Talk(SAY_SUMMON_MAJ);
events.ScheduleEvent(EVENT_OUTRO_2, 8000);
events.ScheduleEvent(EVENT_OUTRO_3, 24000);
}
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
index 0160f35f143..edd8905ff4a 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp
@@ -23,22 +23,23 @@ SDComment: some spells doesnt work correctly
SDCategory: Molten Core
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "molten_core.h"
enum Texts
{
- SAY_REINFORCEMENTS1 = -1409013,
- SAY_REINFORCEMENTS2 = -1409014,
- SAY_HAND = -1409015,
- SAY_WRATH = -1409016,
- SAY_KILL = -1409017,
- SAY_MAGMABURST = -1409018,
- SAY_SUMMON_MAJ = -1409008,
- SAY_ARRIVAL1_RAG = -1409009,
- SAY_ARRIVAL2_MAJ = -1409010,
- SAY_ARRIVAL3_RAG = -1409011,
- SAY_ARRIVAL5_RAG = -1409012,
+ SAY_SUMMON_MAJ = 0,
+ SAY_ARRIVAL1_RAG = 1,
+ SAY_ARRIVAL2_MAJ = 2,
+ SAY_ARRIVAL3_RAG = 3,
+ SAY_ARRIVAL5_RAG = 4,
+ SAY_REINFORCEMENTS1 = 5,
+ SAY_REINFORCEMENTS2 = 6,
+ SAY_HAND = 7,
+ SAY_WRATH = 8,
+ SAY_KILL = 9,
+ SAY_MAGMABURST = 10
};
enum Spells
@@ -111,7 +112,7 @@ class boss_ragnaros : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
if (urand(0, 99) < 25)
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void UpdateAI(const uint32 diff)
@@ -136,16 +137,16 @@ class boss_ragnaros : public CreatureScript
switch (eventId)
{
case EVENT_INTRO_1:
- DoScriptText(SAY_ARRIVAL1_RAG, me);
+ Talk(SAY_ARRIVAL1_RAG);
break;
case EVENT_INTRO_2:
- DoScriptText(SAY_ARRIVAL3_RAG, me);
+ Talk(SAY_ARRIVAL3_RAG);
break;
case EVENT_INTRO_3:
me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H);
break;
case EVENT_INTRO_4:
- DoScriptText(SAY_ARRIVAL5_RAG, me);
+ Talk(SAY_ARRIVAL5_RAG);
if (instance)
if (Creature* executus = Unit::GetCreature(*me, instance->GetData64(BOSS_MAJORDOMO_EXECUTUS)))
me->Kill(executus);
@@ -204,13 +205,13 @@ class boss_ragnaros : public CreatureScript
case EVENT_WRATH_OF_RAGNAROS:
DoCastVictim(SPELL_WRATH_OF_RAGNAROS);
if (urand(0, 1))
- DoScriptText(SAY_WRATH, me);
+ Talk(SAY_WRATH);
events.ScheduleEvent(EVENT_WRATH_OF_RAGNAROS, 25000);
break;
case EVENT_HAND_OF_RAGNAROS:
DoCast(me, SPELL_HAND_OF_RAGNAROS);
if (urand(0, 1))
- DoScriptText(SAY_HAND, me);
+ Talk(SAY_HAND);
events.ScheduleEvent(EVENT_HAND_OF_RAGNAROS, 20000);
break;
case EVENT_LAVA_BURST:
@@ -228,7 +229,7 @@ class boss_ragnaros : public CreatureScript
if (!_hasYelledMagmaBurst)
{
//Say our dialog
- DoScriptText(SAY_MAGMABURST, me);
+ Talk(SAY_MAGMABURST);
_hasYelledMagmaBurst = true;
}
}
@@ -255,7 +256,7 @@ class boss_ragnaros : public CreatureScript
if (!_hasSubmergedOnce)
{
- DoScriptText(SAY_REINFORCEMENTS1, me);
+ Talk(SAY_REINFORCEMENTS1);
// summon 8 elementals
for (uint8 i = 0; i < 8; ++i)
@@ -271,7 +272,7 @@ class boss_ragnaros : public CreatureScript
}
else
{
- DoScriptText(SAY_REINFORCEMENTS2, me);
+ Talk(SAY_REINFORCEMENTS2);
for (uint8 i = 0; i < 8; ++i)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp
index f6a6e647a1d..1a055b9bce0 100644
--- a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp
+++ b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "InstanceScript.h"
#include "CreatureAI.h"
#include "molten_core.h"
+#include "TemporarySummon.h"
Position const SummonPositions[10] =
{
@@ -116,7 +117,7 @@ class instance_molten_core : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -127,7 +128,7 @@ class instance_molten_core : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index bf887bec164..4a29a7d929b 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -15,10 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "Vehicle.h"
#include "ObjectMgr.h"
#include "ScriptedEscortAI.h"
+#include "CombatAI.h"
+#include "PassiveAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "CreatureTextMgr.h"
/*######
##Quest 12848
@@ -26,7 +33,7 @@
#define GCD_CAST 1
-enum eDeathKnightSpells
+enum UnworthyInitiate
{
SPELL_SOUL_PRISON_CHAIN_SELF = 54612,
SPELL_SOUL_PRISON_CHAIN = 54613,
@@ -35,25 +42,24 @@ enum eDeathKnightSpells
SPELL_ICY_TOUCH = 52372,
SPELL_PLAGUE_STRIKE = 52373,
SPELL_BLOOD_STRIKE = 52374,
- SPELL_DEATH_COIL = 52375
-};
+ SPELL_DEATH_COIL = 52375,
-#define EVENT_ICY_TOUCH 1
-#define EVENT_PLAGUE_STRIKE 2
-#define EVENT_BLOOD_STRIKE 3
-#define EVENT_DEATH_COIL 4
+ SAY_EVENT_START = 0,
+ SAY_EVENT_ATTACK = 1,
-//used by 29519, 29520, 29565, 29566, 29567 but signed for 29519
-int32 say_event_start[8] =
-{
- -1609000, -1609001, -1609002, -1609003,
- -1609004, -1609005, -1609006, -1609007
+ EVENT_ICY_TOUCH = 1,
+ EVENT_PLAGUE_STRIKE = 2,
+ EVENT_BLOOD_STRIKE = 3,
+ EVENT_DEATH_COIL = 4
};
-int32 say_event_attack[9] =
+enum UnworthyInitiatePhase
{
- -1609008, -1609009, -1609010, -1609011, -1609012,
- -1609013, -1609014, -1609015, -1609016
+ PHASE_CHAINED,
+ PHASE_TO_EQUIP,
+ PHASE_EQUIPING,
+ PHASE_TO_ATTACK,
+ PHASE_ATTACKING,
};
uint32 acherus_soul_prison[12] =
@@ -81,15 +87,6 @@ uint32 acherus_unworthy_initiate[5] =
29567
};
-enum UnworthyInitiatePhase
-{
- PHASE_CHAINED,
- PHASE_TO_EQUIP,
- PHASE_EQUIPING,
- PHASE_TO_ATTACK,
- PHASE_ATTACKING,
-};
-
class npc_unworthy_initiate : public CreatureScript
{
public:
@@ -149,7 +146,7 @@ public:
me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true);
if (Player* starter = Unit::GetPlayer(*me, playerGUID))
- DoScriptText(say_event_attack[rand()%9], me, starter);
+ sCreatureTextMgr->SendChat(me, SAY_EVENT_ATTACK, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, starter);
phase = PHASE_TO_ATTACK;
}
@@ -168,7 +165,7 @@ public:
anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f);
playerGUID = target->GetGUID();
- DoScriptText(say_event_start[rand()%8], me, target);
+ sCreatureTextMgr->SendChat(me, SAY_EVENT_START, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, target);
}
void UpdateAI(const uint32 diff)
@@ -185,7 +182,7 @@ public:
anchorGUID = anchor->GetGUID();
}
else
- sLog->outError("npc_unworthy_initiateAI: unable to find anchor!");
+ sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find anchor!");
float dist = 99.0f;
GameObject* prison = NULL;
@@ -205,7 +202,7 @@ public:
if (prison)
prison->ResetDoorOrButton();
else
- sLog->outError("npc_unworthy_initiateAI: unable to find prison!");
+ sLog->outError(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: unable to find prison!");
}
break;
case PHASE_TO_EQUIP:
@@ -303,7 +300,7 @@ public:
prisonerGUID = guid;
}
- uint64 GetGUID(int32 /*id*/)
+ uint64 GetGUID(int32 /*id*/) const
{
return prisonerGUID;
}
@@ -335,15 +332,7 @@ public:
enum eDuelEnums
{
- SAY_DUEL_A = -1609080,
- SAY_DUEL_B = -1609081,
- SAY_DUEL_C = -1609082,
- SAY_DUEL_D = -1609083,
- SAY_DUEL_E = -1609084,
- SAY_DUEL_F = -1609085,
- SAY_DUEL_G = -1609086,
- SAY_DUEL_H = -1609087,
- SAY_DUEL_I = -1609088,
+ SAY_DUEL = 0,
SPELL_DUEL = 52996,
//SPELL_DUEL_TRIGGERED = 52990,
@@ -354,11 +343,6 @@ enum eDuelEnums
FACTION_HOSTILE = 2068
};
-int32 m_auiRandomSay[] =
-{
- SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I
-};
-
class npc_death_knight_initiate : public CreatureScript
{
public:
@@ -383,8 +367,7 @@ public:
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15);
- int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32));
- DoScriptText(m_auiRandomSay[uiSayId], creature, player);
+ sCreatureTextMgr->SendChat(creature, SAY_EVENT_ATTACK, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
player->CastSpell(creature, SPELL_DUEL, false);
player->CastSpell(player, SPELL_DUEL_FLAG, true);
@@ -1074,9 +1057,9 @@ public:
{
car->AI()->SetGUID(miner->GetGUID());
CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player);
- } else sLog->outError("TSCR: OnGossipHello vehicle entry is not correct.");
- } else sLog->outError("TSCR: OnGossipHello player is not on the vehicle.");
- } else sLog->outError("TSCR: OnGossipHello Scarlet Miner cant be found by script.");
+ } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct.");
+ } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle.");
+ } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script.");
}
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
index 1c17e6afa9b..7ceb86dd980 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
@@ -15,33 +15,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "CreatureTextMgr.h"
//How to win friends and influence enemies
// texts signed for creature 28939 but used for 28939, 28940, 28610
enum win_friends
{
- SAY_PERSUADE1 = -1609501,
- SAY_PERSUADE2 = -1609502,
- SAY_PERSUADE3 = -1609503,
- SAY_PERSUADE4 = -1609504,
- SAY_PERSUADE5 = -1609505,
- SAY_PERSUADE6 = -1609506,
- SAY_PERSUADE7 = -1609507,
- SAY_CRUSADER1 = -1609508,
- SAY_CRUSADER2 = -1609509,
- SAY_CRUSADER3 = -1609510,
- SAY_CRUSADER4 = -1609511,
- SAY_CRUSADER5 = -1609512,
- SAY_CRUSADER6 = -1609513,
- SAY_PERSUADED1 = -1609514,
- SAY_PERSUADED2 = -1609515,
- SAY_PERSUADED3 = -1609516,
- SAY_PERSUADED4 = -1609517,
- SAY_PERSUADED5 = -1609518,
- SAY_PERSUADED6 = -1609519,
- SPELL_PERSUASIVE_STRIKE = 52781
+ SAY_CRUSADER = 1,
+ SAY_PERSUADED1 = 2,
+ SAY_PERSUADED2 = 3,
+ SAY_PERSUADED3 = 4,
+ SAY_PERSUADED4 = 5,
+ SAY_PERSUADED5 = 6,
+ SAY_PERSUADED6 = 7,
+ SAY_PERSUADE_RAND = 8,
+ SPELL_PERSUASIVE_STRIKE = 52781,
+ SPELL_THREAT_PULSE = 58111,
+ QUEST_HOW_TO_WIN_FRIENDS = 12720,
};
class npc_crusade_persuaded : public CreatureScript
@@ -58,97 +53,96 @@ public:
{
npc_crusade_persuadedAI(Creature* creature) : ScriptedAI(creature) {}
- uint32 uiSpeech_timer;
- uint32 uiSpeech_counter;
- uint64 uiPlayerGUID;
+ uint32 speechTimer;
+ uint32 speechCounter;
+ uint64 playerGUID;
void Reset()
{
- uiSpeech_timer = 0;
- uiSpeech_counter = 0;
- uiPlayerGUID = 0;
+ speechTimer = 0;
+ speechCounter = 0;
+ playerGUID = 0;
me->SetReactState(REACT_AGGRESSIVE);
me->RestoreFaction();
}
void SpellHit(Unit* caster, const SpellInfo* spell)
{
- if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter)
+ if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !speechCounter)
{
- if (CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE)
+ if (Player* player = caster->ToPlayer())
{
- uiPlayerGUID = caster->GetGUID();
- uiSpeech_timer = 1000;
- uiSpeech_counter = 1;
- me->setFaction(caster->getFaction());
- me->CombatStop(true);
- me->GetMotionMaster()->MoveIdle();
- me->SetReactState(REACT_PASSIVE);
- DoCastAOE(58111, true);
-
- DoScriptText(RAND(SAY_PERSUADE1, SAY_PERSUADE2, SAY_PERSUADE3,
- SAY_PERSUADE4, SAY_PERSUADE5, SAY_PERSUADE6,
- SAY_PERSUADE7), caster);
-
- DoScriptText(RAND(SAY_CRUSADER1, SAY_CRUSADER2, SAY_CRUSADER3,
- SAY_CRUSADER4, SAY_CRUSADER5, SAY_CRUSADER6), me);
+ if (player->GetQuestStatus(QUEST_HOW_TO_WIN_FRIENDS) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ speechTimer = 1000;
+ speechCounter = 1;
+ me->setFaction(player->getFaction());
+ me->CombatStop(true);
+ me->GetMotionMaster()->MoveIdle();
+ me->SetReactState(REACT_PASSIVE);
+ DoCastAOE(SPELL_THREAT_PULSE, true);
+
+ sCreatureTextMgr->SendChat(me, SAY_PERSUADE_RAND, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ Talk(SAY_CRUSADER);
+ }
}
}
}
void UpdateAI(const uint32 diff)
{
- if (uiSpeech_counter)
+ if (speechCounter)
{
- if (uiSpeech_timer <= diff)
+ if (speechTimer <= diff)
{
- Player* player = Unit::GetPlayer(*me, uiPlayerGUID);
+ Player* player = Unit::GetPlayer(*me, playerGUID);
if (!player)
{
EnterEvadeMode();
return;
}
- switch (uiSpeech_counter)
+ switch (speechCounter)
{
case 1:
- DoScriptText(SAY_PERSUADED1, me);
- uiSpeech_timer = 8000;
+ Talk(SAY_PERSUADED1);
+ speechTimer = 8000;
break;
case 2:
- DoScriptText(SAY_PERSUADED2, me);
- uiSpeech_timer = 8000;
+ Talk(SAY_PERSUADED2);
+ speechTimer = 8000;
break;
case 3:
- DoScriptText(SAY_PERSUADED3, me);
- uiSpeech_timer = 8000;
+ Talk(SAY_PERSUADED3);
+ speechTimer = 8000;
break;
case 4:
- DoScriptText(SAY_PERSUADED4, me);
- uiSpeech_timer = 8000;
+ Talk(SAY_PERSUADED4);
+ speechTimer = 8000;
break;
case 5:
- DoScriptText(SAY_PERSUADED5, player);
- uiSpeech_timer = 8000;
+ sCreatureTextMgr->SendChat(me, SAY_PERSUADED5, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
+ speechTimer = 8000;
break;
case 6:
- DoScriptText(SAY_PERSUADED6, me);
+ Talk(SAY_PERSUADED6);
player->Kill(me);
- //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- uiSpeech_counter = 0;
- player->GroupEventHappens(12720, me);
+ speechCounter = 0;
+ player->GroupEventHappens(QUEST_HOW_TO_WIN_FRIENDS, me);
return;
}
- ++uiSpeech_counter;
- DoCastAOE(58111, true);
- } else uiSpeech_timer -= diff;
+ ++speechCounter;
+ DoCastAOE(SPELL_THREAT_PULSE, true);
+
+ } else
+ speechTimer -= diff;
return;
}
@@ -168,16 +162,16 @@ public:
enum eKoltira
{
- SAY_BREAKOUT1 = -1609561,
- SAY_BREAKOUT2 = -1609562,
- SAY_BREAKOUT3 = -1609563,
- SAY_BREAKOUT4 = -1609564,
- SAY_BREAKOUT5 = -1609565,
- SAY_BREAKOUT6 = -1609566,
- SAY_BREAKOUT7 = -1609567,
- SAY_BREAKOUT8 = -1609568,
- SAY_BREAKOUT9 = -1609569,
- SAY_BREAKOUT10 = -1609570,
+ SAY_BREAKOUT1 = 0,
+ SAY_BREAKOUT2 = 1,
+ SAY_BREAKOUT3 = 2,
+ SAY_BREAKOUT4 = 3,
+ SAY_BREAKOUT5 = 4,
+ SAY_BREAKOUT6 = 5,
+ SAY_BREAKOUT7 = 6,
+ SAY_BREAKOUT8 = 7,
+ SAY_BREAKOUT9 = 8,
+ SAY_BREAKOUT10 = 9,
SPELL_KOLTIRA_TRANSFORM = 52899,
SPELL_ANTI_MAGIC_ZONE = 52894,
@@ -244,7 +238,7 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_BREAKOUT1, me);
+ Talk(SAY_BREAKOUT1);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
break;
case 1:
@@ -259,7 +253,7 @@ public:
case 3:
SetEscortPaused(true);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
- DoScriptText(SAY_BREAKOUT2, me);
+ Talk(SAY_BREAKOUT2);
DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up
break;
case 4:
@@ -303,22 +297,22 @@ public:
switch (m_uiWave)
{
case 0:
- DoScriptText(SAY_BREAKOUT3, me);
+ Talk(SAY_BREAKOUT3);
SummonAcolyte(3);
m_uiWave_Timer = 20000;
break;
case 1:
- DoScriptText(SAY_BREAKOUT4, me);
+ Talk(SAY_BREAKOUT4);
SummonAcolyte(3);
m_uiWave_Timer = 20000;
break;
case 2:
- DoScriptText(SAY_BREAKOUT5, me);
+ Talk(SAY_BREAKOUT5);
SummonAcolyte(4);
m_uiWave_Timer = 20000;
break;
case 3:
- DoScriptText(SAY_BREAKOUT6, me);
+ 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;
break;
@@ -328,7 +322,7 @@ public:
if (!temp || !temp->isAlive())
{
- DoScriptText(SAY_BREAKOUT8, me);
+ Talk(SAY_BREAKOUT8);
m_uiWave_Timer = 5000;
}
else
@@ -339,13 +333,13 @@ public:
break;
}
case 5:
- DoScriptText(SAY_BREAKOUT9, me);
+ Talk(SAY_BREAKOUT9);
me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE);
// i do not know why the armor will also be removed
m_uiWave_Timer = 2500;
break;
case 6:
- DoScriptText(SAY_BREAKOUT10, me);
+ Talk(SAY_BREAKOUT10);
SetEscortPaused(false);
break;
}
@@ -363,8 +357,8 @@ public:
//Scarlet courier
enum ScarletCourierEnum
{
- SAY_TREE1 = -1609531,
- SAY_TREE2 = -1609532,
+ SAY_TREE1 = 0,
+ SAY_TREE2 = 1,
SPELL_SHOOT = 52818,
GO_INCONSPICUOUS_TREE = 191144,
NPC_SCARLET_COURIER = 29076
@@ -396,7 +390,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_TREE2, me);
+ Talk(SAY_TREE2);
me->Dismount();
uiStage = 0;
}
@@ -422,7 +416,7 @@ public:
me->SetWalk(true);
if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f))
{
- DoScriptText(SAY_TREE1, me);
+ Talk(SAY_TREE1);
float x, y, z;
tree->GetContactPoint(me, x, y, z);
me->GetMotionMaster()->MovePoint(1, x, y, z);
@@ -452,12 +446,10 @@ public:
enum valroth
{
- SAY_VALROTH1 = -1609581,
- SAY_VALROTH2 = -1609582,
- SAY_VALROTH3 = -1609583,
- SAY_VALROTH4 = -1609584,
- SAY_VALROTH5 = -1609585,
- SAY_VALROTH6 = -1609586,
+ //SAY_VALROTH1 = 0, Unused
+ SAY_VALROTH_AGGRO = 1,
+ SAY_VALROTH_RAND = 2,
+ SAY_VALROTH_DEATH = 3,
SPELL_RENEW = 38210,
SPELL_INQUISITOR_PENANCE = 52922,
SPELL_VALROTH_SMITE = 52926,
@@ -491,7 +483,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_VALROTH2, me);
+ Talk(SAY_VALROTH_AGGRO);
DoCast(who, SPELL_VALROTH_SMITE);
}
@@ -524,12 +516,12 @@ public:
void Shout()
{
if (rand()%100 < 15)
- DoScriptText(RAND(SAY_VALROTH3, SAY_VALROTH4, SAY_VALROTH5), me);
+ Talk(SAY_VALROTH_RAND);
}
void JustDied(Unit* killer)
{
- DoScriptText(SAY_VALROTH6, me);
+ Talk(SAY_VALROTH_DEATH);
killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true);
}
};
@@ -542,60 +534,60 @@ public:
//used by 29032, 29061, 29065, 29067, 29068, 29070, 29074, 29072, 29073, 29071 but signed for 29032
enum SpecialSurprise
{
- SAY_EXEC_START_1 = -1609025, // speech for all
- SAY_EXEC_START_2 = -1609026,
- SAY_EXEC_START_3 = -1609027,
- SAY_EXEC_PROG_1 = -1609028,
- SAY_EXEC_PROG_2 = -1609029,
- SAY_EXEC_PROG_3 = -1609030,
- SAY_EXEC_PROG_4 = -1609031,
- SAY_EXEC_PROG_5 = -1609032,
- SAY_EXEC_PROG_6 = -1609033,
- SAY_EXEC_PROG_7 = -1609034,
- SAY_EXEC_NAME_1 = -1609035,
- SAY_EXEC_NAME_2 = -1609036,
- SAY_EXEC_RECOG_1 = -1609037,
- SAY_EXEC_RECOG_2 = -1609038,
- SAY_EXEC_RECOG_3 = -1609039,
- SAY_EXEC_RECOG_4 = -1609040,
- SAY_EXEC_RECOG_5 = -1609041,
- SAY_EXEC_RECOG_6 = -1609042,
- SAY_EXEC_NOREM_1 = -1609043,
- SAY_EXEC_NOREM_2 = -1609044,
- SAY_EXEC_NOREM_3 = -1609045,
- SAY_EXEC_NOREM_4 = -1609046,
- SAY_EXEC_NOREM_5 = -1609047,
- SAY_EXEC_NOREM_6 = -1609048,
- SAY_EXEC_NOREM_7 = -1609049,
- SAY_EXEC_NOREM_8 = -1609050,
- SAY_EXEC_NOREM_9 = -1609051,
- SAY_EXEC_THINK_1 = -1609052,
- SAY_EXEC_THINK_2 = -1609053,
- SAY_EXEC_THINK_3 = -1609054,
- SAY_EXEC_THINK_4 = -1609055,
- SAY_EXEC_THINK_5 = -1609056,
- SAY_EXEC_THINK_6 = -1609057,
- SAY_EXEC_THINK_7 = -1609058,
- SAY_EXEC_THINK_8 = -1609059,
- SAY_EXEC_THINK_9 = -1609060,
- SAY_EXEC_THINK_10 = -1609061,
- SAY_EXEC_LISTEN_1 = -1609062,
- SAY_EXEC_LISTEN_2 = -1609063,
- SAY_EXEC_LISTEN_3 = -1609064,
- SAY_EXEC_LISTEN_4 = -1609065,
- SAY_PLAGUEFIST = -1609066,
- SAY_EXEC_TIME_1 = -1609067,
- SAY_EXEC_TIME_2 = -1609068,
- SAY_EXEC_TIME_3 = -1609069,
- SAY_EXEC_TIME_4 = -1609070,
- SAY_EXEC_TIME_5 = -1609071,
- SAY_EXEC_TIME_6 = -1609072,
- SAY_EXEC_TIME_7 = -1609073,
- SAY_EXEC_TIME_8 = -1609074,
- SAY_EXEC_TIME_9 = -1609075,
- SAY_EXEC_TIME_10 = -1609076,
- SAY_EXEC_WAITING = -1609077,
- EMOTE_DIES = -1609078,
+ SAY_EXEC_START_1 = 0, // speech for all
+ SAY_EXEC_START_2 = 1,
+ SAY_EXEC_START_3 = 2,
+ SAY_EXEC_PROG_1 = 3,
+ SAY_EXEC_PROG_2 = 4,
+ SAY_EXEC_PROG_3 = 5,
+ SAY_EXEC_PROG_4 = 6,
+ SAY_EXEC_PROG_5 = 7,
+ SAY_EXEC_PROG_6 = 8,
+ SAY_EXEC_PROG_7 = 9,
+ SAY_EXEC_NAME_1 = 10,
+ SAY_EXEC_NAME_2 = 11,
+ SAY_EXEC_RECOG_1 = 12,
+ SAY_EXEC_RECOG_2 = 13,
+ SAY_EXEC_RECOG_3 = 14,
+ SAY_EXEC_RECOG_4 = 15,
+ SAY_EXEC_RECOG_5 = 16,
+ SAY_EXEC_RECOG_6 = 17,
+ SAY_EXEC_NOREM_1 = 18,
+ SAY_EXEC_NOREM_2 = 19,
+ SAY_EXEC_NOREM_3 = 20,
+ SAY_EXEC_NOREM_4 = 21,
+ SAY_EXEC_NOREM_5 = 22,
+ SAY_EXEC_NOREM_6 = 23,
+ SAY_EXEC_NOREM_7 = 24,
+ SAY_EXEC_NOREM_8 = 25,
+ SAY_EXEC_NOREM_9 = 26,
+ SAY_EXEC_THINK_1 = 27,
+ SAY_EXEC_THINK_2 = 28,
+ SAY_EXEC_THINK_3 = 29,
+ SAY_EXEC_THINK_4 = 30,
+ SAY_EXEC_THINK_5 = 31,
+ SAY_EXEC_THINK_6 = 32,
+ SAY_EXEC_THINK_7 = 33,
+ SAY_EXEC_THINK_8 = 34,
+ SAY_EXEC_THINK_9 = 35,
+ SAY_EXEC_THINK_10 = 36,
+ SAY_EXEC_LISTEN_1 = 37,
+ SAY_EXEC_LISTEN_2 = 38,
+ SAY_EXEC_LISTEN_3 = 39,
+ SAY_EXEC_LISTEN_4 = 40,
+ SAY_PLAGUEFIST = 41,
+ SAY_EXEC_TIME_1 = 42,
+ SAY_EXEC_TIME_2 = 43,
+ SAY_EXEC_TIME_3 = 44,
+ SAY_EXEC_TIME_4 = 45,
+ SAY_EXEC_TIME_5 = 46,
+ SAY_EXEC_TIME_6 = 47,
+ SAY_EXEC_TIME_7 = 48,
+ SAY_EXEC_TIME_8 = 49,
+ SAY_EXEC_TIME_9 = 50,
+ SAY_EXEC_TIME_10 = 51,
+ SAY_EXEC_WAITING = 52,
+ EMOTE_DIES = 53,
NPC_PLAGUEFIST = 29053
};
@@ -706,28 +698,28 @@ public:
case RACE_HUMAN:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_5, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_1, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_5, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_7, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_5, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_1, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_5, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_7, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_6, me, player);
+ Talk(SAY_EXEC_TIME_6, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -736,28 +728,28 @@ public:
case RACE_ORC:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_6, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_1, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_7, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_8, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_6, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_1, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_7, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_8, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_8, me, player);
+ Talk(SAY_EXEC_TIME_8, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -766,28 +758,28 @@ public:
case RACE_DWARF:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_2, me, player); break;
+ case 0: Talk(SAY_EXEC_START_2, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_2, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_3, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_2, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_5, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_2, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_2, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_3, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_2, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_5, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_2, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_3, me, player);
+ Talk(SAY_EXEC_TIME_3, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -796,28 +788,28 @@ public:
case RACE_NIGHTELF:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_5, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_1, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_6, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_2, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_5, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_1, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_6, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_2, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_7, me, player);
+ Talk(SAY_EXEC_TIME_7, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -826,28 +818,28 @@ public:
case RACE_UNDEAD_PLAYER:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_3, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_4, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_3, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_1, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_3, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_3, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_4, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_3, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_1, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_3, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_4, me, player);
+ Talk(SAY_EXEC_TIME_4, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -856,28 +848,28 @@ public:
case RACE_TAUREN:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_1, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_5, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_8, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_9, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_1, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_5, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_8, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_9, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_9, me, player);
+ Talk(SAY_EXEC_TIME_9, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -886,28 +878,28 @@ public:
case RACE_GNOME:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_4, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_1, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_4, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_6, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_4, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_1, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_4, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_6, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_5, me, player);
+ Talk(SAY_EXEC_TIME_5, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -916,28 +908,28 @@ public:
case RACE_TROLL:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_3, me, player); break;
+ case 0: Talk(SAY_EXEC_START_3, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_7, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_2, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_6, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_9, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_10, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_4, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_7, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_2, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_6, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_9, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_10, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_4, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_10, me, player);
+ Talk(SAY_EXEC_TIME_10, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -946,28 +938,28 @@ public:
case RACE_BLOODELF:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_1, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_1, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_1, player->GetGUID()); break;
//case 5: //unknown
- case 6: DoScriptText(SAY_EXEC_THINK_3, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 6: Talk(SAY_EXEC_THINK_3, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_1, me, player);
+ Talk(SAY_EXEC_TIME_1, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
@@ -976,28 +968,28 @@ public:
case RACE_DRAENEI:
switch (ExecuteSpeech_Counter)
{
- case 0: DoScriptText(SAY_EXEC_START_1, me, player); break;
+ case 0: Talk(SAY_EXEC_START_1, player->GetGUID()); break;
case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break;
- case 2: DoScriptText(SAY_EXEC_PROG_1, me, player); break;
- case 3: DoScriptText(SAY_EXEC_NAME_1, me, player); break;
- case 4: DoScriptText(SAY_EXEC_RECOG_2, me, player); break;
- case 5: DoScriptText(SAY_EXEC_NOREM_1, me, player); break;
- case 6: DoScriptText(SAY_EXEC_THINK_4, me, player); break;
- case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, player); break;
+ case 2: Talk(SAY_EXEC_PROG_1, player->GetGUID()); break;
+ case 3: Talk(SAY_EXEC_NAME_1, player->GetGUID()); break;
+ case 4: Talk(SAY_EXEC_RECOG_2, player->GetGUID()); break;
+ case 5: Talk(SAY_EXEC_NOREM_1, player->GetGUID()); break;
+ case 6: Talk(SAY_EXEC_THINK_4, player->GetGUID()); break;
+ case 7: Talk(SAY_EXEC_LISTEN_1, player->GetGUID()); break;
case 8:
if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f))
- DoScriptText(SAY_PLAGUEFIST, Plaguefist, player);
+ Plaguefist->AI()->Talk(SAY_PLAGUEFIST, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_EXEC_TIME_2, me, player);
+ Talk(SAY_EXEC_TIME_2, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
break;
case 10:
- DoScriptText(SAY_EXEC_WAITING, me, player);
+ Talk(SAY_EXEC_WAITING, player->GetGUID());
break;
case 11:
- DoScriptText(EMOTE_DIES, me);
+ Talk(EMOTE_DIES);
me->setDeathState(JUST_DIED);
me->SetHealth(0);
return;
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
index 8cee23fab1c..8f410cf62bc 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
#define LESS_MOB // if you do not have a good server and do not want it to be laggy as hell
//Light of Dawn
@@ -48,93 +51,78 @@ enum mograine
WORLD_STATE_COUNTDOWN = 3603,
WORLD_STATE_EVENT_BEGIN = 3605,
- SAY_LIGHT_OF_DAWN01 = -1609201, // pre text
- SAY_LIGHT_OF_DAWN02 = -1609202,
- SAY_LIGHT_OF_DAWN03 = -1609203,
- SAY_LIGHT_OF_DAWN04 = -1609204, // intro
- SAY_LIGHT_OF_DAWN05 = -1609205,
- SAY_LIGHT_OF_DAWN06 = -1609206,
- SAY_LIGHT_OF_DAWN07 = -1609207, // During the fight - Korfax, Champion of the Light
- SAY_LIGHT_OF_DAWN08 = -1609208, // Lord Maxwell Tyrosus
- SAY_LIGHT_OF_DAWN09 = -1609209, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN10 = -1609210,
- SAY_LIGHT_OF_DAWN11 = -1609211,
- SAY_LIGHT_OF_DAWN12 = -1609212,
- SAY_LIGHT_OF_DAWN13 = -1609213,
- SAY_LIGHT_OF_DAWN14 = -1609214,
- SAY_LIGHT_OF_DAWN15 = -1609215,
- SAY_LIGHT_OF_DAWN16 = -1609216,
- SAY_LIGHT_OF_DAWN17 = -1609217,
- SAY_LIGHT_OF_DAWN18 = -1609218,
- SAY_LIGHT_OF_DAWN19 = -1609219,
- SAY_LIGHT_OF_DAWN20 = -1609220,
- SAY_LIGHT_OF_DAWN21 = -1609221,
- SAY_LIGHT_OF_DAWN22 = -1609222,
- SAY_LIGHT_OF_DAWN23 = -1609223,
- SAY_LIGHT_OF_DAWN24 = -1609224,
- SAY_LIGHT_OF_DAWN25 = -1609225, // After the fight
- SAY_LIGHT_OF_DAWN26 = -1609226, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN27 = -1609227, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN28 = -1609228, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN29 = -1609229, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN30 = -1609230, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN31 = -1609231, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN32 = -1609232, // Highlord Alexandros Mograine
- SAY_LIGHT_OF_DAWN33 = -1609233, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN34 = -1609234, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN35 = -1609235, // Darion Mograine
- SAY_LIGHT_OF_DAWN36 = -1609236, // Darion Mograine
- SAY_LIGHT_OF_DAWN37 = -1609237, // Highlord Alexandros Mograine
- SAY_LIGHT_OF_DAWN38 = -1609238, // Darion Mograine
- SAY_LIGHT_OF_DAWN39 = -1609239, // Highlord Alexandros Mograine
- SAY_LIGHT_OF_DAWN40 = -1609240, // Darion Mograine
- SAY_LIGHT_OF_DAWN41 = -1609241, // Highlord Alexandros Mograine
- SAY_LIGHT_OF_DAWN42 = -1609242, // Highlord Alexandros Mograine
- SAY_LIGHT_OF_DAWN43 = -1609243, // The Lich King
- SAY_LIGHT_OF_DAWN44 = -1609244, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN45 = -1609245, // The Lich King
- SAY_LIGHT_OF_DAWN46 = -1609246, // The Lich King
- SAY_LIGHT_OF_DAWN47 = -1609247, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN48 = -1609248, // The Lich King
- SAY_LIGHT_OF_DAWN49 = -1609249, // The Lich King
- SAY_LIGHT_OF_DAWN50 = -1609250, // Lord Maxwell Tyrosus
- SAY_LIGHT_OF_DAWN51 = -1609251, // The Lich King
- SAY_LIGHT_OF_DAWN52 = -1609252, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN53 = -1609253, // Highlord Darion Mograine
- SAY_LIGHT_OF_DAWN54 = -1609254, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN55 = -1609255, // The Lich King
- SAY_LIGHT_OF_DAWN56 = -1609256, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN57 = -1609257, // The Lich King
- SAY_LIGHT_OF_DAWN58 = -1609258, // The Lich King
- SAY_LIGHT_OF_DAWN59 = -1609259, // The Lich King
- SAY_LIGHT_OF_DAWN60 = -1609260, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN61 = -1609261, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN62 = -1609262, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN63 = -1609263, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN64 = -1609264, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN65 = -1609265, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN66 = -1609266, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN67 = -1609267, // Highlord Tirion Fordring
- SAY_LIGHT_OF_DAWN68 = -1609268, // Highlord Darion Mograine
-
- EMOTE_LIGHT_OF_DAWN01 = -1609269, // Emotes
- EMOTE_LIGHT_OF_DAWN02 = -1609270,
- EMOTE_LIGHT_OF_DAWN03 = -1609271,
- EMOTE_LIGHT_OF_DAWN04 = -1609272,
- EMOTE_LIGHT_OF_DAWN05 = -1609273,
- EMOTE_LIGHT_OF_DAWN06 = -1609274,
- EMOTE_LIGHT_OF_DAWN07 = -1609275,
- EMOTE_LIGHT_OF_DAWN08 = -1609276,
- EMOTE_LIGHT_OF_DAWN09 = -1609277,
- EMOTE_LIGHT_OF_DAWN10 = -1609278,
- EMOTE_LIGHT_OF_DAWN11 = -1609279,
- EMOTE_LIGHT_OF_DAWN12 = -1609280,
- EMOTE_LIGHT_OF_DAWN13 = -1609281,
- EMOTE_LIGHT_OF_DAWN14 = -1609282,
- EMOTE_LIGHT_OF_DAWN15 = -1609283,
- EMOTE_LIGHT_OF_DAWN16 = -1609284,
- EMOTE_LIGHT_OF_DAWN17 = -1609285,
- EMOTE_LIGHT_OF_DAWN18 = -1609286,
+ SAY_LIGHT_OF_DAWN01 = 0, // pre text
+ SAY_LIGHT_OF_DAWN02 = 1,
+ SAY_LIGHT_OF_DAWN03 = 2,
+ SAY_LIGHT_OF_DAWN04 = 3, // intro
+ SAY_LIGHT_OF_DAWN05 = 4,
+ SAY_LIGHT_OF_DAWN06 = 5,
+ SAY_LIGHT_OF_DAWN07 = 6, // During the fight - Korfax, Champion of the Light
+ SAY_LIGHT_OF_DAWN08 = 7, // Lord Maxwell Tyrosus
+ SAY_LIGHT_OF_DAWN09 = 8, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN25 = 24, // After the fight
+ SAY_LIGHT_OF_DAWN26 = 25, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN27 = 26, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN28 = 27, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN29 = 28, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN30 = 29, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN31 = 30, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN32 = 31, // Highlord Alexandros Mograine
+ SAY_LIGHT_OF_DAWN33 = 32, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN34 = 33, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN35 = 34, // Darion Mograine
+ SAY_LIGHT_OF_DAWN36 = 35, // Darion Mograine
+ SAY_LIGHT_OF_DAWN37 = 36, // Highlord Alexandros Mograine
+ SAY_LIGHT_OF_DAWN38 = 37, // Darion Mograine
+ SAY_LIGHT_OF_DAWN39 = 38, // Highlord Alexandros Mograine
+ SAY_LIGHT_OF_DAWN40 = 39, // Darion Mograine
+ SAY_LIGHT_OF_DAWN41 = 40, // Highlord Alexandros Mograine
+ SAY_LIGHT_OF_DAWN42 = 41, // Highlord Alexandros Mograine
+ SAY_LIGHT_OF_DAWN43 = 42, // The Lich King
+ SAY_LIGHT_OF_DAWN44 = 43, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN45 = 44, // The Lich King
+ SAY_LIGHT_OF_DAWN46 = 45, // The Lich King
+ SAY_LIGHT_OF_DAWN47 = 46, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN48 = 47, // The Lich King
+ SAY_LIGHT_OF_DAWN49 = 48, // The Lich King
+ SAY_LIGHT_OF_DAWN50 = 49, // Lord Maxwell Tyrosus
+ SAY_LIGHT_OF_DAWN51 = 50, // The Lich King
+ SAY_LIGHT_OF_DAWN52 = 51, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN53 = 52, // Highlord Darion Mograine
+ SAY_LIGHT_OF_DAWN54 = 53, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN55 = 54, // The Lich King
+ SAY_LIGHT_OF_DAWN56 = 55, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN57 = 56, // The Lich King
+ SAY_LIGHT_OF_DAWN58 = 57, // The Lich King
+ SAY_LIGHT_OF_DAWN59 = 58, // The Lich King
+ SAY_LIGHT_OF_DAWN60 = 59, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN61 = 60, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN62 = 61, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN63 = 62, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN64 = 63, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN65 = 64, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN66 = 65, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN67 = 66, // Highlord Tirion Fordring
+ SAY_LIGHT_OF_DAWN68 = 67, // Highlord Darion Mograine
+
+ EMOTE_LIGHT_OF_DAWN01 = 68, // Emotes
+ EMOTE_LIGHT_OF_DAWN02 = 69,
+ EMOTE_LIGHT_OF_DAWN03 = 70,
+ EMOTE_LIGHT_OF_DAWN04 = 71,
+ EMOTE_LIGHT_OF_DAWN05 = 72,
+ EMOTE_LIGHT_OF_DAWN06 = 73,
+ EMOTE_LIGHT_OF_DAWN07 = 74,
+ EMOTE_LIGHT_OF_DAWN08 = 75,
+ EMOTE_LIGHT_OF_DAWN09 = 76,
+ EMOTE_LIGHT_OF_DAWN10 = 77,
+ EMOTE_LIGHT_OF_DAWN11 = 78,
+ EMOTE_LIGHT_OF_DAWN12 = 79,
+ EMOTE_LIGHT_OF_DAWN13 = 80,
+ EMOTE_LIGHT_OF_DAWN14 = 81,
+ EMOTE_LIGHT_OF_DAWN15 = 82,
+ EMOTE_LIGHT_OF_DAWN16 = 83,
+ EMOTE_LIGHT_OF_DAWN17 = 84,
+ EMOTE_LIGHT_OF_DAWN18 = 85,
GO_LIGHT_OF_DAWN = 191330,
SPELL_THE_LIGHT_OF_DAWN_Q = 53606, // quest credit
@@ -509,9 +497,9 @@ public:
SetHoldState(true);
SpawnNPC();
if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN07, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN07);
if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN08, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN08);
for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i)
NPCChangeTarget(uiGhoulGUID[i]);
@@ -543,7 +531,7 @@ public:
{
//Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID);
- DoScriptText(EMOTE_LIGHT_OF_DAWN05, me);
+ Talk(EMOTE_LIGHT_OF_DAWN05);
if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0))
me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN);
if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
@@ -580,7 +568,7 @@ public:
}
break;
case 4:
- DoScriptText(SAY_LIGHT_OF_DAWN27, me);
+ Talk(SAY_LIGHT_OF_DAWN27);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
if (Creature* temp = Unit::GetCreature(*me, uiKoltiraGUID))
@@ -590,7 +578,7 @@ public:
SetHoldState(true);
break;
case 5:
- DoScriptText(SAY_LIGHT_OF_DAWN33, me);
+ Talk(SAY_LIGHT_OF_DAWN33);
SetHoldState(true);
break;
case 6:
@@ -606,7 +594,7 @@ public:
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP));
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
me->CastSpell(temp, SPELL_ASHBRINGER, true);
- DoScriptText(EMOTE_LIGHT_OF_DAWN14, me);
+ Talk(EMOTE_LIGHT_OF_DAWN14);
SetHoldState(true);
break;
}
@@ -642,7 +630,7 @@ public:
break;
case 2:
- DoScriptText(SAY_LIGHT_OF_DAWN04, me);
+ Talk(SAY_LIGHT_OF_DAWN04);
if (Creature* pKoltira = GetClosestCreatureWithEntry(me, NPC_KOLTIRA_DEATHWEAVER, 50.0f))
uiKoltiraGUID = pKoltira->GetGUID();
if (Creature* pOrbaz = GetClosestCreatureWithEntry(me, NPC_ORBAZ_BLOODBANE, 50.0f))
@@ -653,7 +641,7 @@ public:
break;
case 3: // rise
- DoScriptText(SAY_LIGHT_OF_DAWN05, me);
+ Talk(SAY_LIGHT_OF_DAWN05);
JumpToNextStep(3000);
break;
@@ -731,7 +719,7 @@ public:
break;
case 8: // summon announce
- DoScriptText(SAY_LIGHT_OF_DAWN06, me);
+ Talk(SAY_LIGHT_OF_DAWN06);
JumpToNextStep(5000);
break;
@@ -770,34 +758,34 @@ public:
// ******* After battle *****************************************************************
case 11: // Tirion starts to speak
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN28, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN28);
JumpToNextStep(21000);
break;
case 12:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN29, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN29);
JumpToNextStep(13000);
break;
case 13:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN30, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN30);
JumpToNextStep(13000);
break;
case 14:
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_LIGHT_OF_DAWN31, me);
+ Talk(SAY_LIGHT_OF_DAWN31);
JumpToNextStep(7000);
break;
case 15: // summon gate
- if (Unit* temp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
+ if (Creature* temp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
{
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
temp->CastSpell(temp, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true);
- DoScriptText(EMOTE_LIGHT_OF_DAWN06, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN06);
uiAlexandrosGUID = temp->GetGUID();
}
JumpToNextStep(4000);
@@ -808,7 +796,7 @@ public:
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z);
- DoScriptText(SAY_LIGHT_OF_DAWN32, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN32);
}
SetHoldState(false); // makes darion turns back
JumpToNextStep(5000);
@@ -816,14 +804,14 @@ public:
case 17:
me->SetStandState(UNIT_STAND_STATE_KNEEL);
- DoScriptText(SAY_LIGHT_OF_DAWN34, me);
+ Talk(SAY_LIGHT_OF_DAWN34);
JumpToNextStep(5000);
break;
case 18: // Darion's spirit out
- if (Unit* temp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
+ if (Creature* temp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
{
- DoScriptText(SAY_LIGHT_OF_DAWN35, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN35);
temp->SetWalk(false);
uiDarionGUID = temp->GetGUID();
}
@@ -833,7 +821,7 @@ public:
case 19: // runs to father
if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
{
- DoScriptText(EMOTE_LIGHT_OF_DAWN07, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN07);
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z);
}
JumpToNextStep(4000);
@@ -841,31 +829,31 @@ public:
case 20:
if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN36, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN36);
JumpToNextStep(4000);
break;
case 21:
if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
- DoScriptText(EMOTE_LIGHT_OF_DAWN08, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN08);
JumpToNextStep(4000);
break;
case 22:
if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN37, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN37);
JumpToNextStep(8000);
break;
case 23:
if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN38, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN38);
JumpToNextStep(8000);
break;
case 24:
if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN39, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN39);
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z);
@@ -875,13 +863,13 @@ public:
case 25:
if (Creature* temp = Unit::GetCreature(*me, uiDarionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN40, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN40);
JumpToNextStep(11000);
break;
case 26:
if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN41, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN41);
JumpToNextStep(5000);
break;
@@ -893,14 +881,14 @@ public:
case 28:
if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN42, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN42);
JumpToNextStep(6000);
break;
case 29: // lich king spawns
- if (Unit* temp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
+ if (Creature* temp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000))
{
- DoScriptText(SAY_LIGHT_OF_DAWN43, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN43);
uiLichKingGUID = temp->GetGUID();
if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID))
temp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false);
@@ -911,21 +899,21 @@ public:
case 30:
if (Creature* temp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him
{
- DoScriptText(EMOTE_LIGHT_OF_DAWN09, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN09);
temp->SetVisible(false);
}
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
{
temp->InterruptNonMeleeSpells(false);
- DoScriptText(SAY_LIGHT_OF_DAWN45, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN45);
}
JumpToNextStep(3000);
break;
case 31:
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(EMOTE_LIGHT_OF_DAWN10, me);
- DoScriptText(SAY_LIGHT_OF_DAWN44, me);
+ Talk(EMOTE_LIGHT_OF_DAWN10);
+ Talk(SAY_LIGHT_OF_DAWN44);
JumpToNextStep(3000);
break;
@@ -949,7 +937,7 @@ public:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
{
temp->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
- DoScriptText(SAY_LIGHT_OF_DAWN46, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN46);
}
me->SetSpeed(MOVE_RUN, 6.0f);
me->SetStandState(UNIT_STAND_STATE_DEAD);
@@ -964,33 +952,33 @@ public:
case 38:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN47, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN47);
JumpToNextStep(8000);
break;
case 39:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN48, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN48);
JumpToNextStep(15000);
break;
case 40:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN49, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN49);
JumpToNextStep(17000);
break;
case 41: // Lich king - Apocalypse
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
{
- DoScriptText(EMOTE_LIGHT_OF_DAWN11, temp);
- DoScriptText(SAY_LIGHT_OF_DAWN51, temp);
- if (Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID))
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN11);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN51);
+ if (Creature* pTirion = Unit::GetCreature(*me, uiTirionGUID))
{
pTirion->SetStandState(UNIT_STAND_STATE_KNEEL);
//temp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working
temp->CastSpell(pTirion, SPELL_SOUL_FEAST_TIRION, false);
- DoScriptText(EMOTE_LIGHT_OF_DAWN12, pTirion);
+ pTirion->AI()->Talk(EMOTE_LIGHT_OF_DAWN12);
}
}
JumpToNextStep(2000);
@@ -1032,7 +1020,7 @@ public:
temp->SetWalk(false);
temp->SetSpeed(MOVE_RUN, 2.0f);
temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ);
- DoScriptText(SAY_LIGHT_OF_DAWN50, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN50);
}
if (Creature* temp = Unit::GetCreature(*me, uiKorfaxGUID))
{
@@ -1055,7 +1043,7 @@ public:
case 43: // They all got kicked
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(EMOTE_LIGHT_OF_DAWN13, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN13);
if (Creature* temp = Unit::GetCreature(*me, uiMaxwellGUID))
{
@@ -1104,7 +1092,7 @@ public:
break;
case 45:
- DoScriptText(SAY_LIGHT_OF_DAWN52, me);
+ Talk(SAY_LIGHT_OF_DAWN52);
JumpToNextStep(5000);
break;
@@ -1112,14 +1100,14 @@ public:
me->SetSpeed(MOVE_RUN, 1.0f);
me->SetWalk(true);
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_LIGHT_OF_DAWN53, me);
+ Talk(SAY_LIGHT_OF_DAWN53);
SetHoldState(false); // Darion throws sword
JumpToNextStep(7000);
break;
case 47: // Ashbringer rebirth
me->SetStandState(UNIT_STAND_STATE_KNEEL);
- DoScriptText(EMOTE_LIGHT_OF_DAWN15, me);
+ Talk(EMOTE_LIGHT_OF_DAWN15);
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
{
temp->SetStandState(UNIT_STAND_STATE_STAND);
@@ -1147,26 +1135,26 @@ public:
case 49:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN54, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN54);
JumpToNextStep(4000);
break;
case 50:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN55, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN55);
JumpToNextStep(5000);
break;
case 51:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN56, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN56);
JumpToNextStep(1000);
break;
case 52: // Tiron charges
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
{
- DoScriptText(EMOTE_LIGHT_OF_DAWN16, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN16);
temp->CastSpell(temp, SPELL_TIRION_CHARGE, false); // jumping charge
temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running
@@ -1180,7 +1168,7 @@ public:
case 53:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN57, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN57);
JumpToNextStep(1000);
break;
@@ -1208,13 +1196,13 @@ public:
case 57:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN58, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN58);
JumpToNextStep(10000);
break;
case 58:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN59, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN59);
JumpToNextStep(10000);
break;
@@ -1233,7 +1221,7 @@ public:
case 60:
if (Creature* temp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here
{
- DoScriptText(EMOTE_LIGHT_OF_DAWN17, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN17);
temp->Kill(temp);
}
JumpToNextStep(10000);
@@ -1241,7 +1229,7 @@ public:
case 61:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN60, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN60);
JumpToNextStep(3000);
break;
@@ -1258,50 +1246,50 @@ public:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
{
temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z);
- DoScriptText(SAY_LIGHT_OF_DAWN61, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN61);
}
JumpToNextStep(15000);
break;
case 64:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN62, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN62);
JumpToNextStep(7000);
break;
case 65:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN63, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN63);
JumpToNextStep(10000);
break;
case 66:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN64, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN64);
JumpToNextStep(11000);
break;
case 67:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN65, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN65);
JumpToNextStep(10000);
break;
case 68:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN66, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN66);
JumpToNextStep(8000);
break;
case 69:
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN67, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN67);
JumpToNextStep(10000);
break;
case 70:
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_LIGHT_OF_DAWN68, me);
+ Talk(SAY_LIGHT_OF_DAWN68);
JumpToNextStep(10000);
break;
@@ -1379,12 +1367,7 @@ public:
if (uiFight_speech <= diff)
{
- DoScriptText(RAND(SAY_LIGHT_OF_DAWN09, SAY_LIGHT_OF_DAWN10, SAY_LIGHT_OF_DAWN11,
- SAY_LIGHT_OF_DAWN12, SAY_LIGHT_OF_DAWN13, SAY_LIGHT_OF_DAWN14,
- SAY_LIGHT_OF_DAWN15, SAY_LIGHT_OF_DAWN16, SAY_LIGHT_OF_DAWN17,
- SAY_LIGHT_OF_DAWN18, SAY_LIGHT_OF_DAWN19, SAY_LIGHT_OF_DAWN20,
- SAY_LIGHT_OF_DAWN21, SAY_LIGHT_OF_DAWN22, SAY_LIGHT_OF_DAWN23,
- SAY_LIGHT_OF_DAWN24), me);
+ Talk(SAY_LIGHT_OF_DAWN09);
uiFight_speech = urand(15000, 20000);
} else uiFight_speech -= diff;
@@ -1417,11 +1400,11 @@ public:
if (uiFight_duration <= diff + 5000)
{
if (!uiTirionGUID)
- if (Unit* temp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000))
+ if (Creature* temp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000))
{
temp->setFaction(me->getFaction());
temp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP));
- DoScriptText(SAY_LIGHT_OF_DAWN25, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN25);
uiTirionGUID = temp->GetGUID();
}
}
@@ -1498,7 +1481,7 @@ public:
}
if (Creature* temp = Unit::GetCreature(*me, uiOrbazGUID))
- DoScriptText(EMOTE_LIGHT_OF_DAWN04, temp);
+ temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN04);
if (Creature* temp = Unit::GetCreature(*me, uiThassarianGUID))
{
@@ -1513,7 +1496,7 @@ public:
}
if (Creature* temp = Unit::GetCreature(*me, uiTirionGUID))
- DoScriptText(SAY_LIGHT_OF_DAWN26, temp);
+ temp->AI()->Talk(SAY_LIGHT_OF_DAWN26);
SetHoldState(false);
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
index 0ef2dddda8d..6e7f7e103c5 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
+#include "Player.h"
/*####
## npc_valkyr_battle_maiden
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
index e5886cc39d4..33335c32d05 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp
@@ -23,12 +23,13 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
- SAY_AGGRO = -1189019,
- SAY_SPECIALAE = -1189020,
+ SAY_AGGRO = 0,
+ SAY_SPECIALAE = 1,
SPELL_POLYMORPH = 13323,
SPELL_AOESILENCE = 8988,
@@ -68,7 +69,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
@@ -92,7 +93,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
return;
- DoScriptText(SAY_SPECIALAE, me);
+ Talk(SAY_SPECIALAE);
DoCast(me, SPELL_ARCANEBUBBLE);
bCanDetonate = true;
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 30105cc7315..a2cc0172969 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
index 466f940621d..b97e1d15dc0 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp
@@ -23,13 +23,14 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
- SAY_AGGRO = -1189016,
- SAY_HEALTH = -1189017,
- SAY_KILL = -1189018,
+ SAY_AGGRO = 0,
+ SAY_HEALTH = 1,
+ SAY_KILL = 2,
SPELL_FLAMESHOCK = 8053,
SPELL_SHADOWBOLT = 1106,
@@ -68,12 +69,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*Victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void UpdateAI(const uint32 diff)
@@ -84,7 +85,7 @@ public:
//If we are <35% hp
if (!HpYell && !HealthAbovePct(35))
{
- DoScriptText(SAY_HEALTH, me);
+ Talk(SAY_HEALTH);
HpYell = true;
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
index 813c43288d0..2ff3dcd5e32 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp
@@ -23,20 +23,25 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "SpellMgr.h"
#include "scarlet_monastery.h"
+#include "LFGMgr.h"
+#include "Player.h"
+#include "SpellInfo.h"
//this texts are already used by 3975 and 3976
enum Says
{
- SAY_ENTRANCE = -1189001,
- SAY_REJOINED = -1189002,
- SAY_LOST_HEAD = -1189003,
- SAY_CONFLAGRATION = -1189004,
- SAY_SPROUTING_PUMPKINS = -1189005,
- SAY_PLAYER_DEATH = -1189006,
- SAY_DEATH = -1189007
+ SAY_LOST_HEAD = 0,
+ SAY_PLAYER_DEATH = 1,
+
+ SAY_ENTRANCE = 0,
+ SAY_REJOINED = 1,
+ SAY_CONFLAGRATION = 2,
+ SAY_SPROUTING_PUMPKINS = 3,
+ SAY_DEATH = 4,
};
uint32 RandomLaugh[] = {11965, 11975, 11976};
@@ -44,7 +49,7 @@ uint32 RandomLaugh[] = {11965, 11975, 11976};
enum Entry
{
HH_MOUNTED = 23682,
- HH_DISMOUNTED = 23800, // unhorsed?? wtf type of engrish was that?
+ HH_DISMOUNTED = 23800,
HEAD = 23775,
PULSING_PUMPKIN = 23694,
PUMPKIN_FIEND = 23545,
@@ -125,7 +130,7 @@ static Locations Spawn[]=
{1765.28f, 1347.46f, 17.55f} //spawn point for smoke
};
-static const char* Text[]=
+static char const* Text[]=
{
"Horseman rise...",
"Your time is nigh...",
@@ -247,13 +252,17 @@ public:
laugh = urand(15000, 30000);
}
- void EnterCombat(Unit* /*who*/) {}
- void SaySound(int32 textEntry, Unit* target = 0)
+ void EnterCombat(Unit* /*who*/) { }
+
+ void SaySound(uint8 textEntry, Unit* target = 0)
{
- DoScriptText(textEntry, me, target);
+ if (target)
+ Talk(textEntry, target->GetGUID());
+ else
+ Talk(textEntry);
+
//DoCast(me, SPELL_HEAD_SPEAKS, true);
- Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000);
- if (speaker)
+ if (Creature* speaker = DoSpawnCreature(HELPER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 1000))
speaker->CastSpell(speaker, SPELL_HEAD_SPEAKS, false);
laugh += 3000;
}
@@ -513,9 +522,12 @@ public:
}
}
- void SaySound(int32 textEntry, Unit* target = 0)
+ void SaySound(uint8 textEntry, Unit* target = 0)
{
- DoScriptText(textEntry, me, target);
+ if (target)
+ Talk(textEntry, target->GetGUID());
+ else
+ Talk(textEntry);
laugh += 4000;
}
@@ -561,6 +573,13 @@ public:
CAST_AI(mob_wisp_invis::mob_wisp_invisAI, wisp->AI())->SetType(4);
if (instance)
instance->SetData(DATA_HORSEMAN_EVENT, DONE);
+
+ Map::PlayerList const& players = me->GetMap()->GetPlayers();
+ if (!players.isEmpty())
+ for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
+ if (Player* player = i->getSource())
+ if (player->IsAtGroupRewardDistance(me))
+ sLFGMgr->RewardDungeonDoneFor(285, player);
}
void SpellHit(Unit* caster, const SpellInfo* spell)
@@ -583,8 +602,8 @@ public:
caster->GetMotionMaster()->Clear(false);
caster->GetMotionMaster()->MoveFollow(me, 6, float(urand(0, 5)));
//DoResetThreat();//not sure if need
- std::list<HostileReference*>::const_iterator itr;
- for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
+ ThreatContainer::StorageType threatlist = caster->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->isAlive() && unit != caster)
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
index 58c21d86a2f..8c1b22e9871 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp
@@ -23,20 +23,17 @@ SDComment: Should in addition spawn Myrmidons in the hallway outside
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
enum Says
{
- SAY_AGGRO = -1189000,
- SAY_WHIRLWIND = -1189001,
- SAY_ENRAGE = -1189002,
- SAY_KILL = -1189003
-};
-
-enum Emotes
-{
- EMOTE_ENRAGE = -1189004
+ SAY_AGGRO = 0,
+ SAY_WHIRLWIND = 1,
+ SAY_ENRAGE = 2,
+ SAY_KILL = 3,
+ EMOTE_ENRAGE = 4
};
enum Spells
@@ -81,13 +78,13 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_RUSHINGCHARGE);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
@@ -104,8 +101,8 @@ public:
//If we are <30% hp goes Enraged
if (!Enrage && !HealthAbovePct(30) && !me->IsNonMeleeSpellCasted(false))
{
- DoScriptText(EMOTE_ENRAGE, me);
- DoScriptText(SAY_ENRAGE, me);
+ Talk(EMOTE_ENRAGE);
+ Talk(SAY_ENRAGE);
DoCast(me, SPELL_FRENZY);
Enrage = true;
}
@@ -121,7 +118,7 @@ public:
// Whirlwind_Timer
if (Whirlwind_Timer <= diff)
{
- DoScriptText(SAY_WHIRLWIND, me);
+ Talk(SAY_WHIRLWIND);
DoCast(me->getVictim(), SPELL_WHIRLWIND);
Whirlwind_Timer = 30000;
}
@@ -152,12 +149,7 @@ public:
uint32 Start_Timer;
void Reset() {}
-
- void WaypointReached(uint32 /*waypointId*/)
- {
-
- }
-
+ void WaypointReached(uint32 /*waypointId*/) {}
void EnterCombat(Unit* /*who*/) {}
void UpdateAI(const uint32 diff)
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 1989c318c84..847a14f54d8 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: if this guy not involved in some special event, remove (and let
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSpells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
index f311da401d4..0d08431d39c 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp
@@ -23,11 +23,12 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
- SAY_AGGRO = -1189021,
+ SAY_AGGRO = 0,
SPELL_SUMMONSCARLETHOUND = 17164,
SPELL_BLOODLUST = 6742
};
@@ -55,7 +56,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
index fd978136339..f0e7ac94703 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp
@@ -23,16 +23,17 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
enum Says
{
- SAY_AGGRO = -1189011,
- SAY_HEALTH1 = -1189012,
- SAY_HEALTH2 = -1189013,
- SAY_KILL = -1189014,
- SAY_TRIGGER_VORREL = -1189015
+ SAY_AGGRO = 0,
+ SAY_HEALTH1 = 1,
+ SAY_HEALTH2 = 2,
+ SAY_KILL = 3,
+ SAY_TRIGGER_VORREL = 0
};
enum Spells
@@ -70,12 +71,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*Victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
@@ -84,8 +85,8 @@ public:
return;
//Any other Actions to do with vorrel? setStandState?
- if (Unit* vorrel = Unit::GetUnit(*me, instance->GetData64(DATA_VORREL)))
- DoScriptText(SAY_TRIGGER_VORREL, vorrel);
+ if (Creature* vorrel = Creature::GetCreature(*me, instance->GetData64(DATA_VORREL)))
+ vorrel->AI()->Talk(SAY_TRIGGER_VORREL);
}
void UpdateAI(const uint32 diff)
@@ -96,13 +97,13 @@ public:
//If we are low on hp Do sayings
if (!Yell60 && !HealthAbovePct(60))
{
- DoScriptText(SAY_HEALTH1, me);
+ Talk(SAY_HEALTH1);
Yell60 = true;
}
if (!Yell30 && !HealthAbovePct(30))
{
- DoScriptText(SAY_HEALTH2, me);
+ Talk(SAY_HEALTH2);
Yell30 = true;
}
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 8d813bfe502..651ca453916 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp
@@ -23,20 +23,22 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
+#include "SpellInfo.h"
enum Says
{
//Mograine says
- SAY_MO_AGGRO = -1189005,
- SAY_MO_KILL = -1189006,
- SAY_MO_RESSURECTED = -1189007,
+ SAY_MO_AGGRO = 0,
+ SAY_MO_KILL = 1,
+ SAY_MO_RESSURECTED = 2,
//Whitemane says
- SAY_WH_INTRO = -1189008,
- SAY_WH_KILL = -1189009,
- SAY_WH_RESSURECT = -1189010,
+ SAY_WH_INTRO = 0,
+ SAY_WH_KILL = 1,
+ SAY_WH_RESSURECT = 2,
};
enum Spells
@@ -112,7 +114,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_MO_AGGRO, me);
+ Talk(SAY_MO_AGGRO);
DoCast(me, SPELL_RETRIBUTIONAURA);
me->CallForHelp(VISIBLE_RANGE);
@@ -120,7 +122,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_MO_KILL, me);
+ Talk(SAY_MO_KILL);
}
void DamageTaken(Unit* /*doneBy*/, uint32 &damage)
@@ -165,7 +167,7 @@ public:
//When hit with ressurection say text
if (spell->Id == SPELL_SCARLETRESURRECTION)
{
- DoScriptText(SAY_MO_RESSURECTED, me);
+ Talk(SAY_MO_RESSURECTED);
_bFakeDeath = false;
if (instance)
@@ -274,12 +276,18 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_WH_INTRO, me);
+ Talk(SAY_WH_INTRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_WH_KILL, me);
+ Talk(SAY_WH_KILL);
+ }
+
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (!_bCanResurrectCheck && damage >= me->GetHealth())
+ damage = me->GetHealth() - 1;
}
void UpdateAI(const uint32 diff)
@@ -295,7 +303,7 @@ public:
if (Unit* Mograine = Unit::GetUnit(*me, instance->GetData64(DATA_MOGRAINE)))
{
DoCast(Mograine, SPELL_SCARLETRESURRECTION);
- DoScriptText(SAY_WH_RESSURECT, me);
+ Talk(SAY_WH_RESSURECT);
_bCanResurrect = false;
}
}
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
index 8035adfc33f..6eb27327438 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
index ba0b854754e..e65ab21b8cf 100644
--- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scarlet Monastery
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scarlet_monastery.h"
enum Entry
@@ -131,7 +132,7 @@ public:
}
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
@@ -146,7 +147,7 @@ public:
return 0;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == TYPE_MOGRAINE_AND_WHITE_EVENT)
return encounter[0];
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
index 2bc0320b81d..c2ccde645ca 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp
@@ -23,7 +23,8 @@ SDComment: Doors missing in instance script.
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_ARCANEMISSILES 22272
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
index 967f771fe7a..b4c4332aa45 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
class boss_death_knight_darkreaver : public CreatureScript
{
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 82f4dc85060..08aa86d6a06 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp
@@ -23,11 +23,13 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
enum eEnums
{
+ EMOTE_FRENZY_KILL = 0,
SPELL_REND = 16509,
SPELL_BACKHAND = 18103,
SPELL_FRENZY = 8269
@@ -66,7 +68,10 @@ public:
instance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
+ {
+ instance->SetData(TYPE_GANDLING, IN_PROGRESS);
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ }
}
}
@@ -99,7 +104,7 @@ public:
if (m_uiFrenzy_Timer <= uiDiff)
{
DoCast(me, SPELL_FRENZY);
- DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
+ Talk(EMOTE_FRENZY_KILL);
m_uiFrenzy_Timer = 120000;
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
index e438ae56a2b..e1cffbaf90d 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_CURSEOFAGONY 18671
@@ -66,7 +67,10 @@ public:
instance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
+ {
+ instance->SetData(TYPE_GANDLING, IN_PROGRESS);
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ }
}
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
index 498e6596b06..1768584cb25 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_CALLOFGRAVES 17831
@@ -73,7 +74,10 @@ public:
instance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
+ {
+ instance->SetData(TYPE_GANDLING, IN_PROGRESS);
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ }
}
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
index 064faa5643d..3eb78662578 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_CURSEOFBLOOD 24673
//#define SPELL_ILLUSION 17773
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
index 5fd5a96d605..10736464ef3 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWBOLTVOLLEY 20741
#define SPELL_BONESHIELD 27688
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 327c1df921d..3035688343c 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp
@@ -23,7 +23,8 @@ SDComment: aura applied/defined in database
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_IMMOLATE 20294 // Old ID was 15570
@@ -62,7 +63,10 @@ public:
instance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
+ {
+ instance->SetData(TYPE_GANDLING, IN_PROGRESS);
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ }
}
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
index 1919a1ba099..dfab9dd37df 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_VOLATILEINFECTION 24928
@@ -66,7 +67,10 @@ public:
instance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
+ {
+ instance->SetData(TYPE_GANDLING, IN_PROGRESS);
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ }
}
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
index fd10c6374a6..808dc97dc86 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_FROSTBOLT 21369
#define SPELL_ICEARMOR 18100 //This is actually a buff he gives himself
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
index a28cecf3772..b3d42d4676a 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "scholomance.h"
#define SPELL_TRAMPLE 15550
@@ -68,7 +69,10 @@ public:
instance->SetData(DATA_THERAVENIAN_DEATH, 0);
if (instance->GetData(TYPE_GANDLING) == IN_PROGRESS)
+ {
+ instance->SetData(TYPE_GANDLING, IN_PROGRESS);
me->SummonCreature(1853, 180.73f, -9.43856f, 75.507f, 1.61399f, TEMPSUMMON_DEAD_DESPAWN, 0);
+ }
}
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
index f5f453c30bd..dd3e591bf61 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp
@@ -23,10 +23,12 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
+ EMOTE_FRENZY_KILL = 0,
SPELL_FLAMESTRIKE = 18399,
SPELL_BLAST_WAVE = 16046,
SPELL_FIRESHIELD = 19626,
@@ -87,7 +89,7 @@ public:
if (m_uiFrenzy_Timer <= uiDiff)
{
DoCast(me, SPELL_FRENZY);
- DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
+ Talk(EMOTE_FRENZY_KILL);
m_uiFrenzy_Timer = 24000;
}
diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
index 86023d21eca..f8a0c0010d2 100644
--- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
+++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Scholomance
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "scholomance.h"
#define GO_GATE_KIRTONOS 175570
@@ -127,21 +128,14 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
- if (type == TYPE_GANDLING)
- {
- if (IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && IsBossDied[3] && IsBossDied[4] && IsBossDied[5])
- {
- m_auiEncounter[0] = IN_PROGRESS;
- return IN_PROGRESS;
- }
- }
-
- return 0;
+ return (type == TYPE_GANDLING &&
+ IsBossDied[0] && IsBossDied[1] && IsBossDied[2] &&
+ IsBossDied[3] && IsBossDied[4] && IsBossDied[5])
+ ? IN_PROGRESS : 0;
}
};
-
};
void AddSC_instance_scholomance()
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
index 57b902ac6d4..27a3aaa3fae 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp
@@ -23,16 +23,19 @@ SDComment:
SDCategory: Shadowfang Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptedCreature.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "shadowfang_keep.h"
+#include "TemporarySummon.h"
#define MAX_ENCOUNTER 4
enum eEnums
{
- SAY_BOSS_DIE_AD = -1033007,
- SAY_BOSS_DIE_AS = -1033008,
- SAY_ARCHMAGE = -1033009,
+ SAY_BOSS_DIE_AD = 4,
+ SAY_BOSS_DIE_AS = 3,
+ SAY_ARCHMAGE = 0,
NPC_ASH = 3850,
NPC_ADA = 3849,
@@ -137,8 +140,8 @@ public:
if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive())
{
- DoScriptText(SAY_BOSS_DIE_AD, pAda);
- DoScriptText(SAY_BOSS_DIE_AS, pAsh);
+ pAda->AI()->Talk(SAY_BOSS_DIE_AD);
+ pAsh->AI()->Talk(SAY_BOSS_DIE_AS);
}
}
@@ -190,7 +193,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -239,7 +242,6 @@ public:
return;
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
- Creature* summon = NULL;
if (!pArchmage || !pArchmage->isAlive())
return;
@@ -251,21 +253,25 @@ public:
switch (uiPhase)
{
case 1:
- summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
+ {
+ Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
summon->SetReactState(REACT_DEFENSIVE);
summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true);
- DoScriptText(SAY_ARCHMAGE, summon);
+ summon->AI()->Talk(SAY_ARCHMAGE);
uiTimer = 2000;
uiPhase = 2;
break;
+ }
case 2:
+ {
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
uiPhase = 0;
break;
+ }
}
} else uiTimer -= uiDiff;
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index 676cd7be4f0..c98148e645b 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -34,6 +34,7 @@ EndContentData */
#include "SpellAuraEffects.h"
#include "ScriptedEscortAI.h"
#include "shadowfang_keep.h"
+#include "Player.h"
/*######
## npc_shadowfang_prisoner
@@ -41,13 +42,13 @@ EndContentData */
enum eEnums
{
- SAY_FREE_AS = -1033000,
- SAY_OPEN_DOOR_AS = -1033001,
- SAY_POST_DOOR_AS = -1033002,
- SAY_FREE_AD = -1033003,
- SAY_OPEN_DOOR_AD = -1033004,
- SAY_POST1_DOOR_AD = -1033005,
- SAY_POST2_DOOR_AD = -1033006,
+ SAY_FREE_AS = 0,
+ SAY_OPEN_DOOR_AS = 1,
+ SAY_POST_DOOR_AS = 2,
+ SAY_FREE_AD = 0,
+ SAY_OPEN_DOOR_AD = 1,
+ SAY_POST1_DOOR_AD = 2,
+ SAY_POST2_DOOR_AD = 3,
SPELL_UNLOCK = 6421,
NPC_ASH = 3850,
@@ -109,15 +110,15 @@ public:
{
case 0:
if (uiNpcEntry == NPC_ASH)
- DoScriptText(SAY_FREE_AS, me);
+ Talk(SAY_FREE_AS);
else
- DoScriptText(SAY_FREE_AD, me);
+ Talk(SAY_FREE_AD);
break;
case 10:
if (uiNpcEntry == NPC_ASH)
- DoScriptText(SAY_OPEN_DOOR_AS, me);
+ Talk(SAY_OPEN_DOOR_AS);
else
- DoScriptText(SAY_OPEN_DOOR_AD, me);
+ Talk(SAY_OPEN_DOOR_AD);
break;
case 11:
if (uiNpcEntry == NPC_ASH)
@@ -125,16 +126,16 @@ public:
break;
case 12:
if (uiNpcEntry == NPC_ASH)
- DoScriptText(SAY_POST_DOOR_AS, me);
+ Talk(SAY_POST_DOOR_AS);
else
- DoScriptText(SAY_POST1_DOOR_AD, me);
+ Talk(SAY_POST1_DOOR_AD);
if (instance)
instance->SetData(TYPE_FREE_NPC, DONE);
break;
case 13:
if (uiNpcEntry != NPC_ASH)
- DoScriptText(SAY_POST2_DOOR_AD, me);
+ Talk(SAY_POST2_DOOR_AD);
break;
}
}
@@ -168,7 +169,7 @@ public:
void Reset()
{
- uiDarkOffering = urand(290, 10);
+ uiDarkOffering = urand(200, 1000);
}
void UpdateAI(uint32 const uiDiff)
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
index 85faa14900b..cd3fbd09223 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp
@@ -23,7 +23,8 @@ SDComment: aura applied/defined in database
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SAY_0 "Intruders! More pawns of the Argent Dawn, no doubt. I already count one of their number among my prisoners. Withdraw from my domain before she is executed!"
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
index 106719d654f..7dafcc2b647 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
@@ -23,7 +23,8 @@ SDComment: MC disabled
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_BANSHEEWAIL 16565
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 01299ae06b6..4c2aa395e3c 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//front, left
#define ADD_1X 3553.851807f
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
index 21e3e19d890..04380da3051 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp
@@ -23,7 +23,8 @@ SDComment: Possibly need to fix/improve summons after death
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eEnums
{
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
index 37e0bd5757f..5e67f35af8b 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_DRAININGBLOW 16793
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 f8a10f06155..522e43c0824 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_FROSTBOLT 17503
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
index c9a43edb66d..d6742e63167 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_ENCASINGWEBS 4962
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 ebeda248331..96e59a657a3 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
@@ -23,8 +23,10 @@ SDComment: Basic script to have support for Horde paladin epic mount (quest 9737
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
+#include "Player.h"
/*#####
# Additional:
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
index cf8b10a2ee5..f650029a439 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//Spell ID to summon this guy is 24627 "Summon Postmaster Malown"
//He should be spawned along with three other elites once the third postbox has been opened
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 3bb1ce7959d..4f82367924d 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#define SPELL_TRAMPLE 5568
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 a281c1b59c6..356023bce77 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SAY_SPAWN "TIMMY!"
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
index 387b6d7b13c..2e4ec7278fc 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -23,8 +23,11 @@ SDComment: In progress. Undead side 75% implemented. Save/load not implemented.
SDCategory: Stratholme
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "stratholme.h"
+#include "Player.h"
#define GO_SERVICE_ENTRANCE 175368
#define GO_GAUNTLET_GATE1 175357
@@ -122,7 +125,7 @@ class instance_stratholme : public InstanceMapScript
return true;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Cannot open slaugther square yet.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Cannot open slaugther square yet.");
return false;
}
@@ -240,7 +243,7 @@ class instance_stratholme : public InstanceMapScript
break;
EncounterState[0] = data;
events.ScheduleEvent(EVENT_BARON_RUN, 2700000);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Baron run in progress.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run in progress.");
break;
case FAIL:
DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM);
@@ -298,10 +301,10 @@ class instance_stratholme : public InstanceMapScript
//UpdateGoState(ziggurat4GUID, 0, true);
if (Creature* pBaron = instance->GetCreature(baronGUID))
pBaron->SummonCreature(C_RAMSTEIN, 4032.84f, -3390.24f, 119.73f, 4.71f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Ramstein spawned.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Ramstein spawned.");
}
else
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: %u Abomnation left to kill.", count);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: %u Abomnation left to kill.", count);
}
if (data == NOT_STARTED)
@@ -310,7 +313,7 @@ class instance_stratholme : public InstanceMapScript
if (data == DONE)
{
events.ScheduleEvent(EVENT_SLAUGHTER_SQUARE, 60000);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Slaugther event will continue in 1 minute.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Slaugther event will continue in 1 minute.");
}
EncounterState[4] = data;
break;
@@ -399,7 +402,7 @@ class instance_stratholme : public InstanceMapScript
OUT_LOAD_INST_DATA_COMPLETE;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -423,7 +426,7 @@ class instance_stratholme : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
@@ -446,7 +449,7 @@ class instance_stratholme : public InstanceMapScript
case EVENT_BARON_RUN:
if (GetData(TYPE_BARON_RUN) != DONE)
SetData(TYPE_BARON_RUN, FAIL);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN));
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Baron run event reached end. Event has state %u.", GetData(TYPE_BARON_RUN));
break;
case EVENT_SLAUGHTER_SQUARE:
if (Creature* baron = instance->GetCreature(baronGUID))
@@ -456,7 +459,7 @@ class instance_stratholme : public InstanceMapScript
HandleGameObject(ziggurat4GUID, true);
HandleGameObject(ziggurat5GUID, true);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Stratholme: Black guard sentries spawned. Opening gates to baron.");
}
break;
default:
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
index 7e167093e07..5da38e21d2f 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp
@@ -30,9 +30,12 @@ mob_restless_soul
mobs_spectral_ghostly_citizen
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "stratholme.h"
#include "Group.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist)
@@ -80,12 +83,10 @@ public:
/*######
## mob_freed_soul
######*/
-
-//Possibly more of these quotes around.
-#define SAY_ZAPPED0 -1329000
-#define SAY_ZAPPED1 -1329001
-#define SAY_ZAPPED2 -1329002
-#define SAY_ZAPPED3 -1329003
+enum FreedSoul
+{
+ SAY_ZAPPED = 0
+};
class mob_freed_soul : public CreatureScript
{
@@ -103,7 +104,7 @@ public:
void Reset()
{
- DoScriptText(RAND(SAY_ZAPPED0, SAY_ZAPPED1, SAY_ZAPPED2, SAY_ZAPPED3), me);
+ Talk(SAY_ZAPPED);
}
void EnterCombat(Unit* /*who*/) {}
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
index e804fff44f5..624e5460213 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp
@@ -23,7 +23,8 @@ SDComment:Place Holder
SDCategory: Sunken Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "sunken_temple.h"
#define GO_ATALAI_STATUE1 148830
@@ -192,7 +193,7 @@ public:
State = data;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == EVENT_STATE)
return State;
diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
index 35d6766872f..040e2153c2d 100644
--- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
+++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp
@@ -27,8 +27,10 @@ EndScriptData */
at_malfurion_Stormrage_trigger
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunken_temple.h"
+#include "Player.h"
/*#####
# at_malfurion_Stormrage_trigger
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
index 43c94f8a57d..3e9d2e991fc 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
@@ -22,46 +22,43 @@ SD%Complete: 80
SDComment: Find a way to start the intro, best code for the intro
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
enum Quotes
{
- YELL_INTRO = -1580017,
- YELL_INTRO_BREAK_ICE = -1580018,
- YELL_INTRO_CHARGE = -1580019,
- YELL_INTRO_KILL_MADRIGOSA = -1580020,
- YELL_INTRO_TAUNT = -1580021,
-
- YELL_MADR_ICE_BARRIER = -1580031,
- YELL_MADR_INTRO = -1580032,
- YELL_MADR_ICE_BLOCK = -1580033,
- YELL_MADR_TRAP = -1580034,
- YELL_MADR_DEATH = -1580035,
-
- YELL_AGGRO = -1580022,
- YELL_KILL1 = -1580023,
- YELL_KILL2 = -1580024,
- YELL_KILL3 = -1580025,
- YELL_LOVE1 = -1580026,
- YELL_LOVE2 = -1580027,
- YELL_LOVE3 = -1580028,
- YELL_BERSERK = -1580029,
- YELL_DEATH = -1580030
+ YELL_INTRO = 0,
+ YELL_INTRO_BREAK_ICE = 1,
+ YELL_INTRO_CHARGE = 2,
+ YELL_INTRO_KILL_MADRIGOSA = 3,
+ YELL_INTRO_TAUNT = 4,
+
+ YELL_AGGRO = 5,
+ YELL_KILL = 6,
+ YELL_LOVE = 7,
+ YELL_BERSERK = 8,
+ YELL_DEATH = 9,
+
+ YELL_MADR_ICE_BARRIER = 0,
+ YELL_MADR_INTRO = 1,
+ YELL_MADR_ICE_BLOCK = 2,
+ YELL_MADR_TRAP = 3,
+ YELL_MADR_DEATH = 4,
};
enum Spells
{
- SPELL_METEOR_SLASH = 45150,
- SPELL_BURN = 46394,
- SPELL_STOMP = 45185,
- SPELL_BERSERK = 26662,
- SPELL_DUAL_WIELD = 42459,
-
- SPELL_INTRO_FROST_BLAST = 45203,
- SPELL_INTRO_FROSTBOLT = 44843,
- SPELL_INTRO_ENCAPSULATE = 45665,
- SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661
+ SPELL_METEOR_SLASH = 45150,
+ SPELL_BURN = 46394,
+ SPELL_STOMP = 45185,
+ SPELL_BERSERK = 26662,
+ SPELL_DUAL_WIELD = 42459,
+
+ SPELL_INTRO_FROST_BLAST = 45203,
+ SPELL_INTRO_FROSTBOLT = 44843,
+ SPELL_INTRO_ENCAPSULATE = 45665,
+ SPELL_INTRO_ENCAPSULATE_CHANELLING = 45661
};
#define FELMYST 25038
@@ -121,7 +118,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(YELL_AGGRO, me);
+ Talk(YELL_AGGRO);
if (instance)
instance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS);
@@ -129,12 +126,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(YELL_KILL1, YELL_KILL2, YELL_KILL3), me);
+ Talk(YELL_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(YELL_DEATH, me);
+ Talk(YELL_DEATH);
if (instance)
{
@@ -170,7 +167,7 @@ public:
else
{
//Madrigosa not found, end intro
- sLog->outError("Madrigosa was not found");
+ sLog->outError(LOG_FILTER_TSCR, "Madrigosa was not found");
EndIntro();
}
}
@@ -198,19 +195,19 @@ public:
switch (IntroPhase)
{
case 0:
- DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa);
+ Madrigosa->AI()->Talk(YELL_MADR_ICE_BARRIER);
IntroPhaseTimer = 7000;
++IntroPhase;
break;
case 1:
me->SetInFront(Madrigosa);
Madrigosa->SetInFront(me);
- DoScriptText(YELL_MADR_INTRO, Madrigosa, me);
+ Madrigosa->AI()->Talk(YELL_MADR_INTRO, me->GetGUID());
IntroPhaseTimer = 9000;
++IntroPhase;
break;
case 2:
- DoScriptText(YELL_INTRO, me, Madrigosa);
+ Talk(YELL_INTRO, Madrigosa->GetGUID());
IntroPhaseTimer = 13000;
++IntroPhase;
break;
@@ -224,32 +221,32 @@ public:
++IntroPhase;
break;
case 4:
- DoScriptText(YELL_INTRO_BREAK_ICE, me);
+ Talk(YELL_INTRO_BREAK_ICE);
IntroPhaseTimer = 6000;
++IntroPhase;
break;
case 5:
Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false);
- DoScriptText(YELL_MADR_TRAP, Madrigosa);
+ Madrigosa->AI()->Talk(YELL_MADR_TRAP);
DoCast(me, SPELL_INTRO_ENCAPSULATE);
IntroPhaseTimer = 11000;
++IntroPhase;
break;
case 6:
- DoScriptText(YELL_INTRO_CHARGE, me);
+ Talk(YELL_INTRO_CHARGE);
IntroPhaseTimer = 5000;
++IntroPhase;
break;
case 7:
me->Kill(Madrigosa);
- DoScriptText(YELL_MADR_DEATH, Madrigosa);
+ Madrigosa->AI()->Talk(YELL_MADR_DEATH);
me->SetFullHealth();
me->AttackStop();
IntroPhaseTimer = 4000;
++IntroPhase;
break;
case 8:
- DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me);
+ Talk(YELL_INTRO_KILL_MADRIGOSA);
me->SetOrientation(0.14f);
me->StopMoving();
Madrigosa->setDeathState(CORPSE);
@@ -257,7 +254,7 @@ public:
++IntroPhase;
break;
case 9:
- DoScriptText(YELL_INTRO_TAUNT, me);
+ Talk(YELL_INTRO_TAUNT);
IntroPhaseTimer = 5000;
++IntroPhase;
break;
@@ -315,7 +312,7 @@ public:
if (StompTimer <= diff)
{
- DoScriptText(RAND(YELL_LOVE1, YELL_LOVE2, YELL_LOVE3), me);
+ Talk(YELL_LOVE);
DoCast(me->getVictim(), SPELL_STOMP);
StompTimer = 30000;
} else StompTimer -= diff;
@@ -335,7 +332,7 @@ public:
if (BerserkTimer < diff && !Enraged)
{
- DoScriptText(YELL_BERSERK, me);
+ Talk(YELL_BERSERK);
DoCast(me, SPELL_BERSERK);
Enraged = true;
} else BerserkTimer -= diff;
@@ -343,7 +340,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_brutallus()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
index 03486a644a2..23a83a7ee8f 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp
@@ -21,40 +21,34 @@ SD%Complete: 100
SDComment:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
+#include "SpellInfo.h"
enum Quotes
{
- //Alytesh
- YELL_CANFLAGRATION = -1580044,
- YELL_SISTER_SACROLASH_DEAD = -1580045,
- YELL_ALY_KILL_1 = -1580046,
- YELL_ALY_KILL_2 = -1580047,
- YELL_ALY_DEAD = -1580048,
- YELL_BERSERK = -1580049,
-
- //Sacrolash
- YELL_SHADOW_NOVA = -1580050,
- YELL_SISTER_ALYTHESS_DEAD = -1580051,
- YELL_SAC_KILL_1 = -1580052,
- YELL_SAC_KILL_2 = -1580053,
- SAY_SAC_DEAD = -1580054,
- YELL_ENRAGE = -1580055,
-
- //Intro
- YELL_INTRO_SAC_1 = -1580056,
- YELL_INTRO_ALY_2 = -1580057,
- YELL_INTRO_SAC_3 = -1580058,
- YELL_INTRO_ALY_4 = -1580059,
- YELL_INTRO_SAC_5 = -1580060,
- YELL_INTRO_ALY_6 = -1580061,
- YELL_INTRO_SAC_7 = -1580062,
- YELL_INTRO_ALY_8 = -1580063,
-
- //Emote
- EMOTE_SHADOW_NOVA = -1580064,
- EMOTE_CONFLAGRATION = -1580065
+ YELL_INTRO_SAC_1 = 0,
+ YELL_INTRO_SAC_3 = 1,
+ YELL_INTRO_SAC_5 = 2,
+ YELL_INTRO_SAC_7 = 3,
+ YELL_SAC_DEAD = 4,
+ EMOTE_SHADOW_NOVA = 5,
+ YELL_ENRAGE = 6,
+ YELL_SISTER_ALYTHESS_DEAD = 7,
+ YELL_SAC_KILL = 8,
+ YELL_SHADOW_NOVA = 9,
+
+ YELL_INTRO_ALY_2 = 0,
+ YELL_INTRO_ALY_4 = 1,
+ YELL_INTRO_ALY_6 = 2,
+ YELL_INTRO_ALY_8 = 3,
+ EMOTE_CONFLAGRATION = 4,
+ YELL_ALY_KILL = 5,
+ YELL_ALY_DEAD = 6,
+ YELL_SISTER_SACROLASH_DEAD = 7,
+ YELL_CANFLAGRATION = 8,
+ YELL_BERSERK = 9,
};
enum Spells
@@ -120,13 +114,12 @@ public:
if (instance)
{
- Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS));
- if (Temp)
+ if (Creature *temp = Unit::GetCreature(*me, instance->GetData64(DATA_ALYTHESS)))
{
- if (Temp->isDead())
- CAST_CRE(Temp)->Respawn();
- else if (Temp->getVictim())
- me->getThreatManager().addThreat(Temp->getVictim(), 0.0f);
+ if (temp->isDead())
+ temp->Respawn();
+ else if (temp->getVictim())
+ me->getThreatManager().addThreat(temp->getVictim(), 0.0f);
}
}
@@ -152,9 +145,9 @@ public:
if (instance)
{
- Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS));
- if (Temp && Temp->isAlive() && !(Temp->getVictim()))
- CAST_CRE(Temp)->AI()->AttackStart(who);
+ Creature *temp = Unit::GetCreature(*me, instance->GetData64(DATA_ALYTHESS));
+ if (temp && temp->isAlive() && !temp->getVictim())
+ temp->AI()->AttackStart(who);
}
if (instance)
@@ -164,7 +157,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
if (rand()%4 == 0)
- DoScriptText(RAND(YELL_SAC_KILL_1, YELL_SAC_KILL_2), me);
+ Talk(YELL_SAC_KILL);
}
void JustDied(Unit* /*killer*/)
@@ -172,7 +165,7 @@ public:
// only if ALY death
if (SisterDeath)
{
- DoScriptText(SAY_SAC_DEAD, me);
+ Talk(YELL_SAC_DEAD);
if (instance)
instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE);
@@ -234,7 +227,7 @@ public:
Temp = Unit::GetUnit(*me, instance->GetData64(DATA_ALYTHESS));
if (Temp && Temp->isDead())
{
- DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me);
+ Talk(YELL_SISTER_ALYTHESS_DEAD);
DoCast(me, SPELL_EMPOWER);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
SisterDeath = true;
@@ -274,8 +267,8 @@ public:
if (!SisterDeath)
{
if (target)
- DoScriptText(EMOTE_SHADOW_NOVA, me, target);
- DoScriptText(YELL_SHADOW_NOVA, me);
+ Talk(EMOTE_SHADOW_NOVA, target->GetGUID());
+ Talk(YELL_SHADOW_NOVA);
}
ShadownovaTimer = 30000+(rand()%5000);
}
@@ -323,7 +316,7 @@ public:
if (EnrageTimer < diff && !Enraged)
{
me->InterruptSpell(CURRENT_GENERIC_SPELL);
- DoScriptText(YELL_ENRAGE, me);
+ Talk(YELL_ENRAGE);
DoCast(me, SPELL_ENRAGE);
Enraged = true;
} else EnrageTimer -= diff;
@@ -340,7 +333,6 @@ public:
}
}
};
-
};
class boss_alythess : public CreatureScript
@@ -382,13 +374,12 @@ public:
if (instance)
{
- Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH));
- if (Temp)
+ if (Creature *temp = Unit::GetCreature((*me), instance->GetData64(DATA_SACROLASH)))
{
- if (Temp->isDead())
- CAST_CRE(Temp)->Respawn();
- else if (Temp->getVictim())
- me->getThreatManager().addThreat(Temp->getVictim(), 0.0f);
+ if (temp->isDead())
+ temp->Respawn();
+ else if (temp->getVictim())
+ me->getThreatManager().addThreat(temp->getVictim(), 0.0f);
}
}
@@ -415,9 +406,9 @@ public:
if (instance)
{
- Unit* Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH));
- if (Temp && Temp->isAlive() && !(Temp->getVictim()))
- CAST_CRE(Temp)->AI()->AttackStart(who);
+ Creature *temp = Unit::GetCreature(*me, instance->GetData64(DATA_SACROLASH));
+ if (temp && temp->isAlive() && !temp->getVictim())
+ temp->AI()->AttackStart(who);
}
if (instance)
@@ -458,7 +449,7 @@ public:
{
if (rand()%4 == 0)
{
- DoScriptText(RAND(YELL_ALY_KILL_1, YELL_ALY_KILL_2), me);
+ Talk(YELL_ALY_KILL);
}
}
@@ -466,7 +457,7 @@ public:
{
if (SisterDeath)
{
- DoScriptText(YELL_ALY_DEAD, me);
+ Talk(YELL_ALY_DEAD);
if (instance)
instance->SetData(DATA_EREDAR_TWINS_EVENT, DONE);
@@ -479,7 +470,6 @@ public:
{
switch (spell->Id)
{
-
case SPELL_BLAZE:
target->CastSpell(target, SPELL_BLAZE_SUMMON, true);
case SPELL_CONFLAGRATION:
@@ -530,24 +520,24 @@ public:
case 0: return 0;
case 1:
if (Sacrolash)
- DoScriptText(YELL_INTRO_SAC_1, Sacrolash);
+ Sacrolash->AI()->Talk(YELL_INTRO_SAC_1);
return 1000;
- case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000;
+ case 2: Talk(YELL_INTRO_ALY_2); return 1000;
case 3:
if (Sacrolash)
- DoScriptText(YELL_INTRO_SAC_3, Sacrolash);
+ Sacrolash->AI()->Talk(YELL_INTRO_SAC_3);
return 2000;
- case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000;
+ case 4: Talk(YELL_INTRO_ALY_4); return 1000;
case 5:
if (Sacrolash)
- DoScriptText(YELL_INTRO_SAC_5, Sacrolash);
+ Sacrolash->AI()->Talk(YELL_INTRO_SAC_5);
return 2000;
- case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000;
+ case 6: Talk(YELL_INTRO_ALY_6); return 1000;
case 7:
if (Sacrolash)
- DoScriptText(YELL_INTRO_SAC_7, Sacrolash);
+ Sacrolash->AI()->Talk(YELL_INTRO_SAC_7);
return 3000;
- case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000;
+ case 8: Talk(YELL_INTRO_ALY_8); return 900000;
}
return 10000;
}
@@ -570,7 +560,7 @@ public:
Temp = Unit::GetUnit(*me, instance->GetData64(DATA_SACROLASH));
if (Temp && Temp->isDead())
{
- DoScriptText(YELL_SISTER_SACROLASH_DEAD, me);
+ Talk(YELL_SISTER_SACROLASH_DEAD);
DoCast(me, SPELL_EMPOWER);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
SisterDeath = true;
@@ -624,8 +614,8 @@ public:
if (!SisterDeath)
{
if (target)
- DoScriptText(EMOTE_CONFLAGRATION, me, target);
- DoScriptText(YELL_CANFLAGRATION, me);
+ Talk(EMOTE_CONFLAGRATION, target->GetGUID());
+ Talk(YELL_CANFLAGRATION);
}
BlazeTimer = 4000;
@@ -663,13 +653,12 @@ public:
if (EnrageTimer < diff && !Enraged)
{
me->InterruptSpell(CURRENT_GENERIC_SPELL);
- DoScriptText(YELL_BERSERK, me);
+ Talk(YELL_BERSERK);
DoCast(me, SPELL_ENRAGE);
Enraged = true;
} else EnrageTimer -= diff;
}
};
-
};
class mob_shadow_image : public CreatureScript
@@ -704,7 +693,6 @@ public:
{
switch (spell->Id)
{
-
case SPELL_SHADOW_FURY:
case SPELL_DARK_STRIKE:
if (!target->HasAura(SPELL_DARK_FLAME))
@@ -751,7 +739,6 @@ public:
} else DarkstrikeTimer -= diff;
}
};
-
};
void AddSC_boss_eredar_twins()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
index 72ad1100752..35fabb7a195 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
@@ -21,19 +21,23 @@ SD%Complete: 0
SDComment:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "sunwell_plateau.h"
enum Yells
{
- YELL_BIRTH = -1580036,
- YELL_KILL1 = -1580037,
- YELL_KILL2 = -1580038,
- YELL_BREATH = -1580039,
- YELL_TAKEOFF = -1580040,
- YELL_BERSERK = -1580041,
- YELL_DEATH = -1580042,
- YELL_KALECGOS = -1580043, // after felmyst's death spawned and say this
+ YELL_BIRTH = 0,
+ YELL_KILL = 1,
+ YELL_BREATH = 2,
+ YELL_TAKEOFF = 3,
+ YELL_BERSERK = 4,
+ YELL_DEATH = 5,
+ //YELL_KALECGOS = 6, Not used. After felmyst's death spawned and say this
};
enum Spells
@@ -176,17 +180,17 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(YELL_KILL1, YELL_KILL2), me);
+ Talk(YELL_KILL);
}
void JustRespawned()
{
- DoScriptText(YELL_BIRTH, me);
+ Talk(YELL_BIRTH);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(YELL_DEATH, me);
+ Talk(YELL_DEATH);
if (instance)
instance->SetData(DATA_FELMYST_EVENT, DONE);
@@ -274,7 +278,7 @@ public:
me->GetMotionMaster()->Clear(false);
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->StopMoving();
- DoScriptText(YELL_TAKEOFF, me);
+ Talk(YELL_TAKEOFF);
events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000);
break;
case 1:
@@ -419,7 +423,7 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_BERSERK:
- DoScriptText(YELL_BERSERK, me);
+ Talk(YELL_BERSERK);
DoCast(me, SPELL_BERSERK, true);
events.ScheduleEvent(EVENT_BERSERK, 10000);
break;
@@ -454,7 +458,7 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_BERSERK:
- DoScriptText(YELL_BERSERK, me);
+ Talk(YELL_BERSERK);
DoCast(me, SPELL_BERSERK, true);
break;
case EVENT_FLIGHT_SEQUENCE:
@@ -507,7 +511,6 @@ public:
}
}
};
-
};
class mob_felmyst_vapor : public CreatureScript
@@ -540,7 +543,6 @@ public:
AttackStart(target);
}
};
-
};
class mob_felmyst_trail : public CreatureScript
@@ -568,7 +570,6 @@ public:
void MoveInLineOfSight(Unit* /*who*/) {}
void UpdateAI(const uint32 /*diff*/) {}
};
-
};
void AddSC_boss_felmyst()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
index f783fcc1eb5..c2dc7123f6d 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
@@ -23,65 +23,60 @@ SDComment:
SDCategory: Sunwell_Plateau
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
+#include "Player.h"
+#include "WorldSession.h"
enum Yells
{
- //Kalecgos dragon form
- SAY_EVIL_AGGRO = -1580000,
- SAY_EVIL_SPELL1 = -1580001,
- SAY_EVIL_SPELL2 = -1580002,
- SAY_EVIL_SLAY1 = -1580003,
- SAY_EVIL_SLAY2 = -1580004,
- SAY_EVIL_ENRAGE = -1580005,
-
- //Kalecgos humanoid form
- SAY_GOOD_AGGRO = -1580006,
- SAY_GOOD_NEAR_DEATH = -1580007,
- SAY_GOOD_NEAR_DEATH2 = -1580008,
- SAY_GOOD_PLRWIN = -1580009,
-
- //Sathrovarr
- SAY_SATH_AGGRO = -1580010,
- SAY_SATH_DEATH = -1580011,
- SAY_SATH_SPELL1 = -1580012,
- SAY_SATH_SPELL2 = -1580013,
- SAY_SATH_SLAY1 = -1580014,
- SAY_SATH_SLAY2 = -1580015,
- SAY_SATH_ENRAGE = -1580016,
+ SAY_SATH_AGGRO = 0,
+ SAY_SATH_SLAY = 1,
+ SAY_SATH_DEATH = 2,
+ SAY_SATH_SPELL1 = 3,
+ SAY_SATH_SPELL2 = 4,
+
+ SAY_EVIL_AGGRO = 0,
+ SAY_EVIL_SLAY = 1,
+ SAY_GOOD_PLRWIN = 2,
+ SAY_EVIL_ENRAGE = 3,
+
+ SAY_GOOD_AGGRO = 0,
+ SAY_GOOD_NEAR_DEATH = 1,
+ SAY_GOOD_NEAR_DEATH2 = 2,
};
enum Spells
{
- AURA_SUNWELL_RADIANCE = 45769,
- AURA_SPECTRAL_EXHAUSTION = 44867,
- AURA_SPECTRAL_REALM = 46021,
- AURA_SPECTRAL_INVISIBILITY = 44801,
- AURA_DEMONIC_VISUAL = 44800,
-
- SPELL_SPECTRAL_BLAST = 44869,
- SPELL_TELEPORT_SPECTRAL = 46019,
- SPELL_ARCANE_BUFFET = 45018,
- SPELL_FROST_BREATH = 44799,
- SPELL_TAIL_LASH = 45122,
-
- SPELL_BANISH = 44836,
- SPELL_TRANSFORM_KALEC = 44670,
- SPELL_ENRAGE = 44807,
-
- SPELL_CORRUPTION_STRIKE = 45029,
- SPELL_AGONY_CURSE = 45032,
- SPELL_SHADOW_BOLT = 45031,
-
- SPELL_HEROIC_STRIKE = 45026,
- SPELL_REVITALIZE = 45027
+ AURA_SUNWELL_RADIANCE = 45769,
+ AURA_SPECTRAL_EXHAUSTION = 44867,
+ AURA_SPECTRAL_REALM = 46021,
+ AURA_SPECTRAL_INVISIBILITY = 44801,
+ AURA_DEMONIC_VISUAL = 44800,
+
+ SPELL_SPECTRAL_BLAST = 44869,
+ SPELL_TELEPORT_SPECTRAL = 46019,
+ SPELL_ARCANE_BUFFET = 45018,
+ SPELL_FROST_BREATH = 44799,
+ SPELL_TAIL_LASH = 45122,
+
+ SPELL_BANISH = 44836,
+ SPELL_TRANSFORM_KALEC = 44670,
+ SPELL_ENRAGE = 44807,
+
+ SPELL_CORRUPTION_STRIKE = 45029,
+ SPELL_AGONY_CURSE = 45032,
+ SPELL_SHADOW_BOLT = 45031,
+
+ SPELL_HEROIC_STRIKE = 45026,
+ SPELL_REVITALIZE = 45027
};
enum SWPActions
{
- DO_ENRAGE = 1,
- DO_BANISH = 2,
+ DO_ENRAGE = 1,
+ DO_BANISH = 2,
};
#define GO_FAILED "You are unable to use this currently."
@@ -269,7 +264,7 @@ public:
}
else
{
- sLog->outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted.");
+ sLog->outError(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted.");
EnterEvadeMode();
return;
}
@@ -303,11 +298,20 @@ public:
if (SpectralBlastTimer <= diff)
{
- std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& m_threatlist = me->getThreatManager().getThreatList();
std::list<Unit*> targetList;
- for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
- if ((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5)
- targetList.push_back((*itr)->getTarget());
+ for (ThreatContainer::StorageType::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
+ {
+ Unit* target = (*itr)->getTarget();
+ if (target
+ && target->GetTypeId() == TYPEID_PLAYER
+ && target->GetGUID() != me->getVictim()->GetGUID()
+ && target->GetPositionZ() > me->GetPositionZ() - 5
+ && !target->HasAura(AURA_SPECTRAL_EXHAUSTION))
+ {
+ targetList.push_back(target);
+ }
+ }
if (targetList.empty())
{
SpectralBlastTimer = 1000;
@@ -348,7 +352,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_EVIL_AGGRO, me);
+ Talk(SAY_EVIL_AGGRO);
DoZoneInCombat();
if (instance)
@@ -357,7 +361,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_EVIL_SLAY1, SAY_EVIL_SLAY2), me);
+ Talk(SAY_EVIL_SLAY);
}
void MovementInform(uint32 type, uint32 /*id*/)
@@ -396,7 +400,7 @@ public:
TalkTimer = 1000;
break;
case 2:
- DoScriptText(SAY_GOOD_PLRWIN, me);
+ Talk(SAY_GOOD_PLRWIN);
TalkTimer = 10000;
break;
case 3:
@@ -414,7 +418,7 @@ public:
switch (TalkSequence)
{
case 1:
- DoScriptText(SAY_EVIL_ENRAGE, me);
+ Talk(SAY_EVIL_ENRAGE);
TalkTimer = 3000;
break;
case 2:
@@ -430,7 +434,6 @@ public:
}
}
};
-
};
class boss_kalec : public CreatureScript
@@ -494,20 +497,20 @@ public:
switch (YellSequence)
{
case 0:
- DoScriptText(SAY_GOOD_AGGRO, me);
+ Talk(SAY_GOOD_AGGRO);
++YellSequence;
break;
case 1:
if (HealthBelowPct(50))
{
- DoScriptText(SAY_GOOD_NEAR_DEATH, me);
+ Talk(SAY_GOOD_NEAR_DEATH);
++YellSequence;
}
break;
case 2:
if (HealthBelowPct(10))
{
- DoScriptText(SAY_GOOD_NEAR_DEATH2, me);
+ Talk(SAY_GOOD_NEAR_DEATH2);
++YellSequence;
}
break;
@@ -532,7 +535,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class kalecgos_teleporter : public GameObjectScript
@@ -560,7 +562,6 @@ public:
player->CastSpell(player, SPELL_TELEPORT_SPECTRAL, true);
return true;
}
-
};
class boss_sathrovarr : public CreatureScript
@@ -633,7 +634,7 @@ public:
me->AddThreat(Kalec, 100.0f);
Kalec->setActive(true);
}
- DoScriptText(SAY_SATH_AGGRO, me);
+ Talk(SAY_SATH_AGGRO);
}
void DamageTaken(Unit* done_by, uint32 &damage)
@@ -655,12 +656,12 @@ public:
EnterEvadeMode();
return;
}
- DoScriptText(RAND(SAY_SATH_SLAY1, SAY_SATH_SLAY2), me);
+ Talk(SAY_SATH_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_SATH_DEATH, me);
+ Talk(SAY_SATH_DEATH);
me->SetPosition(me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation());
TeleportAllPlayersBack();
if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
@@ -760,22 +761,19 @@ public:
if (ResetThreat <= diff)
{
- for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
- {
- if (unit->GetPositionZ() > me->GetPositionZ()+5)
- {
+ if (unit->GetPositionZ() > me->GetPositionZ() + 5)
me->getThreatManager().modifyThreatPercent(unit, -100);
- }
- }
}
ResetThreat = 1000;
} else ResetThreat -= diff;
if (ShadowBoltTimer <= diff)
{
- if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me);
+ if (!(rand()%5))Talk(SAY_SATH_SPELL1);
DoCast(me, SPELL_SHADOW_BOLT);
ShadowBoltTimer = 7000+(rand()%3000);
} else ShadowBoltTimer -= diff;
@@ -790,7 +788,7 @@ public:
if (CorruptionStrikeTimer <= diff)
{
- if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me);
+ if (!(rand()%5))Talk(SAY_SATH_SPELL2);
DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE);
CorruptionStrikeTimer = 13000;
} else CorruptionStrikeTimer -= diff;
@@ -798,7 +796,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_kalecgos()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 8a64d45abcb..b32f9244034 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -24,53 +24,43 @@ EndScriptData */
//TODO rewrite Armageddon
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
#include <math.h>
+#include "Player.h"
/*** Speech and sounds***/
enum Yells
{
- // These are used throughout Sunwell and Magisters(?). Players can hear this while running through the instances.
- SAY_KJ_OFFCOMBAT1 = -1580066,
- SAY_KJ_OFFCOMBAT2 = -1580067,
- SAY_KJ_OFFCOMBAT3 = -1580068,
- SAY_KJ_OFFCOMBAT4 = -1580069,
- SAY_KJ_OFFCOMBAT5 = -1580070,
-
- // Encounter speech and sounds
- SAY_KJ_EMERGE = -1580071,
- SAY_KJ_SLAY1 = -1580072,
- SAY_KJ_SLAY2 = -1580073,
- SAY_KJ_REFLECTION1 = -1580074,
- SAY_KJ_REFLECTION2 = -1580075,
- SAY_KJ_DARKNESS1 = -1580076,
- SAY_KJ_DARKNESS2 = -1580077,
- SAY_KJ_DARKNESS3 = -1580078,
- SAY_KJ_PHASE3 = -1580079,
- SAY_KJ_PHASE4 = -1580080,
- SAY_KJ_PHASE5 = -1580081,
- SAY_KJ_DEATH = -1580093,
- EMOTE_KJ_DARKNESS = -1580094,
-
- /*** Kalecgos - Anveena speech at the beginning of Phase 5; Anveena's sacrifice ***/
- SAY_KALECGOS_AWAKEN = -1580082,
- SAY_ANVEENA_IMPRISONED = -1580083,
- SAY_KALECGOS_LETGO = -1580084,
- SAY_ANVEENA_LOST = -1580085,
- SAY_KALECGOS_FOCUS = -1580086,
- SAY_ANVEENA_KALEC = -1580087,
- SAY_KALECGOS_FATE = -1580088,
- SAY_ANVEENA_GOODBYE = -1580089,
- SAY_KALECGOS_GOODBYE = -1580090,
- SAY_KALECGOS_ENCOURAGE = -1580091,
-
- /*** Kalecgos says throughout the fight ***/
- SAY_KALECGOS_JOIN = -1580092,
- SAY_KALEC_ORB_READY1 = -1580095,
- SAY_KALEC_ORB_READY2 = -1580096,
- SAY_KALEC_ORB_READY3 = -1580097,
- SAY_KALEC_ORB_READY4 = -1580098
+ SAY_KJ_OFFCOMBAT = 0,
+
+ SAY_KALECGOS_ENCOURAGE = 0,
+ SAY_KALECGOS_READY1 = 1,
+ SAY_KALECGOS_READY2 = 2,
+ SAY_KALECGOS_READY3 = 3,
+ SAY_KALECGOS_READY4 = 4,
+ SAY_KALECGOS_AWAKEN = 5,
+ SAY_KALECGOS_LETGO = 6,
+ SAY_KALECGOS_FOCUS = 7,
+ SAY_KALECGOS_FATE = 8,
+ SAY_KALECGOS_GOODBYE = 9,
+ SAY_KALECGOS_JOIN = 10,
+
+ SAY_KJ_DEATH = 0,
+ SAY_KJ_SLAY = 1,
+ SAY_KJ_REFLECTION = 2,
+ SAY_KJ_EMERGE = 3,
+ SAY_KJ_DARKNESS = 4,
+ SAY_KJ_PHASE3 = 5,
+ SAY_KJ_PHASE4 = 6,
+ SAY_KJ_PHASE5 = 7,
+ EMOTE_KJ_DARKNESS = 8,
+
+ SAY_ANVEENA_IMPRISONED = 0,
+ SAY_ANVEENA_LOST = 1,
+ SAY_ANVEENA_KALEC = 2,
+ SAY_ANVEENA_GOODBYE = 3,
};
/*** Spells used during the encounter ***/
@@ -320,7 +310,7 @@ public:
pOrb->Refresh();
}
}
- DoScriptText(SAY_KALECGOS_ENCOURAGE, me);
+ Talk(SAY_KALECGOS_ENCOURAGE);
}
else
{
@@ -336,10 +326,10 @@ public:
++EmpowerCount;
switch (EmpowerCount)
{
- case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break;
- case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break;
- case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break;
- case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break;
+ case 1: Talk(SAY_KALECGOS_READY1); break;
+ case 2: Talk(SAY_KALECGOS_READY2); break;
+ case 3: Talk(SAY_KALECGOS_READY3); break;
+ case 4: Talk(SAY_KALECGOS_READY4); break;
}
}
}
@@ -366,7 +356,6 @@ public:
}
}
};
-
};
class go_orb_of_the_blue_flight : public GameObjectScript
@@ -390,7 +379,6 @@ public:
}
return true;
}
-
};
//AI for Kil'jaeden Event Controller
@@ -469,7 +457,7 @@ public:
if (uiRandomSayTimer < diff)
{
if (instance && instance->GetData(DATA_MURU_EVENT) != DONE && instance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED)
- DoScriptText(RAND(SAY_KJ_OFFCOMBAT1, SAY_KJ_OFFCOMBAT2, SAY_KJ_OFFCOMBAT3, SAY_KJ_OFFCOMBAT4, SAY_KJ_OFFCOMBAT5), me);
+ Talk(SAY_KJ_OFFCOMBAT);
uiRandomSayTimer = 30000;
} else uiRandomSayTimer -= diff;
@@ -491,7 +479,6 @@ public:
}
}
};
-
};
//AI for Kil'jaeden
@@ -614,7 +601,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_KJ_DEATH, me);
+ Talk(SAY_KJ_DEATH);
summons.DespawnAll();
if (instance)
@@ -623,7 +610,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KJ_SLAY1, SAY_KJ_SLAY2), me);
+ Talk(SAY_KJ_SLAY);
}
void EnterEvadeMode()
@@ -658,7 +645,7 @@ public:
void CastSinisterReflection()
{
- DoScriptText(RAND(SAY_KJ_REFLECTION1, SAY_KJ_REFLECTION2), me);
+ Talk(SAY_KJ_REFLECTION);
for (uint8 i = 0; i < 4; ++i)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT))
@@ -718,8 +705,8 @@ public:
{
SpeechTimer = 0;
if (instance)
- if (Creature* pSpeechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature)))
- DoScriptText(Speeches[speechCount].textid, pSpeechCreature);
+ if (Creature* speechCreature = Unit::GetCreature(*me, instance->GetData64(Speeches[speechCount].creature)))
+ speechCreature->AI()->Talk(Speeches[speechCount].textid);
if (speechCount == 12)
if (Creature* pAnveena = Unit::GetCreature(*me, instance->GetData64(DATA_ANVEENA)))
pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false);
@@ -754,7 +741,7 @@ public:
if (pRandomPlayer)
DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false);
else
- sLog->outError("try to cast SPELL_LEGION_LIGHTNING on invalid target");
+ sLog->outError(LOG_FILTER_TSCR, "try to cast SPELL_LEGION_LIGHTNING on invalid target");
Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE
Timer[TIMER_SOUL_FLAY] = 2500;
@@ -773,8 +760,8 @@ public:
for (uint8 i = 1; i < Phase; ++i)
{
float sx, sy;
- sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]);
- sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]);
+ sx = ShieldOrbLocations[0][0] + std::sin(ShieldOrbLocations[i][0]);
+ sy = ShieldOrbLocations[0][1] + std::sin(ShieldOrbLocations[i][1]);
me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
}
Timer[TIMER_SUMMON_SHILEDORB] = urand(30000, 60000); // 30-60seconds cooldown
@@ -800,7 +787,7 @@ public:
// Begins to channel for 8 seconds, then deals 50'000 damage to all raid members.
if (!IsInDarkness)
{
- DoScriptText(EMOTE_KJ_DARKNESS, me);
+ Talk(EMOTE_KJ_DARKNESS);
DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false);
ChangeTimers(true, 9000);
Timer[TIMER_DARKNESS] = 8750;
@@ -814,7 +801,7 @@ public:
Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000, 70000);
IsInDarkness = false;
DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE);
- DoScriptText(RAND(SAY_KJ_DARKNESS1, SAY_KJ_DARKNESS2, SAY_KJ_DARKNESS3), me);
+ Talk(SAY_KJ_DARKNESS);
}
Timer[TIMER_SOUL_FLAY] = 9000;
}
@@ -899,7 +886,6 @@ public:
}
}
};
-
};
//AI for Hand of the Deceiver
@@ -986,8 +972,8 @@ public:
{
if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000))
{
- std::list<HostileReference*>::iterator itr;
- for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit)
@@ -1000,7 +986,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
//AI for Felfire Portal
@@ -1045,7 +1030,6 @@ public:
} else uiSpawnFiendTimer -= diff;
}
};
-
};
//AI for Felfire Fiend
@@ -1103,7 +1087,6 @@ public:
}
}
};
-
};
//AI for Armageddon target
@@ -1158,7 +1141,6 @@ public:
} else uiTimer -=diff;
}
};
-
};
//AI for Shield Orbs
@@ -1206,13 +1188,13 @@ public:
{
if (bClockwise)
{
- y = my - r * sin(c);
- x = mx - r * cos(c);
+ y = my - r * std::sin(c);
+ x = mx - r * std::cos(c);
}
else
{
- y = my + r * sin(c);
- x = mx + r * cos(c);
+ y = my + r * std::sin(c);
+ x = mx + r * std::cos(c);
}
bPointReached = false;
uiCheckTimer = 1000;
@@ -1246,7 +1228,6 @@ public:
bPointReached = true;
}
};
-
};
//AI for Sinister Reflection
@@ -1309,7 +1290,8 @@ public:
}
}
- switch (victimClass) {
+ switch (victimClass)
+ {
case CLASS_DRUID:
if (uiTimer[1] <= diff)
{
@@ -1410,13 +1392,12 @@ public:
}
DoMeleeAttackIfReady();
break;
- }
- sLog->outDebug(LOG_FILTER_TSCR, "Sinister-Timer");
- for (uint8 i = 0; i < 3; ++i)
- uiTimer[i] -= diff;
}
+ sLog->outDebug(LOG_FILTER_TSCR, "Sinister-Timer");
+ for (uint8 i = 0; i < 3; ++i)
+ uiTimer[i] -= diff;
+ }
};
-
};
void AddSC_boss_kiljaeden()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
index 66030a1c78c..d23ca834f86 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp
@@ -21,8 +21,11 @@ SD%Complete: 80
SDComment: all sounds, black hole effect triggers to often (46228)
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
+#include "Player.h"
+#include "SpellInfo.h"
// Muru & Entropius's spells
enum Spells
@@ -198,7 +201,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class boss_muru : public CreatureScript
@@ -363,7 +365,6 @@ public:
}
}
};
-
};
class npc_muru_portal : public CreatureScript
@@ -447,7 +448,6 @@ public:
} else SummonTimer -= diff;
}
};
-
};
class npc_dark_fiend : public CreatureScript
@@ -499,7 +499,6 @@ public:
}
else
{
-
if (me->IsWithinDist(me->getVictim(), 5))
{
DoCastAOE(SPELL_DARKFIEND_AOE, false);
@@ -510,7 +509,6 @@ public:
} else WaitTimer -= diff;
}
};
-
};
class npc_void_sentinel : public CreatureScript
@@ -566,7 +564,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class npc_blackhole : public CreatureScript
@@ -645,7 +642,6 @@ public:
else DespawnTimer -= diff;
}
};
-
};
void AddSC_boss_muru()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
index 645026c343d..c4bb41036bc 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp
@@ -23,8 +23,10 @@ SDComment: VERIFY SCRIPT
SDCategory: Sunwell_Plateau
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "sunwell_plateau.h"
+#include "Player.h"
#define MAX_ENCOUNTER 6
@@ -120,7 +122,7 @@ public:
return false;
}
- Player* GetPlayerInMap()
+ Player const * GetPlayerInMap() const
{
Map::PlayerList const& players = instance->GetPlayers();
@@ -133,8 +135,9 @@ public:
return player;
}
}
+ else
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!");
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -179,7 +182,7 @@ public:
}
}
- uint32 GetData(uint32 id)
+ uint32 GetData(uint32 id) const
{
switch (id)
{
@@ -193,7 +196,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 id)
+ uint64 GetData64(uint32 id) const
{
switch (id)
{
@@ -212,8 +215,8 @@ public:
case DATA_ANVEENA: return Anveena;
case DATA_KALECGOS_KJ: return KalecgosKJ;
case DATA_PLAYER_GUID:
- Player* Target = GetPlayerInMap();
- return Target->GetGUID();
+ Player const* target = GetPlayerInMap();
+ return target ? target->GetGUID() : 0;
}
return 0;
}
@@ -275,17 +278,12 @@ public:
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3] << ' '
<< m_auiEncounter[4] << ' ' << m_auiEncounter[5];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
- void Load(const char* in)
+ void Load(char const* in)
{
if (!in)
{
@@ -303,7 +301,6 @@ public:
OUT_LOAD_INST_DATA_COMPLETE;
}
};
-
};
void AddSC_instance_sunwell_plateau()
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
index e6349e3497e..25bc85f47b6 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
@@ -26,7 +26,8 @@ npc_prophet_velen
npc_captain_selana
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sunwell_plateau.h"
/*######
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
index 7a946e9d5bf..0b7a62f6563 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp
@@ -26,8 +26,10 @@ At 33%, he will awaken the Vault Walkers
On his death the vault door opens.
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "uldaman.h"
+#include "Player.h"
#define SAY_AGGRO "Who dares awaken Archaedas? Who dares the wrath of the makers!"
#define SOUND_AGGRO 5855
@@ -94,14 +96,17 @@ class boss_archaedas : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
- void ActivateMinion(uint64 uiGuid, bool bFlag)
+ void ActivateMinion(uint64 uiGuid, bool flag)
{
- Unit* pMinion = Unit::GetUnit(*me, uiGuid);
+ Unit* minion = Unit::GetUnit(*me, uiGuid);
- if (pMinion && pMinion->isAlive())
+ if (minion && minion->isAlive())
{
- DoCast(pMinion, SPELL_AWAKEN_VAULT_WALKER, bFlag);
- pMinion->CastSpell(pMinion, SPELL_ARCHAEDAS_AWAKEN, true);
+ DoCast(minion, SPELL_AWAKEN_VAULT_WALKER, flag);
+ minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN, true);
+ minion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ minion->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
+ minion->setFaction(14);
}
}
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
index 8a845dbb7f6..1537f0eeb88 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_ironaya.cpp
@@ -23,13 +23,16 @@ SDComment:
SDCategory: Uldaman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SAY_AGGRO -1070000
-
-#define SPELL_ARCINGSMASH 8374
-#define SPELL_KNOCKAWAY 10101
-#define SPELL_WSTOMP 11876
+enum Ironaya
+{
+ SAY_AGGRO = 0,
+ SPELL_ARCINGSMASH = 8374,
+ SPELL_KNOCKAWAY = 10101,
+ SPELL_WSTOMP = 11876,
+};
class boss_ironaya : public CreatureScript
{
@@ -57,7 +60,7 @@ class boss_ironaya : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 uiDiff)
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
index fea64c55377..efbc4f75ae1 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp
@@ -23,7 +23,8 @@ SDComment: Need some cosmetics updates when archeadas door are closing (Guardian
SDCategory: Uldaman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "uldaman.h"
enum eSpells
@@ -201,6 +202,9 @@ class instance_uldaman : public InstanceMapScript
continue;
archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true);
target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN, true);
+ target->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE);
+ target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ target->setFaction(14);
return; // only want the first one we find
}
}
@@ -462,20 +466,27 @@ class instance_uldaman : public InstanceMapScript
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
- if (identifier == 0) return uiWhoWokeuiArchaedasGUID;
- if (identifier == 1) return vVaultWalker[0]; // VaultWalker1
- if (identifier == 2) return vVaultWalker[1]; // VaultWalker2
- if (identifier == 3) return vVaultWalker[2]; // VaultWalker3
- if (identifier == 4) return vVaultWalker[3]; // VaultWalker4
-
- if (identifier == 5) return vEarthenGuardian[0];
- if (identifier == 6) return vEarthenGuardian[1];
- if (identifier == 7) return vEarthenGuardian[2];
- if (identifier == 8) return vEarthenGuardian[3];
- if (identifier == 9) return vEarthenGuardian[4];
- if (identifier == 10) return vEarthenGuardian[5];
+ switch (identifier)
+ {
+ case 0:
+ return uiWhoWokeuiArchaedasGUID;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ return vVaultWalker.at(identifier - 1);
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ return vEarthenGuardian.at(identifier - 5);
+ default:
+ break;
+ }
return 0;
} // end GetData64
diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
index 1c6cad7278a..d86da3efce5 100644
--- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
+++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.cpp
@@ -30,8 +30,10 @@ go_keystone_chamber
at_map_chamber
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "uldaman.h"
+#include "Player.h"
/*######
## mob_jadespine_basilisk
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
index a715dbfce9d..068d00f550f 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp
@@ -25,7 +25,12 @@ SQLUpdate:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "zulaman.h"
#include "Weather.h"
@@ -75,7 +80,9 @@ class boss_akilzon : public CreatureScript
boss_akilzonAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ memset(BirdGUIDs, 0, sizeof(BirdGUIDs));
}
+
InstanceScript* instance;
uint64 BirdGUIDs[8];
@@ -111,8 +118,7 @@ class boss_akilzon : public CreatureScript
CloudGUID = 0;
CycloneGUID = 0;
DespawnSummons();
- for (uint8 i = 0; i < 8; ++i)
- BirdGUIDs[i] = 0;
+ memset(BirdGUIDs, 0, sizeof(BirdGUIDs));
StormCount = 0;
StormSequenceTimer = 0;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
index 3baa6ebdf62..f7f279cf716 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp
@@ -23,9 +23,10 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
-//#include "spell.h"
+#include "SpellInfo.h"
#define YELL_AGGRO "Get on your knees and bow to da fang and claw!"
#define SOUND_AGGRO 12020
@@ -108,6 +109,7 @@ class boss_halazzi : public CreatureScript
if (instance)
instance->SetData(DATA_HALAZZIEVENT, NOT_STARTED);
+ LynxGUID = 0;
TransformCount = 0;
BerserkTimer = 600000;
CheckTimer = 1000;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
index a2125c45689..ed10dec97dd 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
@@ -23,22 +23,23 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
#include "GridNotifiers.h"
+#include "CellImpl.h"
enum eEnums
{
- SAY_AGGRO = -1568000,
- SAY_FIRE_BOMBS = -1568001,
- SAY_SUMMON_HATCHER = -1568002,
- SAY_ALL_EGGS = -1568003,
- SAY_BERSERK = -1568004,
- SAY_SLAY_1 = -1568005,
- SAY_SLAY_2 = -1568006,
- SAY_DEATH = -1568007,
- SAY_EVENT_STRANGERS = -1568008,
- SAY_EVENT_FRIENDS = -1568009,
+ SAY_AGGRO = 0,
+ SAY_FIRE_BOMBS = 1,
+ SAY_SUMMON_HATCHER = 2,
+ SAY_ALL_EGGS = 3,
+ SAY_BERSERK = 4,
+ SAY_SLAY = 5,
+ SAY_DEATH = 6,
+ SAY_EVENT_STRANGERS = 7,
+ SAY_EVENT_FRIENDS = 8,
// Jan'alai
SPELL_FLAME_BREATH = 43140,
@@ -161,7 +162,7 @@ class boss_janalai : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_JANALAIEVENT, DONE);
@@ -169,7 +170,7 @@ class boss_janalai : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void EnterCombat(Unit* /*who*/)
@@ -177,7 +178,7 @@ class boss_janalai : public CreatureScript
if (instance)
instance->SetData(DATA_JANALAIEVENT, IN_PROGRESS);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
// DoZoneInCombat();
}
@@ -246,7 +247,7 @@ class boss_janalai : public CreatureScript
cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange());
}
- //sLog->outError("Eggs %d at middle", templist.size());
+ //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at middle", templist.size());
if (templist.empty())
return false;
@@ -350,7 +351,7 @@ class boss_janalai : public CreatureScript
}
else
{
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
DoCast(me, SPELL_BERSERK, true);
EnrageTimer = 300000;
}
@@ -358,7 +359,7 @@ class boss_janalai : public CreatureScript
if (BombTimer <= diff)
{
- DoScriptText(SAY_FIRE_BOMBS, me);
+ Talk(SAY_FIRE_BOMBS);
me->AttackStop();
me->GetMotionMaster()->Clear();
@@ -391,7 +392,7 @@ class boss_janalai : public CreatureScript
{
if (HealthBelowPct(35))
{
- DoScriptText(SAY_ALL_EGGS, me);
+ Talk(SAY_ALL_EGGS);
me->AttackStop();
me->GetMotionMaster()->Clear();
@@ -405,7 +406,7 @@ class boss_janalai : public CreatureScript
{
if (HatchAllEggs(0))
{
- DoScriptText(SAY_SUMMON_HATCHER, me);
+ Talk(SAY_SUMMON_HATCHER);
me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[0][0][0], hatcherway[0][0][1], hatcherway[0][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[1][0][0], hatcherway[1][0][1], hatcherway[1][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
HatcherTimer = 90000;
@@ -532,7 +533,7 @@ class mob_janalai_hatcher : public CreatureScript
cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange());
}
- //sLog->outError("Eggs %d at %d", templist.size(), side);
+ //sLog->outError(LOG_FILTER_TSCR, "Eggs %d at %d", templist.size(), side);
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end() && num > 0; ++i)
if ((*i)->GetDisplayId() != 11686)
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
index 48a406f22a4..eb3057a74d3 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp
@@ -23,9 +23,12 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
//Trash Waves
float NalorakkWay[8][3] =
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
index 2df202af088..5aa74fbbe89 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp
@@ -22,8 +22,10 @@ SD%Complete: 85%
SDComment:
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulaman.h"
+#include "SpellInfo.h"
//Speech
const char* YELL_TRANSFORM_TO_LYNX = "Let me introduce to you my new bruddahs: fang and claw!";
@@ -314,14 +316,12 @@ class boss_zuljin : public CreatureScript
{
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Temp = NULL;
if (SpiritGUID[i])
{
- Temp = Unit::GetUnit(*me, SpiritGUID[i]);
- if (Temp)
+ if (Unit* temp = Unit::GetUnit(*me, SpiritGUID[i]))
{
- Temp->SetVisible(false);
- Temp->setDeathState(DEAD);
+ temp->SetVisible(false);
+ temp->setDeathState(DEAD);
}
}
SpiritGUID[i] = 0;
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
index 884fe109785..7273ca99c7c 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp
@@ -23,8 +23,11 @@ SDComment:
SDCategory: Zul'Aman
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "zulaman.h"
+#include "Player.h"
+#include "TemporarySummon.h"
#define MAX_ENCOUNTER 6
#define RAND_VENDOR 2
@@ -179,12 +182,13 @@ class instance_zulaman : public InstanceMapScript
std::string GetSaveData()
{
+ OUT_SAVE_INST_DATA;
+
std::ostringstream ss;
ss << "S " << BossKilled << ' ' << ChestLooted << ' ' << QuestMinute;
- char* data = new char[ss.str().length()+1];
- strcpy(data, ss.str().c_str());
- //sLog->outError("TSCR: Zul'aman saved, %s.", data);
- return data;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return ss.str();
}
void Load(const char* load)
@@ -193,17 +197,17 @@ class instance_zulaman : public InstanceMapScript
return;
std::istringstream ss(load);
- //sLog->outError("TSCR: Zul'aman loaded, %s.", ss.str().c_str());
+ //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %s.", ss.str().c_str());
char dataHead; // S
uint16 data1, data2, data3;
ss >> dataHead >> data1 >> data2 >> data3;
- //sLog->outError("TSCR: Zul'aman loaded, %d %d %d.", data1, data2, data3);
+ //sLog->outError(LOG_FILTER_TSCR, "Zul'aman loaded, %d %d %d.", data1, data2, data3);
if (dataHead == 'S')
{
BossKilled = data1;
ChestLooted = data2;
QuestMinute = data3;
- } else sLog->outError("TSCR: Zul'aman: corrupted save data.");
+ } else sLog->outError(LOG_FILTER_TSCR, "Zul'aman: corrupted save data.");
}
void SetData(uint32 type, uint32 data)
@@ -280,7 +284,7 @@ class instance_zulaman : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
index bfb22483b09..61c7bda00ac 100644
--- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
@@ -27,8 +27,12 @@ EndScriptData */
npc_forest_frog
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "zulaman.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## npc_forest_frog
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
index 4ba0c187973..c5639a68860 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp
@@ -23,14 +23,15 @@ SDComment: Wrong cleave and red aura is missing.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
enum eYells
{
- SAY_AGGRO = -1309011,
- SAY_FEAST_PANTHER = -1309012,
- SAY_DEATH = -1309013,
+ SAY_AGGRO = 0,
+ SAY_FEAST_PANTHER = 1,
+ SAY_DEATH = 2,
};
enum eSpells
@@ -105,7 +106,7 @@ class boss_arlokk : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustReachedHome()
@@ -119,7 +120,7 @@ class boss_arlokk : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
me->SetDisplayId(MODEL_ID_NORMAL);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -130,8 +131,8 @@ class boss_arlokk : public CreatureScript
void DoSummonPhanters()
{
- if (Unit* pMarkedTarget = Unit::GetUnit(*me, MarkedTargetGUID))
- DoScriptText(SAY_FEAST_PANTHER, me, pMarkedTarget);
+ if (MarkedTargetGUID)
+ Talk(SAY_FEAST_PANTHER, MarkedTargetGUID);
me->SummonCreature(NPC_ZULIAN_PROWLER, -11532.7998f, -1649.6734f, 41.4800f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(NPC_ZULIAN_PROWLER, -11532.9970f, -1606.4840f, 41.2979f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
@@ -170,7 +171,7 @@ class boss_arlokk : public CreatureScript
MarkedTargetGUID = pMarkedTarget->GetGUID();
}
else
- sLog->outError("TSCR: boss_arlokk could not accuire pMarkedTarget.");
+ sLog->outError(LOG_FILTER_TSCR, "boss_arlokk could not accuire pMarkedTarget.");
m_uiMark_Timer = 15000;
}
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
index ce2fd0848f9..5e553c7396f 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
@@ -23,7 +23,8 @@ SDComment: Massive Geyser with knockback not working. Spell buggy.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_FROSTBREATH 16099
#define SPELL_MASSIVEGEYSER 22421 //Not working. Cause its a summon...
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
index cdd45a3fa0d..8c71ea6d48d 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_grilek.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_AVARTAR 24646 //The Enrage Spell
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
index 9edd82c39b0..7d80de88beb 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp
@@ -23,26 +23,30 @@ SDComment: Blood siphon spell buggy cause of Core Issue.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
-#define SAY_AGGRO -1309020
-#define SAY_FLEEING -1309021
-#define SAY_MINION_DESTROY -1309022 //where does it belong?
-#define SAY_PROTECT_ALTAR -1309023 //where does it belong?
+enum Hakkar
+{
+ SAY_AGGRO = 0,
+ SAY_FLEEING = 1,
+ SAY_MINION_DESTROY = 2, //where does it belong?
+ SAY_PROTECT_ALTAR = 3, //where does it belong?
-#define SPELL_BLOODSIPHON 24322
-#define SPELL_CORRUPTEDBLOOD 24328
-#define SPELL_CAUSEINSANITY 24327 //Not working disabled.
-#define SPELL_WILLOFHAKKAR 24178
-#define SPELL_ENRAGE 24318
+ SPELL_BLOODSIPHON = 24322,
+ SPELL_CORRUPTEDBLOOD = 24328,
+ SPELL_CAUSEINSANITY = 24327, //Not working disabled.
+ SPELL_WILLOFHAKKAR = 24178,
+ SPELL_ENRAGE = 24318,
// The Aspects of all High Priests
-#define SPELL_ASPECT_OF_JEKLIK 24687
-#define SPELL_ASPECT_OF_VENOXIS 24688
-#define SPELL_ASPECT_OF_MARLI 24686
-#define SPELL_ASPECT_OF_THEKAL 24689
-#define SPELL_ASPECT_OF_ARLOKK 24690
+ SPELL_ASPECT_OF_JEKLIK = 24687,
+ SPELL_ASPECT_OF_VENOXIS = 24688,
+ SPELL_ASPECT_OF_MARLI = 24686,
+ SPELL_ASPECT_OF_THEKAL = 24689,
+ SPELL_ASPECT_OF_ARLOKK = 24690
+};
class boss_hakkar : public CreatureScript
{
@@ -107,7 +111,7 @@ class boss_hakkar : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
index 27c46b8e0f2..bb3e0b14e0e 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hazzarah.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_MANABURN 26046
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
index 7d2215f8311..3a2da6fdba9 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp
@@ -23,25 +23,28 @@ SDComment: Problem in finding the right flying batriders for spawning and making
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
-#define SAY_AGGRO -1309002
-#define SAY_RAIN_FIRE -1309003
-#define SAY_DEATH -1309004
-
-#define SPELL_CHARGE 22911
-#define SPELL_SONICBURST 23918
-#define SPELL_SCREECH 6605
-#define SPELL_SHADOW_WORD_PAIN 23952
-#define SPELL_MIND_FLAY 23953
-#define SPELL_CHAIN_MIND_FLAY 26044 //Right ID unknown. So disabled
-#define SPELL_GREATERHEAL 23954
-#define SPELL_BAT_FORM 23966
-
-// Batriders Spell
-
-#define SPELL_BOMB 40332 //Wrong ID but Magmadars bomb is not working...
+enum Jeklik
+{
+ SAY_AGGRO = 0,
+ SAY_RAIN_FIRE = 1,
+ SAY_DEATH = 2,
+
+ SPELL_CHARGE = 22911,
+ SPELL_SONICBURST = 23918,
+ SPELL_SCREECH = 6605,
+ SPELL_SHADOW_WORD_PAIN = 23952,
+ SPELL_MIND_FLAY = 23953,
+ SPELL_CHAIN_MIND_FLAY = 26044, //Right ID unknown. So disabled
+ SPELL_GREATERHEAL = 23954,
+ SPELL_BAT_FORM = 23966,
+
+ // Batriders Spell
+ SPELL_BOMB = 40332 //Wrong ID but Magmadars bomb is not working...
+};
class boss_jeklik : public CreatureScript
{
@@ -90,13 +93,13 @@ class boss_jeklik : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_BAT_FORM);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_JEKLIK, DONE);
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
index f4a17da56fb..844a2b16800 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp
@@ -23,23 +23,27 @@ SDComment: Mind Control not working because of core bug. Shades visible for all.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
-#define SAY_AGGRO -1309014
+enum Jindo
+{
+ SAY_AGGRO = 1,
-#define SPELL_BRAINWASHTOTEM 24262
-#define SPELL_POWERFULLHEALINGWARD 24309 //We will not use this spell. We will summon a totem by script cause the spell totems will not cast.
-#define SPELL_HEX 24053
-#define SPELL_DELUSIONSOFJINDO 24306
-#define SPELL_SHADEOFJINDO 24308 //We will not use this spell. We will summon a shade by script.
+ SPELL_BRAINWASHTOTEM = 24262,
+ SPELL_POWERFULLHEALINGWARD = 24309, //We will not use this spell. We will summon a totem by script cause the spell totems will not cast.
+ SPELL_HEX = 24053,
+ SPELL_DELUSIONSOFJINDO = 24306,
+ SPELL_SHADEOFJINDO = 24308, //We will not use this spell. We will summon a shade by script.
-//Healing Ward Spell
-#define SPELL_HEAL 38588 //Totems are not working right. Right heal spell ID is 24311 but this spell is not casting...
+ //Healing Ward Spell
+ SPELL_HEAL = 38588, //Totems are not working right. Right heal spell ID is 24311 but this spell is not casting...
-//Shade of Jindo Spell
-#define SPELL_SHADOWSHOCK 19460
-#define SPELL_INVISIBLE 24699
+ //Shade of Jindo Spell
+ SPELL_SHADOWSHOCK = 19460,
+ SPELL_INVISIBLE = 24699
+};
class boss_jindo : public CreatureScript
{
@@ -71,7 +75,7 @@ class boss_jindo : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
index cbe1178e6c4..9f3aa315efa 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp
@@ -23,26 +23,32 @@ SDComment: Ohgan function needs improvements.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
-#define SAY_AGGRO -1309015
-#define SAY_DING_KILL -1309016
-#define SAY_GRATS_JINDO -1309017
-#define SAY_WATCH -1309018
-#define SAY_WATCH_WHISPER -1309019 //is this text for real? easter egg?
-
-#define SPELL_CHARGE 24408
-#define SPELL_CLEAVE 7160
-#define SPELL_FEAR 29321
-#define SPELL_WHIRLWIND 15589
-#define SPELL_MORTAL_STRIKE 16856
-#define SPELL_ENRAGE 24318
-#define SPELL_WATCH 24314
-#define SPELL_LEVEL_UP 24312
+enum Mandokir
+{
+ SAY_AGGRO = 0,
+ SAY_DING_KILL = 1,
+ SAY_WATCH = 2,
+ SAY_WATCH_WHISPER = 3, //is this text for real? easter egg?
+ SAY_GRATS_JINDO = 0,
+
+ SPELL_CHARGE = 24408,
+ SPELL_CLEAVE = 7160,
+ SPELL_FEAR = 29321,
+ SPELL_WHIRLWIND = 15589,
+ SPELL_MORTAL_STRIKE = 16856,
+ SPELL_ENRAGE = 24318,
+ SPELL_WATCH = 24314,
+ SPELL_LEVEL_UP = 24312,
//Ohgans Spells
-#define SPELL_SUNDERARMOR 24317
+ SPELL_SUNDERARMOR = 24317,
+
+ NPC_SPEAKER = 11391
+};
class boss_mandokir : public CreatureScript
{
@@ -78,6 +84,7 @@ class boss_mandokir : public CreatureScript
bool someWatched;
bool RaptorDead;
bool CombatStart;
+ bool SpeakerDead;
uint64 WatchTarget;
@@ -102,6 +109,7 @@ class boss_mandokir : public CreatureScript
endWatch = false;
RaptorDead = false;
CombatStart = false;
+ SpeakerDead = false;
DoCast(me, 23243);
}
@@ -114,33 +122,45 @@ class boss_mandokir : public CreatureScript
if (KillCount == 3)
{
- DoScriptText(SAY_DING_KILL, me);
+ Talk(SAY_DING_KILL);
if (instance)
{
uint64 JindoGUID = instance->GetData64(DATA_JINDO);
if (JindoGUID)
{
- if (Unit* jTemp = Unit::GetUnit(*me, JindoGUID))
+ if (Creature* jTemp = Creature::GetCreature(*me, JindoGUID))
{
if (jTemp->isAlive())
- DoScriptText(SAY_GRATS_JINDO, jTemp);
+ jTemp->AI()->Talk(SAY_GRATS_JINDO);
}
}
}
- DoCast(me, SPELL_LEVEL_UP, true);
- KillCount = 0;
+ DoCast(me, SPELL_LEVEL_UP, true);
+ KillCount = 0;
}
}
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
{
+ if (!SpeakerDead)
+ {
+ if (!me->FindNearestCreature(NPC_SPEAKER, 100.0f, true))
+ {
+ me->GetMotionMaster()->MovePoint(0, -12196.3f, -1948.37f, 130.36f);
+ SpeakerDead = true;
+ }
+ }
+
+ if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && SpeakerDead)
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+
if (!UpdateVictim())
return;
@@ -188,7 +208,7 @@ class boss_mandokir : public CreatureScript
{
if (Unit* p = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
- DoScriptText(SAY_WATCH, me, p);
+ Talk(SAY_WATCH, p->GetGUID());
DoCast(p, SPELL_WATCH);
WatchTarget = p->GetGUID();
someWatched = true;
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
index 44ab5d851f5..17b268b92ef 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp
@@ -23,22 +23,26 @@ SDComment: Charging healers and casters not working. Perhaps wrong Spell Timers.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
-#define SAY_AGGRO -1309005
-#define SAY_TRANSFORM -1309006
-#define SAY_SPIDER_SPAWN -1309007
-#define SAY_DEATH -1309008
+enum Marli
+{
+ SAY_AGGRO = 0,
+ SAY_TRANSFORM = 1,
+ SAY_SPIDER_SPAWN = 2,
+ SAY_DEATH = 3,
-#define SPELL_CHARGE 22911
-#define SPELL_ASPECT_OF_MARLI 24686 // A stun spell
-#define SPELL_ENVOLWINGWEB 24110
-#define SPELL_POISONVOLLEY 24099
-#define SPELL_SPIDER_FORM 24084
+ SPELL_CHARGE = 22911,
+ SPELL_ASPECT_OF_MARLI = 24686, // A stun spell
+ SPELL_ENVOLWINGWEB = 24110,
+ SPELL_POISONVOLLEY = 24099,
+ SPELL_SPIDER_FORM = 24084,
//The Spider Spells
-#define SPELL_LEVELUP 24312 //Not right Spell.
+ SPELL_LEVELUP = 24312 //Not right Spell.
+};
class boss_marli : public CreatureScript
{
@@ -85,12 +89,12 @@ class boss_marli : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MARLI, DONE);
}
@@ -116,7 +120,7 @@ class boss_marli : public CreatureScript
if (!Spawned && SpawnStartSpiders_Timer <= diff)
{
- DoScriptText(SAY_SPIDER_SPAWN, me);
+ Talk(SAY_SPIDER_SPAWN);
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (!target)
@@ -154,7 +158,7 @@ class boss_marli : public CreatureScript
if (!PhaseTwo && Transform_Timer <= diff)
{
- DoScriptText(SAY_TRANSFORM, me);
+ Talk(SAY_TRANSFORM);
DoCast(me, SPELL_SPIDER_FORM);
const CreatureTemplate* cinfo = me->GetCreatureTemplate();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
index 81260c28d73..32a8f209917 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_renataki.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_AMBUSH 24337
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
index 3da74d16dc3..3ea5d932ab0 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp
@@ -23,14 +23,15 @@ SDComment: Almost finished.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
-#define SAY_AGGRO -1309009
-#define SAY_DEATH -1309010
-
-enum eSpells
+enum Thekal
{
+ SAY_AGGRO = 0,
+ SAY_DEATH = 1,
+
SPELL_MORTALCLEAVE = 22859,
SPELL_SILENCE = 22666,
SPELL_FRENZY = 8269,
@@ -52,7 +53,7 @@ enum eSpells
SPELL_SINISTERSTRIKE = 15581,
SPELL_GOUGE = 12540,
SPELL_KICK = 15614,
- SPELL_BLIND = 21060,
+ SPELL_BLIND = 21060
};
class boss_thekal : public CreatureScript
@@ -105,12 +106,12 @@ class boss_thekal : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_THEKAL, DONE);
}
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
index b22630f51bb..6cdb00236df 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_wushoolay.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "zulgurub.h"
#define SPELL_LIGHTNINGCLOUD 25033
diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
index e3dd5d5933b..8d17a18bb1b 100644
--- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
+++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp
@@ -23,7 +23,8 @@ SDComment: Missing reset function after killing a boss for Ohgan, Thekal.
SDCategory: Zul'Gurub
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "zulgurub.h"
class instance_zulgurub : public InstanceMapScript
@@ -112,7 +113,7 @@ class instance_zulgurub : public InstanceMapScript
}
}
- uint32 GetData(uint32 uiType)
+ uint32 GetData(uint32 uiType) const
{
switch (uiType)
{
@@ -136,7 +137,7 @@ class instance_zulgurub : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 uiData)
+ uint64 GetData64(uint32 uiData) const
{
switch (uiData)
{
@@ -162,4 +163,4 @@ class instance_zulgurub : public InstanceMapScript
void AddSC_instance_zulgurub()
{
new instance_zulgurub();
-} \ No newline at end of file
+}
diff --git a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp
index e4b24dc00ee..b56727b18e1 100644
--- a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp
@@ -26,7 +26,8 @@ EndScriptData */
/* ContentData
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
/*void AddSC_alterac_mountains()
{
diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
index d4d35b107b2..7f96706f48e 100644
--- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
+++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp
@@ -27,8 +27,10 @@ EndScriptData */
npc_professor_phizzlethorpe
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_professor_phizzlethorpe
diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp
index 2042e5313c3..47fb8298ca7 100644
--- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp
+++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp
@@ -27,7 +27,10 @@ EndScriptData */
npc_deathly_usher
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npc_deathly_usher
@@ -58,7 +61,7 @@ public:
bool OnGossipHello(Player* player, Creature* creature)
{
- if (player->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(10757, 1))
+ if (player->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(10757))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp
index 8749c943a6f..6a1ba633660 100644
--- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp
+++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp
@@ -23,7 +23,8 @@ SDComment: Highlord Kruul are presumably no longer in-game on regular bases, how
SDCategory: Bosses
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_SHADOWVOLLEY 21341
#define SPELL_CLEAVE 20677
diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp
index b526246f670..ba1d339730a 100644
--- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp
+++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp
@@ -27,7 +27,10 @@ EndScriptData */
npc_ragged_john
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npc_ragged_john
diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp
index 10cb5987ce5..fbb98979e77 100644
--- a/src/server/scripts/EasternKingdoms/duskwood.cpp
+++ b/src/server/scripts/EasternKingdoms/duskwood.cpp
@@ -23,7 +23,9 @@ SDComment: Quest Support:8735
SDCategory: Duskwood
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
enum Yells
{
diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
index 0519ce94b32..c9b60f847e8 100644
--- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
@@ -30,7 +30,11 @@ npc_darrowshire_spirit
npc_tirion_fordring
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
+#include "WorldSession.h"
class mobs_ghoul_flayer : public CreatureScript
{
diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp
index 8ae72e142c8..c5f9522b23d 100644
--- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp
+++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp
@@ -31,8 +31,11 @@ npc_kelerun_bloodmourn
go_harbinger_second_trial
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## Quest 9686 Second Trial
@@ -514,9 +517,12 @@ public:
## npc_infused_crystal
######*/
-#define MOB_ENRAGED_WRAITH 17086
-#define EMOTE -1000283
-#define QUEST_POWERING_OUR_DEFENSES 8490
+enum InfusedCrystal
+{
+ MOB_ENRAGED_WRAITH = 17086,
+ EMOTE = 0,
+ QUEST_POWERING_OUR_DEFENSES = 8490
+};
struct Location
{
@@ -594,7 +600,7 @@ public:
{
if (EndTimer < diff && Progress)
{
- DoScriptText(EMOTE, me);
+ Talk(EMOTE);
Completed = true;
if (PlayerGUID)
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp
index e40a2f785e6..ddd3b0f423a 100644
--- a/src/server/scripts/EasternKingdoms/ghostlands.cpp
+++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp
@@ -30,8 +30,12 @@ npc_rathis_tomber
npc_ranger_lilatha
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npc_budd_nedreck
@@ -107,18 +111,18 @@ public:
enum eEnums
{
- SAY_START = -1000140,
- SAY_PROGRESS1 = -1000141,
- SAY_PROGRESS2 = -1000142,
- SAY_PROGRESS3 = -1000143,
- SAY_END1 = -1000144,
- SAY_END2 = -1000145,
- SAY_CAPTAIN_ANSWER = -1000146,
+ SAY_START = 0,
+ SAY_PROGRESS1 = 1,
+ SAY_PROGRESS2 = 2,
+ SAY_PROGRESS3 = 3,
+ SAY_END1 = 4,
+ SAY_END2 = 5,
+ SAY_CAPTAIN_ANSWER = 0,
QUEST_ESCAPE_FROM_THE_CATACOMBS = 9212,
- GO_CAGE = 181152,
- NPC_CAPTAIN_HELIOS = 16220,
- FACTION_SMOON_E = 1603,
+ GO_CAGE = 181152,
+ NPC_CAPTAIN_HELIOS = 16220,
+ FACTION_SMOON_E = 1603
};
class npc_ranger_lilatha : public CreatureScript
@@ -142,18 +146,18 @@ public:
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_ACTIVE);
- DoScriptText(SAY_START, me, player);
+ Talk(SAY_START, player->GetGUID());
break;
case 5:
- DoScriptText(SAY_PROGRESS1, me, player);
+ Talk(SAY_PROGRESS1, player->GetGUID());
break;
case 11:
- DoScriptText(SAY_PROGRESS2, me, player);
+ Talk(SAY_PROGRESS2, player->GetGUID());
me->SetOrientation(4.762841f);
break;
case 18:
{
- DoScriptText(SAY_PROGRESS3, me, player);
+ Talk(SAY_PROGRESS3, player->GetGUID());
Creature* Summ1 = me->SummonCreature(16342, 7627.083984f, -7532.538086f, 152.128616f, 1.082733f, TEMPSUMMON_DEAD_DESPAWN, 0);
Creature* Summ2 = me->SummonCreature(16343, 7620.432129f, -7532.550293f, 152.454865f, 0.827478f, TEMPSUMMON_DEAD_DESPAWN, 0);
if (Summ1 && Summ2)
@@ -176,14 +180,14 @@ public:
break;
case 32:
me->SetOrientation(2.978281f);
- DoScriptText(SAY_END1, me, player);
+ Talk(SAY_END1, player->GetGUID());
break;
case 33:
me->SetOrientation(5.858011f);
- DoScriptText(SAY_END2, me, player);
- Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
+ Talk(SAY_END2, player->GetGUID());
+ Creature* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
if (CaptainHelios)
- DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, player);
+ CaptainHelios->AI()->Talk(SAY_CAPTAIN_ANSWER, player->GetGUID());
break;
}
}
diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp
index 8de895cb51f..544ea0fd175 100644
--- a/src/server/scripts/EasternKingdoms/hinterlands.cpp
+++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp
@@ -28,8 +28,10 @@ npc_00x09hl
npc_rinji
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_00x09hl
@@ -37,11 +39,11 @@ EndContentData */
enum eOOX
{
- SAY_OOX_START = -1000287,
- SAY_OOX_AGGRO1 = -1000288,
- SAY_OOX_AGGRO2 = -1000289,
- SAY_OOX_AMBUSH = -1000290,
- SAY_OOX_END = -1000292,
+ SAY_OOX_START = 0,
+ SAY_OOX_AGGRO = 1,
+ SAY_OOX_AMBUSH = 3,
+ SAY_OOX_AMBUSH_REPLY = 4,
+ SAY_OOX_END = 5,
QUEST_RESQUE_OOX_09 = 836,
@@ -68,7 +70,7 @@ public:
else if (player->GetTeam() == HORDE)
creature->setFaction(FACTION_ESCORTEE_H);
- DoScriptText(SAY_OOX_START, creature, player);
+ creature->AI()->Talk(SAY_OOX_START, player->GetGUID());
if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
@@ -92,13 +94,13 @@ public:
switch (waypointId)
{
case 26:
- DoScriptText(SAY_OOX_AMBUSH, me);
+ Talk(SAY_OOX_AMBUSH);
break;
case 43:
- DoScriptText(SAY_OOX_AMBUSH, me);
+ Talk(SAY_OOX_AMBUSH);
break;
case 64:
- DoScriptText(SAY_OOX_END, me);
+ Talk(SAY_OOX_END);
if (Player* player = GetPlayerForEscort())
player->GroupEventHappens(QUEST_RESQUE_OOX_09, me);
break;
@@ -135,10 +137,7 @@ public:
if (who->GetEntry() == NPC_MARAUDING_OWL || who->GetEntry() == NPC_VILE_AMBUSHER)
return;
- if (rand()%1)
- DoScriptText(SAY_OOX_AGGRO1, me);
- else
- DoScriptText(SAY_OOX_AGGRO2, me);
+ Talk(SAY_OOX_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -154,13 +153,13 @@ public:
enum eRinji
{
- SAY_RIN_FREE = -1000403, //from here
- SAY_RIN_BY_OUTRUNNER = -1000404,
- SAY_RIN_HELP_1 = -1000405,
- SAY_RIN_HELP_2 = -1000406, //to here, are used also by 6182 but this is wrong...
- SAY_RIN_COMPLETE = -1000407,
- SAY_RIN_PROGRESS_1 = -1000408,
- SAY_RIN_PROGRESS_2 = -1000409,
+ SAY_RIN_BY_OUTRUNNER = 0,
+
+ SAY_RIN_FREE = 0, //from here
+ SAY_RIN_HELP = 1,
+ SAY_RIN_COMPLETE = 2,
+ SAY_RIN_PROGRESS_1 = 3,
+ SAY_RIN_PROGRESS_2 = 4,
QUEST_RINJI_TRAPPED = 2742,
NPC_RANGER = 2694,
@@ -241,7 +240,8 @@ public:
{
if (who->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner)
{
- DoScriptText(SAY_RIN_BY_OUTRUNNER, who);
+ if (Creature* talker = who->ToCreature())
+ talker->AI()->Talk(SAY_RIN_BY_OUTRUNNER);
m_bIsByOutrunner = true;
}
@@ -249,7 +249,7 @@ public:
return;
//only if attacked and escorter is not in combat?
- DoScriptText(RAND(SAY_RIN_HELP_1, SAY_RIN_HELP_2), me);
+ Talk(SAY_RIN_HELP);
}
}
@@ -285,7 +285,7 @@ public:
switch (waypointId)
{
case 1:
- DoScriptText(SAY_RIN_FREE, me, player);
+ Talk(SAY_RIN_FREE, player->GetGUID());
break;
case 7:
DoSpawnAmbush(true);
@@ -294,7 +294,7 @@ public:
DoSpawnAmbush(false);
break;
case 17:
- DoScriptText(SAY_RIN_COMPLETE, me, player);
+ Talk(SAY_RIN_COMPLETE, player->GetGUID());
player->GroupEventHappens(QUEST_RINJI_TRAPPED, me);
SetRun();
m_uiPostEventCount = 1;
@@ -318,11 +318,11 @@ public:
switch (m_uiPostEventCount)
{
case 1:
- DoScriptText(SAY_RIN_PROGRESS_1, me, player);
+ Talk(SAY_RIN_PROGRESS_1, player->GetGUID());
++m_uiPostEventCount;
break;
case 2:
- DoScriptText(SAY_RIN_PROGRESS_2, me, player);
+ Talk(SAY_RIN_PROGRESS_2, player->GetGUID());
m_uiPostEventCount = 0;
break;
}
diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp
index 93a8d7423c9..fdd9f5f9a86 100644
--- a/src/server/scripts/EasternKingdoms/ironforge.cpp
+++ b/src/server/scripts/EasternKingdoms/ironforge.cpp
@@ -27,7 +27,10 @@ EndScriptData */
npc_royal_historian_archesonus
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npc_royal_historian_archesonus
diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
index 27d8ea3e51c..5625b6994d7 100644
--- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
+++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp
@@ -28,16 +28,22 @@ npc_converted_sentry
npc_greengill_slave
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
+#include "Pet.h"
+#include "SpellInfo.h"
/*######
## npc_converted_sentry
######*/
+enum ConvertedSentry
+{
+ SAY_CONVERTED = 0,
-#define SAY_CONVERTED_1 -1000188
-#define SAY_CONVERTED_2 -1000189
+ SPELL_CONVERT_CREDIT = 45009
+};
-#define SPELL_CONVERT_CREDIT 45009
class npc_converted_sentry : public CreatureScript
{
@@ -71,11 +77,7 @@ public:
{
if (Timer <= diff)
{
- uint32 i = urand(1, 2);
- if (i == 1)
- DoScriptText(SAY_CONVERTED_1, me);
- else
- DoScriptText(SAY_CONVERTED_2, me);
+ Talk(SAY_CONVERTED);
DoCast(me, SPELL_CONVERT_CREDIT);
if (me->isPet())
diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp
index 7ea8a62a5bd..0937e3cbb30 100644
--- a/src/server/scripts/EasternKingdoms/loch_modan.cpp
+++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp
@@ -27,7 +27,10 @@ EndScriptData */
npc_mountaineer_pebblebitty
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npc_mountaineer_pebblebitty
diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp
index 3ade1da4a19..9fa8ac70eed 100644
--- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp
+++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp
@@ -21,18 +21,20 @@ SD%Complete: 100%
SDComment: Support for quest 219.
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
enum eCorporalKeeshan
{
QUEST_MISSING_IN_ACTION = 219,
- SAY_CORPORAL_1 = -1000464,
- SAY_CORPORAL_2 = -1000465,
- SAY_CORPORAL_3 = -1000466,
- SAY_CORPORAL_4 = -1000467,
- SAY_CORPORAL_5 = -1000468,
+ SAY_CORPORAL_1 = 0,
+ SAY_CORPORAL_2 = 1,
+ SAY_CORPORAL_3 = 2,
+ SAY_CORPORAL_4 = 3,
+ SAY_CORPORAL_5 = 4,
SPELL_MOCKING_BLOW = 21008,
SPELL_SHIELD_BASH = 11972,
@@ -48,7 +50,7 @@ public:
if (quest->GetQuestId() == QUEST_MISSING_IN_ACTION)
{
CAST_AI(npc_corporal_keeshan::npc_corporal_keeshanAI, creature->AI())->Start(true, false, player->GetGUID(), quest);
- DoScriptText(SAY_CORPORAL_1, creature);
+ creature->AI()->Talk(SAY_CORPORAL_1);
}
return false;
@@ -122,23 +124,23 @@ public:
uiPhase = 2;
break;
case 2:
- DoScriptText(SAY_CORPORAL_2, me);
+ Talk(SAY_CORPORAL_2);
uiTimer = 15000;
uiPhase = 3;
break;
case 3:
- DoScriptText(SAY_CORPORAL_3, me);
+ Talk(SAY_CORPORAL_3);
me->SetStandState(UNIT_STAND_STATE_STAND);
SetEscortPaused(false);
uiTimer = 0;
uiPhase = 0;
break;
case 4:
- DoScriptText(SAY_CORPORAL_4, me);
+ Talk(SAY_CORPORAL_4);
uiTimer = 2500;
uiPhase = 5;
case 5:
- DoScriptText(SAY_CORPORAL_5, me);
+ Talk(SAY_CORPORAL_5);
uiTimer = 0;
uiPhase = 0;
}
diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
index e6595a83b66..d8e9a9ae49a 100644
--- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
+++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp
@@ -27,14 +27,17 @@ EndScriptData */
npc_blood_knight_stillblade
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*#######
# npc_blood_knight_stillblade
#######*/
enum eStillbladeData
{
- SAY_HEAL = -1000193,
+ SAY_HEAL = 0,
QUEST_REDEEMING_THE_DEAD = 9685,
SPELL_SHIMMERING_VESSEL = 31225,
@@ -95,7 +98,7 @@ public:
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
//me->RemoveAllAuras();
- DoScriptText(SAY_HEAL, me);
+ Talk(SAY_HEAL);
spellHit = true;
}
}
diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
index bc3110878de..1960d90f28f 100644
--- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
+++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp
@@ -28,8 +28,10 @@ npc_deathstalker_erland
pyrewood_ambush
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_deathstalker_erland
@@ -37,20 +39,19 @@ EndContentData */
enum eErland
{
- SAY_QUESTACCEPT = -1000306,
- SAY_START = -1000307,
- SAY_AGGRO_1 = -1000308,
- SAY_AGGRO_2 = -1000309,
- SAY_LAST = -1000310,
+ SAY_QUESTACCEPT = 0,
+ SAY_START = 1,
+ SAY_AGGRO = 2,
+ SAY_PROGRESS = 3,
+ SAY_LAST = 4,
- SAY_THANKS = -1000311,
- SAY_RANE = -1000312,
- SAY_ANSWER = -1000313,
- SAY_MOVE_QUINN = -1000314,
+ SAY_RANE = 0,
+ SAY_RANE_ANSWER = 5,
+ SAY_MOVE_QUINN = 6,
- SAY_GREETINGS = -1000315,
- SAY_QUINN = -1000316,
- SAY_ON_BYE = -1000317,
+ SAY_QUINN = 7,
+ SAY_QUINN_ANSWER = 0,
+ SAY_BYE = 8,
QUEST_ESCORTING = 435,
NPC_RANE = 1950,
@@ -75,34 +76,34 @@ public:
switch (waypointId)
{
case 1:
- DoScriptText(SAY_START, me, player);
+ Talk(SAY_START, player->GetGUID());
+ break;
+ case 10:
+ Talk(SAY_PROGRESS);
break;
case 13:
- DoScriptText(SAY_LAST, me, player);
+ Talk(SAY_LAST, player->GetGUID());
player->GroupEventHappens(QUEST_ESCORTING, me);
break;
- case 14:
- DoScriptText(SAY_THANKS, me, player);
- break;
case 15:
- if (Unit* Rane = me->FindNearestCreature(NPC_RANE, 20))
- DoScriptText(SAY_RANE, Rane);
+ if (Creature* rane = me->FindNearestCreature(NPC_RANE, 20.0f))
+ rane->AI()->Talk(SAY_RANE);
break;
case 16:
- DoScriptText(SAY_ANSWER, me);
+ Talk(SAY_RANE_ANSWER);
break;
case 17:
- DoScriptText(SAY_MOVE_QUINN, me);
+ Talk(SAY_MOVE_QUINN);
break;
case 24:
- DoScriptText(SAY_GREETINGS, me);
+ Talk(SAY_QUINN);
break;
case 25:
- if (Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20))
- DoScriptText(SAY_QUINN, Quinn);
+ if (Creature* quinn = me->FindNearestCreature(NPC_QUINN, 20.0f))
+ quinn->AI()->Talk(SAY_QUINN_ANSWER);
break;
case 26:
- DoScriptText(SAY_ON_BYE, me, NULL);
+ Talk(SAY_BYE);
break;
}
}
@@ -111,7 +112,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me, who);
+ Talk(SAY_AGGRO, who->GetGUID());
}
};
@@ -119,7 +120,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ESCORTING)
{
- DoScriptText(SAY_QUESTACCEPT, creature, player);
+ creature->AI()->Talk(SAY_QUESTACCEPT, player->GetGUID());
if (npc_escortAI* pEscortAI = CAST_AI(npc_deathstalker_erland::npc_deathstalker_erlandAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());
@@ -229,22 +230,18 @@ public:
{
if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
{
- Player* player = NULL;
Unit* target = NULL;
if (PlayerGUID)
- {
- player = Unit::GetPlayer(*me, PlayerGUID);
- if (player)
- target = RAND((Unit*)me, (Unit*)player);
- } else
+ if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
+ if (player->isAlive() && RAND(0, 1))
+ target = player;
+
+ if (!target)
target = me;
- if (target)
- {
- summoned->setFaction(168);
- summoned->AddThreat(target, 32.0f);
- summoned->AI()->AttackStart(target);
- }
+ summoned->setFaction(168);
+ summoned->AddThreat(target, 32.0f);
+ summoned->AI()->AttackStart(target);
}
}
@@ -258,7 +255,7 @@ public:
void UpdateAI(const uint32 diff)
{
- //sLog->outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
+ //sLog->outInfo(LOG_FILTER_TSCR, "DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer);
if (!QuestInProgress)
return;
diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp
index 96ad1da725d..47717526aaa 100644
--- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp
+++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp
@@ -33,8 +33,11 @@ npc_marzon_silent_blade
npc_lord_gregor_lescovar
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_archmage_malin
@@ -203,13 +206,13 @@ public:
enum eLordGregorLescovar
{
- SAY_LESCOVAR_2 = -1000457,
- SAY_GUARD_2 = -1000458,
- SAY_LESCOVAR_3 = -1000459,
- SAY_MARZON_1 = -1000460,
- SAY_LESCOVAR_4 = -1000461,
- SAY_TYRION_2 = -1000462,
- SAY_MARZON_2 = -1000463,
+ SAY_GUARD_2 = 0,
+ SAY_LESCOVAR_2 = 0,
+ SAY_LESCOVAR_3 = 1,
+ SAY_LESCOVAR_4 = 2,
+ SAY_MARZON_1 = 0,
+ SAY_MARZON_2 = 1,
+ SAY_TYRION_2 = 1,
NPC_STORMWIND_ROYAL = 1756,
NPC_MARZON_BLADE = 1755,
@@ -274,7 +277,7 @@ public:
{
case 14:
SetEscortPaused(true);
- DoScriptText(SAY_LESCOVAR_2, me);
+ Talk(SAY_LESCOVAR_2);
uiTimer = 3000;
uiPhase = 1;
break;
@@ -315,7 +318,7 @@ public:
{
case 1:
if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true))
- DoScriptText(SAY_GUARD_2, pGuard);
+ pGuard->AI()->Talk(SAY_GUARD_2);
uiTimer = 3000;
uiPhase = 2;
break;
@@ -330,18 +333,18 @@ public:
uiPhase = 0;
break;
case 4:
- DoScriptText(SAY_LESCOVAR_3, me);
+ Talk(SAY_LESCOVAR_3);
uiTimer = 0;
uiPhase = 0;
break;
case 5:
if (Creature* pMarzon = Unit::GetCreature(*me, MarzonGUID))
- DoScriptText(SAY_MARZON_1, pMarzon);
+ pMarzon->AI()->Talk(SAY_MARZON_1);
uiTimer = 3000;
uiPhase = 6;
break;
case 6:
- DoScriptText(SAY_LESCOVAR_4, me);
+ Talk(SAY_LESCOVAR_4);
if (Player* player = GetPlayerForEscort())
player->AreaExploredOrEventHappens(QUEST_THE_ATTACK);
uiTimer = 2000;
@@ -349,7 +352,7 @@ public:
break;
case 7:
if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true))
- DoScriptText(SAY_TYRION_2, pTyrion);
+ pTyrion->AI()->Talk(SAY_TYRION_2);
if (Creature* pMarzon = Unit::GetCreature(*me, MarzonGUID))
pMarzon->setFaction(14);
me->setFaction(14);
@@ -397,7 +400,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_MARZON_2, me);
+ Talk(SAY_MARZON_2);
if (me->isSummon())
{
@@ -461,14 +464,14 @@ public:
enum eTyrionSpybot
{
- SAY_QUEST_ACCEPT_ATTACK = -1000499,
- SAY_TYRION_1 = -1000450,
- SAY_SPYBOT_1 = -1000451,
- SAY_GUARD_1 = -1000452,
- SAY_SPYBOT_2 = -1000453,
- SAY_SPYBOT_3 = -1000454,
- SAY_LESCOVAR_1 = -1000455,
- SAY_SPYBOT_4 = -1000456,
+ SAY_QUEST_ACCEPT_ATTACK = 0,
+ SAY_SPYBOT_1 = 1,
+ SAY_SPYBOT_2 = 2,
+ SAY_SPYBOT_3 = 3,
+ SAY_SPYBOT_4 = 4,
+ SAY_TYRION_1 = 0,
+ SAY_GUARD_1 = 1,
+ SAY_LESCOVAR_1 = 3,
NPC_PRIESTESS_TYRIONA = 7779,
NPC_LORD_GREGOR_LESCOVAR = 1754,
@@ -508,13 +511,13 @@ public:
break;
case 5:
SetEscortPaused(true);
- DoScriptText(SAY_SPYBOT_1, me);
+ Talk(SAY_SPYBOT_1);
uiTimer = 2000;
uiPhase = 5;
break;
case 17:
SetEscortPaused(true);
- DoScriptText(SAY_SPYBOT_3, me);
+ Talk(SAY_SPYBOT_3);
uiTimer = 3000;
uiPhase = 8;
break;
@@ -530,13 +533,13 @@ public:
switch (uiPhase)
{
case 1:
- DoScriptText(SAY_QUEST_ACCEPT_ATTACK, me);
+ Talk(SAY_QUEST_ACCEPT_ATTACK);
uiTimer = 3000;
uiPhase = 2;
break;
case 2:
if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 10.0f))
- DoScriptText(SAY_TYRION_1, pTyrion);
+ pTyrion->AI()->Talk(SAY_TYRION_1);
uiTimer = 3000;
uiPhase = 3;
break;
@@ -552,12 +555,12 @@ public:
break;
case 5:
if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true))
- DoScriptText(SAY_GUARD_1, pGuard);
+ pGuard->AI()->Talk(SAY_GUARD_1);
uiTimer = 3000;
uiPhase = 6;
break;
case 6:
- DoScriptText(SAY_SPYBOT_2, me);
+ Talk(SAY_SPYBOT_2);
uiTimer = 3000;
uiPhase = 7;
break;
@@ -568,12 +571,12 @@ public:
break;
case 8:
if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR, 10.0f))
- DoScriptText(SAY_LESCOVAR_1, pLescovar);
+ pLescovar->AI()->Talk(SAY_LESCOVAR_1);
uiTimer = 3000;
uiPhase = 9;
break;
case 9:
- DoScriptText(SAY_SPYBOT_4, me);
+ Talk(SAY_SPYBOT_4);
uiTimer = 3000;
uiPhase = 10;
break;
diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
index 03f92ce6d61..2217eba7d1b 100644
--- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
+++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp
@@ -27,7 +27,10 @@ EndScriptData */
mob_yenniku
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## mob_yenniku
diff --git a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp
index 6507ec911c0..099bc0770b7 100644
--- a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp
+++ b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp
@@ -16,8 +16,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_galen_goodward
@@ -29,13 +31,12 @@ enum Galen
GO_GALENS_CAGE = 37118,
- SAY_PERIODIC = -1000500,
- SAY_QUEST_ACCEPTED = -1000501,
- SAY_ATTACKED_1 = -1000502,
- SAY_ATTACKED_2 = -1000503,
- SAY_QUEST_COMPLETE = -1000504,
- EMOTE_WHISPER = -1000505,
- EMOTE_DISAPPEAR = -1000506
+ SAY_PERIODIC = 0,
+ SAY_QUEST_ACCEPTED = 1,
+ SAY_ATTACKED = 2,
+ SAY_QUEST_COMPLETE = 3,
+ EMOTE_WHISPER = 4,
+ EMOTE_DISAPPEAR = 5,
};
class npc_galen_goodward : public CreatureScript
@@ -50,7 +51,7 @@ public:
{
CAST_AI(npc_galen_goodward::npc_galen_goodwardAI, creature->AI())->Start(false, false, player->GetGUID());
creature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
- DoScriptText(SAY_QUEST_ACCEPTED, creature);
+ creature->AI()->Talk(SAY_QUEST_ACCEPTED);
}
return true;
}
@@ -79,7 +80,7 @@ public:
void EnterCombat(Unit* who)
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
- DoScriptText(RAND(SAY_ATTACKED_1, SAY_ATTACKED_2), me, who);
+ Talk(SAY_ATTACKED, who->GetGUID());
}
void WaypointStart(uint32 uiPointId)
@@ -101,7 +102,7 @@ public:
break;
}
case 21:
- DoScriptText(EMOTE_DISAPPEAR, me);
+ Talk(EMOTE_DISAPPEAR);
break;
}
}
@@ -118,8 +119,8 @@ public:
if (Player* player = GetPlayerForEscort())
{
me->SetFacingToObject(player);
- DoScriptText(SAY_QUEST_COMPLETE, me, player);
- DoScriptText(EMOTE_WHISPER, me, player);
+ Talk(SAY_QUEST_COMPLETE, player->GetGUID());
+ Talk(EMOTE_WHISPER, player->GetGUID());
player->GroupEventHappens(QUEST_GALENS_ESCAPE, me);
}
SetRun(true);
@@ -137,7 +138,7 @@ public:
if (m_uiPeriodicSay < uiDiff)
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- DoScriptText(SAY_PERIODIC, me);
+ Talk(SAY_PERIODIC);
m_uiPeriodicSay = 15000;
}
else
diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp
index 4687fa3630f..22cd971a081 100644
--- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp
+++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp
@@ -29,15 +29,17 @@ go_mausoleum_door
go_mausoleum_trigger
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
/*######
## npc_calvin_montague
######*/
-enum eCalvin
+enum Calvin
{
- SAY_COMPLETE = -1000431,
+ SAY_COMPLETE = 0,
SPELL_DRINK = 2639, // possibly not correct spell (but iconId is correct)
QUEST_590 = 590,
FACTION_HOSTILE = 168
@@ -111,22 +113,22 @@ public:
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(uint32 const diff)
{
if (m_uiPhase)
{
- if (m_uiPhaseTimer <= uiDiff)
+ if (m_uiPhaseTimer <= diff)
m_uiPhaseTimer = 7500;
else
{
- m_uiPhaseTimer -= uiDiff;
+ m_uiPhaseTimer -= diff;
return;
}
switch (m_uiPhase)
{
case 1:
- DoScriptText(SAY_COMPLETE, me);
+ Talk(SAY_COMPLETE);
++m_uiPhase;
break;
case 2:
diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp
index a9b627ded34..05938452520 100644
--- a/src/server/scripts/EasternKingdoms/undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/undercity.cpp
@@ -29,7 +29,10 @@ npc_highborne_lamenter
npc_parqual_fintallas
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npc_lady_sylvanas_windrunner
@@ -38,8 +41,8 @@ EndContentData */
enum Sylvanas
{
QUEST_JOURNEY_TO_UNDERCITY = 9180,
- SAY_LAMENT_END = -1000196,
- EMOTE_LAMENT_END = -1000197,
+ EMOTE_LAMENT_END = 0,
+ SAY_LAMENT_END = 1,
SOUND_CREDIT = 10896,
ENTRY_HIGHBORNE_LAMENTER = 21628,
@@ -150,8 +153,8 @@ public:
LamentEventTimer = 2000;
if (!me->HasAura(SPELL_SYLVANAS_CAST))
{
- DoScriptText(SAY_LAMENT_END, me);
- DoScriptText(EMOTE_LAMENT_END, me);
+ Talk(SAY_LAMENT_END);
+ Talk(EMOTE_LAMENT_END);
LamentEvent = false;
}
} else LamentEventTimer -= diff;
@@ -173,13 +176,13 @@ public:
if (me->GetDistance(victim) > 10.0f)
DoCast(victim, SPELL_MULTI_SHOT);
} else FadeTimer -= diff;
-
+
if (SummonSkeletonTimer <= diff)
{
DoCast(me, SPELL_SUMMON_SKELETON);
SummonSkeletonTimer = 20000 + rand()%10000;
} else SummonSkeletonTimer -= diff;
-
+
if (BlackArrowTimer <= diff)
{
if (Unit* victim = me->getVictim())
@@ -188,7 +191,7 @@ public:
BlackArrowTimer = 15000 + rand()%5000;
}
} else BlackArrowTimer -= diff;
-
+
if (ShotTimer <= diff)
{
if (Unit* victim = me->getVictim())
@@ -197,7 +200,7 @@ public:
ShotTimer = 8000 + rand()%2000;
}
} else ShotTimer -= diff;
-
+
if (MultiShotTimer <= diff)
{
if (Unit* victim = me->getVictim())
@@ -205,7 +208,7 @@ public:
DoCast(victim, SPELL_MULTI_SHOT);
MultiShotTimer = 10000 + rand()%3000;
}
- } else MultiShotTimer -= diff;
+ } else MultiShotTimer -= diff;
DoMeleeAttackIfReady();
}
diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
index 0057c01b882..79b49b6a438 100644
--- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
+++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp
@@ -30,8 +30,12 @@ npc_the_scourge_cauldron
npc_andorhal_tower
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npcs_dithers_and_arbington
@@ -277,13 +281,13 @@ enum eTruuen
QUEST_TOMB_LIGHTBRINGER = 9446,
- SAY_WP_0 = -1800064, //Beware! We are attacked!
- SAY_WP_1 = -1800065, //It must be the purity of the Mark of the Lightbringer that is drawing forth the Scourge to attack us. We must proceed with caution lest we be overwhelmed!
- SAY_WP_2 = -1800066, //This land truly needs to be cleansed by the Light! Let us continue on to the tomb. It isn't far now...
- SAY_WP_3 = -1800067, //Be welcome, friends!
- SAY_WP_4 = -1800068, //Thank you for coming here in remembrance of me. Your efforts in recovering that symbol, while unnecessary, are certainly touching to an old man's heart.
- SAY_WP_5 = -1800069, //Please, rise my friend. Keep the Blessing as a symbol of the strength of the Light and how heroes long gone might once again rise in each of us to inspire.
- SAY_WP_6 = -1800070 //Thank you my friend for making this possible. This is a day that I shall never forget! I think I will stay a while. Please return to High Priestess MacDonnell at the camp. I know that she'll be keenly interested to know of what has transpired here.
+ SAY_WP_0 = 0, //Beware! We are attacked!
+ SAY_WP_1 = 1, //It must be the purity of the Mark of the Lightbringer that is drawing forth the Scourge to attack us. We must proceed with caution lest we be overwhelmed!
+ SAY_WP_2 = 2, //This land truly needs to be cleansed by the Light! Let us continue on to the tomb. It isn't far now...
+ SAY_WP_3 = 0, //Be welcome, friends!
+ SAY_WP_4 = 0, //Thank you for coming here in remembrance of me. Your efforts in recovering that symbol, while unnecessary, are certainly touching to an old man's heart.
+ SAY_WP_5 = 1, //Please, rise my friend. Keep the Blessing as a symbol of the strength of the Light and how heroes long gone might once again rise in each of us to inspire.
+ SAY_WP_6 = 2 //Thank you my friend for making this possible. This is a day that I shall never forget! I think I will stay a while. Please return to High Priestess MacDonnell at the camp. I know that she'll be keenly interested to know of what has transpired here.
};
class npc_anchorite_truuen : public CreatureScript
@@ -335,12 +339,12 @@ public:
switch (waypointId)
{
case 8:
- DoScriptText(SAY_WP_0, me);
+ Talk(SAY_WP_0);
me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
break;
case 9:
- DoScriptText(SAY_WP_1, me);
+ Talk(SAY_WP_1);
break;
case 14:
me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
@@ -349,25 +353,31 @@ public:
me->SummonCreature(NPC_GHOUL, me->GetPositionX()+8.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000);
break;
case 15:
- DoScriptText(SAY_WP_2, me);
+ Talk(SAY_WP_2);
case 21:
Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150);
- DoScriptText(SAY_WP_3, Theldanis);
+ if (Theldanis)
+ Theldanis->AI()->Talk(SAY_WP_3);
break;
case 22:
break;
case 23:
Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86f, -1825.42f, 81.99f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
- Ughost->SetDisableGravity(true);
- DoScriptText(SAY_WP_4, Ughost, me);
+ if (Ughost)
+ {
+ Ughost->SetDisableGravity(true);
+ Ughost->AI()->Talk(SAY_WP_4, me->GetGUID());
+ }
m_uiChatTimer = 4000;
break;
case 24:
- DoScriptText(SAY_WP_5, Ughost, me);
+ if (Ughost)
+ Ughost->AI()->Talk(SAY_WP_5, me->GetGUID());
m_uiChatTimer = 4000;
break;
case 25:
- DoScriptText(SAY_WP_6, Ughost, me);
+ if (Ughost)
+ Ughost->AI()->Talk(SAY_WP_6, me->GetGUID());
m_uiChatTimer = 4000;
break;
case 26:
diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp
index 46f1526c5bf..16ba171928c 100644
--- a/src/server/scripts/EasternKingdoms/westfall.cpp
+++ b/src/server/scripts/EasternKingdoms/westfall.cpp
@@ -28,8 +28,10 @@ npc_daphne_stilwell
npc_defias_traitor
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_daphne_stilwell
@@ -37,11 +39,11 @@ EndContentData */
enum eEnums
{
- SAY_DS_START = -1000293,
- SAY_DS_DOWN_1 = -1000294,
- SAY_DS_DOWN_2 = -1000295,
- SAY_DS_DOWN_3 = -1000296,
- SAY_DS_PROLOGUE = -1000297,
+ SAY_DS_START = 0,
+ SAY_DS_DOWN_1 = 1,
+ SAY_DS_DOWN_2 = 2,
+ SAY_DS_DOWN_3 = 3,
+ SAY_DS_PROLOGUE = 4,
SPELL_SHOOT = 6660,
QUEST_TOME_VALOR = 1651,
@@ -58,7 +60,7 @@ public:
{
if (quest->GetQuestId() == QUEST_TOME_VALOR)
{
- DoScriptText(SAY_DS_START, creature);
+ creature->AI()->Talk(SAY_DS_START);
if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwell::npc_daphne_stilwellAI, creature->AI()))
pEscortAI->Start(true, true, player->GetGUID());
@@ -86,13 +88,13 @@ public:
switch (uiWPHolder)
{
case 7:
- DoScriptText(SAY_DS_DOWN_1, me);
+ Talk(SAY_DS_DOWN_1);
break;
case 8:
- DoScriptText(SAY_DS_DOWN_2, me);
+ Talk(SAY_DS_DOWN_2);
break;
case 9:
- DoScriptText(SAY_DS_DOWN_3, me);
+ Talk(SAY_DS_DOWN_3);
break;
}
}
@@ -141,7 +143,7 @@ public:
SetRun(false);
break;
case 11:
- DoScriptText(SAY_DS_PROLOGUE, me);
+ Talk(SAY_DS_PROLOGUE);
break;
case 13:
SetEquipmentSlots(true);
@@ -195,12 +197,14 @@ public:
/*######
## npc_defias_traitor
######*/
+enum DefiasSays
+{
+ SAY_START = 0,
+ SAY_PROGRESS = 1,
+ SAY_END = 2,
+ SAY_AGGRO = 3
+};
-#define SAY_START -1000101
-#define SAY_PROGRESS -1000102
-#define SAY_END -1000103
-#define SAY_AGGRO_1 -1000104
-#define SAY_AGGRO_2 -1000105
#define QUEST_DEFIAS_BROTHERHOOD 155
@@ -216,7 +220,7 @@ public:
if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitor::npc_defias_traitorAI, creature->AI()))
pEscortAI->Start(true, true, player->GetGUID());
- DoScriptText(SAY_START, creature, player);
+ creature->AI()->Talk(SAY_START, player->GetGUID());
}
return true;
@@ -243,10 +247,10 @@ public:
SetRun(false);
break;
case 36:
- DoScriptText(SAY_PROGRESS, me, player);
+ Talk(SAY_PROGRESS, player->GetGUID());
break;
case 44:
- DoScriptText(SAY_END, me, player);
+ Talk(SAY_END, player->GetGUID());
player->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD, me);
break;
}
@@ -254,7 +258,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me, who);
+ Talk(SAY_AGGRO, who->GetGUID());
}
void Reset() {}
diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp
index bf28d9838a4..98f7b0ac967 100644
--- a/src/server/scripts/EasternKingdoms/wetlands.cpp
+++ b/src/server/scripts/EasternKingdoms/wetlands.cpp
@@ -28,8 +28,10 @@ npc_mikhail
npc_tapoke_slim_jahn
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_tapoke_slim_jahn
@@ -59,12 +61,12 @@ public:
{
npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) { }
- bool m_bFriendSummoned;
+ bool IsFriendSummoned;
void Reset()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
- m_bFriendSummoned = false;
+ IsFriendSummoned = false;
}
void WaypointReached(uint32 waypointId)
@@ -82,14 +84,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- Player* player = GetPlayerForEscort();
-
- if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && player)
+ if (HasEscortState(STATE_ESCORT_ESCORTING) && !IsFriendSummoned && GetPlayerForEscort())
{
for (uint8 i = 0; i < 3; ++i)
DoCast(me, SPELL_CALL_FRIENDS, true);
- m_bFriendSummoned = true;
+ IsFriendSummoned = true;
}
}
diff --git a/src/server/scripts/Events/CMakeLists.txt b/src/server/scripts/Events/CMakeLists.txt
new file mode 100644
index 00000000000..00bdaa9cb0c
--- /dev/null
+++ b/src/server/scripts/Events/CMakeLists.txt
@@ -0,0 +1,16 @@
+# Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+set(scripts_STAT_SRCS
+ ${scripts_STAT_SRCS}
+ Events/childrens_week.cpp
+)
+
+message(" -> Prepared: Events")
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
new file mode 100644
index 00000000000..28d033f9d48
--- /dev/null
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -0,0 +1,1050 @@
+/*
+* Copyright (C) 2008-2012 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 "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
+#include "Player.h"
+
+enum Orphans
+{
+ ORPHAN_ORACLE = 33533,
+ ORPHAN_WOLVAR = 33532,
+ ORPHAN_BLOOD_ELF = 22817,
+ ORPHAN_DRAENEI = 22818,
+ ORPHAN_HUMAN = 14305,
+ ORPHAN_ORCISH = 14444,
+};
+
+enum Texts
+{
+ TEXT_ORACLE_ORPHAN_1 = 1,
+ TEXT_ORACLE_ORPHAN_2 = 2,
+ TEXT_ORACLE_ORPHAN_3 = 3,
+ TEXT_ORACLE_ORPHAN_4 = 4,
+ TEXT_ORACLE_ORPHAN_5 = 5,
+ TEXT_ORACLE_ORPHAN_6 = 6,
+ TEXT_ORACLE_ORPHAN_7 = 7,
+ TEXT_ORACLE_ORPHAN_8 = 8,
+ TEXT_ORACLE_ORPHAN_9 = 9,
+ TEXT_ORACLE_ORPHAN_10 = 10,
+ TEXT_ORACLE_ORPHAN_11 = 11,
+ TEXT_ORACLE_ORPHAN_12 = 12,
+ TEXT_ORACLE_ORPHAN_13 = 13,
+ TEXT_ORACLE_ORPHAN_14 = 14,
+
+ TEXT_WOLVAR_ORPHAN_1 = 1,
+ TEXT_WOLVAR_ORPHAN_2 = 2,
+ TEXT_WOLVAR_ORPHAN_3 = 3,
+ TEXT_WOLVAR_ORPHAN_4 = 4,
+ TEXT_WOLVAR_ORPHAN_5 = 5,
+ // 6 - 9 used in Nesingwary script
+ TEXT_WOLVAR_ORPHAN_10 = 10,
+ TEXT_WOLVAR_ORPHAN_11 = 11,
+ TEXT_WOLVAR_ORPHAN_12 = 12,
+ TEXT_WOLVAR_ORPHAN_13 = 13,
+
+ TEXT_WINTERFIN_PLAYMATE_1 = 1,
+ TEXT_WINTERFIN_PLAYMATE_2 = 2,
+
+ TEXT_SNOWFALL_GLADE_PLAYMATE_1 = 1,
+ TEXT_SNOWFALL_GLADE_PLAYMATE_2 = 2,
+
+ TEXT_SOO_ROO_1 = 1,
+ TEXT_ELDER_KEKEK_1 = 1,
+
+ TEXT_ALEXSTRASZA_2 = 2,
+ TEXT_KRASUS_8 = 8,
+};
+
+enum Quests
+{
+ QUEST_PLAYMATE_WOLVAR = 13951,
+ QUEST_PLAYMATE_ORACLE = 13950,
+ QUEST_THE_BIGGEST_TREE_EVER = 13929,
+ QUEST_THE_BRONZE_DRAGONSHRINE_ORACLE = 13933,
+ QUEST_THE_BRONZE_DRAGONSHRINE_WOLVAR = 13934,
+ QUEST_MEETING_A_GREAT_ONE = 13956,
+ QUEST_THE_MIGHTY_HEMET_NESINGWARY = 13957,
+ QUEST_DOWN_AT_THE_DOCKS = 910,
+ QUEST_GATEWAY_TO_THE_FRONTIER = 911,
+ QUEST_BOUGHT_OF_ETERNALS = 1479,
+ QUEST_SPOOKY_LIGHTHOUSE = 1687,
+ QUEST_STONEWROUGHT_DAM = 1558,
+ QUEST_DARK_PORTAL_H = 10951,
+ QUEST_DARK_PORTAL_A = 10952,
+ QUEST_LORDAERON_THRONE_ROOM = 1800,
+ QUEST_AUCHINDOUN_AND_THE_RING = 10950,
+ QUEST_TIME_TO_VISIT_THE_CAVERNS_H = 10963,
+ QUEST_TIME_TO_VISIT_THE_CAVERNS_A = 10962,
+ QUEST_THE_SEAT_OF_THE_NARUU = 10956,
+ QUEST_CALL_ON_THE_FARSEER = 10968,
+ QUEST_JHEEL_IS_AT_AERIS_LANDING = 10954,
+ QUEST_HCHUU_AND_THE_MUSHROOM_PEOPLE = 10945,
+ QUEST_VISIT_THE_THRONE_OF_ELEMENTS = 10953,
+ QUEST_NOW_WHEN_I_GROW_UP = 11975,
+ QUEST_HOME_OF_THE_BEAR_MEN = 13930,
+ QUEST_THE_DRAGON_QUEEN_ORACLE = 13954,
+ QUEST_THE_DRAGON_QUEEN_WOLVAR = 13955,
+};
+
+enum Areatriggers
+{
+ AT_DOWN_AT_THE_DOCKS = 3551,
+ AT_GATEWAY_TO_THE_FRONTIER = 3549,
+ AT_LORDAERON_THRONE_ROOM = 3547,
+ AT_BOUGHT_OF_ETERNALS = 3546,
+ AT_SPOOKY_LIGHTHOUSE = 3552,
+ AT_STONEWROUGHT_DAM = 3548,
+ AT_DARK_PORTAL = 4356,
+
+ NPC_CAVERNS_OF_TIME_CW_TRIGGER = 22872,
+ NPC_EXODAR_01_CW_TRIGGER = 22851,
+ NPC_EXODAR_02_CW_TRIGGER = 22905,
+ NPC_AERIS_LANDING_CW_TRIGGER = 22838,
+ NPC_AUCHINDOUN_CW_TRIGGER = 22831,
+ NPC_SPOREGGAR_CW_TRIGGER = 22829,
+ NPC_THRONE_OF_ELEMENTS_CW_TRIGGER = 22839,
+ NPC_SILVERMOON_01_CW_TRIGGER = 22866,
+ NPC_KRASUS = 27990,
+};
+
+enum Misc
+{
+ SPELL_SNOWBALL = 21343,
+ SPELL_ORPHAN_OUT = 58818,
+
+ DISPLAY_INVISIBLE = 11686,
+};
+
+uint64 getOrphanGUID(Player* player, uint32 orphan)
+{
+ if (Aura* orphanOut = player->GetAura(SPELL_ORPHAN_OUT))
+ if (orphanOut->GetCaster() && orphanOut->GetCaster()->GetEntry() == orphan)
+ return orphanOut->GetCaster()->GetGUID();
+
+ return 0;
+}
+
+/*######
+## npc_winterfin_playmate
+######*/
+class npc_winterfin_playmate : public CreatureScript
+{
+ public:
+ npc_winterfin_playmate() : CreatureScript("npc_winterfin_playmate") {}
+
+ struct npc_winterfin_playmateAI : public ScriptedAI
+ {
+ npc_winterfin_playmateAI(Creature* creature) : ScriptedAI (creature) {}
+
+ void Reset()
+ {
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_PLAYMATE_ORACLE) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_ORACLE)))
+ phase = 1;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch(phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5,me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_1);
+ timer = 3000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ Talk(TEXT_WINTERFIN_PLAYMATE_1);
+ me->HandleEmoteCommand(EMOTE_STATE_DANCE);
+ timer = 3000;
+ break;
+ case 3:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_2);
+ timer = 3000;
+ break;
+ case 4:
+ Talk(TEXT_WINTERFIN_PLAYMATE_2);
+ timer = 5000;
+ break;
+ case 5:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_3);
+ me->HandleEmoteCommand(EMOTE_STATE_NONE);
+ player->GroupEventHappens(QUEST_PLAYMATE_ORACLE, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ uint32 timer;
+ int8 phase;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_winterfin_playmateAI(creature);
+ }
+};
+
+/*######
+## npc_snowfall_glade_playmate
+######*/
+class npc_snowfall_glade_playmate : public CreatureScript
+{
+ public:
+ npc_snowfall_glade_playmate() : CreatureScript("npc_snowfall_glade_playmate") {}
+
+ struct npc_snowfall_glade_playmateAI : public ScriptedAI
+ {
+ npc_snowfall_glade_playmateAI(Creature* creature) : ScriptedAI (creature) {}
+
+ void Reset()
+ {
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_PLAYMATE_WOLVAR) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_WOLVAR)))
+ phase = 1;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch (phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5,me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_1);
+ timer = 5000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ Talk(TEXT_SNOWFALL_GLADE_PLAYMATE_1);
+ DoCast(orphan, SPELL_SNOWBALL);
+ timer = 5000;
+ break;
+ case 3:
+ Talk(TEXT_SNOWFALL_GLADE_PLAYMATE_2);
+ timer = 5000;
+ break;
+ case 4:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_2);
+ orphan->AI()->DoCast(me, SPELL_SNOWBALL);
+ timer = 5000;
+ break;
+ case 5:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_3);
+ player->GroupEventHappens(QUEST_PLAYMATE_WOLVAR, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ uint32 timer;
+ int8 phase;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+ };
+
+ CreatureAI* GetAI(Creature* pCreature) const
+ {
+ return new npc_snowfall_glade_playmateAI(pCreature);
+ }
+};
+
+/*######
+## npc_the_biggest_tree
+######*/
+class npc_the_biggest_tree : public CreatureScript
+{
+ public:
+ npc_the_biggest_tree() : CreatureScript("npc_the_biggest_tree") {}
+
+ struct npc_the_biggest_treeAI : public ScriptedAI
+ {
+ npc_the_biggest_treeAI(Creature* creature) : ScriptedAI (creature)
+ {
+ me->SetDisplayId(DISPLAY_INVISIBLE);
+ }
+
+ void Reset()
+ {
+ timer = 1000;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_THE_BIGGEST_TREE_EVER) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_ORACLE)))
+ phase = 1;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch (phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ timer = 2000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_4);
+ timer = 5000;
+ break;
+ case 3:
+ player->GroupEventHappens(QUEST_THE_BIGGEST_TREE_EVER, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ uint32 timer;
+ uint8 phase;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_the_biggest_treeAI(creature);
+ }
+};
+
+/*######
+## npc_high_oracle_soo_roo
+######*/
+class npc_high_oracle_soo_roo : public CreatureScript
+{
+ public:
+ npc_high_oracle_soo_roo() : CreatureScript("npc_high_oracle_soo_roo") {}
+
+ struct npc_high_oracle_soo_rooAI : public ScriptedAI
+ {
+ npc_high_oracle_soo_rooAI(Creature* creature) : ScriptedAI (creature) {}
+
+ void Reset()
+ {
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_THE_BRONZE_DRAGONSHRINE_ORACLE) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_ORACLE)))
+ phase = 1;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch (phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_5);
+ timer = 3000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ Talk(TEXT_SOO_ROO_1);
+ timer = 6000;
+ break;
+ case 3:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_6);
+ player->GroupEventHappens(QUEST_THE_BRONZE_DRAGONSHRINE_ORACLE, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ uint32 timer;
+ int8 phase;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_high_oracle_soo_rooAI(creature);
+ }
+};
+
+/*######
+## npc_elder_kekek
+######*/
+class npc_elder_kekek : public CreatureScript
+{
+ public:
+ npc_elder_kekek() : CreatureScript("npc_elder_kekek") {}
+
+ struct npc_elder_kekekAI : public ScriptedAI
+ {
+ npc_elder_kekekAI(Creature* creature) : ScriptedAI (creature) {}
+
+ void Reset()
+ {
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_THE_BRONZE_DRAGONSHRINE_WOLVAR) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_WOLVAR)))
+ phase = 1;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!player || !orphan)
+ {
+ Reset();
+ return;
+ }
+
+ switch (phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_4);
+ timer = 3000;
+ break;
+ case 2:
+ Talk(TEXT_ELDER_KEKEK_1);
+ timer = 6000;
+ break;
+ case 3:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_5);
+ player->GroupEventHappens(QUEST_THE_BRONZE_DRAGONSHRINE_WOLVAR, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ uint32 timer;
+ int8 phase;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_elder_kekekAI(creature);
+ }
+};
+
+/*######
+## npc_the_etymidian
+## TODO: A red crystal as a gift for the great one should be spawned during the event.
+######*/
+class npc_the_etymidian : public CreatureScript
+{
+ public:
+ npc_the_etymidian() : CreatureScript("npc_the_etymidian") {}
+
+ struct npc_the_etymidianAI : public ScriptedAI
+ {
+ npc_the_etymidianAI(Creature* creature) : ScriptedAI (creature) {}
+
+ void Reset()
+ {
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_MEETING_A_GREAT_ONE) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_ORACLE)))
+ phase = 1;
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch (phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_7);
+ timer = 5000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_8);
+ timer = 5000;
+ break;
+ case 3:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_9);
+ timer = 5000;
+ break;
+ case 4:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_10);
+ timer = 5000;
+ break;
+ case 5:
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ player->GroupEventHappens(QUEST_MEETING_A_GREAT_ONE, me);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ uint32 timer;
+ int8 phase;
+ uint32 GOtimer;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_the_etymidianAI(creature);
+ }
+};
+
+/*######
+## npc_cw_alexstrasza_trigger
+######*/
+class npc_alexstraza_the_lifebinder : public CreatureScript
+{
+ public:
+ npc_alexstraza_the_lifebinder() : CreatureScript("npc_alexstraza_the_lifebinder") {}
+
+ struct npc_alexstraza_the_lifebinderAI : public ScriptedAI
+ {
+ npc_alexstraza_the_lifebinderAI(Creature* creature) : ScriptedAI (creature) {}
+
+ void Reset()
+ {
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ // Existing SmartAI
+ if (type == 0)
+ {
+ switch (data)
+ {
+ case 1:
+ me->SetOrientation(1.6049f);
+ break;
+ case 2:
+ me->SetOrientation(me->GetHomePosition().GetOrientation());
+ break;
+ }
+ }
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ {
+ if (player->GetQuestStatus(QUEST_THE_DRAGON_QUEEN_ORACLE) == QUEST_STATUS_INCOMPLETE)
+ {
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_ORACLE)))
+ phase = 1;
+ playerGUID = player->GetGUID();
+ }
+ else if (player->GetQuestStatus(QUEST_THE_DRAGON_QUEEN_WOLVAR) == QUEST_STATUS_INCOMPLETE)
+ {
+ if ((orphanGUID = getOrphanGUID(player, ORPHAN_WOLVAR)))
+ phase = 7;
+ playerGUID = player->GetGUID();
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!phase)
+ return;
+
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if (!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch (phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_11);
+ timer = 5000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_12);
+ timer = 5000;
+ break;
+ case 3:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_13);
+ timer = 5000;
+ break;
+ case 4:
+ Talk(TEXT_ALEXSTRASZA_2);
+ me->SetStandState(UNIT_STAND_STATE_KNEEL);
+ me->SetFacingToObject(orphan);
+ timer = 5000;
+ break;
+ case 5:
+ orphan->AI()->Talk(TEXT_ORACLE_ORPHAN_14);
+ timer = 5000;
+ break;
+ case 6:
+ me->SetStandState(UNIT_STAND_STATE_STAND);
+ me->SetOrientation(me->GetHomePosition().GetOrientation());
+ player->GroupEventHappens(QUEST_THE_DRAGON_QUEEN_ORACLE, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ case 7:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_11);
+ timer = 5000;
+ break;
+ case 8:
+ if(Creature* krasus = me->FindNearestCreature(NPC_KRASUS, 10.0f))
+ {
+ orphan->SetFacingToObject(krasus);
+ krasus->AI()->Talk(TEXT_KRASUS_8);
+ }
+ timer = 5000;
+ break;
+ case 9:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_12);
+ timer = 5000;
+ break;
+ case 10:
+ orphan->SetFacingToObject(me);
+ Talk(TEXT_ALEXSTRASZA_2);
+ timer = 5000;
+ break;
+ case 11:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_13);
+ timer = 5000;
+ break;
+ case 12:
+ player->GroupEventHappens(QUEST_THE_DRAGON_QUEEN_WOLVAR, me);
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
+ }
+
+ private:
+ int8 phase;
+ uint32 timer;
+ uint64 playerGUID;
+ uint64 orphanGUID;
+ uint64 alexstraszaGUID;
+
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_alexstraza_the_lifebinderAI(creature);
+ }
+};
+
+/*######
+## at_bring_your_orphan_to
+######*/
+
+class at_bring_your_orphan_to : public AreaTriggerScript
+{
+ public:
+ at_bring_your_orphan_to() : AreaTriggerScript("at_bring_your_orphan_to") { }
+
+ bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
+ {
+ if (player->isDead() || !player->HasAura(SPELL_ORPHAN_OUT))
+ return false;
+
+ uint32 questId = 0;
+ uint32 orphanId = 0;
+
+ switch (trigger->id)
+ {
+ case AT_DOWN_AT_THE_DOCKS:
+ questId = QUEST_DOWN_AT_THE_DOCKS;
+ orphanId = ORPHAN_ORCISH;
+ break;
+ case AT_GATEWAY_TO_THE_FRONTIER:
+ questId = QUEST_GATEWAY_TO_THE_FRONTIER;
+ orphanId = ORPHAN_ORCISH;
+ break;
+ case AT_LORDAERON_THRONE_ROOM:
+ questId = QUEST_LORDAERON_THRONE_ROOM;
+ orphanId = ORPHAN_ORCISH;
+ break;
+ case AT_BOUGHT_OF_ETERNALS:
+ questId = QUEST_BOUGHT_OF_ETERNALS;
+ orphanId = ORPHAN_HUMAN;
+ break;
+ case AT_SPOOKY_LIGHTHOUSE:
+ questId = QUEST_SPOOKY_LIGHTHOUSE;
+ orphanId = ORPHAN_HUMAN;
+ break;
+ case AT_STONEWROUGHT_DAM:
+ questId = QUEST_STONEWROUGHT_DAM;
+ orphanId = ORPHAN_HUMAN;
+ break;
+ case AT_DARK_PORTAL:
+ questId = player->GetTeam() == ALLIANCE ? QUEST_DARK_PORTAL_A : QUEST_DARK_PORTAL_H;
+ orphanId = player->GetTeam() == ALLIANCE ? ORPHAN_DRAENEI : ORPHAN_BLOOD_ELF;
+ break;
+ }
+
+ if (questId && orphanId && getOrphanGUID(player, orphanId) && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
+ player->AreaExploredOrEventHappens(questId);
+
+ return true;
+ }
+};
+
+/*######
+## npc_cw_area_trigger
+######*/
+class npc_cw_area_trigger : public CreatureScript
+{
+ public:
+ npc_cw_area_trigger() : CreatureScript("npc_cw_area_trigger") {}
+
+ struct npc_cw_area_triggerAI : public ScriptedAI
+ {
+ npc_cw_area_triggerAI(Creature* creature) : ScriptedAI (creature)
+ {
+ me->SetDisplayId(DISPLAY_INVISIBLE);
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (who && me->GetDistance2d(who) < 20.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->HasAura(SPELL_ORPHAN_OUT))
+ {
+ uint32 questId = 0;
+ uint32 orphanId = 0;
+ switch (me->GetEntry())
+ {
+ case NPC_CAVERNS_OF_TIME_CW_TRIGGER:
+ questId = player->GetTeam() == ALLIANCE ? QUEST_TIME_TO_VISIT_THE_CAVERNS_A : QUEST_TIME_TO_VISIT_THE_CAVERNS_H;
+ orphanId = player->GetTeam() == ALLIANCE ? ORPHAN_DRAENEI : ORPHAN_BLOOD_ELF;
+ break;
+ case NPC_EXODAR_01_CW_TRIGGER:
+ questId = QUEST_THE_SEAT_OF_THE_NARUU;
+ orphanId = ORPHAN_DRAENEI;
+ break;
+ case NPC_EXODAR_02_CW_TRIGGER:
+ questId = QUEST_CALL_ON_THE_FARSEER;
+ orphanId = ORPHAN_DRAENEI;
+ break;
+ case NPC_AERIS_LANDING_CW_TRIGGER:
+ questId = QUEST_JHEEL_IS_AT_AERIS_LANDING;
+ orphanId = ORPHAN_DRAENEI;
+ break;
+ case NPC_AUCHINDOUN_CW_TRIGGER:
+ questId = QUEST_AUCHINDOUN_AND_THE_RING;
+ orphanId = ORPHAN_DRAENEI;
+ break;
+ case NPC_SPOREGGAR_CW_TRIGGER:
+ questId = QUEST_HCHUU_AND_THE_MUSHROOM_PEOPLE;
+ orphanId = ORPHAN_BLOOD_ELF;
+ break;
+ case NPC_THRONE_OF_ELEMENTS_CW_TRIGGER:
+ questId = QUEST_VISIT_THE_THRONE_OF_ELEMENTS;
+ orphanId = ORPHAN_BLOOD_ELF;
+ break;
+ case NPC_SILVERMOON_01_CW_TRIGGER:
+ if (player->GetQuestStatus(QUEST_NOW_WHEN_I_GROW_UP) == QUEST_STATUS_INCOMPLETE && getOrphanGUID(player, ORPHAN_BLOOD_ELF))
+ {
+ player->AreaExploredOrEventHappens(QUEST_NOW_WHEN_I_GROW_UP);
+ if (player->GetQuestStatus(QUEST_NOW_WHEN_I_GROW_UP) == QUEST_STATUS_COMPLETE)
+ if (Creature* samuro = me->FindNearestCreature(25151, 20.0f))
+ {
+ uint32 emote = 0;
+ switch(urand(1,5))
+ {
+ case 1:
+ emote = EMOTE_ONESHOT_WAVE;
+ break;
+ case 2:
+ emote = EMOTE_ONESHOT_ROAR;
+ break;
+ case 3:
+ emote = EMOTE_ONESHOT_FLEX;
+ break;
+ case 4:
+ emote = EMOTE_ONESHOT_SALUTE;
+ break;
+ case 5:
+ emote = EMOTE_ONESHOT_DANCE;
+ break;
+ }
+ samuro->HandleEmoteCommand(emote);
+ }
+ }
+ break;
+ }
+ if (questId && orphanId && getOrphanGUID(player, orphanId) && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
+ player->AreaExploredOrEventHappens(questId);
+ }
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_cw_area_triggerAI(creature);
+ }
+};
+
+/*######
+## npc_grizzlemaw_cw_trigger
+######*/
+class npc_grizzlemaw_cw_trigger : public CreatureScript
+{
+ public:
+ npc_grizzlemaw_cw_trigger() : CreatureScript("npc_grizzlemaw_cw_trigger") {}
+
+ struct npc_grizzlemaw_cw_triggerAI : public ScriptedAI
+ {
+ npc_grizzlemaw_cw_triggerAI(Creature* creature) : ScriptedAI (creature)
+ {
+ me->SetDisplayId(DISPLAY_INVISIBLE);
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_HOME_OF_THE_BEAR_MEN) == QUEST_STATUS_INCOMPLETE)
+ if (Creature* orphan = Creature::GetCreature(*me, getOrphanGUID(player, ORPHAN_WOLVAR)))
+ {
+ player->AreaExploredOrEventHappens(QUEST_HOME_OF_THE_BEAR_MEN);
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_10);
+ }
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_grizzlemaw_cw_triggerAI(creature);
+ }
+};
+
+void AddSC_event_childrens_week()
+{
+ new npc_elder_kekek();
+ new npc_high_oracle_soo_roo();
+ new npc_winterfin_playmate();
+ new npc_snowfall_glade_playmate();
+ new npc_the_etymidian();
+ new npc_the_biggest_tree();
+ new at_bring_your_orphan_to();
+ new npc_grizzlemaw_cw_trigger();
+ new npc_cw_area_trigger();
+ new npc_alexstraza_the_lifebinder();
+}
diff --git a/src/server/scripts/Examples/example_commandscript.cpp b/src/server/scripts/Examples/example_commandscript.cpp
index 6b7a3d8def7..28ef021d599 100644
--- a/src/server/scripts/Examples/example_commandscript.cpp
+++ b/src/server/scripts/Examples/example_commandscript.cpp
@@ -23,7 +23,7 @@ Comment: Short custom scripting example
Category: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
#include "Chat.h"
// **** This script is designed as an example for others to build on ****
diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp
index 7f75a0fb481..0baa9814970 100644
--- a/src/server/scripts/Examples/example_creature.cpp
+++ b/src/server/scripts/Examples/example_creature.cpp
@@ -23,7 +23,10 @@ SDComment: Short custom scripting example
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
// **** This script is designed as an example for others to build on ****
// **** Please modify whatever you'd like to as this script is only for developement ****
@@ -42,17 +45,18 @@ enum Yells
//List of text id's. The text is stored in database, also in a localized version
//(if translation not exist for the textId, default english text will be used)
//Not required to define in this way, but simplify if changes are needed.
- SAY_AGGRO = -1999900,
- SAY_RANDOM_0 = -1999901,
- SAY_RANDOM_1 = -1999902,
- SAY_RANDOM_2 = -1999903,
- SAY_RANDOM_3 = -1999904,
- SAY_RANDOM_4 = -1999905,
- SAY_BERSERK = -1999906,
- SAY_PHASE = -1999907,
- SAY_DANCE = -1999908,
- SAY_SALUTE = -1999909,
- SAY_EVADE = -1999910,
+ //These texts must be added to the creature texts of the npc for which the script is assigned.
+ SAY_AGGRO = 0, // "Let the games begin."
+ SAY_RANDOM = 1, // "I see endless suffering. I see torment. I see rage. I see everything.",
+ // "Muahahahaha",
+ // "These mortal infedels my lord, they have invaded your sanctum and seek to steal your secrets.",
+ // "You are already dead.",
+ // "Where to go? What to do? So many choices that all end in pain, end in death."
+ SAY_BERSERK = 2, // "$N, I sentance you to death!"
+ SAY_PHASE = 3, // "The suffering has just begun!"
+ SAY_DANCE = 4, // "I always thought I was a good dancer."
+ SAY_SALUTE = 5, // "Move out Soldier!"
+ SAY_EVADE = 6 // "Help $N! I'm under attack!"
};
enum Spells
@@ -124,7 +128,7 @@ class example_creature : public CreatureScript
void EnterCombat(Unit* who)
{
//Say some stuff
- DoScriptText(SAY_AGGRO, me, who);
+ Talk(SAY_AGGRO, who->GetGUID());
}
// *** HANDLED FUNCTION ***
@@ -139,7 +143,7 @@ class example_creature : public CreatureScript
// Called when going out of combat. Reset is called just after.
void EnterEvadeMode()
{
- DoScriptText(SAY_EVADE, me);
+ Talk(SAY_EVADE);
}
// *** HANDLED FUNCTION ***
@@ -151,10 +155,10 @@ class example_creature : public CreatureScript
switch (uiTextEmote)
{
case TEXT_EMOTE_DANCE:
- DoScriptText(SAY_DANCE, me);
+ Talk(SAY_DANCE);
break;
case TEXT_EMOTE_SALUTE:
- DoScriptText(SAY_SALUTE, me);
+ Talk(SAY_SALUTE);
break;
}
}
@@ -170,7 +174,7 @@ class example_creature : public CreatureScript
if (m_uiSayTimer <= uiDiff)
{
//Random switch between 5 outcomes
- DoScriptText(RAND(SAY_RANDOM_0, SAY_RANDOM_1, SAY_RANDOM_2, SAY_RANDOM_3, SAY_RANDOM_4), me);
+ Talk(SAY_RANDOM);
m_uiSayTimer = 45000; //Say something agian in 45 seconds
}
@@ -232,7 +236,7 @@ class example_creature : public CreatureScript
if (m_uiBeserkTimer <= uiDiff)
{
//Say our line then cast uber death spell
- DoScriptText(SAY_BERSERK, me, me->getVictim());
+ Talk(SAY_BERSERK, me->getVictim() ? me->getVictim()->GetGUID() : 0);
DoCast(me->getVictim(), SPELL_BERSERK);
//Cast our beserk spell agian in 12 seconds if we didn't kill everyone
@@ -247,7 +251,7 @@ class example_creature : public CreatureScript
{
//Go to next phase
++m_uiPhase;
- DoScriptText(SAY_PHASE, me);
+ Talk(SAY_PHASE);
DoCast(me, SPELL_FRENZY);
}
else
diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp
index 851a32538e9..cd680b31577 100644
--- a/src/server/scripts/Examples/example_escort.cpp
+++ b/src/server/scripts/Examples/example_escort.cpp
@@ -23,8 +23,12 @@ SDComment: Script used for testing escortAI
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "CreatureTextMgr.h"
enum eEnums
{
@@ -34,18 +38,18 @@ enum eEnums
SPELL_ELIXIR_OF_FORTITUDE = 3593,
SPELL_BLUE_FIREWORK = 11540,
- SAY_AGGRO1 = -1999910,
- SAY_AGGRO2 = -1999911,
- SAY_WP_1 = -1999912,
- SAY_WP_2 = -1999913,
- SAY_WP_3 = -1999914,
- SAY_WP_4 = -1999915,
- SAY_DEATH_1 = -1999916,
- SAY_DEATH_2 = -1999917,
- SAY_DEATH_3 = -1999918,
- SAY_SPELL = -1999919,
- SAY_RAND_1 = -1999920,
- SAY_RAND_2 = -1999921
+ SAY_AGGRO1 = 0,
+ SAY_AGGRO2 = 1,
+ SAY_WP_1 = 2,
+ SAY_WP_2 = 3,
+ SAY_WP_3 = 4,
+ SAY_WP_4 = 5,
+ SAY_DEATH_1 = 6,
+ SAY_DEATH_2 = 7,
+ SAY_DEATH_3 = 8,
+ SAY_SPELL = 9,
+ SAY_RAND_1 = 10,
+ SAY_RAND_2 = 11
};
#define GOSSIP_ITEM_1 "Click to Test Escort(Attack, Run)"
@@ -80,19 +84,19 @@ class example_escort : public CreatureScript
switch (waypointId)
{
case 1:
- DoScriptText(SAY_WP_1, me);
+ Talk(SAY_WP_1);
break;
case 3:
- DoScriptText(SAY_WP_2, me);
+ Talk(SAY_WP_2);
me->SummonCreature(NPC_FELBOAR, me->GetPositionX()+5.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
break;
case 4:
if (Player* player = GetPlayerForEscort())
{
//pTmpPlayer is the target of the text
- DoScriptText(SAY_WP_3, me, player);
+ Talk(SAY_WP_3, player->GetGUID());
//pTmpPlayer is the source of the text
- DoScriptText(SAY_WP_4, player);
+ sCreatureTextMgr->SendChat(me, SAY_WP_4, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
}
break;
}
@@ -103,10 +107,10 @@ class example_escort : public CreatureScript
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (Player* player = GetPlayerForEscort())
- DoScriptText(SAY_AGGRO1, me, player);
+ Talk(SAY_AGGRO1, player->GetGUID());
}
else
- DoScriptText(SAY_AGGRO2, me);
+ Talk(SAY_AGGRO2);
}
void Reset()
@@ -123,13 +127,13 @@ class example_escort : public CreatureScript
{
// not a likely case, code here for the sake of example
if (killer == me)
- DoScriptText(SAY_DEATH_1, me, player);
+ Talk(SAY_DEATH_1, player->GetGUID());
else
- DoScriptText(SAY_DEATH_2, me, player);
+ Talk(SAY_DEATH_2, player->GetGUID());
}
}
else
- DoScriptText(SAY_DEATH_3, me);
+ Talk(SAY_DEATH_3);
}
void UpdateAI(const uint32 uiDiff)
@@ -142,7 +146,7 @@ class example_escort : public CreatureScript
{
if (m_uiDeathCoilTimer <= uiDiff)
{
- DoScriptText(SAY_SPELL, me);
+ Talk(SAY_SPELL);
DoCast(me->getVictim(), SPELL_DEATH_COIL, false);
m_uiDeathCoilTimer = 4000;
}
@@ -158,12 +162,12 @@ class example_escort : public CreatureScript
{
if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0))
{
- DoScriptText(SAY_RAND_1, me);
+ Talk(SAY_RAND_1);
DoCast(me, SPELL_BLUE_FIREWORK, false);
}
else
{
- DoScriptText(SAY_RAND_2, me);
+ Talk(SAY_RAND_2);
DoCast(me, SPELL_ELIXIR_OF_FORTITUDE, false);
}
diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp
index 6d57f1ac798..b6be4ce3ce1 100644
--- a/src/server/scripts/Examples/example_gossip_codebox.cpp
+++ b/src/server/scripts/Examples/example_gossip_codebox.cpp
@@ -23,7 +23,10 @@ SDComment: Show a codebox in gossip option
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
#include <cstring>
enum eEnums
@@ -31,9 +34,10 @@ enum eEnums
SPELL_POLYMORPH = 12826,
SPELL_MARK_OF_THE_WILD = 26990,
- SAY_NOT_INTERESTED = -1999922,
- SAY_WRONG = -1999923,
- SAY_CORRECT = -1999924
+ //These texts must be added to the creature texts of the npc for which the script is assigned.
+ SAY_NOT_INTERESTED = 0, // "Normal select, guess you're not interested."
+ SAY_WRONG = 1, // "Wrong!"
+ SAY_CORRECT = 2 // "You're right, you are allowed to see my inner secrets."
};
#define GOSSIP_ITEM_1 "A quiz: what's your name?"
@@ -63,14 +67,15 @@ class example_gossip_codebox : public CreatureScript
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF+2)
{
- DoScriptText(SAY_NOT_INTERESTED, creature);
+ //Read comment in enum
+ creature->AI()->Talk(SAY_NOT_INTERESTED);
player->CLOSE_GOSSIP_MENU();
}
return true;
}
- bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code)
+ bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code)
{
player->PlayerTalkClass->ClearMenus();
if (sender == GOSSIP_SENDER_MAIN)
@@ -78,14 +83,16 @@ class example_gossip_codebox : public CreatureScript
switch (action)
{
case GOSSIP_ACTION_INFO_DEF+1:
- if (std::strcmp(code, player->GetName()) != 0)
+ if (player->GetName() != code)
{
- DoScriptText(SAY_WRONG, creature);
+ //Read comment in enum
+ creature->AI()->Talk(SAY_WRONG);
creature->CastSpell(player, SPELL_POLYMORPH, true);
}
else
{
- DoScriptText(SAY_CORRECT, creature);
+ //Read comment in enum
+ creature->AI()->Talk(SAY_CORRECT);
creature->CastSpell(player, SPELL_MARK_OF_THE_WILD, true);
}
player->CLOSE_GOSSIP_MENU();
diff --git a/src/server/scripts/Examples/example_misc.cpp b/src/server/scripts/Examples/example_misc.cpp
index d83a00ed82f..68986b44496 100644
--- a/src/server/scripts/Examples/example_misc.cpp
+++ b/src/server/scripts/Examples/example_misc.cpp
@@ -23,13 +23,8 @@ SDComment: Item, Areatrigger and other small code examples
SDCategory: Script Examples
EndScriptData */
-#include "ScriptPCH.h"
#include "ScriptMgr.h"
-
-enum eSay
-{
- SAY_HI = -1999925
-};
+#include "Player.h"
class AT_example_areatrigger : public AreaTriggerScript
{
@@ -42,7 +37,7 @@ class AT_example_areatrigger : public AreaTriggerScript
bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/)
{
- DoScriptText(SAY_HI, player);
+ player->Kill(player);
return true;
}
};
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 70d7f43135c..35e61a5300d 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -22,9 +22,11 @@
* and `ScriptName` is the name of a script assigned on registration
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
+#include "SpellScript.h"
+#include "Player.h"
enum Spells
{
@@ -80,19 +82,19 @@ class spell_ex_5581 : public SpellScriptLoader
{
// this hook is executed before anything about casting the spell is done
// after this hook is executed all the machinery starts
- sLog->outString("Caster just finished preparing the spell (cast bar has expired)");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Caster just finished preparing the spell (cast bar has expired)");
}
void HandleOnCast()
{
// cast is validated and spell targets are selected at this moment
// this is a last place when the spell can be safely interrupted
- sLog->outString("Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to do take reagents, power, launch missile, do visuals and instant spell effects");
}
void HandleAfterCast()
{
- sLog->outString("All immediate Actions for the spell are finished now");
+ sLog->outInfo(LOG_FILTER_GENERAL, "All immediate Actions for the spell are finished now");
// this is a safe for triggering additional effects for a spell without interfering
// with visuals or with other effects of the spell
//GetCaster()->CastSpell(target, SPELL_TRIGGERED, true);
@@ -110,7 +112,7 @@ class spell_ex_5581 : public SpellScriptLoader
void HandleDummyLaunch(SpellEffIndex /*effIndex*/)
{
- sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched!", GetSpellInfo()->Id);
}
void HandleDummyLaunchTarget(SpellEffIndex /*effIndex*/)
@@ -119,17 +121,17 @@ class spell_ex_5581 : public SpellScriptLoader
if (Unit* unitTarget = GetHitUnit())
targetGUID = unitTarget->GetGUID();
// we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
- sLog->outString("Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY is just launched at it's target: " UI64FMTD "!", GetSpellInfo()->Id, targetGUID);
}
void HandleDummyHit(SpellEffIndex /*effIndex*/)
{
- sLog->outString("Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell %u with SPELL_EFFECT_DUMMY has hit!", GetSpellInfo()->Id);
}
void HandleDummyHitTarget(SpellEffIndex /*effIndex*/)
{
- sLog->outString("SPELL_EFFECT_DUMMY is hits it's target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "SPELL_EFFECT_DUMMY is hits it's target!");
// make caster cast a spell on a unit target of effect
if (Unit* target = GetHitUnit())
GetCaster()->CastSpell(target, SPELL_TRIGGERED, true);
@@ -137,23 +139,23 @@ class spell_ex_5581 : public SpellScriptLoader
void HandleBeforeHit()
{
- sLog->outString("Spell is about to hit target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to hit target!");
}
void HandleOnHit()
{
- sLog->outString("Spell just hit target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell just hit target!");
}
void HandleAfterHit()
{
- sLog->outString("Spell just finished hitting target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell just finished hitting target!");
}
void FilterTargets(std::list<Unit*>& /*targetList*/)
{
// usually you want this call for Area Target spells
- sLog->outString("Spell is about to add targets from targetList to final targets!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Spell is about to add targets from targetList to final targets!");
}
// register functions used in spell script - names of these functions do not matter
@@ -228,20 +230,20 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleOnEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect is about to be applied on target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be applied on target!");
// this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler
//PreventDefaultAction();
}
void HandleOnEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect is about to be removed from target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect is about to be removed from target!");
// this hook allows you to prevent execution of AuraEffect handler, or to replace it with your own handler
//PreventDefaultAction();
}
void HandleAfterEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect has just been applied on target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been applied on target!");
Unit* target = GetTarget();
// cast spell on target on aura apply
target->CastSpell(target, SPELL_TRIGGERED, true);
@@ -249,7 +251,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleAfterEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- sLog->outString("Aura Effect has just been just removed from target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Aura Effect has just been just removed from target!");
Unit* target = GetTarget();
Unit* caster = GetCaster();
// caster may be not avalible (logged out for example)
@@ -261,7 +263,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
- sLog->outString("Perioidic Aura Effect is does a tick on target!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is does a tick on target!");
Unit* target = GetTarget();
// aura targets damage self on tick
target->DealDamage(target, 100);
@@ -269,14 +271,14 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectPeriodicUpdate(AuraEffect* aurEff)
{
- sLog->outString("Perioidic Aura Effect is now updated!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Perioidic Aura Effect is now updated!");
// we're doubling aura amount every tick
aurEff->ChangeAmount(aurEff->GetAmount() * 2);
}
void HandleEffectCalcAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
{
- sLog->outString("Amount of Aura Effect is being calculated now!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Amount of Aura Effect is being calculated now!");
// we're setting amount to 100
amount = 100;
// amount will be never recalculated due to applying passive aura
@@ -285,7 +287,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectCalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
- sLog->outString("Periodic data of Aura Effect is being calculated now!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Periodic data of Aura Effect is being calculated now!");
// we're setting aura to be periodic and tick every 10 seconds
isPeriodic = true;
amplitude = 2 * IN_MILLISECONDS;
@@ -293,7 +295,7 @@ class spell_ex_66244 : public SpellScriptLoader
void HandleEffectCalcSpellMod(AuraEffect const* /*aurEff*/, SpellModifier*& spellMod)
{
- sLog->outString("SpellMod data of Aura Effect is being calculated now!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "SpellMod data of Aura Effect is being calculated now!");
// we don't want spellmod for example
if (spellMod)
{
@@ -366,14 +368,14 @@ class spell_ex_absorb_aura : public SpellScriptLoader
void HandleOnEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- sLog->outString("Our aura is now absorbing damage done to us!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Our aura is now absorbing damage done to us!");
// absorb whole damage done to us
absorbAmount = dmgInfo.GetDamage();
}
void HandleAfterEffectAbsorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
{
- sLog->outString("Our aura has absorbed %u damage!", absorbAmount);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Our aura has absorbed %u damage!", absorbAmount);
}
// function registering
@@ -402,7 +404,7 @@ class spell_ex_463 : public SpellScriptLoader
bool CheckAreaTarget(Unit* target)
{
- sLog->outString("Area aura checks if unit is a valid target for it!");
+ sLog->outInfo(LOG_FILTER_GENERAL, "Area aura checks if unit is a valid target for it!");
// in our script we allow only players to be affected
return target->GetTypeId() == TYPEID_PLAYER;
}
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
index a70d05fa0ef..5c46519ab1c 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp
@@ -20,6 +20,7 @@
#include "ScriptedGossip.h"
#include "blackfathom_deeps.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
enum Spells
{
@@ -191,8 +192,8 @@ public:
enum Morridune
{
- SAY_MORRIDUNE_1 = -1048003,
- SAY_MORRIDUNE_2 = -1048004
+ SAY_MORRIDUNE_1 = 0,
+ SAY_MORRIDUNE_2 = 1
};
class npc_morridune : public CreatureScript
@@ -230,7 +231,7 @@ public:
{
npc_morriduneAI(Creature* creature) : npc_escortAI(creature)
{
- DoScriptText(SAY_MORRIDUNE_1, creature);
+ Talk(SAY_MORRIDUNE_1);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
Start(false, false, 0);
}
@@ -244,7 +245,7 @@ public:
me->SetOrientation(1.775791f);
me->SendMovementFlagUpdate();
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- DoScriptText(SAY_MORRIDUNE_2, me);
+ Talk(SAY_MORRIDUNE_2);
break;
}
}
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
index 1c754b78672..0a4779508e9 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp
@@ -21,16 +21,12 @@
enum Spells
{
- SPELL_MIND_BLAST = 15587,
- SPELL_SLEEP = 8399,
-};
+ SPELL_MIND_BLAST = 15587,
+ SPELL_SLEEP = 8399,
-//Id's from ACID
-enum Yells
-{
- SAY_AGGRO = -1048002,
- SAY_SLEEP = -1048001,
- SAY_DEATH = -1048000
+ SAY_AGGRO = 0,
+ SAY_SLEEP = 1,
+ SAY_DEATH = 2
};
class boss_kelris : public CreatureScript
@@ -65,14 +61,14 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(TYPE_KELRIS, IN_PROGRESS);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_KELRIS, DONE);
}
@@ -92,7 +88,7 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
- DoScriptText(SAY_SLEEP, me);
+ Talk(SAY_SLEEP);
DoCast(target, SPELL_SLEEP);
}
sleepTimer = urand(15000, 20000);
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
index 236c7b1ba69..8df5c5cdfd4 100644
--- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
+++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp
@@ -212,7 +212,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -233,7 +233,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
index ee988accbac..afd7603a506 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp
@@ -28,6 +28,7 @@ EndScriptData */
#include "hyjal.h"
#include "SpellAuras.h"
#include "hyjal_trash.h"
+#include "Player.h"
enum Texts
{
@@ -129,7 +130,6 @@ public:
} else CheckTimer -= diff;
}
};
-
};
/* This script is merely a placeholder for the Doomfire that triggers Doomfire spell. It will
@@ -220,7 +220,6 @@ public:
} else ChangeTargetTimer -= diff;
}
};
-
};
/* Finally, Archimonde's script. His script isn't extremely complex, most are simply spells on timers.
@@ -315,8 +314,8 @@ public:
{
Talk(SAY_SLAY);
- if (victim && (victim->GetTypeId() == TYPEID_PLAYER))
- GainSoulCharge(CAST_PLR(victim));
+ if (victim && victim->GetTypeId() == TYPEID_PLAYER)
+ GainSoulCharge(victim->ToPlayer());
}
void GainSoulCharge(Player* victim)
@@ -360,13 +359,13 @@ public:
if (victim && me->IsWithinDistInMap(victim, me->GetAttackDistance(victim)))
return false;
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- if (m_threatlist.empty())
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ if (threatlist.empty())
return false;
std::list<Unit*> targets;
- std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
- for (; itr != m_threatlist.end(); ++itr)
+ ThreatContainer::StorageType::const_iterator itr = threatlist.begin();
+ for (; itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->isAlive())
@@ -637,13 +636,8 @@ public:
DoMeleeAttackIfReady();
}
-
- void WaypointReached(uint32 /*waypointId*/)
- {
-
- }
+ void WaypointReached(uint32 /*waypointId*/) { }
};
-
};
void AddSC_boss_archimonde()
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
index 1be8f8e058f..3ab06642fb5 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp
@@ -33,6 +33,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "hyjalAI.h"
+#include "Player.h"
#define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore."
#define GOSSIP_ITEM_ANETHERON "We are ready for whatever Archimonde might send our way, Lady Proudmoore."
@@ -71,7 +72,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF:
ai->Debug = !ai->Debug;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI - Debug mode has been toggled");
+ sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled");
break;
}
return true;
@@ -148,7 +149,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF:
ai->Debug = !ai->Debug;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI - Debug mode has been toggled");
+ sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI - Debug mode has been toggled");
break;
}
return true;
@@ -222,11 +223,9 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
if (msg == EQUIP_ERR_OK)
- {
- Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
- if (item && player)
+ if (Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true))
player->SendNewItem(item, 1, true, false, true);
- }
+
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
}
return true;
@@ -238,7 +237,7 @@ public:
uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
// Only let them get item if Azgalor is dead.
- if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS, 1))
+ if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
return true;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
index a407f86ba70..70c5bc8b986 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp
@@ -407,7 +407,7 @@ void hyjalAI::Reset()
instance->DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
instance->SetData(DATA_RESET_TRASH_COUNT, 0);
}
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
//Visibility
DoHide = true;
@@ -540,7 +540,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3]
if (!instance)
{
- sLog->outError(ERROR_INST_DATA);
+ sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
return;
}
InfernalCount = 0;//reset infernal count every new wave
@@ -570,7 +570,7 @@ void hyjalAI::SummonNextWave(const Wave wave[18], uint32 Count, float Base[4][3]
else
{
NextWaveTimer = 15000;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
+ sLog->outDebug(LOG_FILTER_TSCR, "HyjalAI: debug mode is enabled. Next Wave in 15 seconds");
}
}
else
@@ -614,47 +614,11 @@ uint32 hyjalAI::GetInstanceData(uint32 Event)
{
if (instance)
return instance->GetData(Event);
- else sLog->outError(ERROR_INST_DATA);
+ else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
return 0;
}
-void hyjalAI::Talk(uint32 id)
-{
- std::list<uint8> index;
- for (uint8 i = 0; i < 9; ++i)
- {
- if (Faction == 0) // Alliance
- {
- if (JainaQuotes[i].id == id)
- index.push_back(i);
- }
- else if (Faction == 1) // Horde
- {
- if (ThrallQuotes[i].id == id)
- index.push_back(i);
- }
- }
-
- if (index.empty())
- return; // No quotes found, no use to continue
-
- uint8 ind = *(index.begin()) + rand()%index.size();
-
- int32 YellId = 0;
- if (Faction == 0) // Alliance
- {
- YellId = JainaQuotes[ind].textid;
- }
- else if (Faction == 1) // Horde
- {
- YellId = ThrallQuotes[ind].textid;
- }
-
- if (YellId)
- DoScriptText(YellId, me);
-}
-
void hyjalAI::Retreat()
{
if (instance)
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
index 68efa94d98b..5fe724c7845 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h
@@ -132,12 +132,6 @@ enum TargetType // Used in the spell
TARGETTYPE_VICTIM = 2,
};
-struct Yells
-{
- uint32 id; // Used to determine the type of yell (attack, rally, etc)
- int32 textid; // The text id to be yelled
-};
-
enum YellId
{
ATTACKED = 0, // Used when attacked and set in combat
@@ -149,32 +143,6 @@ enum YellId
DEATH = 6, // Used on death
};
-const Yells JainaQuotes[]=
-{
- {ATTACKED, -1534000},
- {ATTACKED, -1534001},
- {INCOMING, -1534002},
- {BEGIN, -1534003},
- {RALLY, -1534004},
- {RALLY, -1534005},
- {FAILURE, -1534006},
- {SUCCESS, -1534007},
- {DEATH, -1534008},
-};
-
-const Yells ThrallQuotes[]=
-{
- {ATTACKED, -1534009},
- {ATTACKED, -1534010},
- {INCOMING, -1534011},
- {BEGIN, -1534012},
- {RALLY, -1534013},
- {RALLY, -1534014},
- {FAILURE, -1534015},
- {SUCCESS, -1534016},
- {DEATH, -1534017},
-};
-
struct hyjalAI : public npc_escortAI
{
hyjalAI(Creature* creature);
@@ -215,8 +183,6 @@ struct hyjalAI : public npc_escortAI
uint32 GetInstanceData(uint32 Event); // Gets instance data for this instance, used to check if raid has gotten past a certain point and can access the next phase
- void Talk(uint32 id); // Searches for the appropriate yell and sound and uses it to inform the raid of various things
-
public:
InstanceScript* instance;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index d3218e1729e..01c1617aba4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -38,7 +38,7 @@ enum Spells
SPELL_BANSHEE_CURSE = 31651,
SPELL_BANSHEE_WAIL = 38183,
SPELL_ANTI_MAGIC_SHELL = 31662,
- SPELL_WEB = 28991,
+ SPELL_WEB = 28991,
SPELL_MANA_BURN = 31729,
SPELL_FROST_BREATH = 31688,
SPELL_GARGOYLE_STRIKE = 31664,
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
index 69bb8285404..df180bf5568 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp
@@ -27,6 +27,9 @@ EndScriptData */
#include "InstanceScript.h"
#include "ScriptedCreature.h"
#include "hyjal_trash.h"
+#include "Player.h"
+#include "WorldPacket.h"
+#include "Opcodes.h"
enum Misc
{
@@ -156,7 +159,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -273,7 +276,7 @@ public:
break;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data);
if (data == DONE)
{
@@ -293,7 +296,7 @@ public:
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
index b2853f25a33..17cae714b58 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: Intro, consecutive attacks to a random target durin time wrap,
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
@@ -37,15 +38,11 @@ enum Spells
enum Yells
{
- SAY_INTRO = -1595000, //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own."
- SAY_AGGRO = -1595001, //"We'll see about that, young prince."
- SAY_TIME_WARP_1 = -1595002, //"Tick tock, tick tock..."
- SAY_TIME_WARP_2 = -1595003, //"Not quick enough!"
- SAY_TIME_WARP_3 = -1595004, //"Let's get this over with. "
- SAY_SLAY_1 = -1595005, //"There is no future for you."
- SAY_SLAY_2 = -1595006, //"This is the hour of our greatest triumph!"
- SAY_SLAY_3 = -1595007, //"You were destined to fail. "
- SAY_DEATH = -1595008 //"*gurgles*"
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_TIME_WARP = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4
};
class boss_epoch : public CreatureScript
@@ -90,7 +87,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS);
@@ -123,7 +120,7 @@ public:
if (uiTimeWarpTimer < diff)
{
- DoScriptText(RAND(SAY_TIME_WARP_1, SAY_TIME_WARP_2, SAY_TIME_WARP_3), me);
+ Talk(SAY_TIME_WARP);
DoCastAOE(SPELL_TIME_WARP);
uiTimeWarpTimer = 25300;
} else uiTimeWarpTimer -= diff;
@@ -133,7 +130,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_EPOCH_EVENT, DONE);
@@ -144,7 +141,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
index ccf60f9bd0b..56d07a49dc4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
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 a038a06f815..b07f4120e97 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: Intro & outro
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
@@ -35,28 +36,21 @@ enum Spells
SPELL_SLEEP = 52721, //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target.
H_SPELL_SLEEP = 58849,
SPELL_VAMPIRIC_TOUCH = 52723, //Heals the caster for half the damage dealt by a melee attack.
+ SPELL_MAL_GANIS_KILL_CREDIT = 58124, // Quest credit
SPELL_KILL_CREDIT = 58630 // Non-existing spell as encounter credit, created in spell_dbc
};
enum Yells
{
- SAY_INTRO_1 = -1595009,
- SAY_INTRO_2 = -1595010,
- SAY_AGGRO = -1595011,
- SAY_KILL_1 = -1595012,
- SAY_KILL_2 = -1595013,
- SAY_KILL_3 = -1595014,
- SAY_SLAY_1 = -1595015,
- SAY_SLAY_2 = -1595016,
- SAY_SLAY_3 = -1595017,
- SAY_SLAY_4 = -1595018,
- SAY_SLEEP_1 = -1595019,
- SAY_SLEEP_2 = -1595020,
- SAY_30HEALTH = -1595021,
- SAY_15HEALTH = -1595022,
- SAY_ESCAPE_SPEECH_1 = -1595023,
- SAY_ESCAPE_SPEECH_2 = -1595024,
- SAY_OUTRO = -1595025,
+ SAY_AGGRO = 2,
+ SAY_KILL = 3,
+ SAY_SLAY = 4,
+ SAY_SLEEP = 5,
+ SAY_30HEALTH = 6,
+ SAY_15HEALTH = 7,
+ SAY_ESCAPE_SPEECH_1 = 8,
+ SAY_ESCAPE_SPEECH_2 = 9,
+ SAY_OUTRO = 10
};
enum CombatPhases
@@ -114,7 +108,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS);
}
@@ -136,13 +130,13 @@ public:
if (!bYelled && HealthBelowPct(30))
{
- DoScriptText(SAY_30HEALTH, me);
+ Talk(SAY_30HEALTH);
bYelled = true;
}
if (!bYelled2 && HealthBelowPct(15))
{
- DoScriptText(SAY_15HEALTH, me);
+ Talk(SAY_15HEALTH);
bYelled2 = true;
}
@@ -185,7 +179,7 @@ public:
if (uiSleepTimer < diff)
{
- DoScriptText(RAND(SAY_SLEEP_1, SAY_SLEEP_2), me);
+ Talk(SAY_SLEEP);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
DoCast(target, SPELL_SLEEP);
uiSleepTimer = urand(15000, 20000);
@@ -199,7 +193,7 @@ public:
switch (uiOutroStep)
{
case 1:
- DoScriptText(SAY_ESCAPE_SPEECH_1, me);
+ Talk(SAY_ESCAPE_SPEECH_1);
me->GetMotionMaster()->MoveTargetedHome();
++uiOutroStep;
uiOutroTimer = 8000;
@@ -207,12 +201,12 @@ public:
case 2:
me->SetTarget(instance ? instance->GetData64(DATA_ARTHAS) : 0);
me->HandleEmoteCommand(29);
- DoScriptText(SAY_ESCAPE_SPEECH_2, me);
+ Talk(SAY_ESCAPE_SPEECH_2);
++uiOutroStep;
uiOutroTimer = 9000;
break;
case 3:
- DoScriptText(SAY_OUTRO, me);
+ Talk(SAY_OUTRO);
++uiOutroStep;
uiOutroTimer = 16000;
break;
@@ -237,9 +231,9 @@ public:
if (instance)
{
instance->SetData(DATA_MAL_GANIS_EVENT, DONE);
-
+ DoCastAOE(SPELL_MAL_GANIS_KILL_CREDIT);
// give achievement credit and LFG rewards to players. criteria use spell 58630 which doesn't exist, but it was created in spell_dbc
- DoCast(me, SPELL_KILL_CREDIT);
+ DoCastAOE(SPELL_KILL_CREDIT);
}
}
@@ -248,7 +242,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3, SAY_SLAY_4), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
index d5dd597960f..05d9fe8b5e4 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp
@@ -23,7 +23,8 @@ SDComment: It may need timer adjustment
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
@@ -37,12 +38,10 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1595026,
- SAY_SLAY_1 = -1595027,
- SAY_SLAY_2 = -1595028,
- SAY_SLAY_3 = -1595029,
- SAY_SPAWN = -1595030,
- SAY_DEATH = -1595031
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_SPAWN = 2,
+ SAY_DEATH = 3
};
class boss_meathook : public CreatureScript
@@ -61,7 +60,7 @@ public:
{
instance = creature->GetInstanceScript();
if (instance)
- DoScriptText(SAY_SPAWN, me);
+ Talk(SAY_SPAWN);
}
uint32 uiChainTimer;
@@ -82,7 +81,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS);
@@ -118,7 +117,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MEATHOOK_EVENT, DONE);
@@ -129,7 +128,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
index 7828d172e1e..3a490301e47 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp
@@ -23,7 +23,8 @@ SDComment: TODO: Intro
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "culling_of_stratholme.h"
enum Spells
@@ -39,19 +40,13 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1595032,
- SAY_SPAWN = -1595033,
- SAY_SLAY_1 = -1595034,
- SAY_SLAY_2 = -1595035,
- SAY_SLAY_3 = -1595036,
- SAY_DEATH = -1595037,
- SAY_EXPLODE_GHOUL_1 = -1595038,
- SAY_EXPLODE_GHOUL_2 = -1595039,
- SAY_STEAL_FLESH_1 = -1595040,
- SAY_STEAL_FLESH_2 = -1595041,
- SAY_STEAL_FLESH_3 = -1595042,
- SAY_SUMMON_GHOULS_1 = -1595043,
- SAY_SUMMON_GHOULS_2 = -1595044
+ SAY_AGGRO = 0,
+ SAY_SPAWN = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
+ SAY_EXPLODE_GHOUL = 4,
+ SAY_STEAL_FLESH = 5,
+ SAY_SUMMON_GHOULS = 6
};
class boss_salramm : public CreatureScript
@@ -70,7 +65,7 @@ public:
{
instance = creature->GetInstanceScript();
if (instance)
- DoScriptText(SAY_SPAWN, me);
+ Talk(SAY_SPAWN);
}
uint32 uiCurseFleshTimer;
@@ -95,7 +90,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS);
@@ -125,7 +120,7 @@ public:
//Steal Flesh timer
if (uiStealFleshTimer <= diff)
{
- DoScriptText(RAND(SAY_STEAL_FLESH_1, SAY_STEAL_FLESH_2, SAY_STEAL_FLESH_3), me);
+ Talk(SAY_STEAL_FLESH);
if (Unit* random_pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(random_pTarget, SPELL_STEAL_FLESH);
uiStealFleshTimer = 10000;
@@ -134,7 +129,7 @@ public:
//Summon ghouls timer
if (uiSummonGhoulsTimer <= diff)
{
- DoScriptText(RAND(SAY_SUMMON_GHOULS_1, SAY_SUMMON_GHOULS_2), me);
+ Talk(SAY_SUMMON_GHOULS);
if (Unit* random_pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(random_pTarget, SPELL_SUMMON_GHOULS);
uiSummonGhoulsTimer = 10000;
@@ -145,7 +140,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_SALRAMM_EVENT, DONE);
@@ -156,7 +151,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
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 6454083e424..4887c8adf62 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp
@@ -15,71 +15,95 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "culling_of_stratholme.h"
#include "ScriptedEscortAI.h"
+#include "PassiveAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
enum Says
{
- //First Act - Uther and Jaina Dialog
- SAY_PHASE101 = -1595070, //Arthas
- SAY_PHASE102 = -1595071, //Uther
- SAY_PHASE103 = -1595072, //Arthas
- SAY_PHASE104 = -1595073, //Arthas
- SAY_PHASE105 = -1595074, //Uther
- SAY_PHASE106 = -1595075, //Arthas
- SAY_PHASE107 = -1595076, //Uther
- SAY_PHASE108 = -1595077, //Arthas
- SAY_PHASE109 = -1595078, //Arthas
- SAY_PHASE110 = -1595079, //Uther
- SAY_PHASE111 = -1595080, //Arthas
- SAY_PHASE112 = -1595081, //Uther
- SAY_PHASE113 = -1595082, //Jaina
- SAY_PHASE114 = -1595083, //Arthas
- SAY_PHASE115 = -1595084, //Uther
- SAY_PHASE116 = -1595085, //Arthas
- SAY_PHASE117 = -1595086, //Jaina
- SAY_PHASE118 = -1595087, //Arthas
+ //Arthas
+ //First Act
+ SAY_PHASE101 = 0,
+ SAY_PHASE103 = 1,
+ SAY_PHASE104 = 2,
+ SAY_PHASE106 = 3,
+ SAY_PHASE108 = 4,
+ SAY_PHASE110 = 5,
+ SAY_PHASE112 = 6,
+ SAY_PHASE114 = 7,
+ SAY_PHASE116 = 8,
+ SAY_PHASE118 = 9,
+
//Second Act - City Streets
- SAY_PHASE201 = -1595088, //Arthas
- SAY_PHASE202 = -1595089, //Cityman
- SAY_PHASE203 = -1595090, //Arthas
- SAY_PHASE204 = -1595091, //Crazyman
- SAY_PHASE205 = -1595092, //Arthas
- SAY_PHASE206 = -1595009, //Malganis
- SAY_PHASE207 = -1595010, //Malganis
- SAY_PHASE208 = -1595093, //Arthas
- SAY_PHASE209 = -1595094, //Arthas
- SAY_PHASE210 = -1595095, //Arthas
+ SAY_PHASE201 = 10,
+ SAY_PHASE203 = 11,
+ SAY_PHASE205 = 12,
+ SAY_PHASE208 = 13,
+ SAY_PHASE209 = 14,
+ SAY_PHASE210 = 15,
+
//Third Act - Town Hall
- SAY_PHASE301 = -1595096, //Arthas
- SAY_PHASE302 = -1595097, //Drakonian
- SAY_PHASE303 = -1595098, //Arthas
- SAY_PHASE304 = -1595099, //Arthas
- SAY_PHASE305 = -1595100, //Drakonian
- SAY_PHASE306 = -1595101, //Arthas
- SAY_PHASE307 = -1595102, //Arthas
- SAY_PHASE308 = -1595103, //Arthas
- SAY_PHASE309 = -1595104, //Arthas
- SAY_PHASE310 = -1595105, //Arthas
- SAY_PHASE311 = -1595106, //Arthas
- SAY_PHASE312 = -1595107, //Arthas
- SAY_PHASE313 = -1595108, //Arthas
- SAY_PHASE314 = -1595000, //Epoch
- SAY_PHASE315 = -1595109, //Arthas
+ SAY_PHASE301 = 16,
+ SAY_PHASE303 = 17,
+ SAY_PHASE304 = 18,
+ SAY_PHASE306 = 19,
+ SAY_PHASE307 = 20,
+ SAY_PHASE308 = 21,
+ SAY_PHASE309 = 22,
+ SAY_PHASE310 = 23,
+ SAY_PHASE311 = 24,
+ SAY_PHASE312 = 25,
+ SAY_PHASE313 = 26,
+ SAY_PHASE315 = 27,
+
//Fourth Act - Fire Corridor
- SAY_PHASE401 = -1595110, //Arthas
- SAY_PHASE402 = -1595111, //Arthas
- SAY_PHASE403 = -1595112, //Arthas
- SAY_PHASE404 = -1595113, //Arthas
- SAY_PHASE405 = -1595114, //Arthas
- SAY_PHASE406 = -1595115, //Arthas
- SAY_PHASE407 = -1595116, //Arthas
+ SAY_PHASE401 = 28,
+ SAY_PHASE402 = 29,
+ SAY_PHASE403 = 30,
+ SAY_PHASE404 = 31,
+ SAY_PHASE405 = 32,
+ SAY_PHASE406 = 33,
+ SAY_PHASE407 = 34,
+
//Fifth Act - Mal'Ganis Fight
- SAY_PHASE501 = -1595117, //Arthas
- SAY_PHASE502 = -1595118, //Arthas
- SAY_PHASE503 = -1595119, //Arthas
- SAY_PHASE504 = -1595120, //Arthas
+ SAY_PHASE501 = 35,
+ SAY_PHASE502 = 36,
+ SAY_PHASE503 = 37,
+ SAY_PHASE504 = 38,
+
+ //Malganis
+ SAY_PHASE206 = 0,
+ SAY_PHASE207 = 1,
+
+ //Epoch
+ SAY_PHASE314 = 0,
+
+ //Uther
+ SAY_PHASE102 = 0,
+ SAY_PHASE105 = 1,
+ SAY_PHASE107 = 2,
+ SAY_PHASE109 = 3,
+ SAY_PHASE111 = 4,
+ SAY_PHASE115 = 5,
+
+ //Jaina
+ SAY_PHASE113 = 0,
+ SAY_PHASE117 = 1,
+
+ //Cityman
+ SAY_PHASE202 = 0,
+
+ //Crazyman
+ SAY_PHASE204 = 0,
+
+ //Drakonian
+ SAY_PHASE302 = 0,
+ SAY_PHASE305 = 1,
};
enum NPCs
@@ -245,27 +269,27 @@ public:
ai->Start(true, true, player->GetGUID(), 0, false, false);
ai->SetDespawnAtEnd(false);
ai->bStepping = false;
- ai->uiStep = 1;
+ ai->step = 1;
break;
case GOSSIP_ACTION_INFO_DEF+1:
ai->bStepping = true;
- ai->uiStep = 24;
+ ai->step = 24;
break;
case GOSSIP_ACTION_INFO_DEF+2:
ai->SetHoldState(false);
ai->bStepping = false;
- ai->uiStep = 61;
+ ai->step = 61;
break;
case GOSSIP_ACTION_INFO_DEF+3:
ai->SetHoldState(false);
break;
case GOSSIP_ACTION_INFO_DEF+4:
ai->bStepping = true;
- ai->uiStep = 84;
+ ai->step = 84;
break;
case GOSSIP_ACTION_INFO_DEF+5:
ai->bStepping = true;
- ai->uiStep = 85;
+ ai->step = 85;
break;
}
player->CLOSE_GOSSIP_MENU();
@@ -280,7 +304,7 @@ public:
if (ai && ai->bStepping == false)
{
- switch (ai->uiGossipStep)
+ switch (ai->gossipStep)
{
case 0: //This one is a workaround since the very beggining of the script is wrong.
{
@@ -334,46 +358,46 @@ public:
InstanceScript* instance;
bool bStepping;
- uint32 uiStep;
- uint32 uiPhaseTimer;
- uint32 uiGossipStep;
- uint32 uiPlayerFaction;
- uint32 uiBossEvent;
- uint32 uiWave;
-
- uint64 uiUtherGUID;
- uint64 uiJainaGUID;
- uint64 uiCitymenGUID[2];
- uint64 uiWaveGUID[ENCOUNTER_WAVES_MAX_SPAWNS];
- uint64 uiInfiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER];
- uint64 uiStalkerGUID;
-
- uint64 uiBossGUID; //uiMeathookGUID || uiSalrammGUID
- uint64 uiEpochGUID;
- uint64 uiMalganisGUID;
- uint64 uiInfiniteGUID;
-
- uint32 uiExorcismTimer;
+ uint32 step;
+ uint32 phaseTimer;
+ uint32 gossipStep;
+ uint32 playerFaction;
+ uint32 bossEvent;
+ uint32 wave;
+
+ uint64 utherGUID;
+ uint64 jainaGUID;
+ uint64 citymenGUID[2];
+ uint64 waveGUID[ENCOUNTER_WAVES_MAX_SPAWNS];
+ uint64 infiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER];
+ uint64 stalkerGUID;
+
+ uint64 bossGUID;
+ uint64 epochGUID;
+ uint64 malganisGUID;
+ uint64 infiniteGUID;
+
+ uint32 exorcismTimer;
void Reset()
{
- uiUtherGUID = 0;
- uiJainaGUID = 0;
+ utherGUID = 0;
+ jainaGUID = 0;
for (uint8 i = 0; i < 2; ++i)
- uiCitymenGUID[i] = 0;
+ citymenGUID[i] = 0;
for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i)
- uiWaveGUID[i] = 0;
+ waveGUID[i] = 0;
for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i)
- uiInfiniteDraconianGUID[i] = 0;
+ infiniteDraconianGUID[i] = 0;
- uiStalkerGUID = 0;
- uiBossGUID = 0;
- uiEpochGUID = 0;
- uiMalganisGUID = 0;
- uiInfiniteGUID = 0;
+ stalkerGUID = 0;
+ bossGUID = 0;
+ epochGUID = 0;
+ malganisGUID = 0;
+ infiniteGUID = 0;
if (instance) {
instance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED);
@@ -381,15 +405,15 @@ public:
{
case NOT_STARTED:
bStepping = true;
- uiStep = 0;
+ step = 0;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- uiBossEvent = DATA_MEATHOOK_EVENT;
- uiGossipStep = 0;
+ bossEvent = DATA_MEATHOOK_EVENT;
+ gossipStep = 0;
break;
}
- uiPhaseTimer = 1000;
- uiExorcismTimer = 7300;
- uiWave = 0;
+ phaseTimer = 1000;
+ exorcismTimer = 7300;
+ wave = 0;
}
}
@@ -418,7 +442,7 @@ public:
temp->SetReactState(REACT_PASSIVE);
temp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1], RiftAndSpawnsLocations[i][2], RiftAndSpawnsLocations[i][3]);
if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH)
- uiEpochGUID = temp->GetGUID();
+ epochGUID = temp->GetGUID();
}
}
}
@@ -442,8 +466,8 @@ public:
void JumpToNextStep(uint32 uiTimer)
{
- uiPhaseTimer = uiTimer;
- ++uiStep;
+ phaseTimer = uiTimer;
+ ++step;
}
void WaypointReached(uint32 waypointId)
@@ -465,74 +489,74 @@ public:
bStepping = true;
break;
case 7:
- if (Unit* pCityman0 = me->SummonCreature(NPC_CITY_MAN, 2091.977f, 1275.021f, 140.757f, 0.558f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
- uiCitymenGUID[0] = pCityman0->GetGUID();
- if (Unit* pCityman1 = me->SummonCreature(NPC_CITY_MAN2, 2093.514f, 1275.842f, 140.408f, 3.801f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
- uiCitymenGUID[1] = pCityman1->GetGUID();
+ if (Unit* cityman0 = me->SummonCreature(NPC_CITY_MAN, 2091.977f, 1275.021f, 140.757f, 0.558f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
+ citymenGUID[0] = cityman0->GetGUID();
+ if (Unit* cityman1 = me->SummonCreature(NPC_CITY_MAN2, 2093.514f, 1275.842f, 140.408f, 3.801f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
+ citymenGUID[1] = cityman1->GetGUID();
break;
case 8:
- uiGossipStep = 1;
+ gossipStep = 1;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
SetHoldState(true);
break;
case 12:
SetRun(true);
- DoScriptText(SAY_PHASE210, me);
- if (Unit* pDisguised0 = me->SummonCreature(NPC_CITY_MAN3, 2398.14f, 1207.81f, 134.04f, 5.155249f, TEMPSUMMON_DEAD_DESPAWN, 180000))
+ Talk(SAY_PHASE210);
+ if (Unit* disguised0 = me->SummonCreature(NPC_CITY_MAN3, 2398.14f, 1207.81f, 134.04f, 5.155249f, TEMPSUMMON_DEAD_DESPAWN, 180000))
{
- uiInfiniteDraconianGUID[0] = pDisguised0->GetGUID();
- if (Unit* pDisguised1 = me->SummonCreature(NPC_CITY_MAN4, 2403.22f, 1205.54f, 134.04f, 3.311264f, TEMPSUMMON_DEAD_DESPAWN, 180000))
+ infiniteDraconianGUID[0] = disguised0->GetGUID();
+ if (Unit* disguised1 = me->SummonCreature(NPC_CITY_MAN4, 2403.22f, 1205.54f, 134.04f, 3.311264f, TEMPSUMMON_DEAD_DESPAWN, 180000))
{
- uiInfiniteDraconianGUID[1] = pDisguised1->GetGUID();
+ infiniteDraconianGUID[1] = disguised1->GetGUID();
- if (Unit* pDisguised2 = me->SummonCreature(NPC_CITY_MAN, 2400.82f, 1201.69f, 134.01f, 1.534082f, TEMPSUMMON_DEAD_DESPAWN, 180000))
+ if (Unit* disguised2 = me->SummonCreature(NPC_CITY_MAN, 2400.82f, 1201.69f, 134.01f, 1.534082f, TEMPSUMMON_DEAD_DESPAWN, 180000))
{
- uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID();
- pDisguised0->SetTarget(uiInfiniteDraconianGUID[1]);
- pDisguised1->SetTarget(uiInfiniteDraconianGUID[0]);
- pDisguised2->SetTarget(uiInfiniteDraconianGUID[1]);
+ infiniteDraconianGUID[2] = disguised2->GetGUID();
+ disguised0->SetTarget(infiniteDraconianGUID[1]);
+ disguised1->SetTarget(infiniteDraconianGUID[0]);
+ disguised2->SetTarget(infiniteDraconianGUID[1]);
}
}
}
break;
case 20:
- uiGossipStep = 2;
+ gossipStep = 2;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
SetRun(false);
SetHoldState(true);
break;
case 21:
- DoScriptText(SAY_PHASE301, me);
+ Talk(SAY_PHASE301);
break;
case 25:
SetRun(false);
- SpawnTimeRift(0, &uiInfiniteDraconianGUID[0]);
- DoScriptText(SAY_PHASE307, me);
+ SpawnTimeRift(0, &infiniteDraconianGUID[0]);
+ Talk(SAY_PHASE307);
break;
case 29:
SetRun(false);
- SpawnTimeRift(5, &uiInfiniteDraconianGUID[0]);
- SpawnTimeRift(8, &uiInfiniteDraconianGUID[2]);
- DoScriptText(SAY_PHASE309, me);
+ SpawnTimeRift(5, &infiniteDraconianGUID[0]);
+ SpawnTimeRift(8, &infiniteDraconianGUID[2]);
+ Talk(SAY_PHASE309);
SetHoldState(true);
bStepping = true;
break;
case 31:
SetRun(false);
- SpawnTimeRift(11, &uiInfiniteDraconianGUID[0]);
- SpawnTimeRift(14, &uiInfiniteDraconianGUID[2]);
- DoScriptText(SAY_PHASE311, me);
+ SpawnTimeRift(11, &infiniteDraconianGUID[0]);
+ SpawnTimeRift(14, &infiniteDraconianGUID[2]);
+ Talk(SAY_PHASE311);
SetHoldState(true);
bStepping = true;
break;
case 32:
- DoScriptText(SAY_PHASE401, me);
+ Talk(SAY_PHASE401);
break;
case 34:
- DoScriptText(SAY_PHASE402, me);
+ Talk(SAY_PHASE402);
break;
case 35:
- DoScriptText(SAY_PHASE403, me);
+ Talk(SAY_PHASE403);
break;
case 36:
if (instance)
@@ -542,23 +566,23 @@ public:
case 45:
SetRun(true);
SetDespawnAtFar(false);
- uiGossipStep = 4;
+ gossipStep = 4;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
SetHoldState(true);
break;
case 47:
SetRun(false);
- DoScriptText(SAY_PHASE405, me);
+ Talk(SAY_PHASE405);
break;
case 48:
SetRun(true);
- DoScriptText(SAY_PHASE406, me);
+ Talk(SAY_PHASE406);
break;
case 53:
- DoScriptText(SAY_PHASE407, me);
+ Talk(SAY_PHASE407);
break;
case 54:
- uiGossipStep = 5;
+ gossipStep = 5;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
SetHoldState(true);
break;
@@ -573,18 +597,18 @@ public:
if (bStepping)
{
- if (uiPhaseTimer <= diff)
+ if (phaseTimer <= diff)
{
- switch (uiStep)
+ switch (step)
{
//After reset
case 0:
{
- Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f);
- if (!pJaina)
- pJaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000);
- if (pJaina)
- uiJainaGUID = pJaina->GetGUID();
+ Unit* jaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f);
+ if (!jaina)
+ jaina = me->SummonCreature(NPC_JAINA, 1895.48f, 1292.66f, 143.706f, 0.023475f, TEMPSUMMON_DEAD_DESPAWN, 180000);
+ if (jaina)
+ jainaGUID = jaina->GetGUID();
bStepping = false;
JumpToNextStep(0);
break;
@@ -592,24 +616,24 @@ public:
//After waypoint 0
case 1:
me->SetWalk(false);
- if (Unit* pUther = me->SummonCreature(NPC_UTHER, 1794.357f, 1272.183f, 140.558f, 1.37f, TEMPSUMMON_DEAD_DESPAWN, 180000))
+ if (Unit* uther = me->SummonCreature(NPC_UTHER, 1794.357f, 1272.183f, 140.558f, 1.37f, TEMPSUMMON_DEAD_DESPAWN, 180000))
{
- uiUtherGUID = pUther->GetGUID();
- pUther->SetWalk(false);
- pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f);
- pUther->SetTarget(me->GetGUID());
- me->SetTarget(uiUtherGUID);
+ utherGUID = uther->GetGUID();
+ uther->SetWalk(false);
+ uther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f);
+ uther->SetTarget(me->GetGUID());
+ me->SetTarget(utherGUID);
}
JumpToNextStep(17000);
break;
case 2:
- DoScriptText(SAY_PHASE101, me);
+ Talk(SAY_PHASE101);
JumpToNextStep(2000);
break;
case 3:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
{
- DoScriptText(SAY_PHASE102, pUther);
+ uther->AI()->Talk(SAY_PHASE102);
}
JumpToNextStep(8000);
break;
@@ -617,90 +641,90 @@ public:
SetEscortPaused(false);
bStepping = false;
SetRun(false);
- DoScriptText(SAY_PHASE103, me);
+ Talk(SAY_PHASE103);
JumpToNextStep(0);
break;
//After waypoint 1
case 5:
- if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID))
- pJaina->SetTarget(me->GetGUID());
- DoScriptText(SAY_PHASE104, me);
+ if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ jaina->SetTarget(me->GetGUID());
+ Talk(SAY_PHASE104);
JumpToNextStep(10000);
break;
case 6:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
- DoScriptText(SAY_PHASE105, pUther);
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_PHASE105);
JumpToNextStep(1000);
break;
case 7:
- DoScriptText(SAY_PHASE106, me);
+ Talk(SAY_PHASE106);
JumpToNextStep(4000);
break;
case 8:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
- DoScriptText(SAY_PHASE107, pUther);
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_PHASE107);
JumpToNextStep(6000);
break;
case 9:
- DoScriptText(SAY_PHASE108, me);
+ Talk(SAY_PHASE108);
JumpToNextStep(4000);
break;
case 10:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
- DoScriptText(SAY_PHASE109, pUther);
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_PHASE109);
JumpToNextStep(8000);
break;
case 11:
- DoScriptText(SAY_PHASE110, me);
+ Talk(SAY_PHASE110);
JumpToNextStep(4000);
break;
case 12:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
- DoScriptText(SAY_PHASE111, pUther);
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_PHASE111);
JumpToNextStep(4000);
break;
case 13:
- DoScriptText(SAY_PHASE112, me);
+ Talk(SAY_PHASE112);
JumpToNextStep(11000);
break;
case 14:
- if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID))
- DoScriptText(SAY_PHASE113, pJaina);
+ if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ jaina->AI()->Talk(SAY_PHASE113);
JumpToNextStep(3000);
break;
case 15:
- DoScriptText(SAY_PHASE114, me);
+ Talk(SAY_PHASE114);
JumpToNextStep(9000);
break;
case 16:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
- DoScriptText(SAY_PHASE115, pUther);
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_PHASE115);
JumpToNextStep(4000);
break;
case 17:
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
{
- pUther->SetWalk(true);
- pUther->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
+ uther->SetWalk(true);
+ uther->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
}
JumpToNextStep(1000);
break;
case 18:
- if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID))
+ if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
{
- me->SetTarget(uiJainaGUID);
- pJaina->SetWalk(true);
- pJaina->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
+ me->SetTarget(jainaGUID);
+ jaina->SetWalk(true);
+ jaina->GetMotionMaster()->MovePoint(0, 1794.357f, 1272.183f, 140.558f);
}
JumpToNextStep(1000);
break;
case 19:
- DoScriptText(SAY_PHASE116, me);
+ Talk(SAY_PHASE116);
JumpToNextStep(1000);
break;
case 20:
- if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID))
- DoScriptText(SAY_PHASE117, pJaina);
+ if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ jaina->AI()->Talk(SAY_PHASE117);
JumpToNextStep(3000);
break;
case 21:
@@ -711,8 +735,8 @@ public:
break;
//After waypoint 3
case 22:
- DoScriptText(SAY_PHASE118, me);
- me->SetTarget(uiJainaGUID);
+ Talk(SAY_PHASE118);
+ me->SetTarget(jainaGUID);
JumpToNextStep(10000);
break;
case 23:
@@ -720,11 +744,11 @@ public:
bStepping = false;
SetRun(true);
- if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID))
- pJaina->DisappearAndDie();
+ if (Creature* jaina = Unit::GetCreature(*me, jainaGUID))
+ jaina->DisappearAndDie();
- if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID))
- pUther->DisappearAndDie();
+ if (Creature* uther = Unit::GetCreature(*me, utherGUID))
+ uther->DisappearAndDie();
me->SetTarget(0);
JumpToNextStep(0);
@@ -733,13 +757,13 @@ public:
case 24:
if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET, 2026.469f, 1287.088f, 143.596f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 14000))
{
- uiStalkerGUID = pStalker->GetGUID();
- me->SetTarget(uiStalkerGUID);
+ stalkerGUID = pStalker->GetGUID();
+ me->SetTarget(stalkerGUID);
}
JumpToNextStep(1000);
break;
case 25:
- DoScriptText(SAY_PHASE201, me);
+ Talk(SAY_PHASE201);
JumpToNextStep(12000);
break;
case 26:
@@ -751,24 +775,24 @@ public:
break;
//After waypoint 9
case 27:
- me->SetTarget(uiCitymenGUID[0]);
- if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0]))
+ me->SetTarget(citymenGUID[0]);
+ if (Creature* cityman = Unit::GetCreature(*me, citymenGUID[0]))
{
- pCityman->SetTarget(me->GetGUID());
- pCityman->SetWalk(true);
- pCityman->GetMotionMaster()->MovePoint(0, 2088.625f, 1279.191f, 140.743f);
+ cityman->SetTarget(me->GetGUID());
+ cityman->SetWalk(true);
+ cityman->GetMotionMaster()->MovePoint(0, 2088.625f, 1279.191f, 140.743f);
}
JumpToNextStep(2000);
break;
case 28:
- if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0]))
- DoScriptText(SAY_PHASE202, pCityman);
+ if (Creature* cityman = Unit::GetCreature(*me, citymenGUID[0]))
+ cityman->AI()->Talk(SAY_PHASE202);
JumpToNextStep(4000);
break;
case 29:
SetEscortPaused(false);
bStepping = false;
- DoScriptText(SAY_PHASE203, me);
+ Talk(SAY_PHASE203);
JumpToNextStep(0);
break;
//After waypoint 10
@@ -779,13 +803,13 @@ public:
case 31:
SetEscortPaused(false);
bStepping = false;
- if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1]))
+ if (Creature* cityman1 = Unit::GetCreature(*me, citymenGUID[1]))
{
- DoScriptText(SAY_PHASE204, pCityman1);
- pCityman1->SetTarget(me->GetGUID());
- if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0]))
- pCityman0->Kill(pCityman0);
- me->SetTarget(uiCitymenGUID[1]);
+ cityman1->AI()->Talk(SAY_PHASE204);
+ cityman1->SetTarget(me->GetGUID());
+ if (Creature* cityman0 = Unit::GetCreature(*me, citymenGUID[0]))
+ cityman0->Kill(cityman0);
+ me->SetTarget(citymenGUID[1]);
}
JumpToNextStep(0);
break;
@@ -795,75 +819,75 @@ public:
JumpToNextStep(1000);
break;
case 33:
- if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1]))
- pCityman1->Kill(pCityman1);
+ if (Creature* cityman1 = Unit::GetCreature(*me, citymenGUID[1]))
+ cityman1->Kill(cityman1);
JumpToNextStep(1000);
break;
case 34:
if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000))
{
- uiStalkerGUID = pStalker->GetGUID();
- me->SetTarget(uiStalkerGUID);
+ stalkerGUID = pStalker->GetGUID();
+ me->SetTarget(stalkerGUID);
}
- DoScriptText(SAY_PHASE205, me);
+ Talk(SAY_PHASE205);
JumpToNextStep(3000);
break;
case 35:
if (Unit* pStalkerM = me->SummonCreature(NPC_INVIS_TARGET, 2117.349f, 1288.624f, 136.271f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 60000))
{
- uiStalkerGUID = pStalkerM->GetGUID();
- me->SetTarget(uiStalkerGUID);
+ stalkerGUID = pStalkerM->GetGUID();
+ me->SetTarget(stalkerGUID);
}
JumpToNextStep(1000);
break;
case 36:
- if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS, 2117.349f, 1288.624f, 136.271f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 60000))
+ if (Creature* malganis = me->SummonCreature(NPC_MAL_GANIS, 2117.349f, 1288.624f, 136.271f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 60000))
{
- if (Creature* pStalkerM = Unit::GetCreature(*me, uiStalkerGUID))
- pMalganis->CastSpell(pStalkerM, 63793, false);
+ if (Creature* pStalkerM = Unit::GetCreature(*me, stalkerGUID))
+ malganis->CastSpell(pStalkerM, 63793, false);
- uiMalganisGUID = pMalganis->GetGUID();
- DoScriptText(SAY_PHASE206, pMalganis);
- pMalganis->SetTarget(me->GetGUID());
- pMalganis->SetReactState(REACT_PASSIVE);
+ malganisGUID = malganis->GetGUID();
+ malganis->AI()->Talk(SAY_PHASE206);
+ malganis->SetTarget(me->GetGUID());
+ malganis->SetReactState(REACT_PASSIVE);
}
JumpToNextStep(11000);
break;
case 37:
- if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID))
+ if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
{
- Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f);
+ Creature* pZombie = GetClosestCreatureWithEntry(malganis, NPC_CITY_MAN, 100.0f);
if (!pZombie)
- pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f);
+ pZombie = GetClosestCreatureWithEntry(malganis, NPC_CITY_MAN2, 100.0f);
if (pZombie)
pZombie->UpdateEntry(NPC_ZOMBIE, 0);
else //There's no one else to transform
- uiStep++;
+ step++;
}
else
- uiStep++;
- uiPhaseTimer = 500;
+ step++;
+ phaseTimer = 500;
break;
case 38:
- if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID))
- DoScriptText(SAY_PHASE207, pMalganis);
+ if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
+ malganis->AI()->Talk(SAY_PHASE207);
JumpToNextStep(17000);
break;
case 39:
- if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID))
- pMalganis->SetVisible(false);
- DoScriptText(SAY_PHASE208, me);
+ if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
+ malganis->SetVisible(false);
+ Talk(SAY_PHASE208);
JumpToNextStep(7000);
break;
case 40:
if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET, 2081.447f, 1287.770f, 141.3241f, 1.37f, TEMPSUMMON_TIMED_DESPAWN, 10000))
{
- uiStalkerGUID = pStalker->GetGUID();
- me->SetTarget(uiStalkerGUID);
+ stalkerGUID = pStalker->GetGUID();
+ me->SetTarget(stalkerGUID);
}
- DoScriptText(SAY_PHASE209, me);
+ Talk(SAY_PHASE209);
- uiBossEvent = DATA_MEATHOOK_EVENT;
+ bossEvent = DATA_MEATHOOK_EVENT;
if (instance)
instance->SetData(DATA_ARTHAS_EVENT, IN_PROGRESS);
@@ -879,10 +903,10 @@ public:
case 53:
case 55:
case 57:
- if (instance->GetData(uiBossEvent) != DONE)
+ if (instance->GetData(bossEvent) != DONE)
{
- SpawnWaveGroup(uiWave, uiWaveGUID);
- uiWave++;
+ SpawnWaveGroup(wave, waveGUID);
+ wave++;
}
JumpToNextStep(500);
break;
@@ -894,16 +918,16 @@ public:
case 54:
case 56:
case 58:
- if (instance->GetData(uiBossEvent) != DONE)
+ if (instance->GetData(bossEvent) != DONE)
{
uint32 mobCounter = 0;
uint32 deadCounter = 0;
for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i)
{
- if (uiWaveGUID[i] == 0)
+ if (waveGUID[i] == 0)
break;
++mobCounter;
- Unit* temp = Unit::GetCreature(*me, uiWaveGUID[i]);
+ Unit* temp = Unit::GetCreature(*me, waveGUID[i]);
if (!temp || temp->isDead())
++deadCounter;
}
@@ -911,24 +935,24 @@ public:
if (mobCounter <= deadCounter) //If group is dead
JumpToNextStep(1000);
else
- uiPhaseTimer = 1000;
+ phaseTimer = 1000;
}
else
JumpToNextStep(500);
break;
case 49: //Summon Boss
case 59:
- if (instance->GetData(uiBossEvent) != DONE)
+ if (instance->GetData(bossEvent) != DONE)
{
uint32 uiBossID = 0;
- if (uiBossEvent == DATA_MEATHOOK_EVENT)
+ if (bossEvent == DATA_MEATHOOK_EVENT)
uiBossID = NPC_MEATHOOK;
- else if (uiBossEvent == DATA_SALRAMM_EVENT)
+ else if (bossEvent == DATA_SALRAMM_EVENT)
uiBossID = NPC_SALRAMM;
if (Unit* pBoss = me->SummonCreature(uiBossID, 2232.19f, 1331.933f, 126.662f, 3.15f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000))
{
- uiBossGUID = pBoss->GetGUID();
+ bossGUID = pBoss->GetGUID();
pBoss->SetWalk(true);
pBoss->GetMotionMaster()->MovePoint(0, 2194.110f, 1332.00f, 130.00f);
}
@@ -939,42 +963,42 @@ public:
case 60:
if (instance)
{
- if (instance->GetData(uiBossEvent) == DONE)
+ if (instance->GetData(bossEvent) == DONE)
{
JumpToNextStep(1000);
- if (uiBossEvent == DATA_MEATHOOK_EVENT)
- uiBossEvent = DATA_SALRAMM_EVENT;
- else if (uiBossEvent == DATA_SALRAMM_EVENT)
+ if (bossEvent == DATA_MEATHOOK_EVENT)
+ bossEvent = DATA_SALRAMM_EVENT;
+ else if (bossEvent == DATA_SALRAMM_EVENT)
{
SetHoldState(false);
bStepping = false;
- uiBossEvent = DATA_EPOCH_EVENT;
+ bossEvent = DATA_EPOCH_EVENT;
}
}
- else if (instance->GetData(uiBossEvent) == FAIL)
+ else if (instance->GetData(bossEvent) == FAIL)
npc_escortAI::EnterEvadeMode();
else
- uiPhaseTimer = 10000;
+ phaseTimer = 10000;
}
break;
//After Gossip 2 (waypoint 22)
case 61:
me->SetReactState(REACT_AGGRESSIVE);
- if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0]))
- pDisguised0->SetTarget(me->GetGUID());
- if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1]))
- pDisguised1->SetTarget(me->GetGUID());
- if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2]))
- pDisguised2->SetTarget(me->GetGUID());
+ if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ disguised0->SetTarget(me->GetGUID());
+ if (Creature* disguised1 = Unit::GetCreature(*me, infiniteDraconianGUID[1]))
+ disguised1->SetTarget(me->GetGUID());
+ if (Creature* disguised2 = Unit::GetCreature(*me, infiniteDraconianGUID[2]))
+ disguised2->SetTarget(me->GetGUID());
JumpToNextStep(1000);
break;
case 62:
- if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0]))
- DoScriptText(SAY_PHASE302, pDisguised0);
+ if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ disguised0->AI()->Talk(SAY_PHASE302);
JumpToNextStep(7000);
break;
case 63:
- DoScriptText(SAY_PHASE303, me);
+ Talk(SAY_PHASE303);
SetHoldState(false);
bStepping = false;
JumpToNextStep(0);
@@ -985,46 +1009,46 @@ public:
JumpToNextStep(1000);
break;
case 65:
- if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0]))
- pDisguised0->HandleEmoteCommand(11);
+ if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ disguised0->HandleEmoteCommand(11);
JumpToNextStep(1000);
break;
case 66:
- DoScriptText(SAY_PHASE304, me);
+ Talk(SAY_PHASE304);
JumpToNextStep(2000);
break;
case 67:
- if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0]))
- DoScriptText(SAY_PHASE305, pDisguised0);
+ if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
+ disguised0->AI()->Talk(SAY_PHASE305);
JumpToNextStep(1000);
break;
case 68:
- if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2]))
+ if (Creature* disguised2 = Unit::GetCreature(*me, infiniteDraconianGUID[2]))
{
- pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0);
+ disguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0);
//Make them unattackable
- pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- pDisguised2->SetReactState(REACT_PASSIVE);
+ disguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
+ disguised2->SetReactState(REACT_PASSIVE);
}
JumpToNextStep(2000);
break;
case 69:
- if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1]))
+ if (Creature* disguised1 = Unit::GetCreature(*me, infiniteDraconianGUID[1]))
{
- pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0);
+ disguised1->UpdateEntry(NPC_INFINITE_AGENT, 0);
//Make them unattackable
- pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- pDisguised1->SetReactState(REACT_PASSIVE);
+ disguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
+ disguised1->SetReactState(REACT_PASSIVE);
}
JumpToNextStep(2000);
break;
case 70:
- if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0]))
+ if (Creature* disguised0 = Unit::GetCreature(*me, infiniteDraconianGUID[0]))
{
- pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0);
+ disguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0);
//Make them unattackable
- pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- pDisguised0->SetReactState(REACT_PASSIVE);
+ disguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
+ disguised0->SetReactState(REACT_PASSIVE);
}
JumpToNextStep(2000);
break;
@@ -1035,7 +1059,7 @@ public:
case 77:
//Make cratures attackable
for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i)
- if (Creature* temp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i]))
+ if (Creature* temp = Unit::GetCreature(*me, infiniteDraconianGUID[i]))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
temp->SetReactState(REACT_AGGRESSIVE);
@@ -1046,12 +1070,12 @@ public:
case 74:
case 76:
if (me->isInCombat())
- uiPhaseTimer = 1000;
+ phaseTimer = 1000;
else
{
- if (uiStep == 72) DoScriptText(SAY_PHASE308, me);
- if (uiStep == 74) DoScriptText(SAY_PHASE308, me);
- if (uiStep == 76) DoScriptText(SAY_PHASE310, me);
+ if (step == 72) Talk(SAY_PHASE308);
+ if (step == 74) Talk(SAY_PHASE308);
+ if (step == 76) Talk(SAY_PHASE310);
SetHoldState(false);
bStepping = false;
SetRun(true);
@@ -1060,44 +1084,44 @@ public:
break;
case 78:
if (me->isInCombat())
- uiPhaseTimer = 1000;
+ phaseTimer = 1000;
else
{
- DoScriptText(SAY_PHASE312, me);
+ Talk(SAY_PHASE312);
JumpToNextStep(5000);
}
break;
case 79:
- DoScriptText(SAY_PHASE313, me);
+ Talk(SAY_PHASE313);
JumpToNextStep(1000);
break;
case 80:
if (instance)
if (instance->GetData(DATA_EPOCH_EVENT) != DONE)
{
- SpawnTimeRift(17, &uiEpochGUID);
- if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID))
- DoScriptText(SAY_PHASE314, pEpoch);
- me->SetTarget(uiEpochGUID);
+ SpawnTimeRift(17, &epochGUID);
+ if (Creature* epoch = Unit::GetCreature(*me, epochGUID))
+ epoch->AI()->Talk(SAY_PHASE314);
+ me->SetTarget(epochGUID);
}
JumpToNextStep(18000);
break;
case 81:
if (instance)
if (instance->GetData(DATA_EPOCH_EVENT) != DONE)
- DoScriptText(SAY_PHASE315, me);
+ Talk(SAY_PHASE315);
JumpToNextStep(6000);
break;
case 82:
if (instance)
if (instance->GetData(DATA_EPOCH_EVENT) != DONE)
{
- if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID))
+ if (Creature* epoch = Unit::GetCreature(*me, epochGUID))
{
//Make Epoch attackable
- pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
- pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- pEpoch->SetReactState(REACT_AGGRESSIVE);
+ epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
+ epoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ epoch->SetReactState(REACT_AGGRESSIVE);
}
}
@@ -1108,31 +1132,31 @@ public:
{
if (instance->GetData(DATA_EPOCH_EVENT) == DONE)
{
- uiGossipStep = 3;
+ gossipStep = 3;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
bStepping = false;
- uiBossEvent = DATA_MAL_GANIS_EVENT;
+ bossEvent = DATA_MAL_GANIS_EVENT;
JumpToNextStep(15000);
}
else if (instance->GetData(DATA_EPOCH_EVENT) == FAIL)
npc_escortAI::EnterEvadeMode();
else
- uiPhaseTimer = 10000;
+ phaseTimer = 10000;
}
break;
//After Gossip 4
case 84:
- DoScriptText(SAY_PHASE404, me);
+ Talk(SAY_PHASE404);
SetHoldState(false);
bStepping = false;
break;
//After Gossip 5
case 85:
- DoScriptText(SAY_PHASE501, me);
- if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS, 2296.665f, 1502.362f, 128.362f, 4.961f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000))
+ Talk(SAY_PHASE501);
+ if (Creature* malganis = me->SummonCreature(NPC_MAL_GANIS, 2296.665f, 1502.362f, 128.362f, 4.961f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000))
{
- uiMalganisGUID = pMalganis->GetGUID();
- pMalganis->SetReactState(REACT_PASSIVE);
+ malganisGUID = malganis->GetGUID();
+ malganis->SetReactState(REACT_PASSIVE);
}
if (instance)
if (GameObject* pGate = instance->instance->GetGameObject(instance->GetData64(DATA_MAL_GANIS_GATE_1)))
@@ -1143,15 +1167,15 @@ public:
break;
//After waypoint 55
case 86:
- DoScriptText(SAY_PHASE502, me);
+ Talk(SAY_PHASE502);
JumpToNextStep(6000);
- me->SetTarget(uiMalganisGUID);
+ me->SetTarget(malganisGUID);
break;
case 87:
- if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID))
+ if (Creature* malganis = Unit::GetCreature(*me, malganisGUID))
{
- pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_UNK_6 | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNK_15);
- pMalganis->SetReactState(REACT_AGGRESSIVE);
+ malganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_UNK_6 | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNK_15);
+ malganis->SetReactState(REACT_AGGRESSIVE);
}
JumpToNextStep(1000);
break;
@@ -1166,14 +1190,14 @@ public:
else if (instance->GetData(DATA_MAL_GANIS_EVENT) == FAIL)
npc_escortAI::EnterEvadeMode();
else
- uiPhaseTimer = 10000;
+ phaseTimer = 10000;
}
break;
//After waypoint 56
case 89:
SetRun(true);
- me->SetTarget(uiMalganisGUID);
- DoScriptText(SAY_PHASE503, me);
+ me->SetTarget(malganisGUID);
+ Talk(SAY_PHASE503);
JumpToNextStep(7000);
break;
case 90:
@@ -1182,23 +1206,23 @@ public:
instance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D
me->SetTarget(instance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind
}
- DoScriptText(SAY_PHASE504, me);
+ Talk(SAY_PHASE504);
bStepping = false;
break;
}
- } else uiPhaseTimer -= diff;
+ } else phaseTimer -= diff;
}
//Battling skills
if (!me->getVictim())
return;
- if (uiExorcismTimer < diff)
+ if (exorcismTimer < diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_EXORCISM_N);
- uiExorcismTimer = 7300;
- } else uiExorcismTimer -= diff;
+ exorcismTimer = 7300;
+ } else exorcismTimer -= diff;
if (HealthBelowPct(40))
DoCast(me, SPELL_HOLY_LIGHT);
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
index b232cae4657..0467109effc 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp
@@ -15,9 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "CreatureTextMgr.h"
#include "culling_of_stratholme.h"
+#include "Player.h"
+#include "TemporarySummon.h"
+#include "SpellInfo.h"
#define MAX_ENCOUNTER 5
@@ -194,7 +198,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -214,7 +218,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
index 5b47c2ee07d..bcf48ccd7be 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp
@@ -23,18 +23,18 @@ SDComment: Some spells not implemented
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "dark_portal.h"
enum eEnums
{
- SAY_ENTER = -1269012,
- SAY_AGGRO = -1269013,
- SAY_BANISH = -1269014,
- SAY_SLAY1 = -1269015,
- SAY_SLAY2 = -1269016,
- SAY_DEATH = -1269017,
- EMOTE_FRENZY = -1269018,
+ SAY_ENTER = 0,
+ SAY_AGGRO = 1,
+ SAY_BANISH = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+ EMOTE_FRENZY = 5,
SPELL_CLEAVE = 40504,
SPELL_TIME_STOP = 31422,
@@ -75,7 +75,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void MoveInLineOfSight(Unit* who)
@@ -85,7 +85,7 @@ public:
{
if (me->IsWithinDistInMap(who, 20.0f))
{
- DoScriptText(SAY_BANISH, me);
+ Talk(SAY_BANISH);
me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
}
@@ -95,7 +95,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
@@ -106,7 +106,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -132,7 +132,7 @@ public:
//Frenzy
if (Frenzy_Timer <= diff)
{
- DoScriptText(EMOTE_FRENZY, me);
+ Talk(EMOTE_FRENZY);
DoCast(me, SPELL_ENRAGE);
Frenzy_Timer = 20000+rand()%15000;
} else Frenzy_Timer -= diff;
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 a4e805b3b75..244e22149fc 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
@@ -23,17 +23,17 @@ SDComment: All abilities not implemented
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "dark_portal.h"
enum eEnums
{
- SAY_ENTER = -1269006,
- SAY_AGGRO = -1269007,
- SAY_BANISH = -1269008,
- SAY_SLAY1 = -1269009,
- SAY_SLAY2 = -1269010,
- SAY_DEATH = -1269011,
+ SAY_ENTER = 0,
+ SAY_AGGRO = 1,
+ SAY_BANISH = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
SPELL_ARCANE_BLAST = 31457,
H_SPELL_ARCANE_BLAST = 38538,
@@ -77,7 +77,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void MoveInLineOfSight(Unit* who)
@@ -87,7 +87,7 @@ public:
{
if (me->IsWithinDistInMap(who, 20.0f))
{
- DoScriptText(SAY_BANISH, me);
+ Talk(SAY_BANISH);
me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
}
@@ -97,12 +97,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_RIFT, SPECIAL);
@@ -132,7 +132,7 @@ public:
//Time Lapse
if (TimeLapse_Timer <= diff)
{
- DoScriptText(SAY_BANISH, me);
+ Talk(SAY_BANISH);
DoCast(me, SPELL_TIME_LAPSE);
TimeLapse_Timer = 15000+rand()%10000;
} else TimeLapse_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 f59c9f0ef4c..02a9f4742b3 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp
@@ -23,17 +23,17 @@ SDComment: More abilities need to be implemented
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "dark_portal.h"
enum eEnums
{
- SAY_ENTER = -1269000,
- SAY_AGGRO = -1269001,
- SAY_BANISH = -1269002,
- SAY_SLAY1 = -1269003,
- SAY_SLAY2 = -1269004,
- SAY_DEATH = -1269005,
+ SAY_ENTER = 0,
+ SAY_AGGRO = 1,
+ SAY_BANISH = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
SPELL_HASTE = 31458,
SPELL_MORTAL_WOUND = 31464,
@@ -76,17 +76,17 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_RIFT, SPECIAL);
@@ -99,7 +99,7 @@ public:
{
if (me->IsWithinDistInMap(who, 20.0f))
{
- DoScriptText(SAY_BANISH, me);
+ Talk(SAY_BANISH);
me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
index c2a41cb29d1..5d9eaeac7b9 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp
@@ -29,32 +29,39 @@ npc_time_rift
npc_saat
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "dark_portal.h"
+#include "Player.h"
+#include "SpellInfo.h"
-#define SAY_ENTER -1269020 //where does this belong?
-#define SAY_INTRO -1269021
-#define SAY_WEAK75 -1269022
-#define SAY_WEAK50 -1269023
-#define SAY_WEAK25 -1269024
-#define SAY_DEATH -1269025
-#define SAY_WIN -1269026
-#define SAY_ORCS_ENTER -1269027
-#define SAY_ORCS_ANSWER -1269028
+enum MedivhBm
+{
+ SAY_ENTER = 0, //where does this belong?
+ SAY_INTRO = 1,
+ SAY_WEAK75 = 2,
+ SAY_WEAK50 = 3,
+ SAY_WEAK25 = 4,
+ SAY_DEATH = 5,
+ SAY_WIN = 6,
+ SAY_ORCS_ENTER = 7,
+ SAY_ORCS_ANSWER = 8,
-#define SPELL_CHANNEL 31556
-#define SPELL_PORTAL_RUNE 32570 //aura(portal on ground effect)
+ SPELL_CHANNEL = 31556,
+ SPELL_PORTAL_RUNE = 32570, //aura(portal on ground effect)
-#define SPELL_BLACK_CRYSTAL 32563 //aura
-#define SPELL_PORTAL_CRYSTAL 32564 //summon
+ SPELL_BLACK_CRYSTAL = 32563, //aura
+ SPELL_PORTAL_CRYSTAL = 32564, //summon
-#define SPELL_BANISH_PURPLE 32566 //aura
-#define SPELL_BANISH_GREEN 32567 //aura
+ SPELL_BANISH_PURPLE = 32566, //aura
+ SPELL_BANISH_GREEN = 32567, //aura
-#define SPELL_CORRUPT 31326
-#define SPELL_CORRUPT_AEONUS 37853
+ SPELL_CORRUPT = 31326,
+ SPELL_CORRUPT_AEONUS = 37853,
-#define C_COUNCIL_ENFORCER 17023
+ C_COUNCIL_ENFORCER = 17023
+};
class npc_medivh_bm : public CreatureScript
{
@@ -107,7 +114,7 @@ public:
if (instance->GetData(TYPE_MEDIVH) == IN_PROGRESS || instance->GetData(TYPE_MEDIVH) == DONE)
return;
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
instance->SetData(TYPE_MEDIVH, IN_PROGRESS);
DoCast(me, SPELL_CHANNEL, false);
Check_Timer = 5000;
@@ -158,7 +165,7 @@ public:
if (killer->GetEntry() == me->GetEntry())
return;
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -191,17 +198,17 @@ public:
if (Life25 && pct <= 25)
{
- DoScriptText(SAY_WEAK25, me);
+ Talk(SAY_WEAK25);
Life25 = false;
}
else if (Life50 && pct <= 50)
{
- DoScriptText(SAY_WEAK50, me);
+ Talk(SAY_WEAK50);
Life50 = false;
}
else if (Life75 && pct <= 75)
{
- DoScriptText(SAY_WEAK75, me);
+ Talk(SAY_WEAK75);
Life75 = false;
}
@@ -216,7 +223,7 @@ public:
if (instance->GetData(TYPE_RIFT) == DONE)
{
- DoScriptText(SAY_WIN, me);
+ Talk(SAY_WIN);
Check_Timer = 0;
if (me->HasAura(SPELL_CHANNEL))
@@ -324,7 +331,7 @@ public:
uint32 entry = 0;
entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount];
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry);
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: summoning wave Creature (Wave %u, Entry %u).", mRiftWaveCount, entry);
++mRiftWaveCount;
@@ -349,7 +356,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
return;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_time_rift: not casting anylonger, i need to die.");
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_time_rift: not casting anylonger, i need to die.");
me->setDeathState(JUST_DIED);
if (instance->GetData(TYPE_RIFT) == IN_PROGRESS)
@@ -359,11 +366,13 @@ public:
};
-#define SAY_SAAT_WELCOME -1269019
+enum Saat
+{
+ SPELL_CHRONO_BEACON = 34975,
+ ITEM_CHRONO_BEACON = 24289
+};
#define GOSSIP_ITEM_OBTAIN "[PH] Obtain Chrono-Beacon"
-#define SPELL_CHRONO_BEACON 34975
-#define ITEM_CHRONO_BEACON 24289
class npc_saat : public CreatureScript
{
@@ -386,13 +395,13 @@ public:
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
- if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(ITEM_CHRONO_BEACON, 1))
+ if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(ITEM_CHRONO_BEACON))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_OBTAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(10000, creature->GetGUID());
return true;
}
- else if (player->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !player->HasItemCount(ITEM_CHRONO_BEACON, 1))
+ else if (player->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !player->HasItemCount(ITEM_CHRONO_BEACON))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_OBTAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(10001, creature->GetGUID());
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 2c8cd096644..b7820bae920 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp
@@ -23,8 +23,12 @@ SDComment: Quest support: 9836, 10297. Currently in progress.
SDCategory: Caverns of Time, The Dark Portal
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "dark_portal.h"
+#include "Player.h"
+#include "TemporarySummon.h"
+#include "SpellInfo.h"
#define MAX_ENCOUNTER 2
@@ -192,7 +196,7 @@ public:
{
if (data == IN_PROGRESS)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Starting event.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Starting event.");
InitWorldState();
m_auiEncounter[1] = IN_PROGRESS;
NextPortal_Timer = 15000;
@@ -201,7 +205,7 @@ public:
if (data == DONE)
{
//this may be completed further out in the post-event
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Event completed.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Event completed.");
Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
@@ -235,7 +239,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -251,7 +255,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
if (data == DATA_MEDIVH)
return MedivhGUID;
@@ -266,7 +270,7 @@ public:
if (entry == RIFT_BOSS)
entry = RandRiftBoss();
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Summoning rift boss entry %u.", entry);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Summoning rift boss entry %u.", entry);
Position pos;
me->GetRandomNearPosition(pos, 10.0f);
@@ -277,7 +281,7 @@ public:
if (Creature* summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000))
return summon;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun...");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: What just happened there? No boss, no loot, no fun...");
return NULL;
}
@@ -290,7 +294,7 @@ public:
if (tmp >= CurrentRiftId)
++tmp;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).", tmp, CurrentRiftId);
CurrentRiftId = tmp;
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 c27507cdcec..3398395aca6 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp
@@ -23,22 +23,29 @@ SDComment: Missing adds, missing waypoints to move up to Thrall once spawned + s
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
-#define SAY_ENTER -1560000
-#define SAY_TAUNT1 -1560001
-#define SAY_TAUNT2 -1560002
-#define SAY_SLAY1 -1560003
-#define SAY_SLAY2 -1560004
-#define SAY_DEATH -1560005
+/*######################
+# boss_captain_skarloc #
+#######################*/
-#define SPELL_HOLY_LIGHT 29427
-#define SPELL_CLEANSE 29380
-#define SPELL_HAMMER_OF_JUSTICE 13005
-#define SPELL_HOLY_SHIELD 31904
-#define SPELL_DEVOTION_AURA 8258
-#define SPELL_CONSECRATION 38385
+enum CaptainSkarloc
+{
+ SAY_ENTER = 0,
+ SAY_TAUNT1 = 1,
+ SAY_TAUNT2 = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+
+ SPELL_HOLY_LIGHT = 29427,
+ SPELL_CLEANSE = 29380,
+ SPELL_HAMMER_OF_JUSTICE = 13005,
+ SPELL_HOLY_SHIELD = 31904,
+ SPELL_DEVOTION_AURA = 8258,
+ SPELL_CONSECRATION = 38385
+};
class boss_captain_skarloc : public CreatureScript
{
@@ -79,18 +86,18 @@ public:
void EnterCombat(Unit* /*who*/)
{
//This is not correct. Should taunt Thrall before engage in combat
- DoScriptText(SAY_TAUNT1, me);
- DoScriptText(SAY_TAUNT2, me);
+ Talk(SAY_TAUNT1);
+ Talk(SAY_TAUNT2);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance && instance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS)
instance->SetData(TYPE_THRALL_PART1, DONE);
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 82bd0a9e9be..00204300a51 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp
@@ -23,24 +23,27 @@ SDComment: Missing spawns pre-event, missing speech to be coordinated with rest
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
-#define SAY_ENTER1 -1560013
-#define SAY_ENTER2 -1560014
-#define SAY_ENTER3 -1560015
-#define SAY_AGGRO1 -1560016
-#define SAY_AGGRO2 -1560017
-#define SAY_SLAY1 -1560018
-#define SAY_SLAY2 -1560019
-#define SAY_BREATH1 -1560020
-#define SAY_BREATH2 -1560021
-#define SAY_DEATH -1560022
-
-#define SPELL_SAND_BREATH 31914
-#define SPELL_IMPENDING_DEATH 31916
-#define SPELL_MAGIC_DISRUPTION_AURA 33834
-#define SPELL_WING_BUFFET 31475
+/*###################
+# boss_epoch_hunter #
+####################*/
+
+enum EpochHunter
+{
+ SAY_ENTER = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_BREATH = 3,
+ SAY_DEATH = 4,
+
+ SPELL_SAND_BREATH = 31914,
+ SPELL_IMPENDING_DEATH = 31916,
+ SPELL_MAGIC_DISRUPTION_AURA = 33834,
+ SPELL_WING_BUFFET = 31475
+};
class boss_epoch_hunter : public CreatureScript
{
@@ -76,17 +79,17 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2), me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance && instance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS)
instance->SetData(TYPE_THRALL_PART4, DONE);
@@ -106,7 +109,7 @@ public:
DoCast(me->getVictim(), SPELL_SAND_BREATH);
- DoScriptText(RAND(SAY_BREATH1, SAY_BREATH2), me);
+ Talk(SAY_BREATH);
SandBreath_Timer = urand(10000, 20000);
} else SandBreath_Timer -= diff;
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 45825a81eb2..22036899d64 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp
@@ -23,7 +23,8 @@ SDComment: Missing proper code for patrolling area after being spawned. Script f
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "old_hillsbrad.h"
#include "ScriptedEscortAI.h"
@@ -55,18 +56,20 @@ public:
## boss_lieutenant_drake
######*/
-#define SAY_ENTER -1560006
-#define SAY_AGGRO -1560007
-#define SAY_SLAY1 -1560008
-#define SAY_SLAY2 -1560009
-#define SAY_MORTAL -1560010
-#define SAY_SHOUT -1560011
-#define SAY_DEATH -1560012
-
-#define SPELL_WHIRLWIND 31909
-#define SPELL_HAMSTRING 9080
-#define SPELL_MORTAL_STRIKE 31911
-#define SPELL_FRIGHTENING_SHOUT 33789
+enum LieutenantDrake
+{
+ SAY_ENTER = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_MORTAL = 3,
+ SAY_SHOUT = 4,
+ SAY_DEATH = 5,
+
+ SPELL_WHIRLWIND = 31909,
+ SPELL_HAMSTRING = 9080,
+ SPELL_MORTAL_STRIKE = 31911,
+ SPELL_FRIGHTENING_SHOUT = 33789
+};
struct Location
{
@@ -134,17 +137,17 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -170,7 +173,7 @@ public:
//Fear
if (Fear_Timer <= diff)
{
- DoScriptText(SAY_SHOUT, me);
+ Talk(SAY_SHOUT);
DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT);
Fear_Timer = 25000+rand()%10000;
} else Fear_Timer -= diff;
@@ -178,7 +181,7 @@ public:
//Mortal Strike
if (MortalStrike_Timer <= diff)
{
- DoScriptText(SAY_MORTAL, me);
+ Talk(SAY_MORTAL);
DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
MortalStrike_Timer = 20000+rand()%10000;
} else MortalStrike_Timer -= diff;
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
index b179a15e878..5f7af55358e 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp
@@ -23,8 +23,11 @@ SDComment: If thrall escort fail, all parts will reset. In future, save sub-part
SDCategory: Caverns of Time, Old Hillsbrad Foothills
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "old_hillsbrad.h"
+#include "Player.h"
#define MAX_ENCOUNTER 6
@@ -83,7 +86,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -123,7 +126,7 @@ public:
if (!player)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data);
return;
}
@@ -139,7 +142,7 @@ public:
++mBarrelCount;
DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u", mBarrelCount);
m_auiEncounter[0] = IN_PROGRESS;
@@ -160,7 +163,7 @@ public:
{
++mThrallEventCount;
m_auiEncounter[1] = NOT_STARTED;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
m_auiEncounter[2] = NOT_STARTED;
m_auiEncounter[3] = NOT_STARTED;
m_auiEncounter[4] = NOT_STARTED;
@@ -173,34 +176,34 @@ public:
m_auiEncounter[3] = data;
m_auiEncounter[4] = data;
m_auiEncounter[5] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.", mThrallEventCount);
}
}
else
m_auiEncounter[1] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall escort event adjusted to data %u.", data);
break;
}
case TYPE_THRALL_PART1:
m_auiEncounter[2] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part I adjusted to data %u.", data);
break;
case TYPE_THRALL_PART2:
m_auiEncounter[3] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part II adjusted to data %u.", data);
break;
case TYPE_THRALL_PART3:
m_auiEncounter[4] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part III adjusted to data %u.", data);
break;
case TYPE_THRALL_PART4:
m_auiEncounter[5] = data;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.", data);
break;
}
}
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 data) const
{
switch (data)
{
@@ -220,7 +223,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
index 7d9da6771dc..fe41ff521d8 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp
@@ -29,16 +29,21 @@ npc_thrall_old_hillsbrad
npc_taretha
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "old_hillsbrad.h"
+#include "Player.h"
-#define QUEST_ENTRY_HILLSBRAD 10282
-#define QUEST_ENTRY_DIVERSION 10283
-#define QUEST_ENTRY_ESCAPE 10284
-#define QUEST_ENTRY_RETURN 10285
-#define ITEM_ENTRY_BOMBS 25853
-
+enum Erozion
+{
+ QUEST_ENTRY_HILLSBRAD = 10282,
+ QUEST_ENTRY_DIVERSION = 10283,
+ QUEST_ENTRY_ESCAPE = 10284,
+ QUEST_ENTRY_RETURN = 10285,
+ ITEM_ENTRY_BOMBS = 25853
+};
#define GOSSIP_HELLO_EROZION1 "I need a pack of Incendiary Bombs."
#define GOSSIP_HELLO_EROZION2 "[PH] Teleport please, i'm tired."
@@ -77,7 +82,7 @@ public:
player->PrepareQuestMenu(creature->GetGUID());
InstanceScript* instance = creature->GetInstanceScript();
- if (instance && instance->GetData(TYPE_BARREL_DIVERSION) != DONE && !player->HasItemCount(ITEM_ENTRY_BOMBS, 1))
+ if (instance && instance->GetData(TYPE_BARREL_DIVERSION) != DONE && !player->HasItemCount(ITEM_ENTRY_BOMBS))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
if (player->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE)
@@ -95,97 +100,85 @@ public:
######*/
//Thrall texts
-#define SAY_TH_START_EVENT_PART1 -1560023
-#define SAY_TH_ARMORY -1560024
-#define SAY_TH_SKARLOC_MEET -1560025
-#define SAY_TH_SKARLOC_TAUNT -1560026
-#define SAY_TH_START_EVENT_PART2 -1560027
-#define SAY_TH_MOUNTS_UP -1560028
-#define SAY_TH_CHURCH_END -1560029
-#define SAY_TH_MEET_TARETHA -1560030
-#define SAY_TH_EPOCH_WONDER -1560031
-#define SAY_TH_EPOCH_KILL_TARETHA -1560032
-#define SAY_TH_EVENT_COMPLETE -1560033
-
-#define SAY_TH_RANDOM_LOW_HP1 -1560034
-#define SAY_TH_RANDOM_LOW_HP2 -1560035
-
-#define SAY_TH_RANDOM_DIE1 -1560036
-#define SAY_TH_RANDOM_DIE2 -1560037
-
-#define SAY_TH_RANDOM_AGGRO1 -1560038
-#define SAY_TH_RANDOM_AGGRO2 -1560039
-#define SAY_TH_RANDOM_AGGRO3 -1560040
-#define SAY_TH_RANDOM_AGGRO4 -1560041
-
-#define SAY_TH_RANDOM_KILL1 -1560042
-#define SAY_TH_RANDOM_KILL2 -1560043
-#define SAY_TH_RANDOM_KILL3 -1560044
-
-#define SAY_TH_LEAVE_COMBAT1 -1560045
-#define SAY_TH_LEAVE_COMBAT2 -1560046
-#define SAY_TH_LEAVE_COMBAT3 -1560047
-
-//Taretha texts
-#define SAY_TA_FREE -1560048
-#define SAY_TA_ESCAPED -1560049
-
-//Misc for Thrall
-#define SPELL_STRIKE 14516
-#define SPELL_SHIELD_BLOCK 12169
-#define SPELL_SUMMON_EROZION_IMAGE 33954 //if thrall dies during escort?
+enum ThrallOldHillsbrad
+{
+ SAY_TH_START_EVENT_PART1 = 0,
+ SAY_TH_ARMORY = 1,
+ SAY_TH_SKARLOC_MEET = 2,
+ SAY_TH_SKARLOC_TAUNT = 3,
+ SAY_TH_START_EVENT_PART2 = 4,
+ SAY_TH_MOUNTS_UP = 5,
+ SAY_TH_CHURCH_END = 6,
+ SAY_TH_MEET_TARETHA = 7,
+ SAY_TH_EPOCH_WONDER = 8,
+ SAY_TH_EPOCH_KILL_TARETHA = 9,
+ SAY_TH_EVENT_COMPLETE = 10,
+
+ SAY_TH_RANDOM_LOW_HP = 11,
+ SAY_TH_RANDOM_DIE = 12,
+ SAY_TH_RANDOM_AGGRO = 13,
+ SAY_TH_RANDOM_KILL = 14,
+ SAY_TH_LEAVE_COMBAT = 15,
+
+ //Taretha texts
+ SAY_TA_FREE = 0,
+ SAY_TA_ESCAPED = 1,
+
+ //Misc for Thrall
+ SPELL_STRIKE = 14516,
+ SPELL_SHIELD_BLOCK = 12169,
+ SPELL_SUMMON_EROZION_IMAGE = 33954, //if thrall dies during escort?
+
+ THRALL_WEAPON_ITEM = 927,
+ THRALL_WEAPON_INFO = 218169346,
+ THRALL_SHIELD_ITEM = 2129,
+ THRALL_SHIELD_INFO = 234948100,
+ THRALL_MODEL_UNEQUIPPED = 17292,
+ THRALL_MODEL_EQUIPPED = 18165,
+
+ //Misc Creature entries
+ ENTRY_ARMORER = 18764,
+ ENTRY_SCARLOC = 17862,
+
+ MOB_ENTRY_RIFLE = 17820,
+ MOB_ENTRY_WARDEN = 17833,
+ MOB_ENTRY_VETERAN = 17860,
+ MOB_ENTRY_WATCHMAN = 17814,
+ MOB_ENTRY_SENTRY = 17815,
+
+ MOB_ENTRY_BARN_GUARDSMAN = 18092,
+ MOB_ENTRY_BARN_PROTECTOR = 18093,
+ MOB_ENTRY_BARN_LOOKOUT = 18094,
+
+ MOB_ENTRY_CHURCH_GUARDSMAN = 23175,
+ MOB_ENTRY_CHURCH_PROTECTOR = 23179,
+ MOB_ENTRY_CHURCH_LOOKOUT = 23177,
+
+ MOB_ENTRY_INN_GUARDSMAN = 23176,
+ MOB_ENTRY_INN_PROTECTOR = 23180,
+ MOB_ENTRY_INN_LOOKOUT = 23178,
+
+ SKARLOC_MOUNT = 18798,
+ SKARLOC_MOUNT_MODEL = 18223,
+ EROZION_ENTRY = 18723,
+ ENTRY_EPOCH = 18096,
+
+ GOSSIP_ID_START = 9568,
+ GOSSIP_ID_SKARLOC1 = 9614, //I'm glad Taretha is alive. We now must find a way to free her...
+ GOSSIP_ID_SKARLOC2 = 9579, //What do you mean by this? Is Taretha in danger?
+ GOSSIP_ID_SKARLOC3 = 9580,
+ GOSSIP_ID_TARREN = 9597, //tarren mill is beyond these trees
+ GOSSIP_ID_COMPLETE = 9578 //Thank you friends, I owe my freedom to you. Where is Taretha? I hoped to see her
+};
#define SPEED_WALK (0.5f)
#define SPEED_RUN (1.0f)
#define SPEED_MOUNT (1.6f)
-#define THRALL_WEAPON_ITEM 927
-#define THRALL_WEAPON_INFO 218169346
-#define THRALL_SHIELD_ITEM 2129
-#define THRALL_SHIELD_INFO 234948100
-#define THRALL_MODEL_UNEQUIPPED 17292
-#define THRALL_MODEL_EQUIPPED 18165
-
-//Misc Creature entries
-#define ENTRY_ARMORER 18764
-#define ENTRY_SCARLOC 17862
-
-#define MOB_ENTRY_RIFLE 17820
-#define MOB_ENTRY_WARDEN 17833
-#define MOB_ENTRY_VETERAN 17860
-#define MOB_ENTRY_WATCHMAN 17814
-#define MOB_ENTRY_SENTRY 17815
-
-#define MOB_ENTRY_BARN_GUARDSMAN 18092
-#define MOB_ENTRY_BARN_PROTECTOR 18093
-#define MOB_ENTRY_BARN_LOOKOUT 18094
-
-#define MOB_ENTRY_CHURCH_GUARDSMAN 23175
-#define MOB_ENTRY_CHURCH_PROTECTOR 23179
-#define MOB_ENTRY_CHURCH_LOOKOUT 23177
-
-#define MOB_ENTRY_INN_GUARDSMAN 23176
-#define MOB_ENTRY_INN_PROTECTOR 23180
-#define MOB_ENTRY_INN_LOOKOUT 23178
-
-#define SKARLOC_MOUNT 18798
-#define SKARLOC_MOUNT_MODEL 18223
-#define EROZION_ENTRY 18723
-#define ENTRY_EPOCH 18096
-
//gossip items
-#define GOSSIP_ID_START 9568
-#define GOSSIP_ID_SKARLOC1 9614 //I'm glad Taretha is alive. We now must find a way to free her...
#define GOSSIP_ITEM_SKARLOC1 "Taretha cannot see you, Thrall."
-#define GOSSIP_ID_SKARLOC2 9579 //What do you mean by this? Is Taretha in danger?
#define GOSSIP_ITEM_SKARLOC2 "The situation is rather complicated, Thrall. It would be best for you to head into the mountains now, before more of Blackmoore's men show up. We'll make sure Taretha is safe."
-#define GOSSIP_ID_SKARLOC3 9580
-
-#define GOSSIP_ID_TARREN 9597 //tarren mill is beyond these trees
#define GOSSIP_ITEM_TARREN "We're ready, Thrall."
-
-#define GOSSIP_ID_COMPLETE 9578 //Thank you friends, I owe my freedom to you. Where is Taretha? I hoped to see her
-
#define GOSSIP_ITEM_WALKING "[PH] Start walking."
class npc_thrall_old_hillsbrad : public CreatureScript
@@ -212,7 +205,7 @@ public:
instance->SetData(TYPE_THRALL_PART1, IN_PROGRESS);
}
- DoScriptText(SAY_TH_START_EVENT_PART1, creature);
+ creature->AI()->Talk(SAY_TH_START_EVENT_PART1);
if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI()))
pEscortAI->Start(true, true, player->GetGUID());
@@ -233,7 +226,7 @@ public:
if (instance)
instance->SetData(TYPE_THRALL_PART2, IN_PROGRESS);
- DoScriptText(SAY_TH_START_EVENT_PART2, creature);
+ creature->AI()->Talk(SAY_TH_START_EVENT_PART2);
CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, creature->AI())->StartWP();
break;
@@ -308,7 +301,7 @@ public:
me->SummonCreature(18764, 2181.87f, 112.46f, 89.45f, 0.26f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
break;
case 9:
- DoScriptText(SAY_TH_ARMORY, me);
+ Talk(SAY_TH_ARMORY);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_ITEM);
//me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO);
//me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781);
@@ -341,7 +334,7 @@ public:
me->SummonCreature(MOB_ENTRY_VETERAN, 2104.18f, 194.82f, 65.18f, 5.75f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
break;
case 29:
- DoScriptText(SAY_TH_SKARLOC_MEET, me);
+ Talk(SAY_TH_SKARLOC_MEET);
me->SummonCreature(ENTRY_SCARLOC, 2036.48f, 271.22f, 63.43f, 5.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
//temporary, skarloc should rather be triggered to walk up to thrall
break;
@@ -351,7 +344,7 @@ public:
SetRun(false);
break;
case 31:
- DoScriptText(SAY_TH_MOUNTS_UP, me);
+ Talk(SAY_TH_MOUNTS_UP);
DoMount();
SetRun();
break;
@@ -397,7 +390,7 @@ public:
me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN, 2627.22f, 649.00f, 56.03f, 4.34f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
break;
case 84:
- DoScriptText(SAY_TH_CHURCH_END, me);
+ Talk(SAY_TH_CHURCH_END);
SetRun();
break;
case 91:
@@ -413,20 +406,20 @@ public:
case 94:
if (uint64 TarethaGUID = instance->GetData64(DATA_TARETHA))
{
- if (Unit* Taretha = Unit::GetUnit(*me, TarethaGUID))
- DoScriptText(SAY_TA_ESCAPED, Taretha, me);
+ if (Creature* Taretha = Creature::GetCreature(*me, TarethaGUID))
+ Taretha->AI()->Talk(SAY_TA_ESCAPED, me->GetGUID());
}
break;
case 95:
- DoScriptText(SAY_TH_MEET_TARETHA, me);
+ Talk(SAY_TH_MEET_TARETHA);
instance->SetData(TYPE_THRALL_PART3, DONE);
SetEscortPaused(true);
break;
case 96:
- DoScriptText(SAY_TH_EPOCH_WONDER, me);
+ Talk(SAY_TH_EPOCH_WONDER);
break;
case 97:
- DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me);
+ Talk(SAY_TH_EPOCH_KILL_TARETHA);
SetRun();
break;
case 98:
@@ -482,7 +475,7 @@ public:
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
- DoScriptText(RAND(SAY_TH_LEAVE_COMBAT1, SAY_TH_LEAVE_COMBAT2, SAY_TH_LEAVE_COMBAT3), me);
+ Talk(SAY_TH_LEAVE_COMBAT);
}
}
void StartWP()
@@ -502,7 +495,7 @@ public:
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_TH_RANDOM_AGGRO1, SAY_TH_RANDOM_AGGRO2, SAY_TH_RANDOM_AGGRO3, SAY_TH_RANDOM_AGGRO4), me);
+ Talk(SAY_TH_RANDOM_AGGRO);
if (me->IsMounted())
{
DoUnmount();
@@ -529,7 +522,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_TH_RANDOM_KILL1, SAY_TH_RANDOM_KILL2, SAY_TH_RANDOM_KILL3), me);
+ Talk(SAY_TH_RANDOM_KILL);
}
void JustDied(Unit* slayer)
{
@@ -540,7 +533,7 @@ public:
if (slayer == me)
return;
- DoScriptText(RAND(SAY_TH_RANDOM_DIE1, SAY_TH_RANDOM_DIE2), me);
+ Talk(SAY_TH_RANDOM_DIE);
}
void UpdateAI(const uint32 diff)
@@ -553,7 +546,7 @@ public:
//TODO: add his abilities'n-crap here
if (!LowHp && HealthBelowPct(20))
{
- DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1, SAY_TH_RANDOM_LOW_HP2), me);
+ Talk(SAY_TH_RANDOM_LOW_HP);
LowHp = true;
}
}
@@ -564,10 +557,13 @@ public:
/*######
## npc_taretha
######*/
+enum Taretha
+{
+ GOSSIP_ID_EPOCH1 = 9610, //Thank you for helping Thrall escape, friends. Now I only hope
+ GOSSIP_ID_EPOCH2 = 9613 //Yes, friends. This man was no wizard of
+};
-#define GOSSIP_ID_EPOCH1 9610 //Thank you for helping Thrall escape, friends. Now I only hope
#define GOSSIP_ITEM_EPOCH1 "Strange wizard?"
-#define GOSSIP_ID_EPOCH2 9613 //Yes, friends. This man was no wizard of
#define GOSSIP_ITEM_EPOCH2 "We'll get you out. Taretha. Don't worry. I doubt the wizard would wander too far away."
class npc_taretha : public CreatureScript
@@ -635,7 +631,7 @@ public:
switch (waypointId)
{
case 6:
- DoScriptText(SAY_TA_FREE, me);
+ Talk(SAY_TA_FREE);
break;
case 7:
me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
index 1f887d7ce64..26e1f77bf48 100644
--- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
+++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
+#include "ScriptedCreature.h"
enum Spells
{
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
index 1fdf941d75c..c243682cc61 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp
@@ -35,11 +35,14 @@ EndScriptData */
enum Yells
{
- SAY_AGGRO = -1249000,
- SAY_KILL = -1249001,
- SAY_PHASE_2_TRANS = -1249002,
- SAY_PHASE_3_TRANS = -1249003,
- EMOTE_BREATH = -1249004,
+ // Say
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_PHASE_2_TRANS = 2,
+ SAY_PHASE_3_TRANS = 3,
+
+ // Emote
+ EMOTE_BREATH = 4,
};
enum Spells
@@ -184,7 +187,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->SetInCombatWithZone();
if (instance)
@@ -227,7 +230,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void SpellHit(Unit* /*pCaster*/, const SpellInfo* Spell)
@@ -269,7 +272,7 @@ public:
me->SetCanFly(true);
me->GetMotionMaster()->MovePoint(11, Phase2Location.GetPositionX(), Phase2Location.GetPositionY(), Phase2Location.GetPositionZ()+25);
me->SetSpeed(MOVE_FLIGHT, 1.0f);
- DoScriptText(SAY_PHASE_2_TRANS, me);
+ Talk(SAY_PHASE_2_TRANS);
if (instance)
instance->SetData(DATA_ONYXIA_PHASE, Phase);
WhelpTimer = 5000;
@@ -416,7 +419,7 @@ public:
Phase = PHASE_END;
if (instance)
instance->SetData(DATA_ONYXIA_PHASE, Phase);
- DoScriptText(SAY_PHASE_3_TRANS, me);
+ Talk(SAY_PHASE_3_TRANS);
SetCombatMovement(true);
me->SetCanFly(false);
@@ -432,7 +435,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
- DoScriptText(EMOTE_BREATH, me);
+ Talk(EMOTE_BREATH);
DoCast(me, PointData->SpellId);
DeepBreathTimer = 70000;
}
diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
index 0689a8872bb..adcec659fa3 100644
--- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
+++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp
@@ -29,6 +29,7 @@ EndScriptData */
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "onyxias_lair.h"
+#include "TemporarySummon.h"
class instance_onyxias_lair : public InstanceMapScript
{
@@ -189,7 +190,7 @@ public:
}
}
- uint32 GetData(uint32 Type)
+ uint32 GetData(uint32 Type) const
{
switch (Type)
{
@@ -200,7 +201,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 Data)
+ uint64 GetData64(uint32 Data) const
{
switch (Data)
{
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 bda5267713d..b3690ab14c7 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp
@@ -23,18 +23,22 @@ SDComment:
SDCategory: Razorfen Downs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SAY_AGGRO -1129000
-#define SAY_SUMMON60 -1129001
-#define SAY_SUMMON30 -1129002
-#define SAY_HP -1129003
-#define SAY_KILL -1129004
-
-#define SPELL_AMNENNARSWRATH 13009
-#define SPELL_FROSTBOLT 15530
-#define SPELL_FROST_NOVA 15531
-#define SPELL_FROST_SPECTRES 12642
+enum AmnennarTheColdbringer
+{
+ SAY_AGGRO = 0,
+ SAY_SUMMON60 = 1,
+ SAY_SUMMON30 = 2,
+ SAY_HP = 3,
+ SAY_KILL = 4,
+
+ SPELL_AMNENNARSWRATH = 13009,
+ SPELL_FROSTBOLT = 15530,
+ SPELL_FROST_NOVA = 15531,
+ SPELL_FROST_SPECTRES = 12642
+};
class boss_amnennar_the_coldbringer : public CreatureScript
{
@@ -69,12 +73,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void UpdateAI(const uint32 diff)
@@ -104,20 +108,20 @@ public:
if (!Spectrals60 && HealthBelowPct(60))
{
- DoScriptText(SAY_SUMMON60, me);
+ Talk(SAY_SUMMON60);
DoCast(me->getVictim(), SPELL_FROST_SPECTRES);
Spectrals60 = true;
}
if (!Hp && HealthBelowPct(50))
{
- DoScriptText(SAY_HP, me);
+ Talk(SAY_HP);
Hp = true;
}
if (!Spectrals30 && HealthBelowPct(30))
{
- DoScriptText(SAY_SUMMON30, me);
+ Talk(SAY_SUMMON30);
DoCast(me->getVictim(), SPELL_FROST_SPECTRES);
Spectrals30 = true;
}
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
index 8b138468f4c..f7161638909 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "razorfen_downs.h"
+#include "Player.h"
+#include "TemporarySummon.h"
#define MAX_ENCOUNTER 1
@@ -184,7 +187,7 @@ public:
}
}
- uint32 GetData(uint32 uiType)
+ uint32 GetData(uint32 uiType) const
{
switch (uiType)
{
@@ -195,7 +198,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiType)
+ uint64 GetData64(uint32 uiType) const
{
switch (uiType)
{
diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
index b84ecea4de3..443c9f73cfb 100644
--- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp
@@ -27,8 +27,11 @@ EndScriptData */
npc_henry_stern
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "razorfen_downs.h"
+#include "Player.h"
/*###
# npc_henry_stern
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
index 98395305d57..152c38a6b58 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp
@@ -23,8 +23,10 @@ SDComment:
SDCategory: Razorfen Kraul
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "razorfen_kraul.h"
+#include "Player.h"
#define WARD_KEEPERS_NR 2
@@ -63,7 +65,7 @@ public:
return player;
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
index 43e3fe6efdd..b0953c73e57 100644
--- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
+++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp
@@ -27,24 +27,29 @@ EndScriptData */
npc_willix
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "razorfen_kraul.h"
+#include "Player.h"
-#define SAY_READY -1047000
-#define SAY_POINT -1047001
-#define SAY_AGGRO1 -1047002
-#define SAY_BLUELEAF -1047003
-#define SAY_DANGER -1047004
-#define SAY_BAD -1047005
-#define SAY_THINK -1047006
-#define SAY_SOON -1047007
-#define SAY_FINALY -1047008
-#define SAY_WIN -1047009
-#define SAY_END -1047010
-
-#define QUEST_WILLIX_THE_IMPORTER 1144
-#define ENTRY_BOAR 4514
+enum Willix
+{
+ SAY_READY = 0,
+ SAY_POINT = 1,
+ SAY_AGGRO1 = 2,
+ SAY_BLUELEAF = 3,
+ SAY_DANGER = 4,
+ SAY_BAD = 5,
+ SAY_THINK = 6,
+ SAY_SOON = 7,
+ SAY_FINALY = 8,
+ SAY_WIN = 9,
+ SAY_END = 10,
+
+ QUEST_WILLIX_THE_IMPORTER = 1144,
+ ENTRY_BOAR = 4514
+};
class npc_willix : public CreatureScript
{
@@ -56,7 +61,7 @@ public:
if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER)
{
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
- DoScriptText(SAY_READY, creature, player);
+ creature->AI()->Talk(SAY_READY, player->GetGUID());
creature->setFaction(113);
}
@@ -82,43 +87,43 @@ public:
{
case 3:
me->HandleEmoteCommand(EMOTE_STATE_POINT);
- DoScriptText(SAY_POINT, me, player);
+ Talk(SAY_POINT, player->GetGUID());
break;
case 4:
me->SummonCreature(ENTRY_BOAR, 2137.66f, 1843.98f, 48.08f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 8:
- DoScriptText(SAY_BLUELEAF, me, player);
+ Talk(SAY_BLUELEAF, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_DANGER, me, player);
+ Talk(SAY_DANGER, player->GetGUID());
break;
case 13:
- DoScriptText(SAY_BAD, me, player);
+ Talk(SAY_BAD, player->GetGUID());
break;
case 14:
me->SummonCreature(ENTRY_BOAR, 2078.91f, 1704.54f, 56.77f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 25:
- DoScriptText(SAY_THINK, me, player);
+ Talk(SAY_THINK, player->GetGUID());
break;
case 31:
- DoScriptText(SAY_SOON, me, player);
+ Talk(SAY_SOON, player->GetGUID());
break;
case 42:
- DoScriptText(SAY_FINALY, me, player);
+ Talk(SAY_FINALY, player->GetGUID());
break;
case 43:
me->SummonCreature(ENTRY_BOAR, 1956.43f, 1596.97f, 81.75f, 1.54f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 45:
- DoScriptText(SAY_WIN, me, player);
+ Talk(SAY_WIN, player->GetGUID());
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
if (player->GetTypeId() == TYPEID_PLAYER)
CAST_PLR(player)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER, me);
break;
case 46:
- DoScriptText(SAY_END, me, player);
+ Talk(SAY_END, player->GetGUID());
break;
}
}
@@ -127,7 +132,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO1, me, NULL);
+ Talk(SAY_AGGRO1);
}
void JustSummoned(Creature* summoned)
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
index 459dc87a9b8..40d4d5d54b4 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp
@@ -23,7 +23,8 @@ SDComment: Place Holder
SDCategory: Ruins of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
enum Yells
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
index 36a1ff1bade..e6c5243819a 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp
@@ -19,6 +19,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
+#include "CreatureTextMgr.h"
enum Spells
{
@@ -38,6 +39,11 @@ enum Events
EVENT_WIDE_SLASH = 4
};
+enum Texts
+{
+ SAY_KURINAXX_DEATH = 5, // Yelled by Ossirian the Unscarred
+};
+
class boss_kurinnaxx : public CreatureScript
{
public:
@@ -45,7 +51,7 @@ class boss_kurinnaxx : public CreatureScript
struct boss_kurinnaxxAI : public BossAI
{
- boss_kurinnaxxAI(Creature* creature) : BossAI(creature, BOSS_KURINNAXX)
+ boss_kurinnaxxAI(Creature* creature) : BossAI(creature, DATA_KURINNAXX)
{
}
@@ -68,6 +74,13 @@ class boss_kurinnaxx : public CreatureScript
}
}
+ void JustDied(Unit* /*killer*/)
+ {
+ _JustDied();
+ if (Creature* Ossirian = me->GetMap()->GetCreature(instance->GetData64(DATA_OSSIRIAN)))
+ sCreatureTextMgr->SendChat(Ossirian, SAY_KURINAXX_DEATH, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
+ }
+
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
index 18a77519ba2..4abbf99d4ef 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
enum Texts
@@ -57,7 +58,7 @@ class boss_moam : public CreatureScript
struct boss_moamAI : public BossAI
{
- boss_moamAI(Creature* creature) : BossAI(creature, BOSS_MOAM)
+ boss_moamAI(Creature* creature) : BossAI(creature, DATA_MOAM)
{
}
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
index 91c0110abd5..2bbdaa389ad 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,38 +15,262 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Boss_Ossirian
-SD%Complete: 0
-SDComment: Place holder
-SDCategory: Ruins of Ahn'Qiraj
-EndScriptData */
-
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruins_of_ahnqiraj.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "WorldPacket.h"
+#include "Opcodes.h"
+
+enum Texts
+{
+ SAY_SUPREME = 0,
+ SAY_INTRO = 1,
+ SAY_AGGRO = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+};
+
+enum Spells
+{
+ SPELL_SILENCE = 25195,
+ SPELL_CYCLONE = 25189,
+ SPELL_STOMP = 25188,
+ SPELL_SUPREME = 25176,
+ SPELL_SUMMON = 20477,
+ SPELL_SAND_STORM = 25160,
+ SPELL_SUMMON_CRYSTAL = 25192,
+};
+
+enum Actions
+{
+ ACTION_TRIGGER_WEAKNESS = 1,
+};
-enum Yells
-{
- SAY_SURPREME2 = -1509019,
- SAY_SURPREME3 = -1509020,
- SAY_RAND_INTRO1 = -1509021,
- SAY_RAND_INTRO2 = -1509022,
- SAY_RAND_INTRO3 = -1509023,
- SAY_RAND_INTRO4 = -1509024, //possibly old?
- SAY_AGGRO = -1509025,
- SAY_SLAY = -1509026,
- SAY_DEATH = -1509027
+enum Events
+{
+ EVENT_SILENCE = 1,
+ EVENT_CYCLONE = 2,
+ EVENT_STOMP = 3
};
+uint8 const NUM_CRYSTALS = 9;
+
+// You spin me right round, baby
+// right round like a record, baby
+// right round round round
+Position CrystalCoordinates[NUM_CRYSTALS] =
+{
+ { -9394.230469f, 1951.808594f, 85.97733f, 0.0f },
+ { -9357.931641f, 1930.596802f, 85.556198f, 0.0f },
+ { -9383.113281f, 2011.042725f, 85.556389f, 0.0f },
+ { -9243.36f, 1979.04f, 85.556f, 0.0f },
+ { -9281.68f, 1886.66f, 85.5558f, 0.0f },
+ { -9241.8f, 1806.39f, 85.5557f, 0.0f },
+ { -9366.78f, 1781.76f, 85.5561f, 0.0f },
+ { -9430.37f, 1786.86f, 85.557f, 0.0f },
+ { -9406.73f, 1863.13f, 85.5558f, 0.0f }
+};
+
+float RoomRadius = 165.0f;
+uint8 const NUM_TORNADOS = 5; // TODO: This number is completly random!
+uint8 const NUM_WEAKNESS = 5;
+uint32 const SpellWeakness[NUM_WEAKNESS] = { 25177, 25178, 25180, 25181, 25183 };
+Position const RoomCenter = { -9343.041992f, 1923.278198f, 85.555984f, 0.0 };
+
class boss_ossirian : public CreatureScript
{
public:
boss_ossirian() : CreatureScript("boss_ossirian") { }
- struct boss_ossirianAI : public ScriptedAI
+ struct boss_ossirianAI : public BossAI
{
- boss_ossirianAI(Creature* creature) : ScriptedAI(creature)
+ boss_ossirianAI(Creature* creature) : BossAI(creature, DATA_OSSIRIAN)
+ {
+ SaidIntro = false;
+ Reset();
+ }
+
+ uint64 TriggerGUID;
+ uint64 CrystalGUID;
+ uint8 CrystalIterator;
+ bool SaidIntro;
+
+ void Reset()
+ {
+ _Reset();
+ CrystalIterator = 0;
+ TriggerGUID = 0;
+ CrystalGUID = 0;
+ }
+
+ void SpellHit(Unit* caster, SpellInfo const* spell)
+ {
+ for (uint8 i = 0; i < NUM_WEAKNESS; ++i)
+ {
+ if (spell->Id == SpellWeakness[i])
+ {
+ me->RemoveAurasDueToSpell(SPELL_SUPREME);
+ ((TempSummon*)caster)->UnSummon();
+ SpawnNextCrystal();
+ }
+ }
+ }
+
+ void DoAction(const int32 action)
+ {
+ if (action == ACTION_TRIGGER_WEAKNESS)
+ {
+ if (Creature* Trigger = me->GetMap()->GetCreature(TriggerGUID))
+ {
+ if (!Trigger->HasUnitState(UNIT_STATE_CASTING))
+ Trigger->CastSpell(Trigger, SpellWeakness[urand(0, 4)], false);
+ }
+ }
+ }
+
+ void EnterCombat(Unit* /*who*/)
+ {
+ _EnterCombat();
+ events.Reset();
+ events.ScheduleEvent(EVENT_SILENCE, 30000);
+ events.ScheduleEvent(EVENT_CYCLONE, 20000);
+ events.ScheduleEvent(EVENT_STOMP, 30000);
+
+ DoCast(me, SPELL_SUPREME);
+ Talk(SAY_AGGRO);
+
+ if (instance)
+ {
+ Map* map = me->GetMap();
+ if (!map->IsDungeon())
+ return;
+
+ WorldPacket data(SMSG_WEATHER, (4+4+4));
+ data << uint32(WEATHER_STATE_HEAVY_SANDSTORM) << float(1) << uint8(0);
+ map->SendToPlayers(&data);
+
+ for (uint8 i = 0; i < NUM_TORNADOS; ++i)
+ {
+ Position Point;
+ me->GetRandomPoint(RoomCenter, RoomRadius, Point);
+ if (Creature* Tornado = me->GetMap()->SummonCreature(NPC_SAND_VORTEX, Point))
+ Tornado->CastSpell(Tornado, SPELL_SAND_STORM, true);
+ }
+
+ SpawnNextCrystal();
+ }
+ }
+
+ void KilledUnit(Unit* /*victim*/)
+ {
+ Talk(SAY_SLAY);
+ }
+
+ void EnterEvadeMode()
+ {
+ Cleanup();
+ summons.DespawnAll();
+ ScriptedAI::EnterEvadeMode();
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ Cleanup();
+ _JustDied();
+ }
+
+ void Cleanup()
+ {
+ if (GameObject* Crystal = me->GetMap()->GetGameObject(CrystalGUID))
+ Crystal->Use(me);
+ }
+
+ void SpawnNextCrystal()
+ {
+ if (CrystalIterator == NUM_CRYSTALS)
+ CrystalIterator = 0;
+
+ if (Creature* Trigger = me->GetMap()->SummonCreature(NPC_OSSIRIAN_TRIGGER, CrystalCoordinates[CrystalIterator]))
+ {
+ TriggerGUID = Trigger->GetGUID();
+ if (GameObject* Crystal = Trigger->SummonGameObject(GO_OSSIRIAN_CRYSTAL,
+ CrystalCoordinates[CrystalIterator].GetPositionX(),
+ CrystalCoordinates[CrystalIterator].GetPositionY(),
+ CrystalCoordinates[CrystalIterator].GetPositionZ(),
+ 0, 0, 0, 0, 0, -1))
+ {
+ CrystalGUID = Crystal->GetGUID();
+ ++CrystalIterator;
+ }
+ }
+ }
+
+ void MoveInLineOfSight(Unit* /*who*/)
+ {
+ if (!SaidIntro)
+ {
+ Talk(SAY_INTRO);
+ SaidIntro = true;
+ }
+ }
+
+ void UpdateAI(uint32 const diff)
{
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ // No kiting!
+ if (me->GetDistance(me->getVictim()) > 60.00f && me->GetDistance(me->getVictim()) < 120.00f)
+ DoCast(me->getVictim(), SPELL_SUMMON);
+
+ bool ApplySupreme = true;
+
+ if (me->HasAura(SPELL_SUPREME))
+ ApplySupreme = false;
+ else
+ {
+ for (uint8 i = 0; i < NUM_WEAKNESS; ++i)
+ {
+ if (me->HasAura(SpellWeakness[i]))
+ {
+ ApplySupreme = false;
+ break;
+ }
+ }
+ }
+
+ if (ApplySupreme)
+ {
+ DoCast(me, SPELL_SUPREME);
+ Talk(SAY_SUPREME);
+ }
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SILENCE:
+ DoCast(me, SPELL_SILENCE);
+ events.ScheduleEvent(EVENT_SILENCE, urand(20000, 30000));
+ break;
+ case EVENT_CYCLONE:
+ DoCast(me->getVictim(), SPELL_CYCLONE);
+ events.ScheduleEvent(EVENT_CYCLONE, 20000);
+ break;
+ case EVENT_STOMP:
+ DoCast(me, SPELL_STOMP);
+ events.ScheduleEvent(EVENT_STOMP, 30000);
+ break;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
}
};
@@ -57,7 +280,28 @@ class boss_ossirian : public CreatureScript
}
};
+class go_ossirian_crystal : public GameObjectScript
+{
+ public:
+ go_ossirian_crystal() : GameObjectScript("go_ossirian_crystal") { }
+
+ bool OnGossipHello(Player* player, GameObject* /*go*/)
+ {
+ InstanceScript* Instance = player->GetInstanceScript();
+ if (!Instance)
+ return false;
+
+ Creature* Ossirian = player->FindNearestCreature(NPC_OSSIRIAN, 30.0f);
+ if (!Ossirian || Instance->GetBossState(DATA_OSSIRIAN) != IN_PROGRESS)
+ return false;
+
+ Ossirian->AI()->DoAction(ACTION_TRIGGER_WEAKNESS);
+ return true;
+ }
+};
+
void AddSC_boss_ossirian()
{
new boss_ossirian();
+ new go_ossirian_crystal();
}
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
index afa8eff5823..da67f93f968 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp
@@ -63,7 +63,7 @@ class boss_rajaxx : public CreatureScript
struct boss_rajaxxAI : public BossAI
{
- boss_rajaxxAI(Creature* creature) : BossAI(creature, BOSS_RAJAXX)
+ boss_rajaxxAI(Creature* creature) : BossAI(creature, DATA_RAJAXX)
{
}
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
index d4549242a4c..d61d9416ac6 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ruins_of_ahnqiraj.h"
class instance_ruins_of_ahnqiraj : public InstanceMapScript
@@ -27,7 +28,7 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
{
instance_ruins_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map)
{
- SetBossNumber(MAX_ENCOUNTER);
+ SetBossNumber(NUM_ENCOUNTER);
_kurinaxxGUID = 0;
_rajaxxGUID = 0;
@@ -70,21 +71,21 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
return true;
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
- case BOSS_KURINNAXX:
+ case DATA_KURINNAXX:
return _kurinaxxGUID;
- case BOSS_RAJAXX:
+ case DATA_RAJAXX:
return _rajaxxGUID;
- case BOSS_MOAM:
+ case DATA_MOAM:
return _moamGUID;
- case BOSS_BURU:
+ case DATA_BURU:
return _buruGUID;
- case BOSS_AYAMISS:
+ case DATA_AYAMISS:
return _ayamissGUID;
- case BOSS_OSSIRIAN:
+ case DATA_OSSIRIAN:
return _ossirianGUID;
}
@@ -119,7 +120,7 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
if (dataHead1 == 'R' && dataHead2 == 'A')
{
- for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
+ for (uint8 i = 0; i < NUM_ENCOUNTER; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h
index 14d129a7468..7f7efc83eb5 100644
--- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h
+++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h
@@ -18,15 +18,15 @@
#ifndef DEF_RUINS_OF_AHNQIRAJ_H
#define DEF_RUINS_OF_AHNQIRAJ_H
-enum Encounters
+enum DataTypes
{
- BOSS_KURINNAXX = 0,
- BOSS_RAJAXX = 1,
- BOSS_MOAM = 2,
- BOSS_BURU = 3,
- BOSS_AYAMISS = 4,
- BOSS_OSSIRIAN = 5,
- MAX_ENCOUNTER,
+ DATA_KURINNAXX = 0,
+ DATA_RAJAXX = 1,
+ DATA_MOAM = 2,
+ DATA_BURU = 3,
+ DATA_AYAMISS = 4,
+ DATA_OSSIRIAN = 5,
+ NUM_ENCOUNTER = 6
};
enum Creatures
@@ -40,6 +40,13 @@ enum Creatures
NPC_HIVEZARA_HORNET = 15934,
NPC_HIVEZARA_SWARMER = 15546,
NPC_HIVEZARA_LARVA = 15555,
+ NPC_SAND_VORTEX = 15428,
+ NPC_OSSIRIAN_TRIGGER = 15590,
+};
+
+enum GameObjects
+{
+ GO_OSSIRIAN_CRYSTAL = 180619,
};
#endif
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
index 36b1871c96e..0b78b5f9ab2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#define SPELL_CLEAVE 26350
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
index 11efccd14b7..1cb69689b67 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp
@@ -23,8 +23,10 @@ SDComment: Darkglare tracking issue
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
+#include "Player.h"
/*
* This is a 2 phases events. Here follows an explanation of the main events and transition between phases and sub-phases.
@@ -140,7 +142,7 @@ enum Actions
enum Yells
{
//Text emote
- EMOTE_WEAKENED = -1531011,
+ EMOTE_WEAKENED = 0,
// ****** Out of Combat ******
// Random Wispers - No txt only sound
@@ -180,7 +182,7 @@ public:
{
instance = creature->GetInstanceScript();
if (!instance)
- sLog->outError("TSCR: No Instance eye_of_cthunAI");
+ sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI");
}
InstanceScript* instance;
@@ -486,7 +488,7 @@ public:
instance = creature->GetInstanceScript();
if (!instance)
- sLog->outError("TSCR: No Instance eye_of_cthunAI");
+ sLog->outError(LOG_FILTER_TSCR, "No Instance eye_of_cthunAI");
}
InstanceScript* instance;
@@ -710,7 +712,7 @@ public:
{
instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK);
- DoScriptText(EMOTE_WEAKENED, me);
+ Talk(EMOTE_WEAKENED);
PhaseTimer = 45000;
DoCast(me, SPELL_PURPLE_COLORATION, true);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
index 613bc91182b..5ebce2f04e2 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp
@@ -23,7 +23,8 @@ SDComment: sound not implemented
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SOUND_SENTENCE_YOU 8588
#define SOUND_SERVE_TO 8589
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
index 53fac3ee3ec..ab4968e3bf7 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp
@@ -23,17 +23,21 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define EMOTE_GENERIC_FRENZY_KILL -1000001
-#define EMOTE_GENERIC_BERSERK -1000004
-
-#define SPELL_FRENZY 26051
-#define SPELL_BERSERK 26068
-#define SPELL_POISONBOLT 26052
-#define SPELL_NOXIOUSPOISON 26053
-#define SPELL_WYVERNSTING 26180
-#define SPELL_ACIDSPIT 26050
+enum Huhuran
+{
+ EMOTE_FRENZY_KILL = 0,
+ EMOTE_BERSERK = 1,
+
+ SPELL_FRENZY = 26051,
+ SPELL_BERSERK = 26068,
+ SPELL_POISONBOLT = 26052,
+ SPELL_NOXIOUSPOISON = 26053,
+ SPELL_WYVERNSTING = 26180,
+ SPELL_ACIDSPIT = 26050
+};
class boss_huhuran : public CreatureScript
{
@@ -86,7 +90,7 @@ public:
if (!Frenzy && Frenzy_Timer <= diff)
{
DoCast(me, SPELL_FRENZY);
- DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
+ Talk(EMOTE_FRENZY_KILL);
Frenzy = true;
PoisonBolt_Timer = 3000;
Frenzy_Timer = urand(25000, 35000);
@@ -135,7 +139,7 @@ public:
if (!Berserk && HealthBelowPct(31))
{
me->InterruptNonMeleeSpells(false);
- DoScriptText(EMOTE_GENERIC_BERSERK, me);
+ Talk(EMOTE_BERSERK);
DoCast(me, SPELL_BERSERK);
Berserk = true;
}
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
index 81205780e7d..f7acf28dba3 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp
@@ -23,7 +23,8 @@ SDComment: No model for submerging. Currently just invisible.
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#define SPELL_SWEEP 26103
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
index 8c6c0fa0ad0..2ac9358b976 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp
@@ -23,19 +23,23 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SAY_AGGRO -1531008
-#define SAY_SLAY -1531009
-#define SAY_DEATH -1531010
+enum Sartura
+{
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
-#define SPELL_WHIRLWIND 26083
-#define SPELL_ENRAGE 28747 //Not sure if right ID.
-#define SPELL_ENRAGEHARD 28798
+ SPELL_WHIRLWIND = 26083,
+ SPELL_ENRAGE = 28747, //Not sure if right ID.
+ SPELL_ENRAGEHARD = 28798,
//Guard Spell
-#define SPELL_WHIRLWINDADD 26038
-#define SPELL_KNOCKBACK 26027
+ SPELL_WHIRLWINDADD = 26038,
+ SPELL_KNOCKBACK = 26027
+};
class boss_sartura : public CreatureScript
{
@@ -81,17 +85,17 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
index 4df4bf73330..99a304e3726 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp
@@ -23,23 +23,24 @@ SDComment: Mind Control buggy.
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#include "Group.h"
+#include "Player.h"
-#define SAY_AGGRO1 -1531000
-#define SAY_AGGRO2 -1531001
-#define SAY_AGGRO3 -1531002
-#define SAY_SLAY1 -1531003
-#define SAY_SLAY2 -1531004
-#define SAY_SLAY3 -1531005
-#define SAY_SPLIT -1531006
-#define SAY_DEATH -1531007
-
-#define SPELL_ARCANE_EXPLOSION 25679
-#define SPELL_EARTH_SHOCK 26194
-#define SPELL_TRUE_FULFILLMENT 785
-#define SPELL_BLINK 28391
+enum Skeram
+{
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_SPLIT = 2,
+ SAY_DEATH = 3,
+
+ SPELL_ARCANE_EXPLOSION = 25679,
+ SPELL_EARTH_SHOCK = 26194,
+ SPELL_TRUE_FULFILLMENT = 785,
+ SPELL_BLINK = 28391
+};
class ov_mycoordinates
{
@@ -102,20 +103,20 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
if (!IsImage)
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* /*who*/)
{
if (IsImage || Images75)
return;
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
@@ -207,7 +208,7 @@ public:
void DoSplit(int atPercent /* 75 50 25 */)
{
- DoScriptText(SAY_SPLIT, me);
+ Talk(SAY_SPLIT);
ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227f, 2083.814453f, 125.648788f, 0);
ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875f, 2118.504639f, 133.058151f, 0);
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
index abaab9d830e..b85999042dd 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "temple_of_ahnqiraj.h"
#include "WorldPacket.h"
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
index 7b30200b0b3..d0e97bc36c8 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp
@@ -23,7 +23,8 @@ SDComment: place holder
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_POISON_SHOCK 25993
#define SPELL_POISONBOLT_VOLLEY 25991
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
index f1cc0b401c3..c8a1ff63925 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "temple_of_ahnqiraj.h"
class instance_temple_of_ahnqiraj : public InstanceMapScript
@@ -89,7 +90,7 @@ public:
return false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -117,7 +118,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
index 556247d85af..5bb65454e0a 100644
--- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
+++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp
@@ -23,7 +23,8 @@ SDComment: Shadow storm is not properly implemented in core it should only targe
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "WorldPacket.h"
#include "Item.h"
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
index e61e20c35bc..afd4d834f07 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp
@@ -23,7 +23,8 @@ SDComment: Everything seems to work, still need some checking
SDCategory: Wailing Caverns
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "wailing_caverns.h"
#define MAX_ENCOUNTER 9
@@ -79,7 +80,7 @@ public:
if (data == DONE)SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -97,7 +98,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
if (data == DATA_NARALEX)return NaralexGUID;
return 0;
diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
index 7e93cc7e4c7..6cc8d5931d3 100644
--- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
+++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp
@@ -26,43 +26,43 @@ EndScriptData */
/* ContentData
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "wailing_caverns.h"
+#include "Player.h"
/*######
## npc_disciple_of_naralex
######*/
-enum eEnums
+enum Enums
{
- //say
- SAY_MAKE_PREPARATIONS = -1043001,
- SAY_TEMPLE_OF_PROMISE = -1043002,
- SAY_MUST_CONTINUE = -1043003,
- SAY_BANISH_THE_SPIRITS = -1043004,
- SAY_CAVERNS_PURIFIED = -1043005,
- SAY_BEYOND_THIS_CORRIDOR = -1043006,
- SAY_EMERALD_DREAM = -1043007,
- SAY_MUTANUS_THE_DEVOURER = -1043012,
- SAY_NARALEX_AWAKES = -1043014,
- SAY_THANK_YOU = -1043015,
- SAY_FAREWELL = -1043016,
- SAY_ATTACKED = -1043017,
- //yell
- SAY_AT_LAST = -1043000,
- SAY_I_AM_AWAKE = -1043013,
- //emote
- EMOTE_AWAKENING_RITUAL = -1043008,
- EMOTE_TROUBLED_SLEEP = -1043009,
- EMOTE_WRITHE_IN_AGONY = -1043010,
- EMOTE_HORRENDOUS_VISION = -1043011,
- //spell
+ SAY_AT_LAST = 0,
+ SAY_MAKE_PREPARATIONS = 1,
+ SAY_TEMPLE_OF_PROMISE = 2,
+ SAY_MUST_CONTINUE = 3,
+ SAY_BANISH_THE_SPIRITS = 4,
+ SAY_CAVERNS_PURIFIED = 5,
+ SAY_BEYOND_THIS_CORRIDOR = 6,
+ SAY_EMERALD_DREAM = 7,
+ EMOTE_AWAKENING_RITUAL = 8,
+ EMOTE_TROUBLED_SLEEP = 0,
+ EMOTE_WRITHE_IN_AGONY = 1,
+ EMOTE_HORRENDOUS_VISION = 2,
+ SAY_MUTANUS_THE_DEVOURER = 9,
+ SAY_I_AM_AWAKE = 3,
+ SAY_NARALEX_AWAKES = 10,
+ SAY_THANK_YOU = 4,
+ SAY_FAREWELL = 5,
+ SAY_ATTACKED = 11,
+
SPELL_MARK_OF_THE_WILD_RANK_2 = 5232,
SPELL_SERPENTINE_CLEANSING = 6270,
SPELL_NARALEXS_AWAKENING = 6271,
SPELL_FLIGHT_FORM = 33943,
- //npc entry
+
NPC_DEVIATE_RAVAGER = 3636,
NPC_DEVIATE_VIPER = 5755,
NPC_DEVIATE_MOCCASIN = 5762,
@@ -73,7 +73,6 @@ enum eEnums
#define GOSSIP_ID_START_1 698 //Naralex sleeps again!
#define GOSSIP_ID_START_2 699 //The fanglords are dead!
#define GOSSIP_ITEM_NARALEX "Let the event begin!"
-#define ACHIEVEMENT_WAILING_CAVERNS 630
class npc_disciple_of_naralex : public CreatureScript
{
@@ -95,7 +94,7 @@ public:
if (instance)
instance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS);
- DoScriptText(SAY_MAKE_PREPARATIONS, creature);
+ creature->AI()->Talk(SAY_MAKE_PREPARATIONS);
creature->setFaction(250);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
@@ -122,7 +121,7 @@ public:
if (!instance->GetData(TYPE_NARALEX_YELLED))
{
- DoScriptText(SAY_AT_LAST, creature);
+ creature->AI()->Talk(SAY_AT_LAST);
instance->SetData(TYPE_NARALEX_YELLED, 1);
}
}
@@ -164,7 +163,7 @@ public:
instance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS);
break;
case 5:
- DoScriptText(SAY_MUST_CONTINUE, me);
+ Talk(SAY_MUST_CONTINUE);
instance->SetData(TYPE_NARALEX_PART1, DONE);
break;
case 11:
@@ -173,7 +172,7 @@ public:
instance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS);
break;
case 19:
- DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me);
+ Talk(SAY_BEYOND_THIS_CORRIDOR);
break;
case 24:
eventProgress = 1;
@@ -190,7 +189,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_ATTACKED, me, who);
+ Talk(SAY_ATTACKED, who->GetGUID());
}
void JustDied(Unit* /*slayer*/)
@@ -227,7 +226,7 @@ public:
if (eventProgress == 1)
{
++eventProgress;
- DoScriptText(SAY_TEMPLE_OF_PROMISE, me);
+ Talk(SAY_TEMPLE_OF_PROMISE);
me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763f, 227.874f, -93.3233f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506f, 216.645f, -93.6756f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
}
@@ -236,7 +235,7 @@ public:
if (eventProgress == 1)
{
++eventProgress;
- DoScriptText(SAY_BANISH_THE_SPIRITS, me);
+ Talk(SAY_BANISH_THE_SPIRITS);
DoCast(me, SPELL_SERPENTINE_CLEANSING);
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
eventTimer = 30000;
@@ -248,7 +247,7 @@ public:
if (eventProgress == 2)
{
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true);
- DoScriptText(SAY_CAVERNS_PURIFIED, me);
+ Talk(SAY_CAVERNS_PURIFIED);
instance->SetData(TYPE_NARALEX_PART2, DONE);
if (me->HasAura(SPELL_SERPENTINE_CLEANSING))
me->RemoveAura(SPELL_SERPENTINE_CLEANSING);
@@ -260,7 +259,7 @@ public:
++eventProgress;
eventTimer = 4000;
me->SetStandState(UNIT_STAND_STATE_KNEEL);
- DoScriptText(SAY_EMERALD_DREAM, me);
+ Talk(SAY_EMERALD_DREAM);
}
else
if (eventProgress == 2)
@@ -270,7 +269,7 @@ public:
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
- DoScriptText(EMOTE_AWAKENING_RITUAL, me);
+ Talk(EMOTE_AWAKENING_RITUAL);
}
else
if (eventProgress == 3)
@@ -278,7 +277,7 @@ public:
++eventProgress;
eventTimer = 15000;
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
- DoScriptText(EMOTE_TROUBLED_SLEEP, naralex);
+ naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007f, 227.428f, -97.421f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
@@ -289,7 +288,7 @@ public:
++eventProgress;
eventTimer = 30000;
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
- DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex);
+ naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102f, 227.211f, -102.752f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
@@ -303,9 +302,9 @@ public:
{
++eventProgress;
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
- DoScriptText(EMOTE_HORRENDOUS_VISION, naralex);
+ naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION);
me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
- DoScriptText(SAY_MUTANUS_THE_DEVOURER, me);
+ Talk(SAY_MUTANUS_THE_DEVOURER);
instance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS);
}
else
@@ -315,23 +314,12 @@ public:
eventTimer = 3000;
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
{
- AchievementEntry const* AchievWC = sAchievementStore.LookupEntry(ACHIEVEMENT_WAILING_CAVERNS);
- if (AchievWC)
- {
- Map* map = me->GetMap();
- if (map && map->IsDungeon())
- {
- Map::PlayerList const &players = map->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- itr->getSource()->CompletedAchievement(AchievWC);
- }
- }
if (me->HasAura(SPELL_NARALEXS_AWAKENING))
me->RemoveAura(SPELL_NARALEXS_AWAKENING);
naralex->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_I_AM_AWAKE, naralex);
+ naralex->AI()->Talk(SAY_I_AM_AWAKE);
}
- DoScriptText(SAY_NARALEX_AWAKES, me);
+ Talk(SAY_NARALEX_AWAKES);
}
else
if (eventProgress == 7)
@@ -339,7 +327,7 @@ public:
++eventProgress;
eventTimer = 6000;
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
- DoScriptText(SAY_THANK_YOU, naralex);
+ naralex->AI()->Talk(SAY_THANK_YOU);
}
else
if (eventProgress == 8)
@@ -348,7 +336,7 @@ public:
eventTimer = 8000;
if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX)))
{
- DoScriptText(SAY_FAREWELL, naralex);
+ naralex->AI()->Talk(SAY_FAREWELL);
naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
}
SetRun();
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
index b6c69584358..4cdddb2d9da 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "zulfarrak.h"
+#include "Player.h"
+#include "TemporarySummon.h"
#define NPC_GAHZRILLA 7273
#define PATH_ADDS 81553
@@ -118,6 +121,18 @@ public:
void Initialize()
{
GahzRillaEncounter = NOT_STARTED;
+ ZumrahGUID = 0;
+ BlyGUID = 0;
+ WeegliGUID = 0;
+ OroGUID = 0;
+ RavenGUID = 0;
+ MurtaGUID = 0;
+ EndDoorGUID = 0;
+ PyramidPhase = 0;
+ major_wave_Timer = 0;
+ minor_wave_Timer = 0;
+ addGroupSize = 0;
+ waypoint = 0;
}
void OnCreatureCreate(Creature* creature)
@@ -166,7 +181,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -176,7 +191,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
index 9e3d9240321..0a948e4a5f0 100644
--- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
+++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp
@@ -28,8 +28,11 @@ npc_sergeant_bly
npc_weegli_blastfuse
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "zulfarrak.h"
+#include "Player.h"
/*######
## npc_sergeant_bly
@@ -239,16 +242,16 @@ private:
enum weegliSpells
{
- SPELL_BOMB = 8858,
- SPELL_GOBLIN_LAND_MINE = 21688,
- SPELL_SHOOT = 6660,
- SPELL_WEEGLIS_BARREL = 10772
+ SPELL_BOMB = 8858,
+ SPELL_GOBLIN_LAND_MINE = 21688,
+ SPELL_SHOOT = 6660,
+ SPELL_WEEGLIS_BARREL = 10772
};
enum weegliSays
{
- SAY_WEEGLI_OHNO = -1209000,
- SAY_WEEGLI_OK_I_GO = -1209001
+ SAY_WEEGLI_OHNO = 0,
+ SAY_WEEGLI_OK_I_GO = 1
};
#define GOSSIP_WEEGLI "[PH] Please blow up the door."
@@ -360,7 +363,7 @@ public:
if (instance->GetData(EVENT_PYRAMID) == PYRAMID_CAGES_OPEN)
{
instance->SetData(EVENT_PYRAMID, PYRAMID_ARRIVED_AT_STAIR);
- DoScriptText(SAY_WEEGLI_OHNO, me);
+ Talk(SAY_WEEGLI_OHNO);
me->SetHomePosition(1882.69f, 1272.28f, 41.87f, 0);
}
else
@@ -385,7 +388,7 @@ public:
me->setFaction(FACTION_FRIENDLY);
me->GetMotionMaster()->MovePoint(0, 1858.57f, 1146.35f, 14.745f);
me->SetHomePosition(1858.57f, 1146.35f, 14.745f, 3.85f); // in case he gets interrupted
- DoScriptText(SAY_WEEGLI_OK_I_GO, me);
+ Talk(SAY_WEEGLI_OK_I_GO);
destroyingDoor=true;
}
}
diff --git a/src/server/scripts/Kalimdor/ashenvale.cpp b/src/server/scripts/Kalimdor/ashenvale.cpp
index 9e8cdaa8b92..40ac1609fee 100644
--- a/src/server/scripts/Kalimdor/ashenvale.cpp
+++ b/src/server/scripts/Kalimdor/ashenvale.cpp
@@ -31,6 +31,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*####
# npc_torek
@@ -96,7 +97,7 @@ class npc_torek : public CreatureScript
me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 20:
- DoScriptText(SAY_WIN, me, player);
+ Talk(SAY_WIN, player->GetGUID());
Completed = true;
player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
break;
@@ -174,7 +175,7 @@ enum RuulSnowhoof
NPC_THISTLEFUR_URSA = 3921,
NPC_THISTLEFUR_TOTEMIC = 3922,
NPC_THISTLEFUR_PATHFINDER = 3926,
-
+
QUEST_FREEDOM_TO_RUUL = 6482,
GO_CAGE = 178147
@@ -268,16 +269,16 @@ class npc_ruul_snowhoof : public CreatureScript
enum Muglash
{
- SAY_MUG_START1 = -1800054,
- SAY_MUG_START2 = -1800055,
- SAY_MUG_BRAZIER = -1800056,
- SAY_MUG_BRAZIER_WAIT = -1800057,
- SAY_MUG_ON_GUARD = -1800058,
- SAY_MUG_REST = -1800059,
- SAY_MUG_DONE = -1800060,
- SAY_MUG_GRATITUDE = -1800061,
- SAY_MUG_PATROL = -1800062,
- SAY_MUG_RETURN = -1800063,
+ SAY_MUG_START1 = 0,
+ SAY_MUG_START2 = 1,
+ SAY_MUG_BRAZIER = 2,
+ SAY_MUG_BRAZIER_WAIT = 3,
+ SAY_MUG_ON_GUARD = 4,
+ SAY_MUG_REST = 5,
+ SAY_MUG_DONE = 6,
+ SAY_MUG_GRATITUDE = 7,
+ SAY_MUG_PATROL = 8,
+ SAY_MUG_RETURN = 9,
QUEST_VORSHA = 6641,
@@ -336,10 +337,10 @@ class npc_muglash : public CreatureScript
switch (waypointId)
{
case 0:
- DoScriptText(SAY_MUG_START2, me, player);
+ Talk(SAY_MUG_START2, player->GetGUID());
break;
case 24:
- DoScriptText(SAY_MUG_BRAZIER, me, player);
+ Talk(SAY_MUG_BRAZIER, player->GetGUID());
if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_NAGA_BRAZIER, INTERACTION_DISTANCE*2))
{
@@ -348,14 +349,14 @@ class npc_muglash : public CreatureScript
}
break;
case 25:
- DoScriptText(SAY_MUG_GRATITUDE, me);
+ Talk(SAY_MUG_GRATITUDE);
player->GroupEventHappens(QUEST_VORSHA, me);
break;
case 26:
- DoScriptText(SAY_MUG_PATROL, me);
+ Talk(SAY_MUG_PATROL);
break;
case 27:
- DoScriptText(SAY_MUG_RETURN, me);
+ Talk(SAY_MUG_RETURN);
break;
}
}
@@ -367,7 +368,7 @@ class npc_muglash : public CreatureScript
if (HasEscortState(STATE_ESCORT_PAUSED))
{
if (urand(0, 1))
- DoScriptText(SAY_MUG_ON_GUARD, me, player);
+ Talk(SAY_MUG_ON_GUARD, player->GetGUID());
return;
}
}
@@ -405,7 +406,7 @@ class npc_muglash : public CreatureScript
break;
case 4:
SetEscortPaused(false);
- DoScriptText(SAY_MUG_DONE, me);
+ Talk(SAY_MUG_DONE);
break;
}
}
@@ -444,10 +445,10 @@ class npc_muglash : public CreatureScript
{
if (npc_muglashAI* pEscortAI = CAST_AI(npc_muglashAI, creature->AI()))
{
- DoScriptText(SAY_MUG_START1, creature);
+ creature->AI()->Talk(SAY_MUG_START1);
creature->setFaction(113);
- pEscortAI->Start(true, true, player->GetGUID());
+ pEscortAI->Start(true, false, player->GetGUID());
}
}
return true;
@@ -465,7 +466,7 @@ class go_naga_brazier : public GameObjectScript
{
if (npc_muglash::npc_muglashAI* pEscortAI = CAST_AI(npc_muglash::npc_muglashAI, creature->AI()))
{
- DoScriptText(SAY_MUG_BRAZIER_WAIT, creature);
+ creature->AI()->Talk(SAY_MUG_BRAZIER_WAIT);
pEscortAI->IsBrazierExtinguished = true;
return false;
diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp
index eae5baa8db2..b38d1ac2c3b 100644
--- a/src/server/scripts/Kalimdor/azshara.cpp
+++ b/src/server/scripts/Kalimdor/azshara.cpp
@@ -33,6 +33,9 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "WorldSession.h"
/*######
## mobs_spitelashes
@@ -182,9 +185,9 @@ public:
enum RizzleSprysprocketData
{
QUEST_CHASING_THE_MOONSTONE = 10994,
-
+
MOB_DEPTH_CHARGE = 23025,
-
+
SPELL_RIZZLE_BLACKJACK = 39865,
SPELL_RIZZLE_ESCAPE = 39871,
SPELL_RIZZLE_FROST_GRENADE = 40525,
@@ -192,12 +195,10 @@ enum RizzleSprysprocketData
SPELL_PERIODIC_DEPTH_CHARGE = 39912,
SPELL_GIVE_SOUTHFURY_MOONSTONE = 39886,
- SAY_RIZZLE_START = -1000351,
- MSG_ESCAPE_NOTICE = -1000352,
- SAY_RIZZLE_GRENADE = -1000353,
- SAY_RIZZLE_GRENADE_BACKFIRE = -1000354, // Not used
- SAY_RIZZLE_FINAL = -1000355,
- SAY_RIZZLE_FINAL2 = -1000356, // Not used
+ SAY_RIZZLE_START = 0,
+ SAY_RIZZLE_GRENADE = 1,
+ SAY_RIZZLE_FINAL = 2,
+ MSG_ESCAPE_NOTICE = 3
};
#define GOSSIP_GET_MOONSTONE "Hand over the Southfury moonstone and I'll let you go."
@@ -355,15 +356,15 @@ public:
if (TeleportTimer <= diff)
{
- //temp solution - unit can't be teleported by core using spelleffect 5, only players
- if (me->GetMap())
- {
- me->SetPosition(3706.39f, -3969.15f, 35.9118f, 0);
- me->AI_SendMoveToPacket(3706.39f, -3969.15f, 35.9118f, 0, 0, 0);
- }
+ // temp solution - unit can't be teleported by core using spelleffect 5, only players
+ DoTeleportTo(3706.39f, -3969.15f, 35.9118f);
+
//begin swimming and summon depth charges
Player* player = Unit::GetPlayer(*me, PlayerGUID);
- SendText(MSG_ESCAPE_NOTICE, player);
+ if (!player)
+ return;
+
+ Talk(MSG_ESCAPE_NOTICE, player->GetGUID());
DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE);
me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING);
me->SetSpeed(MOVE_RUN, 0.85f, true);
@@ -386,7 +387,7 @@ public:
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player)
{
- DoScriptText(SAY_RIZZLE_GRENADE, me, player);
+ Talk(SAY_RIZZLE_GRENADE, player->GetGUID());
DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true);
}
GrenadeTimer = 30000;
@@ -403,7 +404,7 @@ public:
if (me->IsWithinDist(player, 10) && me->GetPositionX() > player->GetPositionX() && !Reached)
{
- DoScriptText(SAY_RIZZLE_FINAL, me);
+ Talk(SAY_RIZZLE_FINAL);
me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
me->setFaction(35);
me->GetMotionMaster()->MoveIdle();
@@ -431,7 +432,7 @@ public:
if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(QUEST_CHASING_THE_MOONSTONE) == QUEST_STATUS_INCOMPLETE)
{
PlayerGUID = who->GetGUID();
- DoScriptText(SAY_RIZZLE_START, me);
+ Talk(SAY_RIZZLE_START);
DoCast(who, SPELL_RIZZLE_BLACKJACK, false);
return;
}
@@ -490,7 +491,7 @@ public:
{
if (WeMustDieTimer <= diff)
me->DespawnOrUnsummon();
- else
+ else
WeMustDieTimer -= diff;
}
return;
diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
index 608117ca9af..3f1ae0fa3bf 100644
--- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp
@@ -47,15 +47,9 @@ EndContentData */
enum draeneiSurvivor
{
- SAY_HEAL1 = -1000176,
- SAY_HEAL2 = -1000177,
- SAY_HEAL3 = -1000178,
- SAY_HEAL4 = -1000179,
+ SAY_HEAL = 0,
- SAY_HELP1 = -1000180,
- SAY_HELP2 = -1000181,
- SAY_HELP3 = -1000182,
- SAY_HELP4 = -1000183,
+ SAY_HELP = 1,
SPELL_IRRIDATION = 35046,
SPELL_STUNNED = 28630
@@ -108,7 +102,7 @@ public:
if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f))
{
//Random switch between 4 texts
- DoScriptText(RAND(SAY_HELP1, SAY_HELP2, SAY_HELP3, SAY_HELP4), me, who);
+ Talk(SAY_HELP, who->GetGUID());
SayHelpTimer = 20000;
CanSayHelp = false;
@@ -140,7 +134,7 @@ public:
if (Player* player = Unit::GetPlayer(*me, pCaster))
{
- DoScriptText(RAND(SAY_HEAL1, SAY_HEAL2, SAY_HEAL3, SAY_HEAL4), me, player);
+ Talk(SAY_HEAL, player->GetGUID());
player->TalkedToCreature(me->GetEntry(), me->GetGUID());
}
@@ -181,9 +175,9 @@ public:
enum Overgrind
{
- SAY_TEXT = -1000184,
- SAY_EMOTE = -1000185,
- ATTACK_YELL = -1000186,
+ SAY_TEXT = 0,
+ SAY_EMOTE = 1,
+ ATTACK_YELL = 2,
AREA_COVE = 3579,
AREA_ISLE = 3639,
@@ -257,7 +251,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(ATTACK_YELL, me, who);
+ Talk(ATTACK_YELL, who->GetGUID());
}
void UpdateAI(const uint32 diff)
@@ -266,8 +260,8 @@ public:
{
if (EmoteTimer <= diff)
{
- DoScriptText(SAY_TEXT, me);
- DoScriptText(SAY_EMOTE, me);
+ Talk(SAY_TEXT);
+ Talk(SAY_EMOTE);
EmoteTimer = urand(120000, 150000);
} else EmoteTimer -= diff;
}
@@ -338,12 +332,12 @@ public:
enum Magwin
{
- SAY_START = -1000111,
- SAY_AGGRO = -1000112,
- SAY_PROGRESS = -1000113,
- SAY_END1 = -1000114,
- SAY_END2 = -1000115,
- EMOTE_HUG = -1000116,
+ SAY_START = 0,
+ SAY_AGGRO = 1,
+ SAY_PROGRESS = 2,
+ SAY_END1 = 3,
+ SAY_END2 = 4,
+ EMOTE_HUG = 5,
QUEST_A_CRY_FOR_SAY_HELP = 9528
};
@@ -380,17 +374,17 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_START, me, player);
+ Talk(SAY_START, player->GetGUID());
break;
case 17:
- DoScriptText(SAY_PROGRESS, me, player);
+ Talk(SAY_PROGRESS, player->GetGUID());
break;
case 28:
- DoScriptText(SAY_END1, me, player);
+ Talk(SAY_END1, player->GetGUID());
break;
case 29:
- DoScriptText(EMOTE_HUG, me, player);
- DoScriptText(SAY_END2, me, player);
+ Talk(EMOTE_HUG, player->GetGUID());
+ Talk(SAY_END2, player->GetGUID());
player->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP, me);
break;
}
@@ -399,7 +393,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_AGGRO, me, who);
+ Talk(SAY_AGGRO, who->GetGUID());
}
void Reset() {}
@@ -417,15 +411,15 @@ enum Geezle
SPELL_TREE_DISGUISE = 30298,
- GEEZLE_SAY_1 = -1000629,
- SPARK_SAY_2 = -1000630,
- SPARK_SAY_3 = -1000631,
- GEEZLE_SAY_4 = -1000632,
- SPARK_SAY_5 = -1000633,
- SPARK_SAY_6 = -1000634,
- GEEZLE_SAY_7 = -1000635,
+ GEEZLE_SAY_1 = 0,
+ SPARK_SAY_2 = 3,
+ SPARK_SAY_3 = 4,
+ GEEZLE_SAY_4 = 1,
+ SPARK_SAY_5 = 5,
+ SPARK_SAY_6 = 6,
+ GEEZLE_SAY_7 = 2,
- EMOTE_SPARK = -1000636,
+ EMOTE_SPARK = 7,
MOB_SPARK = 17243,
GO_NAGA_FLAG = 181694
@@ -479,41 +473,49 @@ public:
uint32 NextStep(uint8 Step)
{
Creature* Spark = Unit::GetCreature(*me, SparkGUID);
+ if (!Spark)
+ return 99999999;
switch (Step)
{
case 0:
- if (Spark)
- Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f);
+ Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f);
me->GetMotionMaster()->MovePoint(0, -5092.26f, -11252, 0.71f);
- return 9000; // NPCs are walking up to fire
+ return 9000;
case 1:
DespawnNagaFlag(true);
- DoScriptText(EMOTE_SPARK, Spark);
+ Spark->AI()->Talk(EMOTE_SPARK);
return 1000;
case 2:
- DoScriptText(GEEZLE_SAY_1, me, Spark);
- if (Spark)
- {
- Spark->SetInFront(me);
- me->SetInFront(Spark);
- }
+ Talk(GEEZLE_SAY_1, SparkGUID);
+ Spark->SetInFront(me);
+ me->SetInFront(Spark);
return 5000;
- case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000;
- case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000;
- case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000;
- case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000;
- case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000;
- case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000;
+ case 3:
+ Spark->AI()->Talk(SPARK_SAY_2);
+ return 7000;
+ case 4:
+ Spark->AI()->Talk(SPARK_SAY_3);
+ return 8000;
+ case 5:
+ Talk(GEEZLE_SAY_4, SparkGUID);
+ return 8000;
+ case 6:
+ Spark->AI()->Talk(SPARK_SAY_5);
+ return 9000;
+ case 7:
+ Spark->AI()->Talk(SPARK_SAY_6);
+ return 8000;
+ case 8:
+ Talk(GEEZLE_SAY_7, SparkGUID);
+ return 2000;
case 9:
me->GetMotionMaster()->MoveTargetedHome();
- if (Spark)
- Spark->GetMotionMaster()->MovePoint(0, SparkPos);
+ Spark->GetMotionMaster()->MovePoint(0, SparkPos);
CompleteQuest();
return 9000;
case 10:
- if (Spark)
- Spark->DisappearAndDie();
+ Spark->DisappearAndDie();
DespawnNagaFlag(false);
me->DisappearAndDie();
default: return 99999999;
@@ -549,8 +551,8 @@ public:
(*itr)->Respawn();
}
}
- else
- sLog->outError("SD2 ERROR: FlagList is empty!");
+ else
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: FlagList is empty!");
}
void UpdateAI(const uint32 diff)
@@ -560,7 +562,7 @@ public:
if (EventStarted)
SayTimer = NextStep(Step++);
}
- else
+ else
SayTimer -= diff;
}
};
@@ -658,9 +660,7 @@ enum BristlelimbCage
NPC_STILLPINE_CAPITIVE = 17375,
GO_BRISTELIMB_CAGE = 181714,
- CAPITIVE_SAY_1 = -1000474,
- CAPITIVE_SAY_2 = -1000475,
- CAPITIVE_SAY_3 = -1000476,
+ CAPITIVE_SAY = 0,
POINT_INIT = 1,
EVENT_DESPAWN = 1,
@@ -673,9 +673,7 @@ class npc_stillpine_capitive : public CreatureScript
struct npc_stillpine_capitiveAI : public ScriptedAI
{
- npc_stillpine_capitiveAI(Creature* creature) : ScriptedAI(creature)
- {
- }
+ npc_stillpine_capitiveAI(Creature* creature) : ScriptedAI(creature) {}
void Reset()
{
@@ -693,7 +691,7 @@ class npc_stillpine_capitive : public CreatureScript
{
if (owner)
{
- DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), me, owner);
+ Talk(CAPITIVE_SAY, owner->GetGUID());
_player = owner;
}
Position pos;
diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp
index 3883b740d02..3b77ee34275 100644
--- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp
@@ -31,6 +31,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## mob_webbed_creature
@@ -157,7 +158,7 @@ enum Stillpine
NPC_PRINCESS_STILLPINE = 17682,
GO_PRINCESS_STILLPINES_CAGE = 181928,
SPELL_OPENING_PRINCESS_STILLPINE_CREDIT = 31003,
- SAY_DIRECTION = -1800074
+ SAY_DIRECTION = 0
};
class go_princess_stillpines_cage : public GameObjectScript
@@ -190,7 +191,7 @@ public:
{
if (type == POINT_MOTION_TYPE && id == 1)
{
- DoScriptText(SAY_DIRECTION, me);
+ Talk(SAY_DIRECTION);
me->DespawnOrUnsummon();
}
}
diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp
index ec098951c03..7bc2e96e0dc 100644
--- a/src/server/scripts/Kalimdor/boss_azuregos.cpp
+++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp
@@ -28,7 +28,7 @@ EndScriptData */
enum Say
{
- SAY_TELEPORT = -1000100
+ SAY_TELEPORT = 0
};
enum Spells
@@ -89,10 +89,10 @@ public:
if (TeleportTimer <= diff)
{
- DoScriptText(SAY_TELEPORT, me);
- std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
- std::list<HostileReference*>::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i!= threatlist.end(); ++i)
+ Talk(SAY_TELEPORT);
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -158,7 +158,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_azuregos()
diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp
index 0e02a77169e..921cc6aaf97 100644
--- a/src/server/scripts/Kalimdor/darkshore.cpp
+++ b/src/server/scripts/Kalimdor/darkshore.cpp
@@ -34,6 +34,8 @@ EndContentData */
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*####
# npc_kerlonian
@@ -41,23 +43,12 @@ EndContentData */
enum Kerlonian
{
- SAY_KER_START = -1000434,
-
- EMOTE_KER_SLEEP_1 = -1000435,
- EMOTE_KER_SLEEP_2 = -1000436,
- EMOTE_KER_SLEEP_3 = -1000437,
-
- SAY_KER_SLEEP_1 = -1000438,
- SAY_KER_SLEEP_2 = -1000439,
- SAY_KER_SLEEP_3 = -1000440,
- SAY_KER_SLEEP_4 = -1000441,
-
- EMOTE_KER_AWAKEN = -1000445,
-
- SAY_KER_ALERT_1 = -1000442,
- SAY_KER_ALERT_2 = -1000443,
-
- SAY_KER_END = -1000444,
+ SAY_KER_START = 0,
+ EMOTE_KER_SLEEP = 1,
+ SAY_KER_SLEEP = 2,
+ SAY_KER_ALERT_1 = 3,
+ SAY_KER_END = 4,
+ EMOTE_KER_AWAKEN = 5,
SPELL_SLEEP_VISUAL = 25148,
SPELL_AWAKEN = 17536,
@@ -79,7 +70,7 @@ public:
if (npc_kerlonianAI* pKerlonianAI = CAST_AI(npc_kerlonian::npc_kerlonianAI, creature->AI()))
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_KER_START, creature, player);
+ creature->AI()->Talk(SAY_KER_START, player->GetGUID());
pKerlonianAI->StartFollow(player, FACTION_KER_ESCORTEE, quest);
}
}
@@ -116,7 +107,7 @@ public:
if (player->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE)
player->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me);
- DoScriptText(SAY_KER_END, me);
+ Talk(SAY_KER_END);
}
SetFollowComplete();
@@ -134,9 +125,9 @@ public:
{
SetFollowPaused(true);
- DoScriptText(RAND(EMOTE_KER_SLEEP_1, EMOTE_KER_SLEEP_2, EMOTE_KER_SLEEP_3), me);
+ Talk(EMOTE_KER_SLEEP);
- DoScriptText(RAND(SAY_KER_SLEEP_1, SAY_KER_SLEEP_2, SAY_KER_SLEEP_3, SAY_KER_SLEEP_4), me);
+ Talk(SAY_KER_SLEEP);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
DoCast(me, SPELL_SLEEP_VISUAL, false);
@@ -147,7 +138,7 @@ public:
me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL);
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(EMOTE_KER_AWAKEN, me);
+ Talk(EMOTE_KER_AWAKEN);
SetFollowPaused(false);
}
@@ -185,19 +176,19 @@ public:
enum Remtravel
{
- SAY_REM_START = -1000327,
- SAY_REM_AGGRO = -1000328,
- SAY_REM_RAMP1_1 = -1000329,
- SAY_REM_RAMP1_2 = -1000330,
- SAY_REM_BOOK = -1000331,
- SAY_REM_TENT1_1 = -1000332,
- SAY_REM_TENT1_2 = -1000333,
- SAY_REM_MOSS = -1000334,
- EMOTE_REM_MOSS = -1000335,
- SAY_REM_MOSS_PROGRESS = -1000336,
- SAY_REM_PROGRESS = -1000337,
- SAY_REM_REMEMBER = -1000338,
- EMOTE_REM_END = -1000339,
+ SAY_REM_START = 0,
+ SAY_REM_AGGRO = 1,
+ SAY_REM_RAMP1_1 = 2,
+ SAY_REM_RAMP1_2 = 3,
+ SAY_REM_BOOK = 4,
+ SAY_REM_TENT1_1 = 5,
+ SAY_REM_TENT1_2 = 6,
+ SAY_REM_MOSS = 7,
+ EMOTE_REM_MOSS = 8,
+ SAY_REM_MOSS_PROGRESS = 9,
+ SAY_REM_PROGRESS = 10,
+ SAY_REM_REMEMBER = 11,
+ EMOTE_REM_END = 12,
FACTION_ESCORTEE = 10,
QUEST_ABSENT_MINDED_PT2 = 731,
@@ -240,40 +231,40 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_REM_START, me, player);
+ Talk(SAY_REM_START, player->GetGUID());
break;
case 5:
- DoScriptText(SAY_REM_RAMP1_1, me, player);
+ Talk(SAY_REM_RAMP1_1, player->GetGUID());
break;
case 6:
DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 9:
- DoScriptText(SAY_REM_RAMP1_2, me, player);
+ Talk(SAY_REM_RAMP1_2, player->GetGUID());
break;
case 14:
//depend quest rewarded?
- DoScriptText(SAY_REM_BOOK, me, player);
+ Talk(SAY_REM_BOOK, player->GetGUID());
break;
case 15:
- DoScriptText(SAY_REM_TENT1_1, me, player);
+ Talk(SAY_REM_TENT1_1, player->GetGUID());
break;
case 16:
DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 17:
- DoScriptText(SAY_REM_TENT1_2, me, player);
+ Talk(SAY_REM_TENT1_2, player->GetGUID());
break;
case 26:
- DoScriptText(SAY_REM_MOSS, me, player);
+ Talk(SAY_REM_MOSS, player->GetGUID());
break;
case 27:
- DoScriptText(EMOTE_REM_MOSS, me, player);
+ Talk(EMOTE_REM_MOSS, player->GetGUID());
break;
case 28:
- DoScriptText(SAY_REM_MOSS_PROGRESS, me, player);
+ Talk(SAY_REM_MOSS_PROGRESS, player->GetGUID());
break;
case 29:
DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
@@ -281,13 +272,13 @@ public:
DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 31:
- DoScriptText(SAY_REM_PROGRESS, me, player);
+ Talk(SAY_REM_PROGRESS, player->GetGUID());
break;
case 41:
- DoScriptText(SAY_REM_REMEMBER, me, player);
+ Talk(SAY_REM_REMEMBER, player->GetGUID());
break;
case 42:
- DoScriptText(EMOTE_REM_END, me, player);
+ Talk(EMOTE_REM_END, player->GetGUID());
player->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me);
break;
}
@@ -299,7 +290,7 @@ public:
void EnterCombat(Unit* who)
{
if (urand(0, 1))
- DoScriptText(SAY_REM_AGGRO, me, who);
+ Talk(SAY_REM_AGGRO, who->GetGUID());
}
void JustSummoned(Creature* /*pSummoned*/)
@@ -317,8 +308,8 @@ public:
enum Threshwackonator
{
- EMOTE_START = -1000325, //signed for 4966
- SAY_AT_CLOSE = -1000326, //signed for 4966
+ EMOTE_START = 0,
+ SAY_AT_CLOSE = 1,
QUEST_GYROMAST_REV = 2078,
NPC_GELKAK = 6667,
FACTION_HOSTILE = 14
@@ -340,7 +331,7 @@ public:
if (npc_threshwackonatorAI* pThreshAI = CAST_AI(npc_threshwackonator::npc_threshwackonatorAI, creature->AI()))
{
- DoScriptText(EMOTE_START, creature);
+ creature->AI()->Talk(EMOTE_START);
pThreshAI->StartFollow(player);
}
}
@@ -376,7 +367,7 @@ public:
{
if (me->IsWithinDistInMap(who, 10.0f))
{
- DoScriptText(SAY_AT_CLOSE, who);
+ Talk(SAY_AT_CLOSE, who->GetGUID());
DoAtEnd();
}
}
diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp
index e196c71f681..8c56714e614 100644
--- a/src/server/scripts/Kalimdor/desolace.cpp
+++ b/src/server/scripts/Kalimdor/desolace.cpp
@@ -34,13 +34,13 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
enum DyingKodo
{
// signed for 9999
- SAY_SMEED_HOME_1 = -1000348,
- SAY_SMEED_HOME_2 = -1000349,
- SAY_SMEED_HOME_3 = -1000350,
+ SAY_SMEED_HOME = 0,
QUEST_KODO = 5561,
@@ -132,7 +132,8 @@ public:
if (me->IsWithinDistInMap(who, 10.0f))
{
- DoScriptText(RAND(SAY_SMEED_HOME_1, SAY_SMEED_HOME_2, SAY_SMEED_HOME_3), who);
+ if (Creature* talker = who->ToCreature())
+ talker->AI()->Talk(SAY_SMEED_HOME);
//spell have no implemented effect (dummy), so useful to notify spellHit
DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true);
diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp
index ec06a542b6f..04e65693154 100644
--- a/src/server/scripts/Kalimdor/durotar.cpp
+++ b/src/server/scripts/Kalimdor/durotar.cpp
@@ -19,6 +19,7 @@
#include "ScriptedCreature.h"
#include "Vehicle.h"
#include "SpellScript.h"
+#include "Player.h"
/*######
##Quest 5441: Lazy Peons
@@ -27,7 +28,7 @@
enum LazyPeonYells
{
- SAY_SPELL_HIT = -1000600 //Ow! OK, I''ll get back to work, $N!'
+ SAY_SPELL_HIT = 0
};
enum LazyPeon
@@ -76,7 +77,7 @@ public:
&& CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)
{
caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
- DoScriptText(SAY_SPELL_HIT, me, caster);
+ Talk(SAY_SPELL_HIT, caster->GetGUID());
me->RemoveAllAuras();
if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20))
me->GetMotionMaster()->MovePoint(1, Lumberpile->GetPositionX()-1, Lumberpile->GetPositionY(), Lumberpile->GetPositionZ());
diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
index 5800a6a58a0..018b39c58e8 100644
--- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
+++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp
@@ -36,6 +36,8 @@ EndContentData */
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## mobs_risen_husk_spirit
@@ -136,22 +138,16 @@ class mobs_risen_husk_spirit : public CreatureScript
enum TheramoreGuard
{
- SAY_QUEST1 = -1000641,
- SAY_QUEST2 = -1000642,
- SAY_QUEST3 = -1000643,
- SAY_QUEST4 = -1000644,
- SAY_QUEST5 = -1000645,
- SAY_QUEST6 = -1000646,
- SAY_QUEST7 = -1000647,
- SAY_QUEST8 = -1000648,
- SAY_QUEST9 = -1000649,
-
- QUEST_DISCREDITING_THE_DESERTERS = 11133,
-
- NPC_THERAMORE_GUARD = 4979,
-
- SPELL_DOCTORED_LEAFLET = 42725,
- SPELL_PROPAGANDIZED = 42246,
+ QUEST_DISCREDITING_THE_DESERTERS = 11133,
+
+ NPC_THERAMORE_GUARD = 4979,
+
+ SPELL_DOCTORED_LEAFLET = 42725,
+ SPELL_PROPAGANDIZED = 42246,
+
+ SAY_QUEST1 = 0,
+ SAY_QUEST2 = 1,
+ SAY_QUEST3 = 2
};
#define GOSSIP_ITEM_THERAMORE_GUARD "You look like an intelligent person. Why don't you read one of these leaflets and give it some thought?"
@@ -179,7 +175,7 @@ public:
{
player->CLOSE_GOSSIP_MENU();
player->KilledMonsterCredit(NPC_THERAMORE_GUARD, 0);
- DoScriptText(SAY_QUEST1, creature);
+ creature->AI()->Talk(SAY_QUEST1);
creature->CastSpell(creature, SPELL_DOCTORED_LEAFLET, false);
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
CAST_AI(npc_theramore_guard::npc_theramore_guardAI, creature->AI())->YellTimer = 4000;
@@ -218,12 +214,12 @@ public:
switch (Step)
{
case 0:
- DoScriptText(RAND(SAY_QUEST2, SAY_QUEST3, SAY_QUEST4, SAY_QUEST5, SAY_QUEST6), me);
+ Talk(SAY_QUEST2);
YellTimer = 3000;
++Step;
break;
case 1:
- DoScriptText(RAND(SAY_QUEST7, SAY_QUEST8, SAY_QUEST9), me);
+ Talk(SAY_QUEST3);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
Step = 0;
bYellTimer = false;
@@ -326,12 +322,11 @@ public:
enum Hendel
{
- // looks like all this text ids are wrong.
- SAY_PROGRESS_1_TER = -1000411, // signed for 3568
- SAY_PROGRESS_2_HEN = -1000412, // signed for 3568
- SAY_PROGRESS_3_TER = -1000413,
- SAY_PROGRESS_4_TER = -1000414,
- EMOTE_SURRENDER = -1000415,
+ SAY_PROGRESS_1_TER = 0,
+ SAY_PROGRESS_2_HEN = 1,
+ SAY_PROGRESS_3_TER = 2,
+ SAY_PROGRESS_4_TER = 3,
+ EMOTE_SURRENDER = 4,
QUEST_MISSING_DIPLO_PT16 = 1324,
FACTION_HOSTILE = 168, //guessed, may be different
@@ -389,7 +384,7 @@ public:
if (Player* player = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself())
player->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me);
- DoScriptText(EMOTE_SURRENDER, me);
+ Talk(EMOTE_SURRENDER);
EnterEvadeMode();
}
}
@@ -405,8 +400,8 @@ Position const MovePosition = {-2967.030f, -3872.1799f, 35.620f, 0.0f};
enum Zelfrax
{
- SAY_ZELFRAX = -1000472,
- SAY_ZELFRAX_2 = -1000473
+ SAY_ZELFRAX1 = 0,
+ SAY_ZELFRAX2 = 1
};
class npc_zelfrax : public CreatureScript
@@ -459,8 +454,8 @@ public:
{
SetCombatMovement(false);
me->GetMotionMaster()->MovePoint(0, MovePosition);
- DoScriptText(SAY_ZELFRAX, me);
- DoScriptText(SAY_ZELFRAX_2, me);
+ Talk(SAY_ZELFRAX1);
+ Talk(SAY_ZELFRAX2);
}
void UpdateAI(uint32 const /*Diff*/)
@@ -482,16 +477,16 @@ enum Stinky
{
QUEST_STINKYS_ESCAPE_H = 1270,
QUEST_STINKYS_ESCAPE_A = 1222,
- SAY_QUEST_ACCEPTED = -1000507,
- SAY_STAY_1 = -1000508,
- SAY_STAY_2 = -1000509,
- SAY_STAY_3 = -1000510,
- SAY_STAY_4 = -1000511,
- SAY_STAY_5 = -1000512,
- SAY_STAY_6 = -1000513,
- SAY_QUEST_COMPLETE = -1000514,
- SAY_ATTACKED_1 = -1000515,
- EMOTE_DISAPPEAR = -1000516
+ SAY_QUEST_ACCEPTED = 0,
+ SAY_STAY_1 = 1,
+ SAY_STAY_2 = 2,
+ SAY_STAY_3 = 3,
+ SAY_STAY_4 = 4,
+ SAY_STAY_5 = 5,
+ SAY_STAY_6 = 6,
+ SAY_QUEST_COMPLETE = 7,
+ SAY_ATTACKED_1 = 8,
+ EMOTE_DISAPPEAR = 9
};
class npc_stinky : public CreatureScript
@@ -512,7 +507,7 @@ public:
{
creature->setFaction(FACTION_ESCORT_N_NEUTRAL_ACTIVE);
creature->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_QUEST_ACCEPTED, creature);
+ creature->AI()->Talk(SAY_QUEST_ACCEPTED);
pEscortAI->Start(false, false, player->GetGUID());
}
}
@@ -532,29 +527,29 @@ public:
switch (waypointId)
{
case 7:
- DoScriptText(SAY_STAY_1, me, player);
+ Talk(SAY_STAY_1, player->GetGUID());
break;
case 11:
- DoScriptText(SAY_STAY_2, me, player);
+ Talk(SAY_STAY_2, player->GetGUID());
break;
case 25:
- DoScriptText(SAY_STAY_3, me, player);
+ Talk(SAY_STAY_3, player->GetGUID());
break;
case 26:
- DoScriptText(SAY_STAY_4, me, player);
+ Talk(SAY_STAY_4, player->GetGUID());
break;
case 27:
- DoScriptText(SAY_STAY_5, me, player);
+ Talk(SAY_STAY_5, player->GetGUID());
break;
case 28:
- DoScriptText(SAY_STAY_6, me, player);
+ Talk(SAY_STAY_6, player->GetGUID());
me->SetStandState(UNIT_STAND_STATE_KNEEL);
break;
case 29:
me->SetStandState(UNIT_STAND_STATE_STAND);
break;
case 37:
- DoScriptText(SAY_QUEST_COMPLETE, me, player);
+ Talk(SAY_QUEST_COMPLETE, player->GetGUID());
me->SetSpeed(MOVE_RUN, 1.2f, true);
me->SetWalk(false);
if (player->GetQuestStatus(QUEST_STINKYS_ESCAPE_H))
@@ -563,14 +558,14 @@ public:
player->GroupEventHappens(QUEST_STINKYS_ESCAPE_A, me);
break;
case 39:
- DoScriptText(EMOTE_DISAPPEAR, me);
+ Talk(EMOTE_DISAPPEAR);
break;
}
}
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_ATTACKED_1, me, who);
+ Talk(SAY_ATTACKED_1, who->GetGUID());
}
void Reset() {}
diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp
index 9243ea0017e..f1d9a9028e1 100644
--- a/src/server/scripts/Kalimdor/felwood.cpp
+++ b/src/server/scripts/Kalimdor/felwood.cpp
@@ -30,6 +30,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npcs_riverbreeze_and_silversky
@@ -40,10 +41,10 @@ EndContentData */
enum RiverbreezeAndSilversky
{
SPELL_CENARION_BEACON = 15120,
-
+
NPC_ARATHANDRIS_SILVERSKY = 9528,
NPC_MAYBESS_RIVERBREEZE = 9529,
-
+
QUEST_CLEASING_FELWOOD_A = 4101,
QUEST_CLEASING_FELWOOD_H = 4102
};
diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp
index 4fcd20951c9..148f53c9e57 100644
--- a/src/server/scripts/Kalimdor/feralas.cpp
+++ b/src/server/scripts/Kalimdor/feralas.cpp
@@ -27,6 +27,9 @@ EndScriptData */
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npc_gregan_brewspewer
@@ -72,12 +75,10 @@ public:
enum OOX
{
- //signed for 7806
- SAY_OOX_START = -1000287,
- SAY_OOX_AGGRO1 = -1000288,
- SAY_OOX_AGGRO2 = -1000289,
- SAY_OOX_AMBUSH = -1000290,
- SAY_OOX_END = -1000292,
+ SAY_OOX_START = 0,
+ SAY_OOX_AGGRO = 1,
+ SAY_OOX_AMBUSH = 2,
+ SAY_OOX_END = 3,
NPC_YETI = 7848,
NPC_GORILLA = 5260,
@@ -100,7 +101,7 @@ public:
{
if (quest->GetQuestId() == QUEST_RESCUE_OOX22FE)
{
- DoScriptText(SAY_OOX_START, creature);
+ creature->AI()->Talk(SAY_OOX_START);
//change that the npc is not lying dead on the ground
creature->SetStandState(UNIT_STAND_STATE_STAND);
@@ -132,28 +133,28 @@ public:
{
// First Ambush(3 Yetis)
case 11:
- DoScriptText(SAY_OOX_AMBUSH, me);
+ Talk(SAY_OOX_AMBUSH);
me->SummonCreature(NPC_YETI, -4841.01f, 1593.91f, 73.42f, 3.98f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_YETI, -4837.61f, 1568.58f, 78.21f, 3.13f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_YETI, -4841.89f, 1569.95f, 76.53f, 0.68f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
break;
//Second Ambush(3 Gorillas)
case 21:
- DoScriptText(SAY_OOX_AMBUSH, me);
+ Talk(SAY_OOX_AMBUSH);
me->SummonCreature(NPC_GORILLA, -4595.81f, 2005.99f, 53.08f, 3.74f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_GORILLA, -4597.53f, 2008.31f, 52.70f, 3.78f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_GORILLA, -4599.37f, 2010.59f, 52.77f, 3.84f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
break;
//Third Ambush(4 Gnolls)
case 30:
- DoScriptText(SAY_OOX_AMBUSH, me);
+ Talk(SAY_OOX_AMBUSH);
me->SummonCreature(NPC_WOODPAW_REAVER, -4425.14f, 2075.87f, 47.77f, 3.77f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_WOODPAW_BRUTE, -4426.68f, 2077.98f, 47.57f, 3.77f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_WOODPAW_MYSTIC, -4428.33f, 2080.24f, 47.43f, 3.87f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
me->SummonCreature(NPC_WOODPAW_ALPHA, -4430.04f, 2075.54f, 46.83f, 3.81f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
break;
case 37:
- DoScriptText(SAY_OOX_END, me);
+ Talk(SAY_OOX_END);
// Award quest credit
if (Player* player = GetPlayerForEscort())
player->GroupEventHappens(QUEST_RESCUE_OOX22FE, me);
@@ -171,7 +172,7 @@ public:
{
//For an small probability the npc says something when he get aggro
if (urand(0, 9) > 7)
- DoScriptText(RAND(SAY_OOX_AGGRO1, SAY_OOX_AGGRO2), me);
+ Talk(SAY_OOX_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -202,6 +203,39 @@ public:
};
+enum GordunniTrap
+{
+ GO_GORDUNNI_DIRT_MOUND = 144064,
+};
+
+class spell_gordunni_trap : public SpellScriptLoader
+{
+ public:
+ spell_gordunni_trap() : SpellScriptLoader("spell_gordunni_trap") { }
+
+ class spell_gordunni_trap_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gordunni_trap_SpellScript);
+
+ void HandleDummy()
+ {
+ if (Unit* caster = GetCaster())
+ if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
+ chest->SetSpellId(GetSpellInfo()->Id);
+ }
+
+ void Register()
+ {
+ OnCast += SpellCastFn(spell_gordunni_trap_SpellScript::HandleDummy);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gordunni_trap_SpellScript();
+ }
+};
+
/*######
## AddSC
######*/
@@ -211,4 +245,5 @@ void AddSC_feralas()
new npc_gregan_brewspewer();
new npc_oox22fe();
new npc_screecher_spirit();
+ new spell_gordunni_trap();
}
diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp
index 9df208d2578..9485048da8c 100644
--- a/src/server/scripts/Kalimdor/moonglade.cpp
+++ b/src/server/scripts/Kalimdor/moonglade.cpp
@@ -35,6 +35,8 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## npc_bunthen_plainswind
@@ -273,14 +275,8 @@ enum ClintarSpirit
{
ASPECT_RAVEN = 22915,
- //from -1000292 to -1000287 are signed for 7806. but all this texts ids wrong.
- CLINTAR_SPIRIT_SAY_START = -1000286,
- CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1 = -1000287,
- CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2 = -1000288,
- CLINTAR_SPIRIT_SAY_GET_ONE = -1000289,
- CLINTAR_SPIRIT_SAY_GET_TWO = -1000290,
- CLINTAR_SPIRIT_SAY_GET_THREE = -1000291,
- CLINTAR_SPIRIT_SAY_GET_FINAL = -1000292
+ // Texts for EnterCombat, the event and the end of the event are missing
+ CLINTAR_SPIRIT_SAY_START = 0,
};
class npc_clintar_spirit : public CreatureScript
@@ -296,7 +292,10 @@ public:
struct npc_clintar_spiritAI : public npc_escortAI
{
public:
- npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature) {}
+ npc_clintar_spiritAI(Creature* creature) : npc_escortAI(creature)
+ {
+ PlayerGUID = 0;
+ }
uint8 Step;
uint32 CurrWP;
@@ -345,15 +344,6 @@ public:
npc_escortAI::EnterEvadeMode();
}
- void EnterCombat(Unit* who)
- {
- switch (urand(0, 1))
- {
- case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break;
- case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break;
- }
- }
-
void StartEvent(Player* player)
{
if (player && player->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE)
@@ -405,7 +395,7 @@ public:
switch (Step)
{
case 0:
- me->Say(CLINTAR_SPIRIT_SAY_START, 0, PlayerGUID);
+ Talk(CLINTAR_SPIRIT_SAY_START, PlayerGUID);
EventTimer = 8000;
Step = 1;
break;
@@ -424,7 +414,7 @@ public:
break;
case 1:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
- DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, player);
+ // Needs text
EventOnWait = false;
break;
}
@@ -447,7 +437,7 @@ public:
switch (Step)
{
case 0:
- DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, player);
+ // Needs text
EventTimer = 15000;
Step = 1;
break;
@@ -491,7 +481,7 @@ public:
switch (Step)
{
case 0:
- DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, player);
+ // Needs text
EventTimer = 4000;
Step = 1;
break;
@@ -505,7 +495,7 @@ public:
{
case 0:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2);
- DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, player);
+ // Needs text
player->CompleteQuest(10965);
EventTimer = 1500;
Step = 1;
diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp
index 5b35688c2b8..a86f891c6c0 100644
--- a/src/server/scripts/Kalimdor/mulgore.cpp
+++ b/src/server/scripts/Kalimdor/mulgore.cpp
@@ -32,6 +32,8 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
# npc_skorn_whitecloud
@@ -74,10 +76,9 @@ public:
enum KyleFrenzied
{
- //emote signed for 7780 but propably thats wrong id.
- EMOTE_SEE_LUNCH = -1000340,
- EMOTE_EAT_LUNCH = -1000341,
- EMOTE_DANCE = -1000342,
+ EMOTE_SEE_LUNCH = 0,
+ EMOTE_EAT_LUNCH = 1,
+ EMOTE_DANCE = 2,
SPELL_LUNCH = 42222,
NPC_KYLE_FRENZIED = 23616,
@@ -132,7 +133,7 @@ public:
}
EventActive = true;
- DoScriptText(EMOTE_SEE_LUNCH, me);
+ Talk(EMOTE_SEE_LUNCH);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL);
}
}
@@ -171,7 +172,7 @@ public:
}
break;
case 2:
- DoScriptText(EMOTE_EAT_LUNCH, me);
+ Talk(EMOTE_EAT_LUNCH);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
break;
case 3:
@@ -182,7 +183,7 @@ public:
break;
case 4:
EventTimer = 30000;
- DoScriptText(EMOTE_DANCE, me);
+ Talk(EMOTE_DANCE);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL);
break;
case 5:
diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp
index fca8d0f5fc5..5080daefbf9 100644
--- a/src/server/scripts/Kalimdor/orgrimmar.cpp
+++ b/src/server/scripts/Kalimdor/orgrimmar.cpp
@@ -31,6 +31,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
/*######
## npc_shenthul
diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp
index 639de3dc3b2..f9b16b907eb 100644
--- a/src/server/scripts/Kalimdor/silithus.cpp
+++ b/src/server/scripts/Kalimdor/silithus.cpp
@@ -33,6 +33,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "Group.h"
+#include "Player.h"
/*###
## npc_highlord_demitrian
@@ -229,56 +230,56 @@ public:
####*/
enum EternalBoard
{
- QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519,
-
- FACTION_HOSTILE = 14,
- FACTION_FRIENDLY = 35,
-
- C_ANACHRONOS = 15381,
- C_FANDRAL_STAGHELM = 15382,
- C_ARYGOS = 15380,
- C_MERITHRA = 15378,
- C_CAELESTRASZ = 15379,
-
- ANACHRONOS_SAY_1 = -1350000,
- ANACHRONOS_SAY_2 = -1350001,
- ANACHRONOS_SAY_3 = -1350002,
- ANACHRONOS_SAY_4 = -1350003,
- ANACHRONOS_SAY_5 = -1350004,
- ANACHRONOS_SAY_6 = -1350005,
- ANACHRONOS_SAY_7 = -1350006,
- ANACHRONOS_SAY_8 = -1350007,
- ANACHRONOS_SAY_9 = -1350008,
- ANACHRONOS_SAY_10 = -1350009,
- ANACHRONOS_EMOTE_1 = -1350010,
- ANACHRONOS_EMOTE_2 = -1350011,
- ANACHRONOS_EMOTE_3 = -1350012,
-
- FANDRAL_SAY_1 = -1350013,
- FANDRAL_SAY_2 = -1350014,
- FANDRAL_SAY_3 = -1350015,
- FANDRAL_SAY_4 = -1350016,
- FANDRAL_SAY_5 = -1350017,
- FANDRAL_SAY_6 = -1350018,
- FANDRAL_EMOTE_1 = -1350019,
- FANDRAL_EMOTE_2 = -1350020,
-
- CAELESTRASZ_SAY_1 = -1350021,
- CAELESTRASZ_SAY_2 = -1350022,
- CAELESTRASZ_YELL_1 = -1350023,
-
- ARYGOS_SAY_1 = -1350024,
- ARYGOS_YELL_1 = -1350025,
- ARYGOS_EMOTE_1 = -1350026,
-
- MERITHRA_SAY_1 = -1350027,
- MERITHRA_SAY_2 = -1350028,
- MERITHRA_YELL_1 = -1350029,
- MERITHRA_EMOTE_1 = -1350030,
-
- GO_GATE_OF_AHN_QIRAJ = 176146,
- GO_GLYPH_OF_AHN_QIRAJ = 176148,
- GO_ROOTS_OF_AHN_QIRAJ = 176147
+ QUEST_A_PAWN_ON_THE_ETERNAL_BOARD = 8519,
+
+ FACTION_HOSTILE = 14,
+ FACTION_FRIENDLY = 35,
+
+ C_ANACHRONOS = 15381,
+ C_FANDRAL_STAGHELM = 15382,
+ C_ARYGOS = 15380,
+ C_MERITHRA = 15378,
+ C_CAELESTRASZ = 15379,
+
+ ANACHRONOS_SAY_1 = 0,
+ ANACHRONOS_SAY_2 = 1,
+ ANACHRONOS_SAY_3 = 2,
+ ANACHRONOS_SAY_4 = 3,
+ ANACHRONOS_SAY_5 = 4,
+ ANACHRONOS_SAY_6 = 5,
+ ANACHRONOS_SAY_7 = 6,
+ ANACHRONOS_SAY_8 = 7,
+ ANACHRONOS_SAY_9 = 8,
+ ANACHRONOS_SAY_10 = 9,
+ ANACHRONOS_EMOTE_1 = 10,
+ ANACHRONOS_EMOTE_2 = 11,
+ ANACHRONOS_EMOTE_3 = 12,
+
+ FANDRAL_SAY_1 = 0,
+ FANDRAL_SAY_2 = 1,
+ FANDRAL_SAY_3 = 2,
+ FANDRAL_SAY_4 = 3,
+ FANDRAL_SAY_5 = 4,
+ FANDRAL_SAY_6 = 5,
+ FANDRAL_EMOTE_1 = 6,
+ FANDRAL_EMOTE_2 = 7,
+
+ CAELESTRASZ_SAY_1 = 0,
+ CAELESTRASZ_SAY_2 = 1,
+ CAELESTRASZ_YELL_1 = 2,
+
+ ARYGOS_SAY_1 = 0,
+ ARYGOS_YELL_1 = 1,
+ ARYGOS_EMOTE_1 = 2,
+
+ MERITHRA_SAY_1 = 0,
+ MERITHRA_SAY_2 = 1,
+ MERITHRA_YELL_1 = 2,
+ MERITHRA_EMOTE_1 = 3,
+
+ GO_GATE_OF_AHN_QIRAJ = 176146,
+ GO_GLYPH_OF_AHN_QIRAJ = 176148,
+ GO_ROOTS_OF_AHN_QIRAJ = 176147
};
/*#####
# Quest: A Pawn on the Eternal Board
@@ -529,50 +530,49 @@ public:
if (!player)
return;
- Unit* Fandral = player->FindNearestCreature(C_FANDRAL_STAGHELM, 100.0f, me);
- Unit* Arygos = player->FindNearestCreature(C_ARYGOS, 100.0f, me);
- Unit* Caelestrasz = player->FindNearestCreature(C_CAELESTRASZ, 100.0f, me);
- Unit* Merithra = player->FindNearestCreature(C_MERITHRA, 100.0f, me);
+ Creature* Fandral = player->FindNearestCreature(C_FANDRAL_STAGHELM, 100.0f, me);
+ Creature* Arygos = player->FindNearestCreature(C_ARYGOS, 100.0f, me);
+ Creature* Caelestrasz = player->FindNearestCreature(C_CAELESTRASZ, 100.0f, me);
+ Creature* Merithra = player->FindNearestCreature(C_MERITHRA, 100.0f, me);
if (!Fandral || !Arygos || !Caelestrasz || !Merithra)
return;
- Unit* mob = NULL;
AnimationTimer = EventAnim[AnimationCount].Timer;
if (eventEnd == false)
{
switch (AnimationCount)
{
case 0:
- DoScriptText(ANACHRONOS_SAY_1, me, Fandral);
+ Talk(ANACHRONOS_SAY_1,Fandral->GetGUID());
break;
case 1:
Fandral->SetTarget(me->GetGUID());
- DoScriptText(FANDRAL_SAY_1, Fandral, me);
+ Fandral->AI()->Talk(FANDRAL_SAY_1, me->GetGUID());
break;
case 2:
Fandral->SetTarget(0);
- DoScriptText(MERITHRA_EMOTE_1, Merithra);
+ Merithra->AI()->Talk(MERITHRA_EMOTE_1);
break;
case 3:
- DoScriptText(MERITHRA_SAY_1, Merithra);
+ Merithra->AI()->Talk(MERITHRA_SAY_1);
break;
case 4:
- DoScriptText(ARYGOS_EMOTE_1, Arygos);
+ Arygos->AI()->Talk(ARYGOS_EMOTE_1);
break;
case 5:
Caelestrasz->SetTarget(Fandral->GetGUID());
- DoScriptText(CAELESTRASZ_SAY_1, Caelestrasz);
+ Caelestrasz->AI()->Talk(CAELESTRASZ_SAY_1);
break;
case 6:
- DoScriptText(MERITHRA_SAY_2, Merithra);
+ Merithra->AI()->Talk(MERITHRA_SAY_2);
break;
case 7:
Caelestrasz->SetTarget(0);
Merithra->GetMotionMaster()->MoveCharge(-8065, 1530, 2.61f, 10);
break;
case 8:
- DoScriptText(MERITHRA_YELL_1, Merithra);
+ Merithra->AI()->Talk(MERITHRA_YELL_1);
break;
case 9:
Merithra->CastSpell(Merithra, 25105, true);
@@ -591,7 +591,7 @@ public:
case 13:
break;
case 14:
- DoScriptText(ARYGOS_SAY_1, Arygos);
+ Arygos->AI()->Talk(ARYGOS_SAY_1);
Merithra->SetVisible(false);
break;
case 15:
@@ -599,7 +599,7 @@ public:
Merithra->GetMotionMaster()->MoveCharge(-8034.535f, 1535.14f, 2.61f, 42);
break;
case 16:
- DoScriptText(ARYGOS_YELL_1, Arygos);
+ Arygos->AI()->Talk(ARYGOS_YELL_1);
break;
case 17:
Arygos->CastSpell(Arygos, 25107, true);
@@ -618,7 +618,7 @@ public:
case 21:
break;
case 22:
- DoScriptText(CAELESTRASZ_SAY_2, Caelestrasz, Fandral);
+ Caelestrasz->AI()->Talk(CAELESTRASZ_SAY_2, Fandral->GetGUID());
break;
case 23:
Caelestrasz->GetMotionMaster()->MoveCharge(-8065, 1530, 2.61f, 10);
@@ -626,7 +626,7 @@ public:
Arygos->GetMotionMaster()->MoveCharge(-8034.535f, 1535.14f, 2.61f, 10);
break;
case 24:
- DoScriptText(CAELESTRASZ_YELL_1, Caelestrasz);
+ Caelestrasz->AI()->Talk(CAELESTRASZ_YELL_1);
break;
case 25:
Caelestrasz->CastSpell(Caelestrasz, 25106, true);
@@ -640,16 +640,16 @@ public:
Caelestrasz->CastSpell(Caelestrasz, 54293, false);
break;
case 28:
- DoScriptText(ANACHRONOS_SAY_2, me, Fandral);
+ Talk(ANACHRONOS_SAY_2, Fandral->GetGUID());
break;
case 29:
Caelestrasz->GetMotionMaster()->MoveCharge(-8095, 1530, 50, 42);
- DoScriptText(FANDRAL_SAY_2, Fandral, me);
+ Fandral->AI()->Talk(FANDRAL_SAY_2);
break;
case 30:
break;
case 31:
- DoScriptText(ANACHRONOS_SAY_3, me, Fandral);
+ Talk(ANACHRONOS_SAY_3, Fandral->GetGUID());
break;
case 32:
Caelestrasz->SetVisible(false);
@@ -658,7 +658,7 @@ public:
me->GetMotionMaster()->MoveCharge(-8113, 1525, 2.77f, 8);
break;//both run to the gate
case 33:
- DoScriptText(ANACHRONOS_SAY_4, me);
+ Talk(ANACHRONOS_SAY_4);
Caelestrasz->GetMotionMaster()->MoveCharge(-8050, 1473, 65, 15);
break; //Text: sands will stop
case 34:
@@ -678,48 +678,49 @@ public:
me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ, -8130, 1525, 17.5f, 0, 0, 0, 0, 0, 0);
break;
case 39:
- DoScriptText(ANACHRONOS_SAY_5, me, Fandral);
+ Talk(ANACHRONOS_SAY_5, Fandral->GetGUID());
break;
case 40:
Fandral->CastSpell(me, 25167, true);
break;
case 41:
Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ, -8130, 1525, 17.5f, 0, 0, 0, 0, 0, 0);
- DoScriptText(FANDRAL_SAY_3, Fandral);
+ Fandral->AI()->Talk(FANDRAL_SAY_3);
break;
case 42:
me->CastStop();
- DoScriptText(FANDRAL_EMOTE_1, Fandral);
+ Fandral->AI()->Talk(FANDRAL_EMOTE_1);
break;
case 43:
Fandral->CastStop();
break;
case 44:
- DoScriptText(ANACHRONOS_SAY_6, me);
+ Talk(ANACHRONOS_SAY_6);
break;
case 45:
- DoScriptText(ANACHRONOS_SAY_7, me);
+ Talk(ANACHRONOS_SAY_7);
break;
case 46:
- DoScriptText(ANACHRONOS_SAY_8, me);
+ Talk(ANACHRONOS_SAY_8);
me->GetMotionMaster()->MoveCharge(-8110, 1527, 2.77f, 4);
break;
case 47:
- DoScriptText(ANACHRONOS_EMOTE_1, me);
+ Talk(ANACHRONOS_EMOTE_1);
break;
case 48:
- DoScriptText(FANDRAL_SAY_4, Fandral, me);
+ Fandral->AI()->Talk(FANDRAL_SAY_4, me->GetGUID());
break;
case 49:
- DoScriptText(FANDRAL_SAY_5, Fandral, me);
+ Fandral->AI()->Talk(FANDRAL_SAY_5, me->GetGUID());
break;
case 50:
- DoScriptText(FANDRAL_EMOTE_2, Fandral);
+ Fandral->AI()->Talk(FANDRAL_EMOTE_2);
Fandral->CastSpell(-8127, 1525, 17.5f, 33806, true);
break;
case 51:
{
uint32 entries[4] = { 15423, 15424, 15414, 15422 };
+ Unit* mob = NULL;
for (uint8 i = 0; i < 4; ++i)
{
mob = player->FindNearestCreature(entries[i], 50, me);
@@ -733,19 +734,19 @@ public:
}
case 52:
Fandral->GetMotionMaster()->MoveCharge(-8028.75f, 1538.795f, 2.61f, 4);
- DoScriptText(ANACHRONOS_SAY_9, me, Fandral);
+ Fandral->AI()->Talk(ANACHRONOS_SAY_9, me->GetGUID());
break;
case 53:
- DoScriptText(FANDRAL_SAY_6, Fandral);
+ Fandral->AI()->Talk(FANDRAL_SAY_6);
break;
case 54:
- DoScriptText(ANACHRONOS_EMOTE_2, me);
+ Talk(ANACHRONOS_EMOTE_2);
break;
case 55:
Fandral->SetVisible(false);
break;
case 56:
- DoScriptText(ANACHRONOS_EMOTE_3, me);
+ Talk(ANACHRONOS_EMOTE_3);
me->GetMotionMaster()->MoveCharge(-8116, 1522, 3.65f, 4);
break;
case 57:
@@ -759,7 +760,7 @@ public:
break;
case 60:
if (player)
- DoScriptText(ANACHRONOS_SAY_10, me, player);
+ Talk(ANACHRONOS_SAY_10, player->GetGUID());
me->GetMotionMaster()->MoveCharge(-8113.46f, 1524.16f, 2.89f, 4);
break;
case 61:
@@ -781,7 +782,7 @@ public:
me->SetVisible(false);
if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID)))
{
- DoScriptText(ARYGOS_YELL_1, me);
+ Talk(ARYGOS_YELL_1);
AnachronosQuestTrigger->AI()->EnterEvadeMode();
eventEnd=true;
}
@@ -844,9 +845,6 @@ public:
void UpdateAI(const uint32 diff)
{
- Unit* target = NULL;
- //Player* player = me->GetPlayer(PlayerGUID);
-
if (!Timers)
{
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers
@@ -890,6 +888,7 @@ public:
}
if (!hasTarget)
{
+ Unit* target = NULL;
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414)
target = me->FindNearestCreature(15423, 20, true);
if (me->GetEntry() == 15423)
@@ -1055,7 +1054,7 @@ public:
{
if (!Announced && AnnounceTimer <= diff)
{
- DoScriptText(WavesInfo[WaveCount].WaveTextId, me);
+ Talk(WavesInfo[WaveCount].WaveTextId);
Announced = true;
} else AnnounceTimer -= diff;
@@ -1291,37 +1290,37 @@ class go_wind_stone : public GameObjectScript
{
case TEMPLAR:
{
- if (player->HasItemCount(ITEM_TEMPLAR_FIRE, 1))
+ if (player->HasItemCount(ITEM_TEMPLAR_FIRE))
result |= FIRE;
- if (player->HasItemCount(ITEM_TEMPLAR_WATER, 1))
+ if (player->HasItemCount(ITEM_TEMPLAR_WATER))
result |= WATER;
- if (player->HasItemCount(ITEM_TEMPLAR_EARTH, 1))
+ if (player->HasItemCount(ITEM_TEMPLAR_EARTH))
result |= EARTH;
- if (player->HasItemCount(ITEM_TEMPLAR_AIR, 1))
+ if (player->HasItemCount(ITEM_TEMPLAR_AIR))
result |= AIR;
break;
}
case DUKE:
{
- if (player->HasItemCount(ITEM_DUKE_FIRE, 1))
+ if (player->HasItemCount(ITEM_DUKE_FIRE))
result |= FIRE;
- if (player->HasItemCount(ITEM_DUKE_WATER, 1))
+ if (player->HasItemCount(ITEM_DUKE_WATER))
result |= WATER;
- if (player->HasItemCount(ITEM_DUKE_EARTH, 1))
+ if (player->HasItemCount(ITEM_DUKE_EARTH))
result |= EARTH;
- if (player->HasItemCount(ITEM_DUKE_AIR, 1))
+ if (player->HasItemCount(ITEM_DUKE_AIR))
result |= AIR;
break;
}
case ROYAL:
{
- if (player->HasItemCount(ITEM_ROYAL_FIRE, 1))
+ if (player->HasItemCount(ITEM_ROYAL_FIRE))
result |= FIRE;
- if (player->HasItemCount(ITEM_ROYAL_WATER, 1))
+ if (player->HasItemCount(ITEM_ROYAL_WATER))
result |= WATER;
- if (player->HasItemCount(ITEM_ROYAL_EARTH, 1))
+ if (player->HasItemCount(ITEM_ROYAL_EARTH))
result |= EARTH;
- if (player->HasItemCount(ITEM_ROYAL_AIR, 1))
+ if (player->HasItemCount(ITEM_ROYAL_AIR))
result |= AIR;
break;
}
diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
index d38395c7b37..033274f8561 100644
--- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
+++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp
@@ -32,6 +32,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_braug_dimspirit
@@ -100,9 +101,9 @@ enum Kaya
NPC_GRIMTOTEM_BRUTE = 11912,
NPC_GRIMTOTEM_SORCERER = 11913,
- SAY_START = -1000357,
- SAY_AMBUSH = -1000358,
- SAY_END = -1000359,
+ SAY_START = 0,
+ SAY_AMBUSH = 1,
+ SAY_END = 2,
QUEST_PROTECT_KAYA = 6523
};
@@ -125,14 +126,14 @@ public:
switch (waypointId)
{
case 16:
- DoScriptText(SAY_AMBUSH, me);
+ Talk(SAY_AMBUSH);
me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53f, -503.34f, -46.31f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85f, -503.77f, -45.90f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37f, -496.23f, -45.71f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 18:
me->SetInFront(player);
- DoScriptText(SAY_END, me, player);
+ Talk(SAY_END);
player->GroupEventHappens(QUEST_PROTECT_KAYA, me);
break;
}
@@ -153,7 +154,7 @@ public:
if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoof::npc_kaya_flathoofAI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());
- DoScriptText(SAY_START, creature);
+ creature->AI()->Talk(SAY_START);
creature->setFaction(113);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
}
diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp
index 9b742b495bb..b7644395571 100644
--- a/src/server/scripts/Kalimdor/tanaris.cpp
+++ b/src/server/scripts/Kalimdor/tanaris.cpp
@@ -38,6 +38,8 @@ EndContentData */
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## mob_aquementas
@@ -45,7 +47,7 @@ EndContentData */
enum Aquementas
{
- AGGRO_YELL_AQUE = -1000350,
+ AGGRO_YELL_AQUE = 0,
SPELL_AQUA_JET = 13586,
SPELL_FROST_SHOCK = 15089
@@ -99,7 +101,7 @@ public:
void EnterCombat(Unit* who)
{
- DoScriptText(AGGRO_YELL_AQUE, me, who);
+ Talk(AGGRO_YELL_AQUE, who->GetGUID());
}
void UpdateAI(const uint32 diff)
@@ -150,20 +152,20 @@ public:
enum CustodianOfTime
{
- WHISPER_CUSTODIAN_1 = -1000217,
- WHISPER_CUSTODIAN_2 = -1000218,
- WHISPER_CUSTODIAN_3 = -1000219,
- WHISPER_CUSTODIAN_4 = -1000220,
- WHISPER_CUSTODIAN_5 = -1000221,
- WHISPER_CUSTODIAN_6 = -1000222,
- WHISPER_CUSTODIAN_7 = -1000223,
- WHISPER_CUSTODIAN_8 = -1000224,
- WHISPER_CUSTODIAN_9 = -1000225,
- WHISPER_CUSTODIAN_10 = -1000226,
- WHISPER_CUSTODIAN_11 = -1000227,
- WHISPER_CUSTODIAN_12 = -1000228,
- WHISPER_CUSTODIAN_13 = -1000229,
- WHISPER_CUSTODIAN_14 = -1000230
+ WHISPER_CUSTODIAN_1 = 0,
+ WHISPER_CUSTODIAN_2 = 1,
+ WHISPER_CUSTODIAN_3 = 2,
+ WHISPER_CUSTODIAN_4 = 3,
+ WHISPER_CUSTODIAN_5 = 4,
+ WHISPER_CUSTODIAN_6 = 5,
+ WHISPER_CUSTODIAN_7 = 6,
+ WHISPER_CUSTODIAN_8 = 7,
+ WHISPER_CUSTODIAN_9 = 8,
+ WHISPER_CUSTODIAN_10 = 9,
+ WHISPER_CUSTODIAN_11 = 10,
+ WHISPER_CUSTODIAN_12 = 11,
+ WHISPER_CUSTODIAN_13 = 12,
+ WHISPER_CUSTODIAN_14 = 13
};
class npc_custodian_of_time : public CreatureScript
@@ -187,58 +189,58 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(WHISPER_CUSTODIAN_1, me, player);
+ Talk(WHISPER_CUSTODIAN_1, player->GetGUID());
break;
case 1:
- DoScriptText(WHISPER_CUSTODIAN_2, me, player);
+ Talk(WHISPER_CUSTODIAN_2, player->GetGUID());
break;
case 2:
- DoScriptText(WHISPER_CUSTODIAN_3, me, player);
+ Talk(WHISPER_CUSTODIAN_3, player->GetGUID());
break;
case 3:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ Talk(WHISPER_CUSTODIAN_4, player->GetGUID());
break;
case 5:
- DoScriptText(WHISPER_CUSTODIAN_5, me, player);
+ Talk(WHISPER_CUSTODIAN_5, player->GetGUID());
break;
case 6:
- DoScriptText(WHISPER_CUSTODIAN_6, me, player);
+ Talk(WHISPER_CUSTODIAN_6, player->GetGUID());
break;
case 7:
- DoScriptText(WHISPER_CUSTODIAN_7, me, player);
+ Talk(WHISPER_CUSTODIAN_7, player->GetGUID());
break;
case 8:
- DoScriptText(WHISPER_CUSTODIAN_8, me, player);
+ Talk(WHISPER_CUSTODIAN_8, player->GetGUID());
break;
case 9:
- DoScriptText(WHISPER_CUSTODIAN_9, me, player);
+ Talk(WHISPER_CUSTODIAN_9, player->GetGUID());
break;
case 10:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ Talk(WHISPER_CUSTODIAN_4, player->GetGUID());
break;
case 13:
- DoScriptText(WHISPER_CUSTODIAN_10, me, player);
+ Talk(WHISPER_CUSTODIAN_10, player->GetGUID());
break;
case 14:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ Talk(WHISPER_CUSTODIAN_4, player->GetGUID());
break;
case 16:
- DoScriptText(WHISPER_CUSTODIAN_11, me, player);
+ Talk(WHISPER_CUSTODIAN_11, player->GetGUID());
break;
case 17:
- DoScriptText(WHISPER_CUSTODIAN_12, me, player);
+ Talk(WHISPER_CUSTODIAN_12, player->GetGUID());
break;
case 18:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ Talk(WHISPER_CUSTODIAN_4, player->GetGUID());
break;
case 22:
- DoScriptText(WHISPER_CUSTODIAN_13, me, player);
+ Talk(WHISPER_CUSTODIAN_13, player->GetGUID());
break;
case 23:
- DoScriptText(WHISPER_CUSTODIAN_4, me, player);
+ Talk(WHISPER_CUSTODIAN_4, player->GetGUID());
break;
case 24:
- DoScriptText(WHISPER_CUSTODIAN_14, me, player);
+ Talk(WHISPER_CUSTODIAN_14, player->GetGUID());
DoCast(player, 34883);
// below here is temporary workaround, to be removed when spell works properly
player->AreaExploredOrEventHappens(10277);
@@ -425,13 +427,11 @@ public:
enum Npc00X17
{
- //texts are signed for 7806
- SAY_OOX_START = -1000287,
- SAY_OOX_AGGRO1 = -1000288,
- SAY_OOX_AGGRO2 = -1000289,
- SAY_OOX_AMBUSH = -1000290,
- SAY_OOX17_AMBUSH_REPLY = -1000291,
- SAY_OOX_END = -1000292,
+ SAY_OOX_START = 0,
+ SAY_OOX_AGGRO = 1,
+ SAY_OOX_AMBUSH = 2,
+ SAY_OOX17_AMBUSH_REPLY = 0,
+ SAY_OOX_END = 3,
Q_OOX17 = 648,
SPAWN_FIRST = 7803,
@@ -452,7 +452,7 @@ public:
creature->SetFullHealth();
creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
- DoScriptText(SAY_OOX_START, creature);
+ creature->AI()->Talk(SAY_OOX_START);
if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17::npc_OOX17AI, creature->AI()))
pEscortAI->Start(true, false, player->GetGUID());
@@ -479,18 +479,18 @@ public:
me->SummonCreature(SPAWN_FIRST, -8350.96f, -4445.79f, 10.10f, 6.20f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_FIRST, -8355.96f, -4447.79f, 10.10f, 6.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_FIRST, -8353.96f, -4442.79f, 10.10f, 6.08f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_OOX_AMBUSH, me);
+ Talk(SAY_OOX_AMBUSH);
break;
case 56:
me->SummonCreature(SPAWN_SECOND_1, -7510.07f, -4795.50f, 9.35f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_SECOND_2, -7515.07f, -4797.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(SPAWN_SECOND_2, -7518.07f, -4792.50f, 9.35f, 6.22f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_OOX_AMBUSH, me);
- if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30))
- DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff);
+ Talk(SAY_OOX_AMBUSH);
+ if (Creature* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30))
+ scoff->AI()->Talk(SAY_OOX17_AMBUSH_REPLY);
break;
case 86:
- DoScriptText(SAY_OOX_END, me);
+ Talk(SAY_OOX_END);
player->GroupEventHappens(Q_OOX17, me);
break;
}
@@ -501,7 +501,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_OOX_AGGRO1, SAY_OOX_AGGRO2), me);
+ Talk(SAY_OOX_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -517,14 +517,13 @@ public:
enum Tooga
{
- SAY_TOOG_THIRST = -1000391,
- SAY_TOOG_WORRIED = -1000392,
- SAY_TOOG_POST_1 = -1000393,
- SAY_TORT_POST_2 = -1000394,
- SAY_TOOG_POST_3 = -1000395,
- SAY_TORT_POST_4 = -1000396,
- SAY_TOOG_POST_5 = -1000397,
- SAY_TORT_POST_6 = -1000398,
+ SAY_TOOG_WORRIED = 0,
+ SAY_TOOG_POST_1 = 1,
+ SAY_TORT_POST_2 = 0,
+ SAY_TOOG_POST_3 = 2,
+ SAY_TORT_POST_4 = 1,
+ SAY_TOOG_POST_5 = 3,
+ SAY_TORT_POST_6 = 2,
QUEST_TOOGA = 1560,
NPC_TORTA = 6015,
@@ -615,8 +614,8 @@ public:
{
PostEventTimer = 5000;
- Unit* pTorta = Unit::GetUnit(*me, TortaGUID);
- if (!pTorta || !pTorta->isAlive())
+ Creature* torta = Creature::GetCreature(*me, TortaGUID);
+ if (!torta || !torta->isAlive())
{
//something happened, so just complete
SetFollowComplete();
@@ -626,22 +625,22 @@ public:
switch (PhasePostEvent)
{
case 1:
- DoScriptText(SAY_TOOG_POST_1, me);
+ Talk(SAY_TOOG_POST_1);
break;
case 2:
- DoScriptText(SAY_TORT_POST_2, pTorta);
+ torta->AI()->Talk(SAY_TORT_POST_2);
break;
case 3:
- DoScriptText(SAY_TOOG_POST_3, me);
+ Talk(SAY_TOOG_POST_3);
break;
case 4:
- DoScriptText(SAY_TORT_POST_4, pTorta);
+ torta->AI()->Talk(SAY_TORT_POST_4);
break;
case 5:
- DoScriptText(SAY_TOOG_POST_5, me);
+ Talk(SAY_TOOG_POST_5);
break;
case 6:
- DoScriptText(SAY_TORT_POST_6, pTorta);
+ torta->AI()->Talk(SAY_TORT_POST_6);
me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, ToWaterLoc);
break;
}
@@ -659,7 +658,7 @@ public:
CheckSpeechTimer = 5000;
if (urand(0, 9) > 8)
- DoScriptText(RAND(SAY_TOOG_THIRST, SAY_TOOG_WORRIED), me);
+ Talk(SAY_TOOG_WORRIED);
}
else
CheckSpeechTimer -= Diff;
diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp
index 7f2b2fc7f05..dfd42d132d8 100644
--- a/src/server/scripts/Kalimdor/teldrassil.cpp
+++ b/src/server/scripts/Kalimdor/teldrassil.cpp
@@ -30,6 +30,7 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedFollowerAI.h"
+#include "Player.h"
/*####
# npc_mist
@@ -37,8 +38,8 @@ EndContentData */
enum Mist
{
- SAY_AT_HOME = -1000323,
- EMOTE_AT_HOME = -1000324,
+ SAY_AT_HOME = 0,
+ EMOTE_AT_HOME = 1,
QUEST_MIST = 938,
NPC_ARYNIA = 3519,
FACTION_DARNASSUS = 79
@@ -77,7 +78,7 @@ public:
{
if (me->IsWithinDistInMap(who, 10.0f))
{
- DoScriptText(SAY_AT_HOME, who);
+ Talk(SAY_AT_HOME, who->GetGUID());
DoComplete();
}
}
@@ -85,7 +86,7 @@ public:
void DoComplete()
{
- DoScriptText(EMOTE_AT_HOME, me);
+ Talk(EMOTE_AT_HOME);
Player* player = GetLeaderForFollower();
if (player && player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp
index f4983558b67..9417e7993f7 100644
--- a/src/server/scripts/Kalimdor/the_barrens.cpp
+++ b/src/server/scripts/Kalimdor/the_barrens.cpp
@@ -36,6 +36,8 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## npc_beaten_corpse
@@ -81,17 +83,14 @@ public:
enum Gilthares
{
- SAY_GIL_START = -1000370,
- SAY_GIL_AT_LAST = -1000371,
- SAY_GIL_PROCEED = -1000372,
- SAY_GIL_FREEBOOTERS = -1000373,
- SAY_GIL_AGGRO_1 = -1000374,
- SAY_GIL_AGGRO_2 = -1000375,
- SAY_GIL_AGGRO_3 = -1000376,
- SAY_GIL_AGGRO_4 = -1000377,
- SAY_GIL_ALMOST = -1000378,
- SAY_GIL_SWEET = -1000379,
- SAY_GIL_FREED = -1000380,
+ SAY_GIL_START = 0,
+ SAY_GIL_AT_LAST = 1,
+ SAY_GIL_PROCEED = 2,
+ SAY_GIL_FREEBOOTERS = 3,
+ SAY_GIL_AGGRO = 4,
+ SAY_GIL_ALMOST = 5,
+ SAY_GIL_SWEET = 6,
+ SAY_GIL_FREED = 7,
QUEST_FREE_FROM_HOLD = 898,
AREA_MERCHANT_COAST = 391,
@@ -110,7 +109,7 @@ public:
creature->setFaction(FACTION_ESCORTEE);
creature->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_GIL_START, creature, player);
+ creature->AI()->Talk(SAY_GIL_START, player->GetGUID());
if (npc_giltharesAI* pEscortAI = CAST_AI(npc_gilthares::npc_giltharesAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID(), quest);
@@ -138,22 +137,22 @@ public:
switch (waypointId)
{
case 16:
- DoScriptText(SAY_GIL_AT_LAST, me, player);
+ Talk(SAY_GIL_AT_LAST, player->GetGUID());
break;
case 17:
- DoScriptText(SAY_GIL_PROCEED, me, player);
+ Talk(SAY_GIL_PROCEED, player->GetGUID());
break;
case 18:
- DoScriptText(SAY_GIL_FREEBOOTERS, me, player);
+ Talk(SAY_GIL_FREEBOOTERS, player->GetGUID());
break;
case 37:
- DoScriptText(SAY_GIL_ALMOST, me, player);
+ Talk(SAY_GIL_ALMOST,player->GetGUID());
break;
case 47:
- DoScriptText(SAY_GIL_SWEET, me, player);
+ Talk(SAY_GIL_SWEET, player->GetGUID());
break;
case 53:
- DoScriptText(SAY_GIL_FREED, me, player);
+ Talk(SAY_GIL_FREED, player->GetGUID());
player->GroupEventHappens(QUEST_FREE_FROM_HOLD, me);
break;
}
@@ -169,7 +168,7 @@ public:
if (who->GetTypeId() != TYPEID_PLAYER && me->GetAreaId() == AREA_MERCHANT_COAST)
{
//appears to be pretty much random (possible only if escorter not in combat with who yet?)
- DoScriptText(RAND(SAY_GIL_AGGRO_1, SAY_GIL_AGGRO_2, SAY_GIL_AGGRO_3, SAY_GIL_AGGRO_4), me, who);
+ Talk(SAY_GIL_AGGRO, who->GetGUID());
}
}
};
@@ -322,11 +321,11 @@ enum TwiggyFlathead
NPC_BIG_WILL = 6238,
NPC_AFFRAY_CHALLENGER = 6240,
- SAY_BIG_WILL_READY = -1000123,
- SAY_TWIGGY_FLATHEAD_BEGIN = -1000124,
- SAY_TWIGGY_FLATHEAD_FRAY = -1000125,
- SAY_TWIGGY_FLATHEAD_DOWN = -1000126,
- SAY_TWIGGY_FLATHEAD_OVER = -1000127,
+ SAY_BIG_WILL_READY = 0,
+ SAY_TWIGGY_FLATHEAD_BEGIN = 0,
+ SAY_TWIGGY_FLATHEAD_FRAY = 1,
+ SAY_TWIGGY_FLATHEAD_DOWN = 2,
+ SAY_TWIGGY_FLATHEAD_OVER = 3
};
Position const AffrayChallengerLoc[6] =
@@ -410,7 +409,7 @@ public:
return;
if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) {
- DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me);
+ Talk(SAY_TWIGGY_FLATHEAD_DOWN);
pWarrior->FailQuest(1719);
for (uint8 i = 0; i < 6; ++i) // unsummon challengers
@@ -439,7 +438,7 @@ public:
if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) {
pWarrior->AreaExploredOrEventHappens(1719);
- DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me, pWarrior);
+ Talk(SAY_TWIGGY_FLATHEAD_BEGIN, pWarrior->GetGUID());
for (uint8 i = 0; i < 6; ++i)
{
@@ -468,7 +467,7 @@ public:
Creature* creature = Unit::GetCreature((*me), AffrayChallenger[i]);
if ((!creature || (!creature->isAlive())) && !ChallengerDown[i])
{
- DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me);
+ Talk(SAY_TWIGGY_FLATHEAD_DOWN);
ChallengerDown[i] = true;
}
}
@@ -480,7 +479,7 @@ public:
{
if (Wave < 6 && AffrayChallenger[Wave] && !EventBigWill)
{
- DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, me);
+ Talk(SAY_TWIGGY_FLATHEAD_FRAY);
Creature* creature = Unit::GetCreature((*me), AffrayChallenger[Wave]);
if (creature && (creature->isAlive()))
{
@@ -510,7 +509,7 @@ public:
Creature* creature = Unit::GetCreature((*me), BigWill);
if (!creature || !creature->isAlive())
{
- DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me);
+ Talk(SAY_TWIGGY_FLATHEAD_OVER);
Reset();
}
}
@@ -528,14 +527,14 @@ public:
enum Wizzlecrank
{
- SAY_START = -1000298,
- SAY_STARTUP1 = -1000299,
- SAY_STARTUP2 = -1000300,
- SAY_MERCENARY = -1000301,
- SAY_PROGRESS_1 = -1000302,
- SAY_PROGRESS_2 = -1000303,
- SAY_PROGRESS_3 = -1000304,
- SAY_END = -1000305,
+ SAY_MERCENARY = 0,
+ SAY_START = 0,
+ SAY_STARTUP1 = 1,
+ SAY_STARTUP2 = 2,
+ SAY_PROGRESS_1 = 3,
+ SAY_PROGRESS_2 = 4,
+ SAY_PROGRESS_3 = 5,
+ SAY_END = 6,
QUEST_ESCAPE = 863,
FACTION_RATCHET = 637,
@@ -579,7 +578,7 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_STARTUP1, me);
+ Talk(SAY_STARTUP1);
break;
case 9:
SetRun(false);
@@ -587,7 +586,7 @@ public:
case 17:
if (Creature* temp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000))
{
- DoScriptText(SAY_MERCENARY, temp);
+ temp->AI()->Talk(SAY_MERCENARY);
me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
}
break;
@@ -607,10 +606,10 @@ public:
switch (PointId)
{
case 9:
- DoScriptText(SAY_STARTUP2, me, player);
+ Talk(SAY_STARTUP2, player->GetGUID());
break;
case 18:
- DoScriptText(SAY_PROGRESS_1, me, player);
+ Talk(SAY_PROGRESS_1, player->GetGUID());
SetRun();
break;
}
@@ -636,13 +635,13 @@ public:
switch (PostEventCount)
{
case 0:
- DoScriptText(SAY_PROGRESS_2, me);
+ Talk(SAY_PROGRESS_2);
break;
case 1:
- DoScriptText(SAY_PROGRESS_3, me);
+ Talk(SAY_PROGRESS_3);
break;
case 2:
- DoScriptText(SAY_END, me);
+ Talk(SAY_END);
break;
case 3:
if (Player* player = GetPlayerForEscort())
diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp
index b9ae356ddf1..53751cb8278 100644
--- a/src/server/scripts/Kalimdor/thousand_needles.cpp
+++ b/src/server/scripts/Kalimdor/thousand_needles.cpp
@@ -36,6 +36,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*#####
# npc_kanati
@@ -43,7 +44,7 @@ EndContentData */
enum Kanati
{
- SAY_KAN_START = -1000410,
+ SAY_KAN_START = 0,
QUEST_PROTECT_KANATI = 4966,
NPC_GALAK_ASS = 10720
@@ -81,7 +82,7 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_KAN_START, me);
+ Talk(SAY_KAN_START);
DoSpawnGalak();
break;
case 1:
@@ -111,11 +112,11 @@ public:
enum Lakota
{
- SAY_LAKO_START = -1000365,
- SAY_LAKO_LOOK_OUT = -1000366,
- SAY_LAKO_HERE_COME = -1000367,
- SAY_LAKO_MORE = -1000368,
- SAY_LAKO_END = -1000369,
+ SAY_LAKO_START = 0,
+ SAY_LAKO_LOOK_OUT = 1,
+ SAY_LAKO_HERE_COME = 2,
+ SAY_LAKO_MORE = 3,
+ SAY_LAKO_END = 4,
QUEST_FREE_AT_LAST = 4904,
NPC_GRIM_BANDIT = 10758,
@@ -145,7 +146,7 @@ public:
{
if (quest->GetQuestId() == QUEST_FREE_AT_LAST)
{
- DoScriptText(SAY_LAKO_START, creature, player);
+ creature->AI()->Talk(SAY_LAKO_START, player->GetGUID());
creature->setFaction(FACTION_ESCORTEE_LAKO);
if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsong::npc_lakota_windsongAI, creature->AI()))
@@ -170,15 +171,15 @@ public:
switch (waypointId)
{
case 8:
- DoScriptText(SAY_LAKO_LOOK_OUT, me);
+ Talk(SAY_LAKO_LOOK_OUT);
DoSpawnBandits(ID_AMBUSH_1);
break;
case 14:
- DoScriptText(SAY_LAKO_HERE_COME, me);
+ Talk(SAY_LAKO_HERE_COME);
DoSpawnBandits(ID_AMBUSH_2);
break;
case 21:
- DoScriptText(SAY_LAKO_MORE, me);
+ Talk(SAY_LAKO_MORE);
DoSpawnBandits(ID_AMBUSH_3);
break;
case 45:
@@ -203,9 +204,9 @@ public:
enum Packa
{
- SAY_START = -1000362,
- SAY_WYVERN = -1000363,
- SAY_COMPLETE = -1000364,
+ SAY_START = 0,
+ SAY_WYVERN = 1,
+ SAY_COMPLETE = 2,
QUEST_HOMEWARD = 4770,
NPC_WYVERN = 4107,
@@ -228,7 +229,7 @@ public:
{
if (quest->GetQuestId() == QUEST_HOMEWARD)
{
- DoScriptText(SAY_START, creature, player);
+ creature->AI()->Talk(SAY_START, player->GetGUID());
creature->setFaction(FACTION_ESCORTEE);
if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountain::npc_paoka_swiftmountainAI, creature->AI()))
@@ -253,11 +254,11 @@ public:
switch (waypointId)
{
case 15:
- DoScriptText(SAY_WYVERN, me);
+ Talk(SAY_WYVERN);
DoSpawnWyvern();
break;
case 26:
- DoScriptText(SAY_COMPLETE, me);
+ Talk(SAY_COMPLETE);
break;
case 27:
if (Player* player = GetPlayerForEscort())
diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp
index b8b05b9692f..1b10a3a204b 100644
--- a/src/server/scripts/Kalimdor/thunder_bluff.cpp
+++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp
@@ -26,6 +26,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
/*#####
# npc_cairne_bloodhoof
diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp
index 786d2fc0cd3..801855e7249 100644
--- a/src/server/scripts/Kalimdor/ungoro_crater.cpp
+++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp
@@ -32,15 +32,17 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
enum AmeData
{
- SAY_READY = -1000517,
- SAY_AGGRO1 = -1000518,
- SAY_SEARCH = -1000519,
- SAY_AGGRO2 = -1000520,
- SAY_AGGRO3 = -1000521,
- SAY_FINISH = -1000522,
+ SAY_READY = 0,
+ SAY_AGGRO1 = 1,
+ SAY_SEARCH = 2,
+ SAY_AGGRO2 = 3,
+ SAY_AGGRO3 = 4,
+ SAY_FINISH = 5,
SPELL_DEMORALIZINGSHOUT = 13730,
@@ -60,7 +62,7 @@ public:
if (quest->GetQuestId() == QUEST_CHASING_AME)
{
CAST_AI(npc_escortAI, (creature->AI()))->Start(false, false, player->GetGUID());
- DoScriptText(SAY_READY, creature, player);
+ creature->AI()->Talk(SAY_READY, player->GetGUID());
creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
// Change faction so mobs attack
creature->setFaction(113);
@@ -87,21 +89,21 @@ public:
{
case 19:
me->SummonCreature(ENTRY_STOMPER, -6391.69f, -1730.49f, -272.83f, 4.96f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_AGGRO1, me, player);
+ Talk(SAY_AGGRO1, player->GetGUID());
break;
case 28:
- DoScriptText(SAY_SEARCH, me, player);
+ Talk(SAY_SEARCH, player->GetGUID());
break;
case 38:
me->SummonCreature(ENTRY_TARLORD, -6370.75f, -1382.84f, -270.51f, 6.06f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_AGGRO2, me, player);
+ Talk(SAY_AGGRO2, player->GetGUID());
break;
case 49:
me->SummonCreature(ENTRY_TARLORD1, -6324.44f, -1181.05f, -270.17f, 4.34f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
- DoScriptText(SAY_AGGRO3, me, player);
+ Talk(SAY_AGGRO3, player->GetGUID());
break;
case 55:
- DoScriptText(SAY_FINISH, me, player);
+ Talk(SAY_FINISH, player->GetGUID());
player->GroupEventHappens(QUEST_CHASING_AME, me);
break;
}
@@ -145,27 +147,20 @@ public:
enum Ringo
{
- SAY_RIN_START_1 = -1000416,
- SAY_RIN_START_2 = -1000417,
-
- SAY_FAINT_1 = -1000418,
- SAY_FAINT_2 = -1000419,
- SAY_FAINT_3 = -1000420,
- SAY_FAINT_4 = -1000421,
-
- SAY_WAKE_1 = -1000422,
- SAY_WAKE_2 = -1000423,
- SAY_WAKE_3 = -1000424,
- SAY_WAKE_4 = -1000425,
-
- SAY_RIN_END_1 = -1000426,
- SAY_SPR_END_2 = -1000427,
- SAY_RIN_END_3 = -1000428,
- EMOTE_RIN_END_4 = -1000429,
- EMOTE_RIN_END_5 = -1000430,
- SAY_RIN_END_6 = -1000431, // signed for 6784
- SAY_SPR_END_7 = -1000432,
- EMOTE_RIN_END_8 = -1000433,
+ SAY_RIN_START = 0,
+
+ SAY_FAINT = 1,
+
+ SAY_WAKE = 2,
+
+ SAY_RIN_END_1 = 3,
+ SAY_SPR_END_2 = 0,
+ SAY_RIN_END_3 = 4,
+ EMOTE_RIN_END_4 = 5,
+ EMOTE_RIN_END_5 = 6,
+ SAY_RIN_END_6 = 7,
+ SAY_SPR_END_7 = 1,
+ EMOTE_RIN_END_8 = 8,
SPELL_REVIVE_RINGO = 15591,
QUEST_A_LITTLE_HELP = 4491,
@@ -182,10 +177,10 @@ public:
{
if (quest->GetQuestId() == QUEST_A_LITTLE_HELP)
{
- if (npc_ringoAI* pRingoAI = CAST_AI(npc_ringo::npc_ringoAI, creature->AI()))
+ if (npc_ringoAI* ringoAI = CAST_AI(npc_ringo::npc_ringoAI, creature->AI()))
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
- pRingoAI->StartFollow(player, FACTION_ESCORTEE, quest);
+ ringoAI->StartFollow(player, FACTION_ESCORTEE, quest);
}
}
@@ -247,7 +242,7 @@ public:
{
SetFollowPaused(true);
- DoScriptText(RAND(SAY_FAINT_1, SAY_FAINT_2, SAY_FAINT_3, SAY_FAINT_4), me);
+ Talk(SAY_FAINT);
}
//what does actually happen here? Emote? Aura?
@@ -261,7 +256,7 @@ public:
if (HasFollowState(STATE_FOLLOW_POSTEVENT))
return;
- DoScriptText(RAND(SAY_WAKE_1, SAY_WAKE_2, SAY_WAKE_3, SAY_WAKE_4), me);
+ Talk(SAY_WAKE);
SetFollowPaused(false);
}
@@ -274,8 +269,8 @@ public:
{
if (EndEventTimer <= Diff)
{
- Unit* pSpraggle = Unit::GetUnit(*me, SpraggleGUID);
- if (!pSpraggle || !pSpraggle->isAlive())
+ Creature* spraggle = Creature::GetCreature(*me, SpraggleGUID);
+ if (!spraggle || !spraggle->isAlive())
{
SetFollowComplete();
return;
@@ -284,37 +279,37 @@ public:
switch (EndEventProgress)
{
case 1:
- DoScriptText(SAY_RIN_END_1, me);
+ Talk(SAY_RIN_END_1);
EndEventTimer = 3000;
break;
case 2:
- DoScriptText(SAY_SPR_END_2, pSpraggle);
+ spraggle->AI()->Talk(SAY_SPR_END_2);
EndEventTimer = 5000;
break;
case 3:
- DoScriptText(SAY_RIN_END_3, me);
+ Talk(SAY_RIN_END_3);
EndEventTimer = 1000;
break;
case 4:
- DoScriptText(EMOTE_RIN_END_4, me);
+ Talk(EMOTE_RIN_END_4);
SetFaint();
EndEventTimer = 9000;
break;
case 5:
- DoScriptText(EMOTE_RIN_END_5, me);
+ Talk(EMOTE_RIN_END_5);
ClearFaint();
EndEventTimer = 1000;
break;
case 6:
- DoScriptText(SAY_RIN_END_6, me);
+ Talk(SAY_RIN_END_6);
EndEventTimer = 3000;
break;
case 7:
- DoScriptText(SAY_SPR_END_7, pSpraggle);
+ spraggle->AI()->Talk(SAY_SPR_END_7);
EndEventTimer = 10000;
break;
case 8:
- DoScriptText(EMOTE_RIN_END_8, me);
+ Talk(EMOTE_RIN_END_8);
EndEventTimer = 5000;
break;
case 9:
diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp
index 2c4da0fdf7c..73b8bfe9af1 100644
--- a/src/server/scripts/Kalimdor/winterspring.cpp
+++ b/src/server/scripts/Kalimdor/winterspring.cpp
@@ -30,6 +30,8 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npc_rivern_frostwind
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index 8f34fa56525..b34a990d39d 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -15,11 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/*
- * Comment: Find correct mushrooms spell to make them visible - buffs of the mushrooms not ever applied to the users...
- */
-
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
enum Spells
@@ -33,12 +30,24 @@ enum Spells
SPELL_POISONOUS_MUSHROOM_VISUAL_AREA = 61566, // Self
SPELL_POISONOUS_MUSHROOM_VISUAL_AURA = 56741, // Self
SPELL_PUTRID_MUSHROOM = 31690, // To make the mushrooms visible
+ SPELL_POWER_MUSHROOM_VISUAL_AURA = 56740,
};
enum Creatures
{
- NPC_HEALTHY_MUSHROOM = 30391,
- NPC_POISONOUS_MUSHROOM = 30435
+ NPC_HEALTHY_MUSHROOM = 30391,
+ NPC_POISONOUS_MUSHROOM = 30435,
+ NPC_TRIGGER = 19656
+};
+
+enum event
+{
+ EVENT_SPAWN = 1,
+ EVENT_MINI,
+ EVENT_ROOT,
+ EVENT_BASH,
+ EVENT_BOLT,
+ EVENT_AURA
};
class boss_amanitar : public CreatureScript
@@ -46,110 +55,118 @@ class boss_amanitar : public CreatureScript
public:
boss_amanitar() : CreatureScript("boss_amanitar") { }
- struct boss_amanitarAI : public ScriptedAI
+ struct boss_amanitarAI : public BossAI
{
- boss_amanitarAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- bFirstTime = true;
- }
-
- InstanceScript* instance;
-
- uint32 uiRootTimer;
- uint32 uiBashTimer;
- uint32 uiBoltTimer;
- uint32 uiSpawnTimer;
-
- bool bFirstTime;
+ boss_amanitarAI(Creature* creature) : BossAI(creature, DATA_AMANITAR) { }
void Reset()
{
- uiRootTimer = urand(5*IN_MILLISECONDS, 9*IN_MILLISECONDS);
- uiBashTimer = urand(10*IN_MILLISECONDS, 14*IN_MILLISECONDS);
- uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- uiSpawnTimer = 0;
+ _Reset();
me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE);
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true);
+ summons.DespawnAll();
if (instance)
{
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
- if (!bFirstTime)
- instance->SetData(DATA_AMANITAR_EVENT, FAIL);
- else
- bFirstTime = false;
+ instance->SetData(DATA_AMANITAR_EVENT, NOT_STARTED);
}
}
- void JustDied(Unit* /*killer*/)
+ void JustDied(Unit* /*Killer*/)
{
if (instance)
{
+ _JustDied();
instance->SetData(DATA_AMANITAR_EVENT, DONE);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_MINI);
+ summons.DespawnAll();
}
}
void EnterCombat(Unit* /*who*/)
{
+ _EnterCombat();
+
+ events.ScheduleEvent(EVENT_ROOT, urand(5,9)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_BASH, urand(10,14)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_BOLT, urand(15,20)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_MINI, urand(12,18)*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SPAWN, 5 *IN_MILLISECONDS);
+
+ me->SetInCombatWithZone();
if (instance)
instance->SetData(DATA_AMANITAR_EVENT, IN_PROGRESS);
-
- DoCast(me, SPELL_MINI, false);
}
void SpawnAdds()
{
+ uint8 u = 0;
+
for (uint8 i = 0; i < 30; ++i)
{
- Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0);
+ Position pos;
+ me->GetPosition(&pos);
+ me->GetRandomNearPosition(pos, 30.0f);
+ pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
- if (victim)
+ if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
{
- Position pos;
- victim->GetPosition(&pos);
- me->GetRandomNearPosition(pos, float(urand(5, 80)));
- me->SummonCreature(NPC_POISONOUS_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
- me->GetRandomNearPosition(pos, float(urand(5, 80)));
- me->SummonCreature(NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30*IN_MILLISECONDS);
+ Creature* temp1 = trigger->FindNearestCreature(NPC_HEALTHY_MUSHROOM, 4.0f, true);
+ Creature* temp2 = trigger->FindNearestCreature(NPC_POISONOUS_MUSHROOM, 4.0f, true);
+ if (temp1 || temp2)
+ {
+ trigger->DisappearAndDie();
+ }
+ else
+ {
+ u = 1 - u;
+ trigger->DisappearAndDie();
+ me->SummonCreature(u > 0 ? NPC_POISONOUS_MUSHROOM : NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60*IN_MILLISECONDS);
+ }
}
}
}
void UpdateAI(const uint32 diff)
{
- //Return since we have no target
if (!UpdateVictim())
return;
- if (uiSpawnTimer <= diff)
- {
- SpawnAdds();
- uiSpawnTimer = urand(35*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else uiSpawnTimer -= diff;
-
- if (uiRootTimer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_ENTANGLING_ROOTS);
- uiRootTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else uiRootTimer -= diff;
+ events.Update(diff);
- if (uiBashTimer <= diff)
- {
- DoCastVictim(SPELL_BASH);
- uiBashTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else uiBashTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (uiBoltTimer <= diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
- DoCast(target, SPELL_VENOM_BOLT_VOLLEY);
- uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else uiBoltTimer -= diff;
-
+ switch (eventId)
+ {
+ case EVENT_SPAWN:
+ SpawnAdds();
+ events.ScheduleEvent(EVENT_SPAWN, 20*IN_MILLISECONDS);
+ break;
+ case EVENT_MINI:
+ DoCast(SPELL_MINI);
+ events.ScheduleEvent(EVENT_MINI, urand(25,30)*IN_MILLISECONDS);
+ break;
+ case EVENT_ROOT:
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_ENTANGLING_ROOTS,true);
+ events.ScheduleEvent(EVENT_ROOT, urand(10,15)*IN_MILLISECONDS);
+ break;
+ case EVENT_BASH:
+ DoCastVictim(SPELL_BASH);
+ events.ScheduleEvent(EVENT_BASH, urand(7,12)*IN_MILLISECONDS);
+ break;
+ case EVENT_BOLT:
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_VENOM_BOLT_VOLLEY,true);
+ events.ScheduleEvent(EVENT_BOLT, urand(18,22)*IN_MILLISECONDS);
+ break;
+ default:
+ break;
+ }
+ }
DoMeleeAttackIfReady();
}
};
@@ -169,30 +186,26 @@ public:
{
mob_amanitar_mushroomsAI(Creature* creature) : Scripted_NoMovementAI(creature) {}
- uint32 uiAuraTimer;
- uint32 uiDeathTimer;
+ EventMap events;
void Reset()
{
- DoCast(me, SPELL_PUTRID_MUSHROOM, true); // Hack, to make the mushrooms visible, can't find orig. spell...
+ events.Reset();
+ events.ScheduleEvent(EVENT_AURA, 1*IN_MILLISECONDS);
- if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
- DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true);
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
+ DoCast(SPELL_PUTRID_MUSHROOM);
- uiAuraTimer = 0;
- uiDeathTimer = 30*IN_MILLISECONDS;
+ if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
+ DoCast(SPELL_POISONOUS_MUSHROOM_VISUAL_AURA);
+ else
+ DoCast(SPELL_POWER_MUSHROOM_VISUAL_AURA);
}
- void JustDied(Unit* killer)
+ void DamageTaken(Unit* /*attacker*/, uint32 &damage)
{
- if (!killer)
- return;
-
- if (me->GetEntry() == NPC_HEALTHY_MUSHROOM && killer->GetTypeId() == TYPEID_PLAYER)
- {
- me->InterruptNonMeleeSpells(false);
- DoCast(killer, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, false);
- }
+ if (damage >= me->GetHealth() && me->GetEntry() == NPC_HEALTHY_MUSHROOM)
+ DoCast(me, SPELL_HEALTHY_MUSHROOM_POTENT_FUNGUS, true);
}
void EnterCombat(Unit* /*who*/) {}
@@ -200,18 +213,30 @@ public:
void UpdateAI(const uint32 diff)
{
- if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (uiAuraTimer <= diff)
+ switch (eventId)
{
- DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
- DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD, false);
- uiAuraTimer = 7*IN_MILLISECONDS;
- } else uiAuraTimer -= diff;
+ case EVENT_AURA:
+ if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
+ {
+ DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AREA, true);
+ DoCast(me, SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
+ }
+ events.ScheduleEvent(EVENT_AURA, 7*IN_MILLISECONDS);
+ break;
+ default:
+ break;
+ }
}
- if (uiDeathTimer <= diff)
- me->DisappearAndDie();
- else uiDeathTimer -= diff;
}
};
@@ -223,6 +248,6 @@ public:
void AddSC_boss_amanitar()
{
- new boss_amanitar;
- new mob_amanitar_mushrooms;
-}
+ new boss_amanitar();
+ new mob_amanitar_mushrooms();
+} \ No newline at end of file
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 ea757e86f4d..9b48d7a9e1c 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
@@ -15,41 +15,47 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "ahnkahet.h"
-//not in db
enum Yells
{
- SAY_AGGRO = -1619014,
- SAY_SLAY_1 = -1619015,
- SAY_SLAY_2 = -1619016,
- SAY_SLAY_3 = -1619017,
- SAY_DEATH = -1619018,
- SAY_EGG_SAC_1 = -1619019,
- SAY_EGG_SAC_2 = -1619020
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_EGG_SAC = 3,
+ EMOTE_HATCHES = 4
};
enum Spells
{
- SPELL_BROOD_PLAGUE = 56130,
- H_SPELL_BROOD_PLAGUE = 59467,
- H_SPELL_BROOD_RAGE = 59465,
- SPELL_ENRAGE = 26662, // Enraged if too far away from home
- SPELL_SUMMON_SWARMERS = 56119, //2x 30178 -- 2x every 10secs
- SPELL_SUMMON_SWARM_GUARD = 56120, //1x 30176 -- every 25secs
+ SPELL_BROOD_PLAGUE = 56130,
+ H_SPELL_BROOD_RAGE = 59465,
+ SPELL_ENRAGE = 26662, // Enraged if too far away from home
+ SPELL_SUMMON_SWARMERS = 56119, // 2x 30178 -- 2x every 10secs
+ SPELL_SUMMON_SWARM_GUARD = 56120, // 1x 30176 -- every 25%
+ // Spells Adds
+ SPELL_SPRINT = 56354,
+ SPELL_GUARDIAN_AURA = 56151
};
enum Creatures
{
- MOB_AHNKAHAR_SWARMER = 30178,
- MOB_AHNKAHAR_GUARDIAN_ENTRY = 30176
+ NPC_AHNKAHAR_SWARMER = 30178,
+ NPC_AHNKAHAR_GUARDIAN = 30176
};
-#define ACTION_AHNKAHAR_GUARDIAN_DEAD 1
-#define DATA_RESPECT_YOUR_ELDERS 2
-
-#define EMOTE_HATCHES "An Ahn'kahar Guardian hatches!"
+enum Events
+{
+ EVENT_PLAGUE = 1,
+ EVENT_RAGE,
+ EVENT_SUMMON_SWARMER,
+ EVENT_CHECK_ENRAGE,
+ EVENT_SPRINT,
+ DATA_RESPECT_YOUR_ELDERS
+};
class boss_elder_nadox : public CreatureScript
{
@@ -58,35 +64,24 @@ class boss_elder_nadox : public CreatureScript
struct boss_elder_nadoxAI : public ScriptedAI
{
- boss_elder_nadoxAI(Creature* creature) : ScriptedAI(creature)
+ boss_elder_nadoxAI(Creature* creature) : ScriptedAI(creature), summons(me)
{
- instance = me->GetInstanceScript();
+ instance = creature->GetInstanceScript();
}
- uint32 uiPlagueTimer;
- uint32 uiRagueTimer;
-
- uint32 uiSwarmerSpawnTimer;
- uint32 uiGuardSpawnTimer;
- uint32 uiEnrageTimer;
-
- bool bGuardSpawned;
- bool respectYourElders;
-
+ bool GuardianDied;
+ uint8 AmountHealthModifier;
InstanceScript* instance;
+ SummonList summons;
+ EventMap events;
void Reset()
{
- uiPlagueTimer = 13000;
- uiRagueTimer = 20000;
+ events.Reset();
+ summons.DespawnAll();
- uiSwarmerSpawnTimer = 10000;
- uiGuardSpawnTimer = 25000;
-
- uiEnrageTimer = 5000;
-
- bGuardSpawned = false;
- respectYourElders = true;
+ AmountHealthModifier = 1;
+ GuardianDied = false;
if (instance)
instance->SetData(DATA_ELDER_NADOX_EVENT, NOT_STARTED);
@@ -94,37 +89,54 @@ class boss_elder_nadox : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_ELDER_NADOX_EVENT, IN_PROGRESS);
+
+ events.ScheduleEvent(EVENT_PLAGUE, 13*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10*IN_MILLISECONDS);
+
+ if (IsHeroic())
+ {
+ events.ScheduleEvent(EVENT_RAGE, 12*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5*IN_MILLISECONDS);
+ }
}
- void KilledUnit(Unit* /*who*/)
+ void JustSummoned(Creature* summon)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ summons.Summon(summon);
+ summon->AI()->DoZoneInCombat();
}
- void JustDied(Unit* /*killer*/)
+ void SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
{
- DoScriptText(SAY_SLAY_3, me); //SAY_SLAY_3 on death?
+ if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
+ GuardianDied = true;
+ }
- if (instance)
- instance->SetData(DATA_ELDER_NADOX_EVENT, DONE);
+ uint32 GetData(uint32 type) const
+ {
+ if (type == DATA_RESPECT_YOUR_ELDERS)
+ return !GuardianDied ? 1 : 0;
+
+ return 0;
}
- void DoAction(int32 const action)
+ void KilledUnit(Unit* /*victim*/)
{
- if (action == ACTION_AHNKAHAR_GUARDIAN_DEAD)
- respectYourElders = false;
+ Talk(SAY_SLAY);
}
- uint32 GetData(uint32 type)
+ void JustDied(Unit* /*killer*/)
{
- if (type == DATA_RESPECT_YOUR_ELDERS)
- return respectYourElders ? 1 : 0;
+ Talk(SAY_DEATH);
- return 0;
+ summons.DespawnAll();
+
+ if (instance)
+ instance->SetData(DATA_ELDER_NADOX_EVENT, DONE);
}
void UpdateAI(uint32 const diff)
@@ -132,64 +144,44 @@ class boss_elder_nadox : public CreatureScript
if (!UpdateVictim())
return;
- if (uiPlagueTimer <= diff)
- {
- DoCast(me->getVictim(), SPELL_BROOD_PLAGUE);
- uiPlagueTimer = 15000;
- }
- else
- uiPlagueTimer -= diff;
+ events.Update(diff);
- if (IsHeroic())
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (uiRagueTimer <= diff)
+ switch (eventId)
{
- if (Creature* Swarmer = me->FindNearestCreature(MOB_AHNKAHAR_SWARMER, 35.0f))
- {
- DoCast(Swarmer, H_SPELL_BROOD_RAGE, true);
- uiRagueTimer = 15000;
- }
+ case EVENT_PLAGUE:
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM,0, 100, true),SPELL_BROOD_PLAGUE,true);
+ events.ScheduleEvent(EVENT_PLAGUE, 15*IN_MILLISECONDS);
+ break;
+ case EVENT_RAGE:
+ DoCast(H_SPELL_BROOD_RAGE);
+ events.ScheduleEvent(EVENT_RAGE, urand(10*IN_MILLISECONDS, 50*IN_MILLISECONDS));
+ break;
+ case EVENT_SUMMON_SWARMER:
+ DoCast(me, SPELL_SUMMON_SWARMERS);
+ if (urand(1, 3) == 3) // 33% chance of dialog
+ Talk(SAY_EGG_SAC);
+ events.ScheduleEvent(EVENT_SUMMON_SWARMER, 10*IN_MILLISECONDS);
+ break;
+ case EVENT_CHECK_ENRAGE:
+ if (me->HasAura(SPELL_ENRAGE))
+ return;
+ if (me->GetPositionZ() < 24.0f)
+ DoCast(me, SPELL_ENRAGE, true);
+ events.ScheduleEvent(EVENT_CHECK_ENRAGE, 5*IN_MILLISECONDS);
+ break;
+ default:
+ break;
}
- else
- uiRagueTimer -= diff;
}
- if (uiSwarmerSpawnTimer <= diff)
+ if (me->HealthBelowPct(100 - AmountHealthModifier * 25))
{
- DoCast(me, SPELL_SUMMON_SWARMERS, true);
- DoCast(me, SPELL_SUMMON_SWARMERS);
- if (urand(1, 3) == 3) // 33% chance of dialog
- DoScriptText(RAND(SAY_EGG_SAC_1, SAY_EGG_SAC_2), me);
-
- uiSwarmerSpawnTimer = 10000;
- }
- else
- uiSwarmerSpawnTimer -= diff;
-
- if (!bGuardSpawned && uiGuardSpawnTimer <= diff)
- {
- me->MonsterTextEmote(EMOTE_HATCHES, me->GetGUID(), true);
+ Talk(EMOTE_HATCHES, me->GetGUID());
DoCast(me, SPELL_SUMMON_SWARM_GUARD);
- bGuardSpawned = true;
- }
- else
- uiGuardSpawnTimer -= diff;
-
- if (uiEnrageTimer <= diff)
- {
- if (me->HasAura(SPELL_ENRAGE, 0))
- return;
-
- float x, y, z, o;
- me->GetHomePosition(x, y, z, o);
- if (z < 24)
- if (!me->IsNonMeleeSpellCasted(false))
- DoCast(me, SPELL_ENRAGE, true);
-
- uiEnrageTimer = 5000;
+ ++AmountHealthModifier;
}
- else
- uiEnrageTimer -= diff;
DoMeleeAttackIfReady();
}
@@ -201,12 +193,6 @@ class boss_elder_nadox : public CreatureScript
}
};
-enum AddSpells
-{
- SPELL_SPRINT = 56354,
- SPELL_GUARDIAN_AURA = 56151
-};
-
class mob_ahnkahar_nerubian : public CreatureScript
{
public:
@@ -214,52 +200,44 @@ class mob_ahnkahar_nerubian : public CreatureScript
struct mob_ahnkahar_nerubianAI : public ScriptedAI
{
- mob_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = me->GetInstanceScript();
- }
+ mob_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature) { }
- InstanceScript* instance;
- uint32 uiSprintTimer;
+ EventMap events;
void Reset()
{
- if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY)
+ if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
DoCast(me, SPELL_GUARDIAN_AURA, true);
- uiSprintTimer = 10000;
- }
- void JustDied(Unit* /*killer*/)
- {
- if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY)
- if (Creature* Nadox = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ELDER_NADOX)))
- Nadox->AI()->DoAction(ACTION_AHNKAHAR_GUARDIAN_DEAD);
+ events.ScheduleEvent(EVENT_SPRINT, 13*IN_MILLISECONDS);
}
- void EnterCombat(Unit* /*who*/)
+ void JustDied(Unit* /*killer*/)
{
+ if (me->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
+ me->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA);
}
- void UpdateAI(uint32 const diff)
+ void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
- if (me->GetEntry() == MOB_AHNKAHAR_GUARDIAN_ENTRY)
- me->RemoveAurasDueToSpell(SPELL_GUARDIAN_AURA);
+ events.Update(diff);
- if (instance)
- if (instance->GetData(DATA_ELDER_NADOX_EVENT) != IN_PROGRESS)
- me->DespawnOrUnsummon();
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (uiSprintTimer <= diff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- DoCast(me, SPELL_SPRINT);
- uiSprintTimer = 25000;
+ switch (eventId)
+ {
+ case EVENT_SPRINT:
+ DoCast(me, SPELL_SPRINT);
+ events.ScheduleEvent(EVENT_SPRINT, 20*IN_MILLISECONDS);
+ break;
+ }
}
- else
- uiSprintTimer -= diff;
-
DoMeleeAttackIfReady();
}
};
@@ -283,6 +261,7 @@ public:
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
creature->UpdateAllStats();
}
+
void Reset() {}
void EnterCombat(Unit* /*who*/) {}
void AttackStart(Unit* /*victim*/) {}
@@ -296,30 +275,68 @@ public:
}
};
-class achievement_respect_your_elders : public AchievementCriteriaScript
+class GuardianCheck
{
- public:
- achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders")
+public:
+ bool operator()(const WorldObject* target) const
+ {
+ if (target->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
+ return true;
+
+ return false;
+ }
+};
+
+class spell_elder_nadox_guardian : public SpellScriptLoader
+{
+public:
+ spell_elder_nadox_guardian() : SpellScriptLoader("spell_elder_nadox_guardian") { }
+
+ class spell_elder_nadox_guardian_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_elder_nadox_guardian_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
{
+ targets.remove_if(GuardianCheck());
}
- bool OnCheck(Player* /*player*/, Unit* target)
+ void Register()
{
- if (!target)
- return false;
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_elder_nadox_guardian_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_elder_nadox_guardian_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
+ }
+ };
- if (Creature* Nadox = target->ToCreature())
- if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS))
- return true;
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_elder_nadox_guardian_SpellScript();
+ }
+};
+
+class achievement_respect_your_elders : public AchievementCriteriaScript
+{
+public:
+ achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") {}
+ bool OnCheck(Player* /*player*/, Unit* target)
+ {
+ if (!target)
return false;
- }
+
+ if (Creature* Nadox = target->ToCreature())
+ if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS))
+ return true;
+
+ return false;
+ }
};
void AddSC_boss_elder_nadox()
{
- new boss_elder_nadox;
- new mob_ahnkahar_nerubian;
- new mob_nadox_eggs;
+ new boss_elder_nadox();
+ new mob_ahnkahar_nerubian();
+ new mob_nadox_eggs();
+ new spell_elder_nadox_guardian();
new achievement_respect_your_elders();
}
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 f1eaa0c87c5..b4756a33b38 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -19,8 +19,11 @@
* Comment: Missing AI for Twisted Visages
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
+#include "Player.h"
+#include "SpellInfo.h"
enum Spells
{
@@ -43,16 +46,13 @@ enum Creatures
MOB_TWISTED_VISAGE = 30625
};
-//not in db
+
enum Yells
{
- SAY_AGGRO = -1619030,
- SAY_SLAY_1 = -1619031,
- SAY_SLAY_2 = -1619032,
- SAY_SLAY_3 = -1619033,
- SAY_DEATH_1 = -1619034,
- SAY_DEATH_2 = -1619035,
- SAY_PHASE = -1619036
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_PHASE = 3
};
enum Achievements
@@ -176,7 +176,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
{
@@ -299,7 +299,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH_1, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_HERALD_VOLAZJ, DONE);
@@ -310,7 +310,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
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 d6e50097765..e6bb23b61d7 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -19,25 +19,19 @@
* Comment: Complete - BUT THE TRIGGER NEEDS DATA WHETHER THE PRISON OF TALDARAM IS OFFLINE !
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
+
enum Yells
{
- TEXT_AGGRO = -1619000,
- TEXT_SACRIFICE_1_1 = -1619001,
- TEXT_SACRIFICE_1_2 = -1619002,
- TEXT_SACRIFICE_2_1 = -1619003,
- TEXT_SACRIFICE_2_2 = -1619004,
- TEXT_SLAY_1 = -1619005,
- TEXT_SLAY_2 = -1619006,
- TEXT_SLAY_3 = -1619007,
- TEXT_DEATH = -1619008,
- TEXT_PREACHING_1 = -1619009,
- TEXT_PREACHING_2 = -1619010,
- TEXT_PREACHING_3 = -1619011,
- TEXT_PREACHING_4 = -1619012,
- TEXT_PREACHING_5 = -1619013
+ TEXT_AGGRO = 0,
+ TEXT_SACRIFICE_1 = 1,
+ TEXT_SACRIFICE_2 = 2,
+ TEXT_SLAY = 3,
+ TEXT_DEATH = 4,
+ TEXT_PREACHING = 5
};
enum Spells
@@ -128,7 +122,7 @@ public:
if (!instance || (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_JEDOGA_CONTROLLER))
return;
- DoScriptText(TEXT_AGGRO, me);
+ Talk(TEXT_AGGRO);
me->SetInCombatWithZone();
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, IN_PROGRESS);
}
@@ -146,12 +140,12 @@ public:
if (!Victim || Victim->GetTypeId() != TYPEID_PLAYER)
return;
- DoScriptText(RAND(TEXT_SLAY_1, TEXT_SLAY_2, TEXT_SLAY_3), me);
+ Talk(TEXT_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(TEXT_DEATH, me);
+ Talk(TEXT_DEATH);
if (instance)
instance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, DONE);
}
@@ -162,7 +156,7 @@ public:
volunteerWork = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_VOLUNTEER_WORK)
return volunteerWork ? 1 : 0;
@@ -177,7 +171,7 @@ public:
if (!bPreDone && who->GetTypeId() == TYPEID_PLAYER && me->GetDistance(who) < 100.0f)
{
- DoScriptText(RAND(TEXT_PREACHING_1, TEXT_PREACHING_2, TEXT_PREACHING_3, TEXT_PREACHING_4, TEXT_PREACHING_5), me);
+ Talk(TEXT_PREACHING);
bPreDone = true;
}
@@ -269,7 +263,7 @@ public:
if (opfer)
{
- DoScriptText(RAND(TEXT_SACRIFICE_1_1, TEXT_SACRIFICE_1_2), me);
+ Talk(TEXT_SACRIFICE_1);
instance->SetData64(DATA_ADD_JEDOGA_OPFER, opfer);
} else
bCanDown = true;
@@ -277,7 +271,7 @@ public:
void Opfern()
{
- DoScriptText(RAND(TEXT_SACRIFICE_2_1, TEXT_SACRIFICE_2_2), me);
+ Talk(TEXT_SACRIFICE_2);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_GIFT_OF_THE_HERALD, false);
@@ -533,11 +527,11 @@ public:
{
npc_jedogas_aufseher_triggerAI(Creature* creature) : Scripted_NoMovementAI(creature)
{
- instance = creature->GetInstanceScript();
- bRemoved = false;
- bRemoved2 = false;
- bCasted = false;
- bCasted2 = false;
+ instance = creature->GetInstanceScript();
+ bRemoved = false;
+ bRemoved2 = false;
+ bCasted = false;
+ bCasted2 = false;
}
InstanceScript* instance;
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 cf3c4274e48..4729f68680e 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ahnkahet.h"
enum Spells
@@ -139,8 +140,8 @@ public:
{
float angle, x, y;
angle = pSpheres[0]->GetAngle(pSphereTarget);
- x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * cos(angle);
- y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * sin(angle);
+ x = pSpheres[0]->GetPositionX() + DATA_SPHERE_DISTANCE * std::cos(angle);
+ y = pSpheres[0]->GetPositionY() + DATA_SPHERE_DISTANCE * std::sin(angle);
pSpheres[0]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[0]->GetPositionZ());
}
if (IsHeroic())
@@ -153,12 +154,12 @@ public:
{
float angle, x, y;
angle = pSpheres[1]->GetAngle(pSphereTarget) + DATA_SPHERE_ANGLE_OFFSET;
- x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
- y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
+ x = pSpheres[1]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
+ y = pSpheres[1]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
pSpheres[1]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[1]->GetPositionZ());
angle = pSpheres[2]->GetAngle(pSphereTarget) - DATA_SPHERE_ANGLE_OFFSET;
- x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * cos(angle);
- y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * sin(angle);
+ x = pSpheres[2]->GetPositionX() + DATA_SPHERE_DISTANCE/2 * std::cos(angle);
+ y = pSpheres[2]->GetPositionY() + DATA_SPHERE_DISTANCE/2 * std::sin(angle);
pSpheres[2]->GetMotionMaster()->MovePoint(0, x, y, pSpheres[2]->GetPositionZ());
}
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
index 74643e58e30..7eaf8368c21 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "ahnkahet.h"
/* Ahn'kahet encounters:
@@ -158,7 +160,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -250,7 +252,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index ca71d8c313e..11ef00775d0 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "azjol_nerub.h"
enum Spells
@@ -24,10 +25,8 @@ enum Spells
SPELL_SUMMON_CARRION_BEETLES = 53521,
SPELL_LEECHING_SWARM = 53467,
SPELL_POUND = 53472,
- SPELL_POUND_H = 59433,
SPELL_SUBMERGE = 53421,
SPELL_IMPALE_DMG = 53454,
- SPELL_IMPALE_DMG_H = 59446,
SPELL_IMPALE_SHAKEGROUND = 53455,
SPELL_IMPALE_SPIKE = 53539, //this is not the correct visual effect
//SPELL_IMPALE_TARGET = 53458,
@@ -45,17 +44,12 @@ enum Creatures
// not in db
enum Yells
{
- SAY_INTRO = -1601010,
- SAY_AGGRO = -1601000,
- SAY_SLAY_1 = -1601001,
- SAY_SLAY_2 = -1601002,
- SAY_SLAY_3 = -1601003,
- SAY_LOCUST_1 = -1601005,
- SAY_LOCUST_2 = -1601006,
- SAY_LOCUST_3 = -1601007,
- SAY_SUBMERGE_1 = -1601008,
- SAY_SUBMERGE_2 = -1601009,
- SAY_DEATH = -1601004
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_LOCUST = 3,
+ SAY_SUBMERGE = 4,
+ SAY_INTRO = 5
};
enum
@@ -162,7 +156,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DelayTimer = 0;
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
@@ -210,7 +204,7 @@ public:
break;
case IMPALE_PHASE_DMG:
if (Creature* impaleTarget = Unit::GetCreature(*me, ImpaleTarget))
- me->CastSpell(impaleTarget, DUNGEON_MODE(SPELL_IMPALE_DMG, SPELL_IMPALE_DMG_H), true);
+ me->CastSpell(impaleTarget, SPELL_IMPALE_DMG, true);
ImpalePhase = IMPALE_PHASE_TARGET;
ImpaleTimer = 9*IN_MILLISECONDS;
break;
@@ -327,7 +321,7 @@ public:
if (Unit* target = me->getVictim())
{
if (Creature* pImpaleTarget = DoSummonImpaleTarget(target))
- me->CastSpell(pImpaleTarget, DUNGEON_MODE(SPELL_POUND, SPELL_POUND_H), false);
+ me->CastSpell(pImpaleTarget, SPELL_POUND, false);
}
PoundTimer = 16500;
} else PoundTimer -= diff;
@@ -339,7 +333,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
Summons.DespawnAll();
if (instance)
instance->SetData(DATA_ANUBARAK_EVENT, DONE);
@@ -349,7 +343,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summon)
diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
index 6587631f249..2690ea13ab1 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp
@@ -28,7 +28,8 @@
* Hadronox to make his way to you. When Hadronox enters the main room, she will web the doors, and no more non-elites will spawn.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "azjol_nerub.h"
enum Spells
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 4d83be53c93..4c817fa9465 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
@@ -19,7 +19,8 @@
* Comment: Find in the future best timers and the event is not implemented.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "azjol_nerub.h"
enum Spells
@@ -60,19 +61,12 @@ enum Mobs
enum Yells
{
- SAY_AGGRO = -1601011,
- SAY_SLAY_1 = -1601012,
- SAY_SLAY_2 = -1601013,
- SAY_DEATH = -1601014,
- //Not in db
- SAY_SEND_GROUP_1 = -1601020,
- SAY_SEND_GROUP_2 = -1601021,
- SAY_SEND_GROUP_3 = -1601022,
- SAY_SWARM_1 = -1601015,
- SAY_SWARM_2 = -1601016,
- SAY_PREFIGHT_1 = -1601017,
- SAY_PREFIGHT_2 = -1601018,
- SAY_PREFIGHT_3 = -1601019
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SWARM = 3,
+ SAY_PREFIGHT = 4,
+ SAY_SEND_GROUP = 5
};
const Position SpawnPoint[] =
@@ -116,7 +110,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
Summon();
uiSummonTimer = 15*IN_MILLISECONDS;
@@ -179,7 +173,7 @@ public:
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_KRIKTHIR_THE_GATEWATCHER_EVENT, DONE);
@@ -190,7 +184,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summoned)
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 12622174e29..10575ae288c 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "azjol_nerub.h"
#define MAX_ENCOUNTER 3
@@ -104,7 +105,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -148,7 +149,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt
index 3502e7fb104..22d0f37a37f 100644
--- a/src/server/scripts/Northrend/CMakeLists.txt
+++ b/src/server/scripts/Northrend/CMakeLists.txt
@@ -10,6 +10,7 @@
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
+ Northrend/wintergrasp.cpp
Northrend/isle_of_conquest.cpp
Northrend/storm_peaks.cpp
Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
@@ -50,6 +51,7 @@ set(scripts_STAT_SRCS
Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp
Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
+ Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h
Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
index b115a4ee827..6d4b4bc9379 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp
@@ -15,33 +15,33 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "obsidian_sanctum.h"
-enum eEnums
+enum Enums
{
//Sartharion Yell
- SAY_SARTHARION_AGGRO = -1615018,
- SAY_SARTHARION_BERSERK = -1615019,
- SAY_SARTHARION_BREATH = -1615020,
- SAY_SARTHARION_CALL_SHADRON = -1615021,
- SAY_SARTHARION_CALL_TENEBRON = -1615022,
- SAY_SARTHARION_CALL_VESPERON = -1615023,
- SAY_SARTHARION_DEATH = -1615024,
- SAY_SARTHARION_SPECIAL_1 = -1615025,
- SAY_SARTHARION_SPECIAL_2 = -1615026,
- SAY_SARTHARION_SPECIAL_3 = -1615027,
- SAY_SARTHARION_SPECIAL_4 = -1615028,
- SAY_SARTHARION_SLAY_1 = -1615029,
- SAY_SARTHARION_SLAY_2 = -1615030,
- SAY_SARTHARION_SLAY_3 = -1615031,
-
- WHISPER_LAVA_CHURN = -1615032,
-
- WHISPER_SHADRON_DICIPLE = -1615008,
- WHISPER_VESPERON_DICIPLE = -1615041,
- WHISPER_HATCH_EGGS = -1615017,
- WHISPER_OPEN_PORTAL = -1615042, // whisper, shared by two dragons
+ SAY_SARTHARION_AGGRO = 0,
+ SAY_SARTHARION_BERSERK = 1,
+ SAY_SARTHARION_BREATH = 2,
+ SAY_SARTHARION_CALL_SHADRON = 3,
+ SAY_SARTHARION_CALL_TENEBRON = 4,
+ SAY_SARTHARION_CALL_VESPERON = 5,
+ SAY_SARTHARION_DEATH = 6,
+ SAY_SARTHARION_SPECIAL = 7,
+ SAY_SARTHARION_SLAY = 8,
+ WHISPER_LAVA_CHURN = 9,
+
+ WHISPER_HATCH_EGGS = 6,
+ WHISPER_OPEN_PORTAL = 6, // whisper, shared by two dragons
+
+ WHISPER_SHADRON_DICIPLE = 7,
+ WHISPER_VESPERON_DICIPLE = 7,
//Sartharion Spells
SPELL_BERSERK = 61632, // Increases the caster's attack speed by 150% and all damage it deals by 500% for 5 min.
@@ -352,7 +352,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_SARTHARION_AGGRO, me);
+ Talk(SAY_SARTHARION_AGGRO);
DoZoneInCombat();
if (instance)
@@ -364,7 +364,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_SARTHARION_DEATH, me);
+ Talk(SAY_SARTHARION_DEATH);
if (instance)
{
@@ -384,7 +384,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SARTHARION_SLAY_1, SAY_SARTHARION_SLAY_2, SAY_SARTHARION_SLAY_3), me);
+ Talk(SAY_SARTHARION_SLAY);
}
// me->ResetLootMode() is called from Reset()
@@ -399,7 +399,7 @@ public:
me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == TWILIGHT_ACHIEVEMENTS)
return drakeCount;
@@ -506,7 +506,7 @@ public:
break;
}
- DoScriptText(iTextId, me);
+ Talk(iTextId);
}
}
}
@@ -522,7 +522,7 @@ public:
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (i->getSource() && i->getSource()->isAlive())
- DoScriptText(WHISPER_LAVA_CHURN, me, i->getSource());
+ Talk(WHISPER_LAVA_CHURN, i->getSource()->GetGUID());
}
}
@@ -561,7 +561,7 @@ public:
if (!m_bIsBerserk && !HealthAbovePct(35)
&& ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive())))
{
- DoScriptText(SAY_SARTHARION_BERSERK, me);
+ Talk(SAY_SARTHARION_BERSERK);
DoCast(me, SPELL_BERSERK);
m_bIsBerserk = true;
}
@@ -619,7 +619,7 @@ public:
// flame breath
if (m_uiFlameBreathTimer <= uiDiff)
{
- DoScriptText(SAY_SARTHARION_BREATH, me);
+ Talk(SAY_SARTHARION_BREATH);
DoCast(me->getVictim(), RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H));
m_uiFlameBreathTimer = urand(25000, 35000);
}
@@ -652,7 +652,7 @@ public:
CastLavaStrikeOnTarget(target);
if (urand(0, 5) == 0)
- DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1, SAY_SARTHARION_SPECIAL_2, SAY_SARTHARION_SPECIAL_3), me);
+ Talk(SAY_SARTHARION_SPECIAL);
}
m_uiLavaStrikeTimer = (m_bIsSoftEnraged ? urand(1400, 2000) : urand(5000, 20000));
}
@@ -696,38 +696,32 @@ public:
enum TeneText
{
- SAY_TENEBRON_AGGRO = -1615009,
- SAY_TENEBRON_SLAY_1 = -1615010,
- SAY_TENEBRON_SLAY_2 = -1615011,
- SAY_TENEBRON_DEATH = -1615012,
- SAY_TENEBRON_BREATH = -1615013,
- SAY_TENEBRON_RESPOND = -1615014,
- SAY_TENEBRON_SPECIAL_1 = -1615015,
- SAY_TENEBRON_SPECIAL_2 = -1615016
+ SAY_TENEBRON_AGGRO = 0,
+ SAY_TENEBRON_SLAY = 1,
+ SAY_TENEBRON_DEATH = 2,
+ SAY_TENEBRON_BREATH = 3,
+ SAY_TENEBRON_RESPOND = 4,
+ SAY_TENEBRON_SPECIAL = 5
};
enum ShadText
{
- SAY_SHADRON_AGGRO = -1615000,
- SAY_SHADRON_SLAY_1 = -1615001,
- SAY_SHADRON_SLAY_2 = -1615002,
- SAY_SHADRON_DEATH = -1615003,
- SAY_SHADRON_BREATH = -1615004,
- SAY_SHADRON_RESPOND = -1615005,
- SAY_SHADRON_SPECIAL_1 = -1615006,
- SAY_SHADRON_SPECIAL_2 = -1615007
+ SAY_SHADRON_AGGRO = 0,
+ SAY_SHADRON_SLAY = 1,
+ SAY_SHADRON_DEATH = 2,
+ SAY_SHADRON_BREATH = 3,
+ SAY_SHADRON_RESPOND = 4,
+ SAY_SHADRON_SPECIAL = 5
};
enum VespText
{
- SAY_VESPERON_AGGRO = -1615033,
- SAY_VESPERON_SLAY_1 = -1615034,
- SAY_VESPERON_SLAY_2 = -1615035,
- SAY_VESPERON_DEATH = -1615036,
- SAY_VESPERON_BREATH = -1615037,
- SAY_VESPERON_RESPOND = -1615038,
- SAY_VESPERON_SPECIAL_1 = -1615039,
- SAY_VESPERON_SPECIAL_2 = -1615040
+ SAY_VESPERON_AGGRO = 0,
+ SAY_VESPERON_SLAY = 1,
+ SAY_VESPERON_DEATH = 2,
+ SAY_VESPERON_BREATH = 3,
+ SAY_VESPERON_RESPOND = 4,
+ SAY_VESPERON_SPECIAL = 5,
};
//to control each dragons common abilities
@@ -824,7 +818,7 @@ struct dummy_dragonAI : public ScriptedAI
if (!PlayerList.isEmpty())
{
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
- DoScriptText(iTextId, me, i->getSource());
+ Talk(iTextId, i->getSource()->GetGUID());
}
}
}
@@ -938,7 +932,7 @@ struct dummy_dragonAI : public ScriptedAI
break;
}
- DoScriptText(iTextId, me);
+ Talk(iTextId);
me->RemoveAurasDueToSpell(uiSpellId);
@@ -1014,13 +1008,13 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_TENEBRON_AGGRO, me);
+ Talk(SAY_TENEBRON_AGGRO);
DoZoneInCombat();
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_TENEBRON_SLAY_1, SAY_TENEBRON_SLAY_2), me);
+ Talk(SAY_TENEBRON_SLAY);
}
void UpdateAI(const uint32 uiDiff)
@@ -1055,7 +1049,7 @@ public:
// shadow breath
if (m_uiShadowBreathTimer <= uiDiff)
{
- DoScriptText(SAY_TENEBRON_BREATH, me);
+ Talk(SAY_TENEBRON_BREATH);
DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H));
m_uiShadowBreathTimer = urand(20000, 25000);
}
@@ -1109,13 +1103,13 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_SHADRON_AGGRO, me);
+ Talk(SAY_SHADRON_AGGRO);
DoZoneInCombat();
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SHADRON_SLAY_1, SAY_SHADRON_SLAY_2), me);
+ Talk(SAY_SHADRON_SLAY);
}
void UpdateAI(const uint32 uiDiff)
@@ -1159,7 +1153,7 @@ public:
// shadow breath
if (m_uiShadowBreathTimer <= uiDiff)
{
- DoScriptText(SAY_SHADRON_BREATH, me);
+ Talk(SAY_SHADRON_BREATH);
DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H));
m_uiShadowBreathTimer = urand(20000, 25000);
}
@@ -1207,13 +1201,13 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_VESPERON_AGGRO, me);
+ Talk(SAY_VESPERON_AGGRO);
DoZoneInCombat();
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_VESPERON_SLAY_1, SAY_VESPERON_SLAY_2), me);
+ Talk(SAY_VESPERON_SLAY);
}
void UpdateAI(const uint32 uiDiff)
@@ -1254,7 +1248,7 @@ public:
// shadow breath
if (m_uiShadowBreathTimer <= uiDiff)
{
- DoScriptText(SAY_VESPERON_BREATH, me);
+ Talk(SAY_VESPERON_BREATH);
DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H));
m_uiShadowBreathTimer = urand(20000, 25000);
}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
index 91d67697ebb..c39d7fbeb09 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "obsidian_sanctum.h"
#define MAX_ENCOUNTER 1
@@ -107,7 +108,7 @@ public:
m_bVesperonKilled = true;
}
- uint32 GetData(uint32 uiType)
+ uint32 GetData(uint32 uiType) const
{
if (uiType == TYPE_SARTHARION_EVENT)
return m_auiEncounter[0];
@@ -121,7 +122,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiData)
+ uint64 GetData64(uint32 uiData) const
{
switch (uiData)
{
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 b2cf755c7af..531e5d9268e 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ruby_sanctum.h"
@@ -157,9 +158,9 @@ class boss_general_zarithrian : public CreatureScript
{
case EVENT_SUMMON_ADDS:
{
- if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHIAN_SPAWN_STALKER_1)))
+ if (Creature* stalker1 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_1)))
stalker1->AI()->DoCast(stalker1, SPELL_SUMMON_FLAMECALLER);
- if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHIAN_SPAWN_STALKER_2)))
+ if (Creature* stalker2 = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ZARITHRIAN_SPAWN_STALKER_2)))
stalker2->AI()->DoCast(stalker2, SPELL_SUMMON_FLAMECALLER);
Talk(SAY_ADDS);
events.ScheduleEvent(EVENT_SUMMON_ADDS, 42000);
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
new file mode 100644
index 00000000000..2bb2b1c3cd7
--- /dev/null
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -0,0 +1,1763 @@
+/*
+ * Copyright (C) 2008-2012 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 "ScriptMgr.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "Spell.h"
+#include "Vehicle.h"
+#include "MapManager.h"
+#include "GameObjectAI.h"
+#include "ScriptedCreature.h"
+#include "ruby_sanctum.h"
+#include "Player.h"
+
+/* ScriptData
+SDName: ruby_sanctum
+SDAuthors: Kaelima, Warpten
+SD%Complete: 90%
+SDComment: Based on Kaelima's initial work (half of it). Corporeality handling is a pure guess, we lack info.
+SDCategory: Chamber of Aspects
+EndScriptData */
+
+enum Texts
+{
+ // Shared
+ SAY_REGENERATE = 0, // Without pressure in both realms, %s begins to regenerate.
+
+ // Halion
+ SAY_INTRO = 1, // Meddlesome insects! You are too late. The Ruby Sanctum is lost!
+ SAY_AGGRO = 2, // Your world teeters on the brink of annihilation. You will ALL bear witness to the coming of a new age of DESTRUCTION!
+ SAY_METEOR_STRIKE = 3, // The heavens burn!
+ SAY_PHASE_TWO = 4, // You will find only suffering within the realm of twilight! Enter if you dare!
+ SAY_DEATH = 5, // Relish this victory, mortals, for it will be your last! This world will burn with the master's return!
+ SAY_KILL = 6, // Another "hero" falls.
+ SAY_BERSERK = 7, // Not good enough.
+ EMOTE_CORPOREALITY_POT = 8, // Your efforts force %s further out of the physical realm!
+ EMOTE_CORPOREALITY_PIP = 9, // Your companions' efforts force %s further into the physical realm!
+
+ // Twilight Halion
+ SAY_SPHERE_PULSE = 1, // Beware the shadow!
+ SAY_PHASE_THREE = 2, // I am the light and the darkness! Cower, mortals, before the herald of Deathwing!
+ EMOTE_CORPOREALITY_TIT = 3, // Your companions' efforts force %s further into the twilight realm!
+ EMOTE_CORPOREALITY_TOT = 4, // Your efforts force %s further out of the twilight realm!
+
+ EMOTE_WARN_LASER = 0, // The orbiting spheres pulse with dark energy!
+};
+
+enum Spells
+{
+ // Halion
+ SPELL_FLAME_BREATH = 74525,
+ SPELL_CLEAVE = 74524,
+ SPELL_METEOR_STRIKE = 74637,
+ SPELL_TAIL_LASH = 74531,
+
+ SPELL_FIERY_COMBUSTION = 74562,
+ SPELL_MARK_OF_COMBUSTION = 74567,
+ SPELL_FIERY_COMBUSTION_EXPLOSION = 74607,
+ SPELL_FIERY_COMBUSTION_SUMMON = 74610,
+
+ // Combustion & Consumption
+ SPELL_SCALE_AURA = 70507, // Aura created in spell_dbc.
+ SPELL_COMBUSTION_DAMAGE_AURA = 74629,
+ SPELL_CONSUMPTION_DAMAGE_AURA = 74803,
+
+ // Twilight Halion
+ SPELL_DARK_BREATH = 74806,
+
+ SPELL_MARK_OF_CONSUMPTION = 74795,
+ SPELL_SOUL_CONSUMPTION = 74792,
+ SPELL_SOUL_CONSUMPTION_EXPLOSION = 74799,
+ SPELL_SOUL_CONSUMPTION_SUMMON = 74800,
+
+ // Living Inferno
+ SPELL_BLAZING_AURA = 75885,
+
+ // Halion Controller
+ SPELL_COSMETIC_FIRE_PILLAR = 76006,
+ SPELL_FIERY_EXPLOSION = 76010,
+ SPELL_CLEAR_DEBUFFS = 75396,
+
+ // Meteor Strike
+ SPELL_METEOR_STRIKE_COUNTDOWN = 74641,
+ SPELL_METEOR_STRIKE_AOE_DAMAGE = 74648,
+ SPELL_METEOR_STRIKE_FIRE_AURA_1 = 74713,
+ SPELL_METEOR_STRIKE_FIRE_AURA_2 = 74718,
+ SPELL_BIRTH_NO_VISUAL = 40031,
+
+ // Shadow Orb
+ SPELL_TWILIGHT_CUTTER = 74768, // Unknown dummy effect (EFFECT_0)
+ SPELL_TWILIGHT_CUTTER_TRIGGERED = 74769,
+ SPELL_TWILIGHT_PULSE_PERIODIC = 78861,
+ SPELL_TRACK_ROTATION = 74758,
+
+ // Misc
+ SPELL_TWILIGHT_DIVISION = 75063, // Phase spell from phase 2 to phase 3
+ SPELL_LEAVE_TWILIGHT_REALM = 74812,
+ SPELL_TWILIGHT_PHASING = 74808, // Phase spell from phase 1 to phase 2
+ SPELL_SUMMON_TWILIGHT_PORTAL = 74809, // Summons go 202794
+ SPELL_SUMMON_EXIT_PORTALS = 74805, // Custom spell created in spell_dbc.
+ SPELL_TWILIGHT_MENDING = 75509,
+ SPELL_TWILIGHT_REALM = 74807,
+ SPELL_DUSK_SHROUD = 75476,
+ SPELL_TWILIGHT_PRECISION = 78243,
+ SPELL_COPY_DAMAGE = 74810 // Aura not found in DBCs.
+};
+
+enum Events
+{
+ // Halion
+ EVENT_ACTIVATE_FIREWALL = 1,
+ EVENT_CLEAVE = 2,
+ EVENT_BREATH = 3,
+ EVENT_METEOR_STRIKE = 4,
+ EVENT_FIERY_COMBUSTION = 5,
+ EVENT_TAIL_LASH = 6,
+
+ // Twilight Halion
+ EVENT_SOUL_CONSUMPTION = 8,
+
+ // Meteor Strike
+ EVENT_SPAWN_METEOR_FLAME = 9,
+
+ // Halion Controller
+ EVENT_START_INTRO = 10,
+ EVENT_INTRO_PROGRESS_1 = 11,
+ EVENT_INTRO_PROGRESS_2 = 12,
+ EVENT_INTRO_PROGRESS_3 = 13,
+ EVENT_CHECK_CORPOREALITY = 14,
+ EVENT_SHADOW_PULSARS_SHOOT = 15,
+ EVENT_TRIGGER_BERSERK = 16,
+ EVENT_TWILIGHT_MENDING = 17
+};
+
+enum Actions
+{
+ // Meteor Strike
+ ACTION_METEOR_STRIKE_BURN = 1,
+ ACTION_METEOR_STRIKE_AOE = 2,
+
+ // Halion Controller
+ ACTION_MONITOR_CORPOREALITY = 3,
+
+ // Orb Carrier
+ ACTION_SHOOT = 4
+};
+
+enum Phases
+{
+ PHASE_ALL = 0,
+ 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
+};
+
+enum Misc
+{
+ DATA_TWILIGHT_DAMAGE_TAKEN = 1,
+ DATA_MATERIAL_DAMAGE_TAKEN = 2,
+ DATA_STACKS_DISPELLED = 3,
+ DATA_FIGHT_PHASE = 4,
+ DATA_EVADE_METHOD = 5
+};
+
+enum OrbCarrierSeats
+{
+ SEAT_NORTH = 0,
+ SEAT_SOUTH = 1,
+ SEAT_EAST = 2,
+ SEAT_WEST = 3
+};
+
+enum CorporealityEvent
+{
+ CORPOREALITY_NONE = 0,
+ CORPOREALITY_TWILIGHT_MENDING = 1,
+ CORPOREALITY_INCREASE = 2,
+ CORPOREALITY_DECREASE = 3
+};
+
+Position const HalionSpawnPos = {3156.67f, 533.8108f, 72.98822f, 3.159046f};
+
+uint8 const MAX_CORPOREALITY_STATE = 11;
+
+struct CorporealityEntry
+{
+ uint32 materialRealmSpell;
+ uint32 twilightRealmSpell;
+};
+
+CorporealityEntry const _corporealityReference[MAX_CORPOREALITY_STATE] = {
+ {74836, 74831},
+ {74835, 74830},
+ {74834, 74829},
+ {74833, 74828},
+ {74832, 74827},
+ {74826, 74826},
+ {74827, 74832},
+ {74828, 74833},
+ {74829, 74834},
+ {74830, 74835},
+ {74831, 74836}
+};
+
+struct generic_halionAI : public BossAI
+{
+ generic_halionAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), _canEvade(false) { }
+
+ void EnterCombat(Unit* who)
+ {
+ BossAI::EnterCombat(who);
+ me->AddAura(SPELL_TWILIGHT_PRECISION, me);
+ _canEvade = false;
+ events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000));
+ events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
+ events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000));
+ }
+
+ void Reset()
+ {
+ _canEvade = false;
+ BossAI::Reset();
+ }
+
+ void EnterEvadeMode()
+ {
+ BossAI::EnterEvadeMode();
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
+ }
+
+ void ExecuteEvent(uint32 const eventId)
+ {
+ switch (eventId)
+ {
+ case EVENT_CLEAVE:
+ DoCastVictim(SPELL_CLEAVE);
+ events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000));
+ break;
+ case EVENT_TAIL_LASH:
+ DoCastAOE(SPELL_TAIL_LASH);
+ events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
+ break;
+ case EVENT_BREATH:
+ DoCast(me, me->GetEntry() == NPC_HALION ? SPELL_FLAME_BREATH : SPELL_DARK_BREATH);
+ events.ScheduleEvent(EVENT_BREATH, urand(10000, 12000));
+ break;
+ }
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ events.Update(diff);
+
+ while (uint32 eventId = events.ExecuteEvent())
+ ExecuteEvent(eventId);
+
+ DoMeleeAttackIfReady();
+ }
+
+ void SetData(uint32 index, uint32 dataValue)
+ {
+ switch (index)
+ {
+ case DATA_EVADE_METHOD:
+ _canEvade = (dataValue == 1);
+ break;
+ default:
+ break;
+ }
+ }
+
+ void SpellHit(Unit* /*who*/, SpellInfo const* spellInfo)
+ {
+ if (spellInfo->Id == SPELL_TWILIGHT_MENDING)
+ Talk(SAY_REGENERATE);
+ }
+
+protected:
+ bool _canEvade;
+};
+
+class boss_halion : public CreatureScript
+{
+ public:
+ boss_halion() : CreatureScript("boss_halion") { }
+
+ struct boss_halionAI : public generic_halionAI
+ {
+ boss_halionAI(Creature* creature) : generic_halionAI(creature, DATA_HALION)
+ {
+ me->SetHomePosition(HalionSpawnPos);
+ }
+
+ void Reset()
+ {
+ generic_halionAI::Reset();
+ me->SetReactState(REACT_DEFENSIVE);
+ me->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ }
+
+ 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)
+ generic_halionAI::EnterEvadeMode();
+ }
+
+ void EnterCombat(Unit* who)
+ {
+ Talk(SAY_AGGRO);
+
+ events.Reset();
+ events.SetPhase(PHASE_ONE);
+
+ generic_halionAI::EnterCombat(who);
+
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1);
+ instance->SetBossState(DATA_HALION, IN_PROGRESS);
+
+ events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 5000);
+ events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000));
+ events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000));
+
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_ONE);
+ }
+
+ void JustDied(Unit* killer)
+ {
+ BossAI::JustDied(killer);
+
+ Talk(SAY_DEATH);
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
+
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ me->Kill(controller);
+ }
+
+ Position const* GetMeteorStrikePosition() const { return &_meteorStrikePos; }
+
+ void DamageTaken(Unit* attacker, uint32& damage)
+ {
+ if (me->HealthBelowPctDamaged(75, damage) && (events.GetPhaseMask() & PHASE_ONE_MASK))
+ {
+ events.SetPhase(PHASE_TWO);
+ Talk(SAY_PHASE_TWO);
+
+ me->CastStop();
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_TWILIGHT_PHASING);
+
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_TWO);
+ return;
+ }
+
+ if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ {
+ // Don't consider copied damage.
+ if (!me->InSamePhase(attacker))
+ return;
+
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->SetData(DATA_MATERIAL_DAMAGE_TAKEN, damage);
+ }
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ return;
+
+ generic_halionAI::UpdateAI(diff);
+ }
+
+ void ExecuteEvent(uint32 const eventId)
+ {
+ switch (eventId)
+ {
+ case EVENT_ACTIVATE_FIREWALL:
+ // Flame ring is activated 5 seconds after starting encounter, DOOR_TYPE_ROOM is only instant.
+ for (uint8 i = DATA_FLAME_RING; i <= DATA_TWILIGHT_FLAME_RING; ++i)
+ if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetData64(i)))
+ instance->HandleGameObject(instance->GetData64(DATA_FLAME_RING), false, flameRing);
+ break;
+ case EVENT_METEOR_STRIKE:
+ {
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_TWILIGHT_REALM))
+ {
+ target->GetPosition(&_meteorStrikePos);
+ me->CastSpell(_meteorStrikePos.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ(), SPELL_METEOR_STRIKE, true, NULL, NULL, me->GetGUID());
+ Talk(SAY_METEOR_STRIKE);
+ }
+ events.ScheduleEvent(EVENT_METEOR_STRIKE, 40000);
+ break;
+ }
+ case EVENT_FIERY_COMBUSTION:
+ {
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_TWILIGHT_REALM))
+ DoCast(target, SPELL_FIERY_COMBUSTION);
+ events.ScheduleEvent(EVENT_FIERY_COMBUSTION, 25000);
+ break;
+ }
+ default:
+ generic_halionAI::ExecuteEvent(eventId);
+ break;
+ }
+ }
+
+ void SetData(uint32 index, uint32 value)
+ {
+ switch (index)
+ {
+ case DATA_FIGHT_PHASE:
+ events.SetPhase(value);
+ break;
+ default:
+ generic_halionAI::SetData(index, value);
+ }
+ }
+
+ private:
+ Position _meteorStrikePos;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<boss_halionAI>(creature);
+ }
+};
+
+typedef boss_halion::boss_halionAI HalionAI;
+
+class boss_twilight_halion : public CreatureScript
+{
+ public:
+ boss_twilight_halion() : CreatureScript("boss_twilight_halion") { }
+
+ struct boss_twilight_halionAI : public generic_halionAI
+ {
+ boss_twilight_halionAI(Creature* creature) : generic_halionAI(creature, DATA_TWILIGHT_HALION)
+ {
+ Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION));
+ if (!halion)
+ return;
+
+ // Using AddAura because no spell cast packet in sniffs.
+ halion->AddAura(SPELL_COPY_DAMAGE, me); // We use explicit targeting here to avoid conditions + SPELL_ATTR6_CANT_TARGET_SELF.
+ me->AddAura(SPELL_COPY_DAMAGE, halion);
+ me->AddAura(SPELL_DUSK_SHROUD, me);
+
+ me->SetHealth(halion->GetHealth());
+ me->SetPhaseMask(0x20, true);
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
+
+ void EnterCombat(Unit* who)
+ {
+ events.Reset();
+ events.SetPhase(PHASE_TWO);
+
+ generic_halionAI::EnterCombat(who);
+
+ events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000);
+
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2);
+ }
+
+ // Never evade
+ void EnterEvadeMode() { }
+
+ void KilledUnit(Unit* victim)
+ {
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_KILL);
+
+ // Victims should not be in the Twilight Realm
+ me->CastSpell(victim, SPELL_LEAVE_TWILIGHT_REALM, true);
+ }
+
+ void JustDied(Unit* killer)
+ {
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION)))
+ {
+ // Ensure looting
+ if (me->IsDamageEnoughForLootingAndReward())
+ halion->LowerPlayerDamageReq(halion->GetMaxHealth());
+
+ if (halion->isAlive())
+ killer->Kill(halion);
+ }
+
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->Kill(controller);
+
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
+ }
+
+ void DamageTaken(Unit* attacker, uint32& damage)
+ {
+ if (me->HealthBelowPctDamaged(50, damage) && (events.GetPhaseMask() & PHASE_TWO_MASK))
+ {
+ events.SetPhase(PHASE_THREE);
+ me->CastStop();
+ DoCast(me, SPELL_TWILIGHT_DIVISION);
+ Talk(SAY_PHASE_THREE);
+ return;
+ }
+
+ if (events.GetPhaseMask() & PHASE_THREE_MASK)
+ {
+ // Don't consider copied damage.
+ if (!me->InSamePhase(attacker))
+ return;
+
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->SetData(DATA_TWILIGHT_DAMAGE_TAKEN, damage);
+ }
+ }
+
+ void SpellHit(Unit* who, SpellInfo const* spell)
+ {
+ switch (spell->Id)
+ {
+ case SPELL_TWILIGHT_DIVISION:
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->DoAction(ACTION_MONITOR_CORPOREALITY);
+ break;
+ default:
+ generic_halionAI::SpellHit(who, spell);
+ break;
+ }
+ }
+
+ void ExecuteEvent(uint32 const eventId)
+ {
+ switch (eventId)
+ {
+ case EVENT_SOUL_CONSUMPTION:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, SPELL_TWILIGHT_REALM))
+ DoCast(target, SPELL_SOUL_CONSUMPTION);
+ events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000);
+ break;
+ default:
+ generic_halionAI::ExecuteEvent(eventId);
+ break;
+ }
+ }
+
+ private:
+ EventMap events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<boss_twilight_halionAI>(creature);
+ }
+};
+
+class npc_halion_controller : public CreatureScript
+{
+ public:
+ npc_halion_controller() : CreatureScript("npc_halion_controller") { }
+
+ struct npc_halion_controllerAI : public ScriptedAI
+ {
+ npc_halion_controllerAI(Creature* creature) : ScriptedAI(creature),
+ _instance(creature->GetInstanceScript()), _summons(me)
+ {
+ me->SetPhaseMask(me->GetPhaseMask() | 0x20, true);
+ _events.SetPhase(PHASE_INTRO);
+ }
+
+ void Reset()
+ {
+ _summons.DespawnAll();
+ _events.Reset();
+ _materialCorporealityValue = 5;
+ _materialDamageTaken = 0;
+ _twilightDamageTaken = 0;
+
+ DoCast(me, SPELL_CLEAR_DEBUFFS);
+ }
+
+ void JustSummoned(Creature* who)
+ {
+ _summons.Summon(who);
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ _events.Reset();
+ _summons.DespawnAll();
+
+ DoCast(me, SPELL_CLEAR_DEBUFFS);
+ }
+
+ void EnterCombat(Unit* /*who*/)
+ {
+ _twilightDamageTaken = 0;
+ _materialDamageTaken = 0;
+
+ _events.ScheduleEvent(EVENT_TRIGGER_BERSERK, 8 * MINUTE * IN_MILLISECONDS);
+ }
+
+ void JustReachedHome()
+ {
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION)))
+ twilightHalion->DespawnOrUnsummon();
+
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION)))
+ {
+ halion->AI()->SetData(DATA_EVADE_METHOD, 1);
+ halion->AI()->EnterEvadeMode();
+ }
+
+ _instance->SetBossState(DATA_HALION, FAIL);
+ }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_INTRO_HALION:
+ _events.Reset();
+ _events.SetPhase(PHASE_INTRO);
+ _events.ScheduleEvent(EVENT_START_INTRO, 2000);
+ break;
+ case ACTION_MONITOR_CORPOREALITY:
+ {
+ for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++)
+ {
+ Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr));
+ if (!halion)
+ continue;
+
+ halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), false);
+ halion->AI()->SetData(DATA_FIGHT_PHASE, PHASE_THREE);
+
+ if (itr == DATA_TWILIGHT_HALION)
+ continue;
+
+ halion->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING);
+ halion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ }
+
+ // Summon Twilight portals
+ DoCast(me, SPELL_SUMMON_EXIT_PORTALS);
+
+ _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 1);
+ // Hardcoding doesn't really matter here.
+ _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, 50);
+ _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 50);
+
+ _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 7500);
+ }
+ default:
+ break;
+ }
+ }
+
+ void UpdateAI(uint32 const 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())
+ {
+ EnterEvadeMode();
+ return;
+ }
+
+ _events.Update(diff);
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_START_INTRO:
+ DoCast(me, SPELL_COSMETIC_FIRE_PILLAR, true);
+ _events.ScheduleEvent(EVENT_INTRO_PROGRESS_1, 4000);
+ break;
+ case EVENT_INTRO_PROGRESS_1:
+ for (uint8 i = DATA_BURNING_TREE_3; i <= DATA_BURNING_TREE_4; ++i)
+ if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetData64(i)))
+ _instance->HandleGameObject(_instance->GetData64(i), true, tree);
+ _events.ScheduleEvent(EVENT_INTRO_PROGRESS_2, 4000);
+ break;
+ case EVENT_INTRO_PROGRESS_2:
+ for (uint8 i = DATA_BURNING_TREE_1; i <= DATA_BURNING_TREE_2; ++i)
+ if (GameObject* tree = ObjectAccessor::GetGameObject(*me, _instance->GetData64(i)))
+ _instance->HandleGameObject(_instance->GetData64(i), true, tree);
+ _events.ScheduleEvent(EVENT_INTRO_PROGRESS_3, 4000);
+ break;
+ case EVENT_INTRO_PROGRESS_3:
+ DoCast(me, SPELL_FIERY_EXPLOSION);
+ if (Creature* halion = me->GetMap()->SummonCreature(NPC_HALION, HalionSpawnPos))
+ halion->AI()->Talk(SAY_INTRO);
+ break;
+ case EVENT_TWILIGHT_MENDING:
+ if (ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION))) // Just check if physical Halion is spawned
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION)))
+ twilightHalion->CastSpell((Unit*)NULL, SPELL_TWILIGHT_MENDING, true);
+ break;
+ case EVENT_TRIGGER_BERSERK:
+ for (uint8 i = DATA_HALION; i <= DATA_TWILIGHT_HALION; i++)
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(i)))
+ halion->CastSpell(halion, SPELL_BERSERK, true);
+ break;
+ case EVENT_SHADOW_PULSARS_SHOOT:
+ if (Creature* twilightHalion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TWILIGHT_HALION)))
+ twilightHalion->AI()->Talk(SAY_SPHERE_PULSE);
+
+ if (Creature* orbCarrier = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_ORB_CARRIER)))
+ orbCarrier->AI()->DoAction(ACTION_SHOOT);
+
+ _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, 29000);
+ break;
+ case EVENT_CHECK_CORPOREALITY:
+ UpdateCorporeality();
+ _events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, 5000);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ void SetData(uint32 id, uint32 value)
+ {
+ switch (id)
+ {
+ case DATA_MATERIAL_DAMAGE_TAKEN:
+ _materialDamageTaken += value;
+ break;
+ case DATA_TWILIGHT_DAMAGE_TAKEN:
+ _twilightDamageTaken += value;
+ break;
+ case DATA_FIGHT_PHASE:
+ _events.SetPhase(value);
+ switch (value)
+ {
+ case PHASE_ONE:
+ DoZoneInCombat();
+ break;
+ case PHASE_TWO:
+ _events.ScheduleEvent(EVENT_SHADOW_PULSARS_SHOOT, 29000);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ private:
+ /// TODO: Find out a better scaling, if any.
+ // [0 , 0.98[: Corporeality goes down
+ // [0.98, 0.99]: Do nothing
+ // ]0.99, 1.01[: Twilight Mending
+ // [1.01, 1.02]: Do nothing
+ // ]1.02, +oo [: Corporeality goes up
+ void UpdateCorporeality()
+ {
+ uint8 oldValue = _materialCorporealityValue;
+ if (_twilightDamageTaken == 0 || _materialDamageTaken == 0)
+ {
+ _events.ScheduleEvent(EVENT_TWILIGHT_MENDING, 100);
+ _twilightDamageTaken = 0;
+ _materialDamageTaken = 0;
+ return;
+ }
+
+ float damageRatio = float(_materialDamageTaken) / float(_twilightDamageTaken);
+
+ CorporealityEvent action = CORPOREALITY_NONE;
+ if (damageRatio < 0.98f) // [0 , 0.98[: Corporeality goes down
+ action = CORPOREALITY_DECREASE;
+ else if (0.99f < damageRatio && damageRatio < 1.01f) // ]0.99, 1.01[: Twilight Mending
+ action = CORPOREALITY_TWILIGHT_MENDING;
+ else if (1.02f < damageRatio) // ]1.02, +oo [: Corporeality goes up
+ action = CORPOREALITY_INCREASE;
+
+ switch (action)
+ {
+ case CORPOREALITY_NONE:
+ {
+ _materialDamageTaken = 0;
+ _twilightDamageTaken = 0;
+ return;
+ }
+ case CORPOREALITY_INCREASE:
+ {
+ if (_materialCorporealityValue >= (MAX_CORPOREALITY_STATE - 1))
+ return;
+ ++_materialCorporealityValue;
+ break;
+ }
+ case CORPOREALITY_DECREASE:
+ {
+ if (_materialCorporealityValue <= 0)
+ return;
+ --_materialCorporealityValue;
+ break;
+ }
+ case CORPOREALITY_TWILIGHT_MENDING:
+ {
+ _events.ScheduleEvent(EVENT_TWILIGHT_MENDING, 100);
+ _materialDamageTaken = 0;
+ _twilightDamageTaken = 0;
+ return;
+ }
+ default:
+ break;
+ }
+
+ _materialDamageTaken = 0;
+ _twilightDamageTaken = 0;
+
+ _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, _materialCorporealityValue * 10);
+ _instance->DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 100 - _materialCorporealityValue * 10);
+
+ for (uint8 itr = DATA_HALION; itr <= DATA_TWILIGHT_HALION; itr++)
+ {
+ if (Creature* halion = ObjectAccessor::GetCreature(*me, _instance->GetData64(itr)))
+ {
+ RemoveCorporeality(halion, itr == DATA_TWILIGHT_HALION);
+ halion->CastSpell(halion, GetSpell(_materialCorporealityValue, itr == DATA_TWILIGHT_HALION), true);
+
+ if (itr == DATA_TWILIGHT_HALION)
+ halion->AI()->Talk(oldValue < _materialCorporealityValue ? EMOTE_CORPOREALITY_TOT : EMOTE_CORPOREALITY_TIT, halion->GetGUID());
+ else // if (itr == DATA_HALION)
+ halion->AI()->Talk(oldValue > _materialCorporealityValue ? EMOTE_CORPOREALITY_POT : EMOTE_CORPOREALITY_PIP, halion->GetGUID());
+ }
+ }
+ }
+
+ void RemoveCorporeality(Creature* who, bool isTwilight = false)
+ {
+ for (uint8 i = 0; i < MAX_CORPOREALITY_STATE; i++)
+ {
+ uint32 spellID = (isTwilight ? _corporealityReference[i].twilightRealmSpell : _corporealityReference[i].materialRealmSpell);
+ if (who->HasAura(spellID))
+ {
+ who->RemoveAurasDueToSpell(spellID);
+ break;
+ }
+ }
+ }
+
+ uint32 GetSpell(uint8 pctValue, bool isTwilight = false) const
+ {
+ CorporealityEntry entry = _corporealityReference[pctValue];
+ return isTwilight ? entry.twilightRealmSpell : entry.materialRealmSpell;
+ }
+
+ EventMap _events;
+ InstanceScript* _instance;
+ SummonList _summons;
+
+ bool _corporealityCheck;
+
+ uint32 _twilightDamageTaken;
+ uint32 _materialDamageTaken;
+ uint8 _materialCorporealityValue;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_halion_controllerAI>(creature);
+ }
+};
+
+typedef npc_halion_controller::npc_halion_controllerAI controllerAI;
+
+class npc_orb_carrier : public CreatureScript
+{
+ public:
+ npc_orb_carrier() : CreatureScript("npc_orb_carrier") { }
+
+ struct npc_orb_carrierAI : public ScriptedAI
+ {
+ npc_orb_carrierAI(Creature* creature) : ScriptedAI(creature),
+ instance(creature->GetInstanceScript())
+ {
+ ASSERT(creature->GetVehicleKit());
+ }
+
+ void UpdateAI(uint32 const /*diff*/)
+ {
+ /// According to sniffs this spell is cast every 1 or 2 seconds.
+ /// However, refreshing it looks bad, so just cast the spell if
+ /// we are not channeling it.
+ if (!me->HasUnitState(UNIT_STATE_CASTING))
+ me->CastSpell((Unit*)NULL, SPELL_TRACK_ROTATION, false);
+
+ /// Workaround: This is here because even though the above spell has SPELL_ATTR1_CHANNEL_TRACK_TARGET,
+ /// we are having two creatures involded here. This attribute is handled clientside, meaning the client
+ /// sends orientation update itself. Here, no packet is sent, and the creature does not rotate. By
+ /// forcing the carrier to always be facing the rotation focus, we ensure everything works as it should.
+ if (Creature* rotationFocus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ORB_ROTATION_FOCUS)))
+ me->SetFacingToObject(rotationFocus); // setInFront
+ }
+
+ void DoAction(int32 const action)
+ {
+ if (action == ACTION_SHOOT)
+ {
+ Vehicle* vehicle = me->GetVehicleKit();
+ Unit* southOrb = vehicle->GetPassenger(SEAT_SOUTH);
+ Unit* northOrb = vehicle->GetPassenger(SEAT_NORTH);
+ if (southOrb && northOrb)
+ {
+ if (northOrb->GetTypeId() == TYPEID_UNIT)
+ northOrb->ToCreature()->AI()->Talk(EMOTE_WARN_LASER);
+ TriggerCutter(northOrb, southOrb);
+ }
+
+ if (!IsHeroic())
+ return;
+
+ Unit* eastOrb = vehicle->GetPassenger(SEAT_EAST);
+ Unit* westOrb = vehicle->GetPassenger(SEAT_WEST);
+ if (eastOrb && westOrb)
+ TriggerCutter(eastOrb, westOrb);
+ }
+ }
+ private:
+ InstanceScript* instance;
+
+ void TriggerCutter(Unit* caster, Unit* target)
+ {
+ caster->CastSpell(caster, SPELL_TWILIGHT_PULSE_PERIODIC, true);
+ target->CastSpell(target, SPELL_TWILIGHT_PULSE_PERIODIC, true);
+ caster->CastSpell(target, SPELL_TWILIGHT_CUTTER, false);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_orb_carrierAI>(creature);
+ }
+};
+
+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
+ {
+ npc_meteor_strike_initialAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ _instance(creature->GetInstanceScript())
+ { }
+
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_METEOR_STRIKE_AOE:
+ DoCast(me, SPELL_METEOR_STRIKE_AOE_DAMAGE, true);
+ DoCast(me, SPELL_METEOR_STRIKE_FIRE_AURA_1, true);
+ for (std::list<Creature*>::iterator itr = _meteorList.begin(); itr != _meteorList.end(); ++itr)
+ (*itr)->AI()->DoAction(ACTION_METEOR_STRIKE_BURN);
+ break;
+ }
+ }
+
+ void IsSummonedBy(Unit* summoner)
+ {
+ Creature* owner = summoner->ToCreature();
+ if (!owner)
+ return;
+
+ // Let Halion Controller count as summoner
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->JustSummoned(me);
+
+ DoCast(me, SPELL_METEOR_STRIKE_COUNTDOWN);
+ DoCast(me, SPELL_BIRTH_NO_VISUAL); // Unknown purpose
+
+ if (HalionAI* halionAI = CAST_AI(HalionAI, owner->AI()))
+ {
+ Position const* ownerPos = halionAI->GetMeteorStrikePosition();
+ Position newPos;
+ float angle[4];
+ angle[0] = me->GetAngle(ownerPos);
+ angle[1] = me->GetAngle(ownerPos) - static_cast<float>(M_PI/2);
+ angle[2] = me->GetAngle(ownerPos) - static_cast<float>(-M_PI/2);
+ angle[3] = me->GetAngle(ownerPos) - static_cast<float>(M_PI);
+
+ _meteorList.clear();
+ for (uint8 i = 0; i < 4; i++)
+ {
+ angle[i] = MapManager::NormalizeOrientation(angle[i]);
+ me->SetOrientation(angle[i]);
+ me->GetNearPosition(newPos, 10.0f, 0.0f); // Exact distance
+ if (Creature* meteor = me->SummonCreature(NPC_METEOR_STRIKE_NORTH + i, newPos, TEMPSUMMON_TIMED_DESPAWN, 30000))
+ _meteorList.push_back(meteor);
+ }
+ }
+ }
+
+ void UpdateAI(uint32 const /*diff*/) { }
+ void EnterEvadeMode() { }
+ private:
+ InstanceScript* _instance;
+ std::list<Creature*> _meteorList;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_meteor_strike_initialAI>(creature);
+ }
+};
+
+class npc_meteor_strike : public CreatureScript
+{
+ public:
+ npc_meteor_strike() : CreatureScript("npc_meteor_strike") { }
+
+ struct npc_meteor_strikeAI : public Scripted_NoMovementAI
+ {
+ npc_meteor_strikeAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ _instance(creature->GetInstanceScript())
+ {
+ _range = 5.0f;
+ _spawnCount = 0;
+ }
+
+ void DoAction(int32 const action)
+ {
+ if (action == ACTION_METEOR_STRIKE_BURN)
+ {
+ DoCast(me, SPELL_METEOR_STRIKE_FIRE_AURA_2, true);
+ me->setActive(true);
+ _events.ScheduleEvent(EVENT_SPAWN_METEOR_FLAME, 500);
+ }
+ }
+
+ void IsSummonedBy(Unit* /*summoner*/)
+ {
+ // Let Halion Controller count as summoner.
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->JustSummoned(me);
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (_spawnCount > 5)
+ return;
+
+ _events.Update(diff);
+
+ if (_events.ExecuteEvent() == EVENT_SPAWN_METEOR_FLAME)
+ {
+ Position pos;
+ me->GetNearPosition(pos, _range, 0.0f);
+
+ if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000))
+ {
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->JustSummoned(flame);
+
+ flame->CastSpell(flame, SPELL_METEOR_STRIKE_FIRE_AURA_2, true);
+ ++_spawnCount;
+ }
+ _range += 5.0f;
+ _events.ScheduleEvent(EVENT_SPAWN_METEOR_FLAME, 800);
+ }
+ }
+
+ private:
+ InstanceScript* _instance;
+ EventMap _events;
+ float _range;
+ uint8 _spawnCount;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_meteor_strikeAI>(creature);
+ }
+};
+
+class npc_combustion_consumption : public CreatureScript
+{
+ public:
+ npc_combustion_consumption() : CreatureScript("npc_combustion_consumption") { }
+
+ struct npc_combustion_consumptionAI : public Scripted_NoMovementAI
+ {
+ npc_combustion_consumptionAI(Creature* creature) : Scripted_NoMovementAI(creature),
+ _instance(creature->GetInstanceScript()), _summonerGuid(0)
+ {
+ switch (me->GetEntry())
+ {
+ case NPC_COMBUSTION:
+ _explosionSpell = SPELL_FIERY_COMBUSTION_EXPLOSION;
+ _damageSpell = SPELL_COMBUSTION_DAMAGE_AURA;
+ me->SetPhaseMask(0x01, true);
+ break;
+ case NPC_CONSUMPTION:
+ _explosionSpell = SPELL_SOUL_CONSUMPTION_EXPLOSION;
+ _damageSpell = SPELL_CONSUMPTION_DAMAGE_AURA;
+ me->SetPhaseMask(0x20, true);
+ break;
+ default: // Should never happen
+ _explosionSpell = 0;
+ _damageSpell = 0;
+ break;
+ }
+
+ if (IsHeroic())
+ me->SetPhaseMask(0x01 | 0x20, true);
+ }
+
+ void IsSummonedBy(Unit* summoner)
+ {
+ // Let Halion Controller count as summoner
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->JustSummoned(me);
+
+ _summonerGuid = summoner->GetGUID();
+ }
+
+ void SetData(uint32 type, uint32 stackAmount)
+ {
+ Unit* summoner = ObjectAccessor::GetUnit(*me, _summonerGuid);
+
+ if (type != DATA_STACKS_DISPELLED || !_damageSpell || !_explosionSpell || !summoner)
+ return;
+
+ me->CastCustomSpell(SPELL_SCALE_AURA, SPELLVALUE_AURA_STACK, stackAmount, me);
+ DoCast(me, _damageSpell);
+
+ int32 damage = 1200 + (stackAmount * 1290); // Needs more researches.
+ summoner->CastCustomSpell(_explosionSpell, SPELLVALUE_BASE_POINT0, damage, summoner);
+ }
+
+ void UpdateAI(uint32 const /*diff*/) { }
+
+ private:
+ InstanceScript* _instance;
+ uint32 _explosionSpell;
+ uint32 _damageSpell;
+ uint64 _summonerGuid;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_combustion_consumptionAI>(creature);
+ }
+};
+
+class npc_living_inferno : public CreatureScript
+{
+ public:
+ npc_living_inferno() : CreatureScript("npc_living_inferno") { }
+
+ struct npc_living_infernoAI : public ScriptedAI
+ {
+ npc_living_infernoAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void IsSummonedBy(Unit* /*summoner*/)
+ {
+ me->SetInCombatWithZone();
+ me->CastSpell(me, SPELL_BLAZING_AURA, true);
+
+ if (InstanceScript* instance = me->GetInstanceScript())
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->JustSummoned(me);
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ me->DespawnOrUnsummon(1);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_living_infernoAI>(creature);
+ }
+};
+
+//! Need sniff data
+class npc_living_ember : public CreatureScript
+{
+ public:
+ npc_living_ember() : CreatureScript("npc_living_ember") { }
+
+ struct npc_living_emberAI : public ScriptedAI
+ {
+ npc_living_emberAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void Reset()
+ {
+ _hasEnraged = false;
+ }
+
+ void EnterCombat(Unit* /*who*/)
+ {
+ _enrageTimer = 20000;
+ _hasEnraged = false;
+ }
+
+ void IsSummonedBy(Unit* /*summoner*/)
+ {
+ if (InstanceScript* instance = me->GetInstanceScript())
+ if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
+ controller->AI()->JustSummoned(me);
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ me->DespawnOrUnsummon(1);
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ if (!_hasEnraged && _enrageTimer <= diff)
+ {
+ _hasEnraged = true;
+ DoCast(me, SPELL_BERSERK);
+ }
+ else _enrageTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ uint32 _enrageTimer;
+ bool _hasEnraged;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetRubySanctumAI<npc_living_emberAI>(creature);
+ }
+};
+
+class go_twilight_portal : public GameObjectScript
+{
+ public:
+ go_twilight_portal() : GameObjectScript("go_twilight_portal") { }
+
+ struct go_twilight_portalAI : public GameObjectAI
+ {
+ go_twilight_portalAI(GameObject* gameobject) : GameObjectAI(gameobject),
+ _instance(gameobject->GetInstanceScript()), _deleted(false)
+ {
+ switch (gameobject->GetEntry())
+ {
+ case GO_HALION_PORTAL_EXIT:
+ gameobject->SetPhaseMask(0x20, true);
+ _spellId = gameobject->GetGOInfo()->goober.spellId;
+ break;
+ case GO_HALION_PORTAL_1:
+ case GO_HALION_PORTAL_2: // Not used, not seen in sniffs. Just in case.
+ gameobject->SetPhaseMask(0x1, true);
+ /// Because WDB template has non-existent spell ID, not seen in sniffs either, meh
+ _spellId = SPELL_TWILIGHT_REALM;
+ break;
+ default:
+ _spellId = 0;
+ break;
+ }
+ }
+
+ bool GossipHello(Player* player)
+ {
+ if (_spellId != 0)
+ player->CastSpell(player, _spellId, true);
+ return true;
+ }
+
+ void UpdateAI(uint32 /*diff*/)
+ {
+ if (_instance->GetBossState(DATA_HALION) == IN_PROGRESS)
+ return;
+
+ if (!_deleted)
+ {
+ _deleted = true;
+ go->Delete();
+ }
+ }
+
+ private:
+ InstanceScript* _instance;
+ uint32 _spellId;
+ bool _deleted;
+ };
+
+ GameObjectAI* GetAI(GameObject* gameobject) const
+ {
+ return GetRubySanctumAI<go_twilight_portalAI>(gameobject);
+ }
+};
+
+class spell_halion_meteor_strike_marker : public SpellScriptLoader
+{
+ public:
+ spell_halion_meteor_strike_marker() : SpellScriptLoader("spell_halion_meteor_strike_marker") { }
+
+ class spell_halion_meteor_strike_marker_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_halion_meteor_strike_marker_AuraScript);
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (!GetCaster())
+ return;
+
+ if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
+ if (Creature* creCaster = GetCaster()->ToCreature())
+ creCaster->AI()->DoAction(ACTION_METEOR_STRIKE_AOE);
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_halion_meteor_strike_marker_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_halion_meteor_strike_marker_AuraScript();
+ }
+};
+
+class spell_halion_combustion_consumption : public SpellScriptLoader
+{
+ public:
+ spell_halion_combustion_consumption(char const* scriptName, uint32 spell) : SpellScriptLoader(scriptName), _spellID(spell) { }
+
+ class spell_halion_combustion_consumption_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_halion_combustion_consumption_AuraScript);
+
+ public:
+ spell_halion_combustion_consumption_AuraScript(uint32 spellID) : AuraScript(), _markSpell(spellID) { }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(_markSpell))
+ return false;
+ return true;
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH)
+ return;
+
+ if (GetTarget()->HasAura(_markSpell))
+ GetTarget()->RemoveAurasDueToSpell(_markSpell, 0, 0, AURA_REMOVE_BY_EXPIRE);
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->CastSpell(GetTarget(), _markSpell, true);
+ }
+
+ void AddMarkStack(AuraEffect const* /*aurEff*/)
+ {
+ GetTarget()->CastSpell(GetTarget(), _markSpell, true);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_halion_combustion_consumption_AuraScript::AddMarkStack, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ AfterEffectApply += AuraEffectApplyFn(spell_halion_combustion_consumption_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_halion_combustion_consumption_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
+ }
+
+ uint32 _markSpell;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_halion_combustion_consumption_AuraScript(_spellID);
+ }
+
+ private:
+ uint32 _spellID;
+};
+
+class spell_halion_marks : public SpellScriptLoader
+{
+ public:
+ spell_halion_marks(char const* scriptName, uint32 summonSpell, uint32 removeSpell) : SpellScriptLoader(scriptName),
+ _summonSpell(summonSpell), _removeSpell(removeSpell) { }
+
+ class spell_halion_marks_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_halion_marks_AuraScript);
+
+ public:
+ spell_halion_marks_AuraScript(uint32 summonSpell, uint32 removeSpell) : AuraScript(),
+ _summonSpellId(summonSpell), _removeSpellId(removeSpell) { }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(_summonSpellId))
+ return false;
+ return true;
+ }
+
+ /// We were purged. Force removed stacks to zero and trigger the appropriated remove handler.
+ void BeforeDispel(DispelInfo* dispelData)
+ {
+ // Prevent any stack from being removed at this point.
+ dispelData->SetRemovedCharges(0);
+
+ if (Unit* dispelledUnit = GetUnitOwner())
+ if (dispelledUnit->HasAura(_removeSpellId))
+ dispelledUnit->RemoveAurasDueToSpell(_removeSpellId, 0, 0, AURA_REMOVE_BY_EXPIRE);
+ }
+
+ void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ return;
+
+ // Stacks marker
+ GetTarget()->CastCustomSpell(_summonSpellId, SPELLVALUE_BASE_POINT1, aurEff->GetBase()->GetStackAmount(), GetTarget(), TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
+ }
+
+ void Register()
+ {
+ OnDispel += AuraDispelFn(spell_halion_marks_AuraScript::BeforeDispel);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_halion_marks_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+
+ uint32 _summonSpellId;
+ uint32 _removeSpellId;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_halion_marks_AuraScript(_summonSpell, _removeSpell);
+ }
+
+ private:
+ uint32 _summonSpell;
+ uint32 _removeSpell;
+};
+
+class spell_halion_damage_aoe_summon : public SpellScriptLoader
+{
+ public:
+ spell_halion_damage_aoe_summon() : SpellScriptLoader("spell_halion_damage_aoe_summon") { }
+
+ class spell_halion_damage_aoe_summon_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_halion_damage_aoe_summon_SpellScript);
+
+ void HandleSummon(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ Unit* caster = GetCaster();
+ uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue);
+ SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB));
+ uint32 duration = uint32(GetSpellInfo()->GetDuration());
+
+ Position pos;
+ caster->GetPosition(&pos);
+ if (Creature* summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, caster, GetSpellInfo()->Id))
+ if (summon->IsAIEnabled)
+ summon->AI()->SetData(DATA_STACKS_DISPELLED, GetSpellValue()->EffectBasePoints[EFFECT_1]);
+ }
+
+ void Register()
+ {
+ OnEffectHit += SpellEffectFn(spell_halion_damage_aoe_summon_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_halion_damage_aoe_summon_SpellScript();
+ }
+};
+
+class spell_halion_twilight_realm_handlers : public SpellScriptLoader
+{
+ public:
+ spell_halion_twilight_realm_handlers(const char* scriptName, uint32 beforeHitSpell, bool isApplyHandler) : SpellScriptLoader(scriptName),
+ _beforeHitSpell(beforeHitSpell), _isApplyHandler(isApplyHandler)
+ { }
+
+ class spell_halion_twilight_realm_handlers_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_halion_twilight_realm_handlers_AuraScript);
+
+ public:
+ spell_halion_twilight_realm_handlers_AuraScript(uint32 beforeHitSpell, bool isApplyHandler) : AuraScript(),
+ _isApply(isApplyHandler), _beforeHitSpellId(beforeHitSpell)
+ { }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(_beforeHitSpellId))
+ return false;
+ return true;
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(SPELL_TWILIGHT_REALM);
+ if (InstanceScript* instance = GetTarget()->GetInstanceScript())
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7);
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*handle*/)
+ {
+ Unit* target = GetTarget();
+ if (!target)
+ return;
+
+ target->RemoveAurasDueToSpell(_beforeHitSpellId, 0, 0, AURA_REMOVE_BY_ENEMY_SPELL);
+ if (InstanceScript* instance = target->GetInstanceScript())
+ instance->SendEncounterUnit(ENCOUNTER_FRAME_UNK7);
+ }
+
+ void Register()
+ {
+ if (!_isApply)
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_halion_twilight_realm_handlers_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_halion_twilight_realm_handlers_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ else
+ AfterEffectApply += AuraEffectApplyFn(spell_halion_twilight_realm_handlers_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PHASE, AURA_EFFECT_HANDLE_REAL);
+ }
+
+ bool _isApply;
+ uint32 _beforeHitSpellId;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_halion_twilight_realm_handlers_AuraScript(_beforeHitSpell, _isApplyHandler);
+ }
+
+ private:
+ uint32 _beforeHitSpell;
+ bool _isApplyHandler;
+};
+
+class spell_halion_clear_debuffs : public SpellScriptLoader
+{
+ public:
+ spell_halion_clear_debuffs() : SpellScriptLoader("spell_halion_clear_debuffs") { }
+
+ class spell_halion_clear_debuffs_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_halion_clear_debuffs_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_CLEAR_DEBUFFS))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_REALM))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ if (GetHitUnit()->HasAura(GetSpellInfo()->Effects[effIndex].CalcValue()))
+ GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[effIndex].CalcValue());
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_halion_clear_debuffs_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_halion_clear_debuffs_SpellScript();
+ }
+};
+
+class TwilightCutterSelector
+{
+ public:
+ TwilightCutterSelector(Unit* caster, Unit* cutterCaster) : _caster(caster), _cutterCaster(cutterCaster) {}
+
+ bool operator()(WorldObject* unit)
+ {
+ return !unit->IsInBetween(_caster, _cutterCaster, 4.0f);
+ }
+
+ private:
+ Unit* _caster;
+ Unit* _cutterCaster;
+};
+
+class spell_halion_twilight_cutter : public SpellScriptLoader
+{
+ public:
+ spell_halion_twilight_cutter() : SpellScriptLoader("spell_halion_twilight_cutter") { }
+
+ class spell_halion_twilight_cutter_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_halion_twilight_cutter_SpellScript);
+
+ void RemoveNotBetween(std::list<WorldObject*>& unitList)
+ {
+ if (unitList.empty())
+ return;
+
+ Unit* caster = GetCaster();
+ if (Aura* cutter = caster->GetAura(SPELL_TWILIGHT_CUTTER))
+ {
+ if (Unit* cutterCaster = cutter->GetCaster())
+ {
+ unitList.remove_if(TwilightCutterSelector(caster, cutterCaster));
+ return;
+ }
+ }
+
+ // In case cutter caster werent found for some reason
+ unitList.clear();
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_halion_twilight_cutter_SpellScript::RemoveNotBetween, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_halion_twilight_cutter_SpellScript();
+ }
+};
+
+class spell_halion_twilight_phasing : public SpellScriptLoader
+{
+ public:
+ spell_halion_twilight_phasing() : SpellScriptLoader("spell_halion_twilight_phasing") { }
+
+ class spell_halion_twilight_phasing_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_halion_twilight_phasing_SpellScript);
+
+ void Phase()
+ {
+ Unit* caster = GetCaster();
+ caster->CastSpell(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), SPELL_SUMMON_TWILIGHT_PORTAL, true);
+ caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_halion_twilight_phasing_SpellScript::Phase);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_halion_twilight_phasing_SpellScript();
+ }
+};
+
+class spell_halion_summon_exit_portals : public SpellScriptLoader
+{
+ public:
+ spell_halion_summon_exit_portals() : SpellScriptLoader("spell_halion_summon_exit_portals") { }
+
+ class spell_halion_summon_exit_portals_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_halion_summon_exit_portals_SpellScript);
+
+ void OnSummon(SpellEffIndex effIndex)
+ {
+ WorldLocation summonPos = *GetExplTargetDest();
+ Position offset = {0.0f, 20.0f, 0.0f, 0.0f};
+ if (effIndex == EFFECT_1)
+ offset.m_positionY = -20.0f;
+
+ summonPos.RelocateOffset(offset);
+
+ SetExplTargetDest(summonPos);
+ GetHitDest()->RelocateOffset(offset);
+ }
+
+ void Register()
+ {
+ OnEffectLaunch += SpellEffectFn(spell_halion_summon_exit_portals_SpellScript::OnSummon, EFFECT_0, SPELL_EFFECT_SUMMON_OBJECT_WILD);
+ OnEffectLaunch += SpellEffectFn(spell_halion_summon_exit_portals_SpellScript::OnSummon, EFFECT_1, SPELL_EFFECT_SUMMON_OBJECT_WILD);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_halion_summon_exit_portals_SpellScript();
+ }
+};
+
+void AddSC_boss_halion()
+{
+ new boss_halion();
+ new boss_twilight_halion();
+
+ new npc_halion_controller();
+ new npc_meteor_strike_initial();
+ new npc_meteor_strike();
+ new npc_combustion_consumption();
+ new npc_orb_carrier();
+ new npc_living_inferno();
+ new npc_living_ember();
+
+ new go_twilight_portal();
+
+ new spell_halion_meteor_strike_marker();
+ new spell_halion_combustion_consumption("spell_halion_soul_consumption", SPELL_MARK_OF_CONSUMPTION);
+ new spell_halion_combustion_consumption("spell_halion_fiery_combustion", SPELL_MARK_OF_COMBUSTION);
+ new spell_halion_marks("spell_halion_mark_of_combustion", SPELL_FIERY_COMBUSTION_SUMMON, SPELL_FIERY_COMBUSTION);
+ new spell_halion_marks("spell_halion_mark_of_consumption", SPELL_SOUL_CONSUMPTION_SUMMON, SPELL_SOUL_CONSUMPTION);
+ new spell_halion_damage_aoe_summon();
+ new spell_halion_twilight_realm_handlers("spell_halion_leave_twilight_realm", SPELL_SOUL_CONSUMPTION, false);
+ new spell_halion_twilight_realm_handlers("spell_halion_enter_twilight_realm", SPELL_FIERY_COMBUSTION, true);
+ new spell_halion_summon_exit_portals();
+ new spell_halion_twilight_phasing();
+ new spell_halion_twilight_cutter();
+ new spell_halion_clear_debuffs();
+}
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 5a7809dbe70..61d693104fa 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ruby_sanctum.h"
enum Texts
@@ -41,6 +42,8 @@ enum Events
EVENT_FLIGHT = 2,
EVENT_FLAME_BREATH = 3,
EVENT_CONFLAGRATION = 4,
+ EVENT_LAND_GROUND = 5,
+ EVENT_AIR_MOVEMENT = 6,
// Event group
EVENT_GROUP_LAND_PHASE = 1,
@@ -50,6 +53,8 @@ enum MovementPoints
{
POINT_FLIGHT = 1,
POINT_LAND = 2,
+ POINT_TAKEOFF = 3,
+ POINT_LAND_GROUND = 4
};
enum Misc
@@ -57,8 +62,9 @@ enum Misc
SOUND_ID_DEATH = 17531,
};
-Position const SavianaRagefireFlyPos = {3155.51f, 683.844f, 95.20f, 4.69f};
-Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 79.54f, 4.69f};
+Position const SavianaRagefireFlyOutPos = {3155.51f, 683.844f, 95.0f, 4.69f};
+Position const SavianaRagefireFlyInPos = {3151.07f, 636.443f, 79.540f, 4.69f};
+Position const SavianaRagefireLandPos = {3151.07f, 636.443f, 78.649f, 4.69f};
class boss_saviana_ragefire : public CreatureScript
{
@@ -95,7 +101,7 @@ class boss_saviana_ragefire : public CreatureScript
void MovementInform(uint32 type, uint32 point)
{
- if (type != POINT_MOTION_TYPE)
+ if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
return;
switch (point)
@@ -105,13 +111,18 @@ class boss_saviana_ragefire : public CreatureScript
Talk(SAY_CONFLAGRATION);
break;
case POINT_LAND:
+ events.ScheduleEvent(EVENT_LAND_GROUND, 1);
+ break;
+ case POINT_LAND_GROUND:
me->SetCanFly(false);
me->SetDisableGravity(false);
+ me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetReactState(REACT_AGGRESSIVE);
- if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
- me->GetMotionMaster()->MovementExpired();
DoStartMovement(me->getVictim());
break;
+ case POINT_TAKEOFF:
+ events.ScheduleEvent(EVENT_AIR_MOVEMENT, 1);
+ break;
default:
break;
}
@@ -148,8 +159,13 @@ class boss_saviana_ragefire : public CreatureScript
{
me->SetCanFly(true);
me->SetDisableGravity(true);
+ me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
me->SetReactState(REACT_PASSIVE);
- me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyPos);
+ me->AttackStop();
+ Position pos;
+ pos.Relocate(me);
+ pos.m_positionZ += 10.0f;
+ me->GetMotionMaster()->MoveTakeoff(POINT_TAKEOFF, pos);
events.ScheduleEvent(EVENT_FLIGHT, 50000);
events.DelayEvents(12500, EVENT_GROUP_LAND_PHASE);
break;
@@ -166,6 +182,12 @@ class boss_saviana_ragefire : public CreatureScript
DoCastVictim(SPELL_FLAME_BREATH);
events.ScheduleEvent(EVENT_FLAME_BREATH, urand(20000, 30000), EVENT_GROUP_LAND_PHASE);
break;
+ case EVENT_AIR_MOVEMENT:
+ me->GetMotionMaster()->MovePoint(POINT_FLIGHT, SavianaRagefireFlyOutPos);
+ break;
+ case EVENT_LAND_GROUND:
+ me->GetMotionMaster()->MoveLand(POINT_LAND_GROUND, SavianaRagefireLandPos);
+ break;
default:
break;
}
@@ -242,7 +264,7 @@ class spell_saviana_conflagration_throwback : public SpellScriptLoader
{
PreventHitDefaultEffect(effIndex);
GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true);
- GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireLandPos);
+ GetHitUnit()->GetMotionMaster()->MovePoint(POINT_LAND, SavianaRagefireFlyInPos);
}
void Register()
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
index f9e302d7634..939c22325d7 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp
@@ -15,9 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "ruby_sanctum.h"
-
+#include "Player.h"
+#include "TemporarySummon.h"
+#include "WorldPacket.h"
DoorData const doorData[] =
{
@@ -36,18 +39,29 @@ class instance_ruby_sanctum : public InstanceMapScript
{
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
- BaltharusTheWarbornGUID = 0;
- GeneralZarithrianGUID = 0;
- SavianaRagefireGUID = 0;
- HalionGUID = 0;
- HalionControllerGUID = 0;
+ BaltharusTheWarbornGUID = 0;
+ GeneralZarithrianGUID = 0;
+ SavianaRagefireGUID = 0;
+ HalionGUID = 0;
+ TwilightHalionGUID = 0;
+ OrbCarrierGUID = 0;
+ OrbRotationFocusGUID = 0;
+ HalionControllerGUID = 0;
CrystalChannelTargetGUID = 0;
- XerestraszaGUID = 0;
- BaltharusSharedHealth = 0;
- FlameWallsGUID = 0;
- FlameRingGUID = 0;
- memset(ZarithianSpawnStalkerGUID, 0, 2*sizeof(uint64));
- memset(BurningTreeGUID, 0, 4*sizeof(uint64));
+ XerestraszaGUID = 0;
+ BaltharusSharedHealth = 0;
+ FlameWallsGUID = 0;
+ FlameRingGUID = 0;
+
+ memset(ZarithrianSpawnStalkerGUID, 0, 2 * sizeof(uint64));
+ memset(BurningTreeGUID, 0, 4 * sizeof(uint64));
+ }
+
+ void OnPlayerEnter(Player* /*player*/)
+ {
+ if (!GetData64(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE)
+ if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos))
+ halionController->AI()->DoAction(ACTION_INTRO_HALION);
}
void OnCreatureCreate(Creature* creature)
@@ -66,19 +80,29 @@ class instance_ruby_sanctum : public InstanceMapScript
case NPC_HALION:
HalionGUID = creature->GetGUID();
break;
+ case NPC_TWILIGHT_HALION:
+ TwilightHalionGUID = creature->GetGUID();
+ break;
case NPC_HALION_CONTROLLER:
HalionControllerGUID = creature->GetGUID();
+ break;
+ case NPC_ORB_CARRIER:
+ OrbCarrierGUID = creature->GetGUID();
+ break;
+ case NPC_ORB_ROTATION_FOCUS:
+ OrbRotationFocusGUID = creature->GetGUID();
+ break;
case NPC_BALTHARUS_TARGET:
CrystalChannelTargetGUID = creature->GetGUID();
break;
case NPC_XERESTRASZA:
XerestraszaGUID = creature->GetGUID();
break;
- case NPC_ZARITHIAN_SPAWN_STALKER:
- if (!ZarithianSpawnStalkerGUID[0])
- ZarithianSpawnStalkerGUID[0] = creature->GetGUID();
+ case NPC_ZARITHRIAN_SPAWN_STALKER:
+ if (!ZarithrianSpawnStalkerGUID[0])
+ ZarithrianSpawnStalkerGUID[0] = creature->GetGUID();
else
- ZarithianSpawnStalkerGUID[1] = creature->GetGUID();
+ ZarithrianSpawnStalkerGUID[1] = creature->GetGUID();
break;
default:
break;
@@ -100,6 +124,9 @@ class instance_ruby_sanctum : public InstanceMapScript
case GO_FLAME_RING:
FlameRingGUID = go->GetGUID();
break;
+ case GO_TWILIGHT_FLAME_RING:
+ TwilightFlameRingGUID = go->GetGUID();
+ break;
case GO_BURNING_TREE_1:
BurningTreeGUID[0] = go->GetGUID();
if (GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE)
@@ -137,7 +164,7 @@ class instance_ruby_sanctum : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
@@ -151,24 +178,28 @@ class instance_ruby_sanctum : public InstanceMapScript
return SavianaRagefireGUID;
case DATA_GENERAL_ZARITHRIAN:
return GeneralZarithrianGUID;
- case DATA_ZARITHIAN_SPAWN_STALKER_1:
- return ZarithianSpawnStalkerGUID[0];
- case DATA_ZARITHIAN_SPAWN_STALKER_2:
- return ZarithianSpawnStalkerGUID[1];
+ case DATA_ZARITHRIAN_SPAWN_STALKER_1:
+ case DATA_ZARITHRIAN_SPAWN_STALKER_2:
+ return ZarithrianSpawnStalkerGUID[type - DATA_ZARITHRIAN_SPAWN_STALKER_1];
case DATA_HALION:
return HalionGUID;
+ case DATA_TWILIGHT_HALION:
+ return TwilightHalionGUID;
+ case DATA_ORB_CARRIER:
+ return OrbCarrierGUID;
+ case DATA_ORB_ROTATION_FOCUS:
+ return OrbRotationFocusGUID;
case DATA_HALION_CONTROLLER:
return HalionControllerGUID;
case DATA_BURNING_TREE_1:
- return BurningTreeGUID[0];
case DATA_BURNING_TREE_2:
- return BurningTreeGUID[1];
case DATA_BURNING_TREE_3:
- return BurningTreeGUID[2];
case DATA_BURNING_TREE_4:
- return BurningTreeGUID[3];
+ return BurningTreeGUID[type - DATA_BURNING_TREE_1];
case DATA_FLAME_RING:
return FlameRingGUID;
+ case DATA_TWILIGHT_FLAME_RING:
+ return TwilightFlameRingGUID;
default:
break;
}
@@ -204,20 +235,30 @@ class instance_ruby_sanctum : public InstanceMapScript
break;
}
case DATA_GENERAL_ZARITHRIAN:
+ {
if (GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE)
HandleGameObject(FlameWallsGUID, state != IN_PROGRESS);
- /*
- if (state == DONE)
+
+ // Not called at instance loading, no big deal.
+ if (state == DONE && GetBossState(DATA_HALION) != DONE)
if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos))
halionController->AI()->DoAction(ACTION_INTRO_HALION);
- */
break;
+ }
case DATA_HALION:
- /*
- if (state != IN_PROGRESS)
+ {
+ DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TOGGLE, 0);
+ DoUpdateWorldState(WORLDSTATE_CORPOREALITY_TWILIGHT, 0);
+ DoUpdateWorldState(WORLDSTATE_CORPOREALITY_MATERIAL, 0);
+
+ // Reopen rings on wipe or success
+ if (state == DONE || state == FAIL)
+ {
HandleGameObject(FlameRingGUID, true);
- */
+ HandleGameObject(TwilightFlameRingGUID, true);
+ }
break;
+ }
default:
break;
}
@@ -227,25 +268,18 @@ class instance_ruby_sanctum : public InstanceMapScript
void SetData(uint32 type, uint32 data)
{
- switch (type)
- {
- case DATA_BALTHARUS_SHARED_HEALTH:
- BaltharusSharedHealth = data;
- break;
- }
+ if (type != DATA_BALTHARUS_SHARED_HEALTH)
+ return;
+
+ BaltharusSharedHealth = data;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
- switch (type)
- {
- case DATA_BALTHARUS_SHARED_HEALTH:
- return BaltharusSharedHealth;
- default:
- break;
- }
+ if (type != DATA_BALTHARUS_SHARED_HEALTH)
+ return 0;
- return 0;
+ return BaltharusSharedHealth;
}
std::string GetSaveData()
@@ -259,6 +293,13 @@ class instance_ruby_sanctum : public InstanceMapScript
return saveStream.str();
}
+ void FillInitialWorldStates(WorldPacket& data)
+ {
+ data << uint32(WORLDSTATE_CORPOREALITY_MATERIAL) << uint32(50);
+ data << uint32(WORLDSTATE_CORPOREALITY_TWILIGHT) << uint32(50);
+ data << uint32(WORLDSTATE_CORPOREALITY_TOGGLE) << uint32(0);
+ }
+
void Load(char const* str)
{
if (!str)
@@ -297,13 +338,18 @@ class instance_ruby_sanctum : public InstanceMapScript
uint64 GeneralZarithrianGUID;
uint64 SavianaRagefireGUID;
uint64 HalionGUID;
+ uint64 TwilightHalionGUID;
uint64 HalionControllerGUID;
+ uint64 OrbCarrierGUID;
+ uint64 OrbRotationFocusGUID;
uint64 CrystalChannelTargetGUID;
uint64 XerestraszaGUID;
uint64 FlameWallsGUID;
- uint64 ZarithianSpawnStalkerGUID[2];
+ uint64 ZarithrianSpawnStalkerGUID[2];
uint64 BurningTreeGUID[4];
uint64 FlameRingGUID;
+ uint64 TwilightFlameRingGUID;
+
uint32 BaltharusSharedHealth;
};
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
index 19ae66b6a60..ce543b95fd5 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ruby_sanctum.h"
+#include "Player.h"
enum Texts
{
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
index 02ade2ff3e7..47a55f9035f 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h
@@ -21,6 +21,7 @@
#include "SpellScript.h"
#include "Map.h"
#include "Creature.h"
+#include "GameObjectAI.h"
#define RSScriptName "instance_ruby_sanctum"
uint32 const EncounterCount = 4;
@@ -36,17 +37,21 @@ enum DataTypes
DATA_HALION = 3,
// Etc
- DATA_XERESTRASZA = 4,
- DATA_CRYSTAL_CHANNEL_TARGET = 5,
- DATA_BALTHARUS_SHARED_HEALTH = 6,
- DATA_ZARITHIAN_SPAWN_STALKER_1 = 7,
- DATA_ZARITHIAN_SPAWN_STALKER_2 = 8,
- DATA_HALION_CONTROLLER = 9,
- DATA_BURNING_TREE_1 = 10,
- DATA_BURNING_TREE_2 = 11,
- DATA_BURNING_TREE_3 = 12,
- DATA_BURNING_TREE_4 = 13,
- DATA_FLAME_RING = 14,
+ DATA_TWILIGHT_HALION = 4,
+ DATA_XERESTRASZA = 5,
+ DATA_CRYSTAL_CHANNEL_TARGET = 6,
+ DATA_BALTHARUS_SHARED_HEALTH = 7,
+ DATA_ZARITHRIAN_SPAWN_STALKER_1 = 8,
+ DATA_ZARITHRIAN_SPAWN_STALKER_2 = 9,
+ DATA_HALION_CONTROLLER = 10,
+ DATA_ORB_CARRIER = 11,
+ DATA_ORB_ROTATION_FOCUS = 12,
+ DATA_BURNING_TREE_1 = 13,
+ DATA_BURNING_TREE_2 = 14,
+ DATA_BURNING_TREE_3 = 15,
+ DATA_BURNING_TREE_4 = 16,
+ DATA_FLAME_RING = 17,
+ DATA_TWILIGHT_FLAME_RING = 18,
};
enum SharedActions
@@ -66,14 +71,14 @@ enum CreaturesIds
// General Zarithrian
NPC_GENERAL_ZARITHRIAN = 39746,
NPC_ONYX_FLAMECALLER = 39814,
- NPC_ZARITHIAN_SPAWN_STALKER = 39794,
+ NPC_ZARITHRIAN_SPAWN_STALKER = 39794,
// Saviana Ragefire
NPC_SAVIANA_RAGEFIRE = 39747,
// Halion
NPC_HALION = 39863,
- NPC_HALION_TWILIGHT = 40142,
+ NPC_TWILIGHT_HALION = 40142,
NPC_HALION_CONTROLLER = 40146,
NPC_LIVING_INFERNO = 40681,
NPC_LIVING_EMBER = 40683,
@@ -81,6 +86,8 @@ enum CreaturesIds
NPC_ORB_ROTATION_FOCUS = 40091,
NPC_SHADOW_ORB_N = 40083,
NPC_SHADOW_ORB_S = 40100,
+ NPC_SHADOW_ORB_E = 40468,
+ NPC_SHADOW_ORB_W = 40469,
NPC_METEOR_STRIKE_MARK = 40029,
NPC_METEOR_STRIKE_NORTH = 40041,
NPC_METEOR_STRIKE_EAST = 40042,
@@ -88,6 +95,8 @@ enum CreaturesIds
NPC_METEOR_STRIKE_SOUTH = 40044,
NPC_METEOR_STRIKE_FLAME = 40055,
NPC_COMBUSTION = 40001,
+ NPC_CONSUMPTION = 40135,
+ NPC_COMBAT_STALKER = 40151, // Seen in sniffs but not used, so no wonder.
// Xerestrasza
NPC_XERESTRASZA = 40429,
@@ -101,6 +110,7 @@ enum GameObjectsIds
GO_FIRE_FIELD = 203005,
GO_FLAME_WALLS = 203006,
GO_FLAME_RING = 203007,
+ GO_TWILIGHT_FLAME_RING = 203624,
GO_BURNING_TREE_1 = 203034,
GO_BURNING_TREE_2 = 203035,
GO_BURNING_TREE_3 = 203036,
@@ -114,6 +124,11 @@ enum WorldStatesRS
WORLDSTATE_CORPOREALITY_TOGGLE = 5051,
};
+enum InstanceSpell
+{
+ SPELL_BERSERK = 26662,
+};
+
template<class AI>
CreatureAI* GetRubySanctumAI(Creature* creature)
{
@@ -124,4 +139,15 @@ CreatureAI* GetRubySanctumAI(Creature* creature)
return NULL;
}
+template<class AI>
+GameObjectAI* GetRubySanctumAI(GameObject* go)
+{
+ if (InstanceMap* instance = go->GetMap()->ToInstanceMap())
+ if (instance->GetInstanceScript())
+ if (instance->GetScriptId() == sObjectMgr->GetScriptId(RSScriptName))
+ return new AI(go);
+
+ return NULL;
+}
+
#endif // RUBY_SANCTUM_H_
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
index e96408acc09..3c20acf34a6 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp
@@ -22,13 +22,39 @@ SDComment: AI for Argent Soldiers are not implemented. AI from bosses need more
SDCategory: Trial of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "trial_of_the_champion.h"
#include "ScriptedEscortAI.h"
-
-enum eSpells
+/*
+enum Yells
{
- //Eadric
+ // Eadric the Pure
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_RADIANCE = 2,
+ EMOTE_HAMMER_RIGHTEOUS = 3,
+ SAY_HAMMER_RIGHTEOUS = 4,
+ SAY_KILL_PLAYER = 5,
+ SAY_DEFEATED = 6,
+
+ // Argent Confessor Paletress
+ SAY_INTRO_1 = 0,
+ SAY_INTRO_2 = 1,
+ SAY_AGGRO = 2,
+ SAY_MEMORY_SUMMON = 3,
+ SAY_MEMORY_DEATH = 4,
+ SAY_KILL_PLAYER = 5,
+ SAY_DEFEATED = 6,
+
+ // Memory of X
+ EMOTE_WAKING_NIGHTMARE = 0
+};
+*/
+enum Spells
+{
+ // Eadric the Pure
SPELL_EADRIC_ACHIEVEMENT = 68197,
SPELL_HAMMER_JUSTICE = 66863,
SPELL_HAMMER_RIGHTEOUS = 66867,
@@ -217,8 +243,6 @@ public:
}
InstanceScript* instance;
-
- Creature* pMemory;
uint64 MemoryGUID;
bool bHealth;
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 9768b50b214..c1a2f9c07d2 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp
@@ -22,11 +22,12 @@ SDComment: missing yells. not sure about timers.
SDCategory: Trial of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "trial_of_the_champion.h"
-enum eSpells
+enum Spells
{
//phase 1
SPELL_PLAGUE_STRIKE = 67884,
@@ -60,13 +61,13 @@ enum eSpells
SPELL_KILL_CREDIT = 68663
};
-enum eModels
+enum Models
{
MODEL_SKELETON = 29846,
MODEL_GHOST = 21300
};
-enum ePhases
+enum Phases
{
PHASE_UNDEAD = 1,
PHASE_SKELETON = 2,
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 18c972b966c..35a22c6bf37 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp
@@ -23,10 +23,12 @@ SDComment: Is missing the ai to make the npcs look for a new mount and use it.
SDCategory: Trial Of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Vehicle.h"
#include "trial_of_the_champion.h"
+#include "Player.h"
enum eSpells
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
index 9ccd136731a..d2a01003324 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp
@@ -21,8 +21,11 @@ SDComment:
SDCategory: Trial Of the Champion
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "trial_of_the_champion.h"
+#include "Player.h"
#define MAX_ENCOUNTER 4
@@ -232,7 +235,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 uiData)
+ uint32 GetData(uint32 uiData) const
{
switch (uiData)
{
@@ -248,7 +251,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiData)
+ uint64 GetData64(uint32 uiData) const
{
switch (uiData)
{
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 c8236ace88c..9c0b894bfa7 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
@@ -26,9 +26,24 @@ EndScriptData */
npc_announcer_toc5
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "trial_of_the_champion.h"
#include "Vehicle.h"
+#include "Player.h"
+
+enum Yells
+{
+ SAY_INTRO_1 = 0,
+ SAY_INTRO_2 = 1,
+ SAY_INTRO_3 = 2,
+ SAY_AGGRO = 3,
+ SAY_PHASE_2 = 4,
+ SAY_PHASE_3 = 5,
+ SAY_KILL_PLAYER = 6,
+ SAY_DEATH = 7
+};
#define GOSSIP_START_EVENT1 "I'm ready to start challenge."
#define GOSSIP_START_EVENT2 "I'm ready for the next challenge."
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h
index cb3a43acdd0..6116a150334 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h
@@ -19,7 +19,7 @@
#ifndef DEF_TOC_H
#define DEF_TOC_H
-enum eData
+enum Data
{
BOSS_GRAND_CHAMPIONS,
BOSS_ARGENT_CHALLENGE_E,
@@ -46,7 +46,7 @@ enum Data64
DATA_GRAND_CHAMPION_3
};
-enum eNpcs
+enum CreatureIds
{
// Horde Champions
NPC_MOKRA = 35572,
@@ -78,7 +78,7 @@ enum eNpcs
NPC_ARELAS = 35005
};
-enum eGameObjects
+enum GameObjects
{
GO_MAIN_GATE = 195647,
@@ -92,7 +92,7 @@ enum eGameObjects
GO_PALETRESS_LOOT_H = 195324
};
-enum eVehicles
+enum Vehicles
{
//Grand Champions Alliance Vehicles
VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT = 35637,
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 e4dcf978574..a9dc9cf394d 100755..100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -16,35 +16,31 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: boss_anubarak_trial
-SD%Complete: ??%
-SDComment: based on /dev/rsa
-SDCategory:
-EndScriptData */
-
// Known bugs:
// Anubarak - underground phase partially not worked
// - tele after impale hit a permafrost doesn't work (the entire tele spell should be better)
-// Burrow - visual is vanishing
-// Burrower - Spider Frenzy not working as it should (frenzy not stacking)
// Scarab - Kill credit isn't crediting?
-// FrostSph - often they are casting Permafrost a little above the ground
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include <limits>
enum Yells
{
- SAY_INTRO = -1649055,
- SAY_AGGRO = -1649056,
- SAY_KILL1 = -1649057,
- SAY_KILL2 = -1649058,
- SAY_DEATH = -1649059,
- EMOTE_SPIKE = -1649060,
- SAY_BURROWER = -1649061,
- EMOTE_LEECHING_SWARM = -1649062,
- SAY_LEECHING_SWARM = -1649063,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_SUBMERGE = 2,
+ EMOTE_BURROWER = 3,
+ SAY_EMERGE = 4,
+ SAY_LEECHING_SWARM = 5,
+ EMOTE_LEECHING_SWARM = 6,
+ SAY_KILL_PLAYER = 7,
+ SAY_DEATH = 8,
+
+ EMOTE_SPIKE = 0
};
enum Summons
@@ -53,73 +49,77 @@ enum Summons
NPC_BURROW = 34862,
NPC_BURROWER = 34607,
NPC_SCARAB = 34605,
- NPC_SPIKE = 34660,
+ NPC_SPIKE = 34660
};
enum BossSpells
{
- SPELL_FREEZE_SLASH = 66012,
- SPELL_PENETRATING_COLD = 66013,
- SPELL_LEECHING_SWARM = 66118,
- SPELL_LEECHING_HEAL = 66125,
- SPELL_LEECHING_DAMAGE = 66240,
- SPELL_MARK = 67574,
- SPELL_SPIKE_CALL = 66169,
- SPELL_SUBMERGE_ANUBARAK = 65981,
- SPELL_CLEAR_ALL_DEBUFFS = 34098,
- SPELL_EMERGE_ANUBARAK = 65982,
- SPELL_SUMMON_BEATLES = 66339,
- SPELL_SUMMON_BURROWER = 66332,
+ SPELL_FREEZE_SLASH = 66012,
+ SPELL_PENETRATING_COLD = 66013,
+ SPELL_LEECHING_SWARM = 66118,
+ SPELL_LEECHING_SWARM_HEAL = 66125,
+ SPELL_LEECHING_SWARM_DMG = 66240,
+ SPELL_MARK = 67574,
+ SPELL_SPIKE_CALL = 66169,
+ SPELL_SUBMERGE_ANUBARAK = 65981,
+ SPELL_CLEAR_ALL_DEBUFFS = 34098,
+ SPELL_EMERGE_ANUBARAK = 65982,
+ SPELL_SUMMON_BEATLES = 66339,
+ SPELL_SUMMON_BURROWER = 66332,
// Burrow
- SPELL_CHURNING_GROUND = 66969,
+ SPELL_CHURNING_GROUND = 66969,
// Scarab
- SPELL_DETERMINATION = 66092,
- SPELL_ACID_MANDIBLE = 65774, //Passive - Triggered
+ SPELL_DETERMINATION = 66092,
+ SPELL_ACID_MANDIBLE = 65774, //Passive - Triggered
// Burrower
- SPELL_SPIDER_FRENZY = 66128,
- SPELL_EXPOSE_WEAKNESS = 67720, //Passive - Triggered
- SPELL_SHADOW_STRIKE = 66134,
- SPELL_SUBMERGE_EFFECT = 53421,
- SPELL_EMERGE_EFFECT = 66947,
+ SPELL_SPIDER_FRENZY = 66128,
+ SPELL_EXPOSE_WEAKNESS = 67720, //Passive - Triggered
+ SPELL_SHADOW_STRIKE = 66134,
+ SPELL_SUBMERGE_EFFECT = 68394,
+ SPELL_AWAKENED = 66311,
+ SPELL_EMERGE_EFFECT = 65982,
+
+ SPELL_PERSISTENT_DIRT = 68048,
- SUMMON_SCARAB = NPC_SCARAB,
- SUMMON_FROSTSPHERE = NPC_FROST_SPHERE,
- SPELL_BERSERK = 26662,
+ SUMMON_SCARAB = NPC_SCARAB,
+ SUMMON_FROSTSPHERE = NPC_FROST_SPHERE,
+ SPELL_BERSERK = 26662,
//Frost Sphere
- SPELL_FROST_SPHERE = 67539,
- SPELL_PERMAFROST = 66193,
- SPELL_PERMAFROST_VISUAL = 65882,
+ SPELL_FROST_SPHERE = 67539,
+ SPELL_PERMAFROST = 66193,
+ SPELL_PERMAFROST_VISUAL = 65882,
+ SPELL_PERMAFROST_MODEL = 66185,
//Spike
- SPELL_SUMMON_SPIKE = 66169,
- SPELL_SPIKE_SPEED1 = 65920,
- SPELL_SPIKE_TRAIL = 65921,
- SPELL_SPIKE_SPEED2 = 65922,
- SPELL_SPIKE_SPEED3 = 65923,
- SPELL_SPIKE_FAIL = 66181,
- SPELL_SPIKE_TELE = 66170,
+ SPELL_SUMMON_SPIKE = 66169,
+ SPELL_SPIKE_SPEED1 = 65920,
+ SPELL_SPIKE_TRAIL = 65921,
+ SPELL_SPIKE_SPEED2 = 65922,
+ SPELL_SPIKE_SPEED3 = 65923,
+ SPELL_SPIKE_FAIL = 66181,
+ SPELL_SPIKE_TELE = 66170
};
#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(66193, 67855, 67856, 67857)
enum SummonActions
{
- ACTION_SHADOW_STRIKE,
- ACTION_SCARAB_SUBMERGE,
+ ACTION_SHADOW_STRIKE = 0,
+ ACTION_SCARAB_SUBMERGE = 1
};
const Position SphereSpawn[6] =
{
- { 786.6439f, 108.2498f, 155.6701f, 0 },
- { 806.8429f, 150.5902f, 155.6701f, 0 },
- { 759.1386f, 163.9654f, 155.6701f, 0 },
- { 744.3701f, 119.5211f, 155.6701f, 0 },
- { 710.0211f, 120.8152f, 155.6701f, 0 },
- { 706.6383f, 161.5266f, 155.6701f, 0 },
+ {779.8038f, 150.6580f, 158.1426f, 0},
+ {736.0243f, 113.4201f, 158.0226f, 0},
+ {712.5712f, 160.9948f, 158.4368f, 0},
+ {701.4271f, 126.4740f, 158.0205f, 0},
+ {747.9202f, 155.0920f, 158.0613f, 0},
+ {769.6285f, 121.1024f, 158.0504f, 0},
};
enum MovementPoints
@@ -127,438 +127,468 @@ enum MovementPoints
POINT_FALL_GROUND = 1
};
-class boss_anubarak_trial : public CreatureScript
+enum PursuingSpikesPhases
{
-public:
- boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") { }
+ PHASE_NO_MOVEMENT = 0,
+ PHASE_IMPALE_NORMAL = 1,
+ PHASE_IMPALE_MIDDLE = 2,
+ PHASE_IMPALE_FAST = 3
+};
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_anubarak_trialAI(creature);
- };
+enum Events
+{
+ // Anub'arak
+ EVENT_FREEZE_SLASH = 1,
+ EVENT_PENETRATING_COLD = 2,
+ EVENT_SUMMON_NERUBIAN = 3,
+ EVENT_NERUBIAN_SHADOW_STRIKE = 4,
+ EVENT_SUBMERGE = 5,
+ EVENT_EMERGE = 6,
+ EVENT_PURSUING_SPIKE = 7,
+ EVENT_SUMMON_SCARAB = 8,
+ EVENT_SUMMON_FROST_SPHERE = 9,
+ EVENT_BERSERK = 10
+};
- struct boss_anubarak_trialAI : public ScriptedAI
- {
- boss_anubarak_trialAI(Creature* creature) : ScriptedAI(creature), Summons(me)
- {
- instance = creature->GetInstanceScript();
- }
+enum Phases
+{
+ // Anub'arak
+ PHASE_MELEE = 1,
+ PHASE_SUBMERGED = 2,
- InstanceScript* instance;
-
- SummonList Summons;
- std::list<uint64> m_vBurrowGUID;
- uint64 m_aSphereGUID[6];
-
- uint32 m_uiFreezeSlashTimer;
- uint32 m_uiPenetratingColdTimer;
- uint32 m_uiSummonNerubianTimer;
- uint32 m_uiNerubianShadowStrikeTimer;
- uint32 m_uiSubmergeTimer;
- uint32 m_uiPursuingSpikeTimer;
- uint32 m_uiSummonScarabTimer;
- uint32 m_uiSummonFrostSphereTimer;
- uint32 m_uiBerserkTimer;
-
- uint8 m_uiStage;
- bool m_bIntro;
- bool m_bReachedPhase3;
- uint64 m_uiTargetGUID;
- uint8 m_uiScarabSummoned;
-
- void Reset()
- {
- m_uiFreezeSlashTimer = 15*IN_MILLISECONDS;
- m_uiPenetratingColdTimer = 20*IN_MILLISECONDS;
- m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS;
- m_uiSummonNerubianTimer = 10*IN_MILLISECONDS;
- m_uiSubmergeTimer = 80*IN_MILLISECONDS;
-
- m_uiPursuingSpikeTimer = 2*IN_MILLISECONDS;
- m_uiSummonScarabTimer = 2*IN_MILLISECONDS;
-
- m_uiSummonFrostSphereTimer = 20*IN_MILLISECONDS;
-
- m_uiBerserkTimer = 10*MINUTE*IN_MILLISECONDS;
- m_uiStage = 0;
- m_uiScarabSummoned = 0;
- m_bIntro = true;
- m_bReachedPhase3 = false;
- m_uiTargetGUID = 0;
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- Summons.DespawnAll();
- m_vBurrowGUID.clear();
- }
+ PHASE_MASK_MELEE = 1 << PHASE_MELEE
+};
+
+class boss_anubarak_trial : public CreatureScript
+{
+ public:
+ boss_anubarak_trial() : CreatureScript("boss_anubarak_trial") { }
- void KilledUnit(Unit* who)
+ struct boss_anubarak_trialAI : public BossAI
{
- if (who->GetTypeId() == TYPEID_PLAYER)
+ boss_anubarak_trialAI(Creature* creature) : BossAI(creature, BOSS_ANUBARAK)
{
- DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me);
- if (instance)
- instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
}
- }
- void MoveInLineOfSight(Unit* /*who*/)
- {
- if (!m_bIntro)
+ void Reset()
{
- DoScriptText(SAY_INTRO, me);
- m_bIntro = false;
+ _Reset();
+ events.SetPhase(PHASE_MELEE);
+ events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 10*IN_MILLISECONDS, 0, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_BERSERK, 10*MINUTE*IN_MILLISECONDS);
+ if (IsHeroic())
+ events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE);
+
+ if (!IsHeroic())
+ events.ScheduleEvent(EVENT_SUMMON_FROST_SPHERE, 20*IN_MILLISECONDS);
+
+ _intro = true;
+ _reachedPhase3 = false;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ // clean up spawned Frost Spheres
+ std::list<Creature*> FrostSphereList;
+ me->GetCreatureListWithEntryInGrid(FrostSphereList, NPC_FROST_SPHERE, 150.0f);
+ if (!FrostSphereList.empty())
+ for (std::list<Creature*>::iterator itr = FrostSphereList.begin(); itr != FrostSphereList.end(); itr++)
+ (*itr)->DespawnOrUnsummon();
+
+ _burrowGUID.clear();
}
- }
- void JustReachedHome()
- {
- if (instance)
- instance->SetData(TYPE_ANUBARAK, FAIL);
- //Summon Scarab Swarms neutral at random places
- for (int i=0; i < 10; i++)
- if (Creature* temp = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ()))
- temp->setFaction(31);
- }
-
- void JustDied(Unit* /*killer*/)
- {
- Summons.DespawnAll();
- DoScriptText(SAY_DEATH, me);
- if (instance)
- instance->SetData(TYPE_ANUBARAK, DONE);
- }
-
- void JustSummoned(Creature* summoned)
- {
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true);
- switch (summoned->GetEntry())
- {
- case NPC_BURROW:
- m_vBurrowGUID.push_back(summoned->GetGUID());
- summoned->SetReactState(REACT_PASSIVE);
- summoned->CastSpell(summoned, SPELL_CHURNING_GROUND, false);
- break;
- case NPC_SPIKE:
- summoned->CombatStart(target);
- DoScriptText(EMOTE_SPIKE, me, target);
- break;
- }
- Summons.Summon(summoned);
- }
-
- void SummonedCreatureDespawn(Creature* summoned)
- {
- switch (summoned->GetEntry())
+ void KilledUnit(Unit* who)
{
- case NPC_SPIKE:
- m_uiPursuingSpikeTimer = 2*IN_MILLISECONDS;
- break;
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ {
+ Talk(SAY_KILL_PLAYER);
+ if (instance)
+ instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
+ }
}
- }
- void EnterCombat(Unit* /*who*/)
- {
- DoScriptText(SAY_AGGRO, me);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetInCombatWithZone();
- if (instance)
- instance->SetData(TYPE_ANUBARAK, IN_PROGRESS);
- //Despawn Scarab Swarms neutral
- EntryCheckPredicate pred(NPC_SCARAB);
- Summons.DoAction(ACTION_SCARAB_SUBMERGE, pred);
- //Spawn Burrow
- for (int i=0; i < 4; i++)
- me->SummonCreature(NPC_BURROW, AnubarakLoc[i+2]);
- //Spawn Frost Spheres
- for (int i=0; i < 6; i++)
- if (Unit* summoned = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i]))
- m_aSphereGUID[i] = summoned->GetGUID();
- }
+ void MoveInLineOfSight(Unit* /*who*/)
+ {
+ if (!_intro)
+ {
+ Talk(SAY_INTRO);
+ _intro = false;
+ }
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
+ void JustReachedHome()
+ {
+ if (instance)
+ instance->SetBossState(BOSS_ANUBARAK, FAIL);
+ //Summon Scarab Swarms neutral at random places
+ for (int i = 0; i < 10; i++)
+ if (Creature* temp = me->SummonCreature(NPC_SCARAB, AnubarakLoc[1].GetPositionX()+urand(0, 50)-25, AnubarakLoc[1].GetPositionY()+urand(0, 50)-25, AnubarakLoc[1].GetPositionZ()))
+ {
+ temp->setFaction(31);
+ temp->GetMotionMaster()->MoveRandom(10);
+ }
+ }
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
+ void JustDied(Unit* /*killer*/)
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+
+ // despawn frostspheres and Burrowers on death
+ std::list<Creature*> AddList;
+ me->GetCreatureListWithEntryInGrid(AddList, NPC_FROST_SPHERE, 150.0f);
+ me->GetCreatureListWithEntryInGrid(AddList, NPC_BURROWER, 150.0f);
+ if (!AddList.empty())
+ for (std::list<Creature*>::iterator itr = AddList.begin(); itr != AddList.end(); itr++)
+ (*itr)->DespawnOrUnsummon();
+ }
- switch (m_uiStage)
+ void JustSummoned(Creature* summoned)
{
- case 0:
- if (m_uiFreezeSlashTimer <= uiDiff)
- {
- DoCastVictim(SPELL_FREEZE_SLASH);
- m_uiFreezeSlashTimer = 15*IN_MILLISECONDS;
- } else m_uiFreezeSlashTimer -= uiDiff;
+ Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
+ switch (summoned->GetEntry())
+ {
+ case NPC_BURROW:
+ _burrowGUID.push_back(summoned->GetGUID());
+ summoned->SetReactState(REACT_PASSIVE);
+ summoned->CastSpell(summoned, SPELL_CHURNING_GROUND, false);
+ summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2);
+ break;
+ case NPC_SPIKE:
+ summoned->CombatStart(target);
+ summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid1);
+ Talk(EMOTE_SPIKE, target->GetGUID());
+ break;
+ default:
+ break;
+ }
+ summons.Summon(summoned);
+ }
- if (m_uiPenetratingColdTimer <= uiDiff)
- {
- me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5));
- m_uiPenetratingColdTimer = 20*IN_MILLISECONDS;
- } else m_uiPenetratingColdTimer -= uiDiff;
+ void EnterCombat(Unit* /*who*/)
+ {
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+
+ // Despawn Scarab Swarms neutral
+ EntryCheckPredicate pred(NPC_SCARAB);
+ summons.DoAction(ACTION_SCARAB_SUBMERGE, pred);
+
+ // Spawn Burrow
+ for (int i = 0; i < 4; i++)
+ me->SummonCreature(NPC_BURROW, AnubarakLoc[i + 2]);
+
+ // Spawn 6 Frost Spheres at start
+ for (int i = 0; i < 6; i++)
+ if (Unit* summoned = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i]))
+ _sphereGUID[i] = summoned->GetGUID();
+ }
- if (m_uiSummonNerubianTimer <= uiDiff && (IsHeroic() || !m_bReachedPhase3))
- {
- me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4));
- m_uiSummonNerubianTimer = 45*IN_MILLISECONDS;
- } else m_uiSummonNerubianTimer -= uiDiff;
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
- if (IsHeroic() && m_uiNerubianShadowStrikeTimer <= uiDiff)
- {
- EntryCheckPredicate pred(NPC_BURROWER);
- Summons.DoAction(ACTION_SHADOW_STRIKE, pred);
- m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS;
- } else m_uiNerubianShadowStrikeTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiSubmergeTimer <= uiDiff && !m_bReachedPhase3 && !me->HasAura(SPELL_BERSERK))
- {
- m_uiStage = 1;
- m_uiSubmergeTimer = 60*IN_MILLISECONDS;
- } else m_uiSubmergeTimer -= uiDiff;
- break;
- case 1:
- DoCast(me, SPELL_SUBMERGE_ANUBARAK);
- DoCast(me, SPELL_CLEAR_ALL_DEBUFFS);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- DoScriptText(SAY_BURROWER, me);
- m_uiScarabSummoned = 0;
- m_uiSummonScarabTimer = 4*IN_MILLISECONDS;
- m_uiStage = 2;
- break;
- case 2:
- if (m_uiPursuingSpikeTimer <= uiDiff)
- {
- DoCast(SPELL_SPIKE_CALL);
- // Just to make sure it won't happen again in this phase
- m_uiPursuingSpikeTimer = 90*IN_MILLISECONDS;
- } else m_uiPursuingSpikeTimer -= uiDiff;
+ events.Update(diff);
- if (m_uiSummonScarabTimer <= uiDiff)
- {
- /* WORKAROUND
- * - The correct implementation is more likely the comment below but it needs spell knowledge
- */
- std::list<uint64>::iterator i = m_vBurrowGUID.begin();
- uint32 at = urand(0, m_vBurrowGUID.size()-1);
- for (uint32 k = 0; k < at; k++)
- ++i;
- if (Creature* pBurrow = Unit::GetCreature(*me, *i))
- pBurrow->CastSpell(pBurrow, 66340, false);
- m_uiScarabSummoned++;
- m_uiSummonScarabTimer = 4*IN_MILLISECONDS;
- if (m_uiScarabSummoned == 4) m_uiSummonScarabTimer = RAID_MODE(4, 20)*IN_MILLISECONDS;
-
- /*It seems that this spell have something more that needs to be taken into account
- //Need more sniff info
- DoCast(SPELL_SUMMON_BEATLES);
- // Just to make sure it won't happen again in this phase
- m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/
- } else m_uiSummonScarabTimer -= uiDiff;
-
- if (m_uiSubmergeTimer <= uiDiff)
- {
- m_uiStage = 3;
- m_uiSubmergeTimer = 80*IN_MILLISECONDS;
- } else m_uiSubmergeTimer -= uiDiff;
- break;
- case 3:
- m_uiStage = 0;
- DoCast(SPELL_SPIKE_TELE);
- Summons.DespawnEntry(NPC_SPIKE);
- me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- DoCast(me, SPELL_EMERGE_ANUBARAK);
- me->GetMotionMaster()->MoveChase(me->getVictim());
- m_uiSummonNerubianTimer = 10*IN_MILLISECONDS;
- m_uiNerubianShadowStrikeTimer = 30*IN_MILLISECONDS;
- m_uiSummonScarabTimer = 2*IN_MILLISECONDS;
- break;
- }
-
- if (!IsHeroic())
- {
- if (m_uiSummonFrostSphereTimer <= uiDiff)
+ while (uint32 eventId = events.ExecuteEvent())
{
- uint8 startAt = urand(0, 5);
- uint8 i = startAt;
- do
+ switch (eventId)
{
- if (Unit* pSphere = Unit::GetCreature(*me, m_aSphereGUID[i]))
+ case EVENT_FREEZE_SLASH:
+ DoCastVictim(SPELL_FREEZE_SLASH);
+ events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE);
+ return;
+ case EVENT_PENETRATING_COLD:
+ me->CastCustomSpell(SPELL_PENETRATING_COLD, SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5, 2, 5));
+ events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, 0, PHASE_MELEE);
+ return;
+ case EVENT_SUMMON_NERUBIAN:
+ if (IsHeroic() || !_reachedPhase3)
+ me->CastCustomSpell(SPELL_SUMMON_BURROWER, SPELLVALUE_MAX_TARGETS, RAID_MODE(1, 2, 2, 4));
+ events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 45*IN_MILLISECONDS, 0, PHASE_MELEE);
+ return;
+ case EVENT_NERUBIAN_SHADOW_STRIKE:
+ {
+ EntryCheckPredicate pred(NPC_BURROWER);
+ summons.DoAction(ACTION_SHADOW_STRIKE, pred);
+ events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE);
+ break;
+ }
+ case EVENT_SUBMERGE:
+ if (!_reachedPhase3 && !me->HasAura(SPELL_BERSERK))
+ {
+ DoCast(me, SPELL_SUBMERGE_ANUBARAK);
+ DoCast(me, SPELL_CLEAR_ALL_DEBUFFS);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ Talk(EMOTE_BURROWER);
+ events.SetPhase(PHASE_SUBMERGED);
+ events.ScheduleEvent(EVENT_PURSUING_SPIKE, 2*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
+ events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
+ events.ScheduleEvent(EVENT_EMERGE, 1*MINUTE*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
+ }
+ break;
+ case EVENT_PURSUING_SPIKE:
+ DoCast(SPELL_SPIKE_CALL);
+ break;
+ case EVENT_SUMMON_SCARAB:
+ {
+ /* WORKAROUND
+ * - The correct implementation is more likely the comment below but it needs spell knowledge
+ */
+ std::list<uint64>::iterator i = _burrowGUID.begin();
+ uint32 at = urand(0, _burrowGUID.size()-1);
+ for (uint32 k = 0; k < at; k++)
+ ++i;
+ if (Creature* pBurrow = Unit::GetCreature(*me, *i))
+ pBurrow->CastSpell(pBurrow, 66340, false);
+
+ events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
+
+ /*It seems that this spell have something more that needs to be taken into account
+ //Need more sniff info
+ DoCast(SPELL_SUMMON_BEATLES);
+ // Just to make sure it won't happen again in this phase
+ m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/
+ break;
+ }
+ case EVENT_EMERGE:
+ events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE);
+ DoCast(SPELL_SPIKE_TELE);
+ summons.DespawnEntry(NPC_SPIKE);
+ me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_EMERGE_ANUBARAK);
+ events.SetPhase(PHASE_MELEE);
+ events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 10*IN_MILLISECONDS, 0, PHASE_MELEE);
+ events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE);
+ if (IsHeroic())
+ events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE);
+ return;
+ case EVENT_SUMMON_FROST_SPHERE:
{
- if (!pSphere->HasAura(SPELL_FROST_SPHERE))
+ uint8 startAt = urand(0, 5);
+ uint8 i = startAt;
+ do
{
- if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i]))
- m_aSphereGUID[i] = summon->GetGUID();
- break;
+ if (Unit* pSphere = Unit::GetCreature(*me, _sphereGUID[i]))
+ {
+ if (!pSphere->HasAura(SPELL_FROST_SPHERE))
+ {
+ if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i]))
+ _sphereGUID[i] = summon->GetGUID();
+ break;
+ }
+ }
+ i = (i + 1) % 6;
}
+ while
+ (i != startAt);
+ events.ScheduleEvent(EVENT_SUMMON_FROST_SPHERE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ break;
}
- i = (i+1)%6;
- } while (i != startAt);
- m_uiSummonFrostSphereTimer = urand(20, 30)*IN_MILLISECONDS;
- } else m_uiSummonFrostSphereTimer -= uiDiff;
- }
+ case EVENT_BERSERK:
+ DoCast(me, SPELL_BERSERK);
+ break;
+ default:
+ break;
+ }
- if (HealthBelowPct(30) && m_uiStage == 0 && !m_bReachedPhase3)
- {
- m_bReachedPhase3 = true;
- DoCastAOE(SPELL_LEECHING_SWARM);
- DoScriptText(EMOTE_LEECHING_SWARM, me);
- DoScriptText(SAY_LEECHING_SWARM, me);
- }
+ }
- if (m_uiBerserkTimer <= uiDiff && !me->HasAura(SPELL_BERSERK))
- {
- DoCast(me, SPELL_BERSERK);
- } else m_uiBerserkTimer -= uiDiff;
+ if (HealthBelowPct(30) && events.GetPhaseMask() & PHASE_MASK_MELEE && !_reachedPhase3)
+ {
+ _reachedPhase3 = true;
+ DoCastAOE(SPELL_LEECHING_SWARM);
+ Talk(EMOTE_LEECHING_SWARM);
+ Talk(SAY_LEECHING_SWARM);
+ }
- DoMeleeAttackIfReady();
- }
- };
+ if (events.GetPhaseMask() & PHASE_MASK_MELEE)
+ DoMeleeAttackIfReady();
+ }
+ private:
+ std::list<uint64> _burrowGUID;
+ uint64 _sphereGUID[6];
+ bool _intro;
+ bool _reachedPhase3;
+ uint32 _frostSphereTimer;
+ uint32 _berserkTimer;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_anubarak_trialAI(creature);
+ };
};
class mob_swarm_scarab : public CreatureScript
{
-public:
- mob_swarm_scarab() : CreatureScript("mob_swarm_scarab") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_swarm_scarabAI(creature);
- };
-
- struct mob_swarm_scarabAI : public ScriptedAI
- {
- mob_swarm_scarabAI(Creature* creature) : ScriptedAI(creature)
- {
- instance = creature->GetInstanceScript();
- }
-
- InstanceScript* instance;
-
- uint32 m_uiDeterminationTimer;
+ public:
+ mob_swarm_scarab() : CreatureScript("mob_swarm_scarab") { }
- void Reset()
+ struct mob_swarm_scarabAI : public ScriptedAI
{
- me->SetCorpseDelay(0);
- m_uiDeterminationTimer = urand(5*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- DoCast(me, SPELL_ACID_MANDIBLE);
- me->SetInCombatWithZone();
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- me->AddThreat(target, 20000.0f);
- if (!me->isInCombat())
- me->DisappearAndDie();
- }
+ mob_swarm_scarabAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ }
- void DoAction(const int32 actionId)
- {
- switch (actionId)
+ void Reset()
{
- case ACTION_SCARAB_SUBMERGE:
- DoCast(SPELL_SUBMERGE_EFFECT);
- me->DespawnOrUnsummon(1000);
- break;
+ me->SetCorpseDelay(0);
+ _determinationTimer = urand(5*IN_MILLISECONDS, 60*IN_MILLISECONDS);
+ DoCast(me, SPELL_ACID_MANDIBLE);
+ me->SetInCombatWithZone();
+ if (me->isInCombat())
+ if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)))
+ Anubarak->AI()->JustSummoned(me);
}
- }
- void JustDied(Unit* killer)
- {
- DoCast(killer, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25));
- }
+ void DoAction(const int32 actionId)
+ {
+ switch (actionId)
+ {
+ case ACTION_SCARAB_SUBMERGE:
+ DoCast(SPELL_SUBMERGE_EFFECT);
+ me->DespawnOrUnsummon(1*IN_MILLISECONDS);
+ break;
+ default:
+ break;
+ }
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
+ void JustDied(Unit* killer)
+ {
+ DoCast(killer, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25));
+ }
- /* Bosskillers don't recognize */
- if (m_uiDeterminationTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- DoCast(me, SPELL_DETERMINATION);
- m_uiDeterminationTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- } else m_uiDeterminationTimer -= uiDiff;
+ if (_instance && _instance->GetBossState(BOSS_ANUBARAK) != IN_PROGRESS)
+ me->DisappearAndDie();
- DoMeleeAttackIfReady();
- }
- };
+ if (!UpdateVictim())
+ return;
-};
+ /* Bosskillers don't recognize */
+ if (_determinationTimer <= diff)
+ {
+ DoCast(me, SPELL_DETERMINATION);
+ _determinationTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
+ }
+ else
+ _determinationTimer -= diff;
-class mob_nerubian_burrower : public CreatureScript
-{
-public:
- mob_nerubian_burrower() : CreatureScript("mob_nerubian_burrower") { }
+ DoMeleeAttackIfReady();
+ }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_nerubian_burrowerAI(creature);
- };
+ private:
+ InstanceScript* _instance;
+ uint32 _determinationTimer;
+ };
- struct mob_nerubian_burrowerAI : public ScriptedAI
- {
- mob_nerubian_burrowerAI(Creature* creature) : ScriptedAI(creature)
+ CreatureAI* GetAI(Creature* creature) const
{
- instance = creature->GetInstanceScript();
- }
-
- InstanceScript* instance;
-
- uint32 m_uiSpiderFrenzyTimer;
- uint32 m_uiSubmergeTimer;
+ return new mob_swarm_scarabAI(creature);
+ };
+};
- void Reset()
- {
- me->SetCorpseDelay(0);
- m_uiSpiderFrenzyTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS);
- m_uiSubmergeTimer = 30*IN_MILLISECONDS;
- DoCast(me, SPELL_EXPOSE_WEAKNESS);
- DoCast(me, SPELL_SPIDER_FRENZY);
- me->SetInCombatWithZone();
- if (!me->isInCombat())
- me->DisappearAndDie();
- }
+class mob_nerubian_burrower : public CreatureScript
+{
+ public:
+ mob_nerubian_burrower() : CreatureScript("mob_nerubian_burrower") { }
- void DoAction(const int32 actionId)
+ struct mob_nerubian_burrowerAI : public ScriptedAI
{
- switch (actionId)
+ mob_nerubian_burrowerAI(Creature* creature) : ScriptedAI(creature)
{
- case ACTION_SHADOW_STRIKE:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SHADOW_STRIKE);
- break;
+ _instance = creature->GetInstanceScript();
}
- }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
+ void Reset()
+ {
+ me->SetCorpseDelay(10);
+ _submergeTimer = 30*IN_MILLISECONDS;
+ DoCast(me, SPELL_EXPOSE_WEAKNESS);
+ DoCast(me, SPELL_SPIDER_FRENZY);
+ DoCast(me, SPELL_AWAKENED);
+ me->SetInCombatWithZone();
+ if (me->isInCombat())
+ if (Creature* Anubarak = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK)))
+ Anubarak->AI()->JustSummoned(me);
+ }
- if ((m_uiSubmergeTimer <= uiDiff) && HealthBelowPct(80))
+ void DoAction(const int32 actionId)
{
- if (me->HasAura(SPELL_SUBMERGE_EFFECT))
+ switch (actionId)
{
- me->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT);
- DoCast(me, SPELL_EMERGE_EFFECT);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
- me->CombatStart(me->SelectNearestTarget());
+ case ACTION_SHADOW_STRIKE:
+ if (!me->HasAura(SPELL_AWAKENED))
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ DoCast(target, SPELL_SHADOW_STRIKE);
+ break;
+ default:
+ break;
}
- else
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (_instance && _instance->GetBossState(BOSS_ANUBARAK) != IN_PROGRESS)
+ me->DisappearAndDie();
+
+ if (!UpdateVictim() && !me->HasAura(SPELL_SUBMERGE_EFFECT))
+ return;
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ if ((_submergeTimer <= diff) && HealthBelowPct(80))
{
- if (!me->HasAura(SPELL_PERMAFROST_HELPER))
+ if (me->HasAura(SPELL_SUBMERGE_EFFECT))
{
- DoCast(me, SPELL_SUBMERGE_EFFECT);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
- me->CombatStop();
+ me->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT);
+ DoCast(me, SPELL_EMERGE_EFFECT);
+ DoCast(me, SPELL_AWAKENED);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
+ else
+ {
+ if (!me->HasAura(SPELL_PERMAFROST_HELPER))
+ {
+ DoCast(me, SPELL_SUBMERGE_EFFECT);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoCast(me, SPELL_PERSISTENT_DIRT, true);
+ }
+ }
+ _submergeTimer = 20*IN_MILLISECONDS;
}
- m_uiSubmergeTimer = 20*IN_MILLISECONDS;
- } else m_uiSubmergeTimer -= uiDiff;
+ else
+ _submergeTimer -= diff;
- DoMeleeAttackIfReady();
- }
- };
+ DoMeleeAttackIfReady();
+ }
+
+ private:
+ uint32 _submergeTimer;
+ Phases _phase;
+ EventMap _events;
+ InstanceScript* _instance;
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_nerubian_burrowerAI(creature);
+ };
};
class mob_frost_sphere : public CreatureScript
@@ -574,16 +604,10 @@ class mob_frost_sphere : public CreatureScript
void Reset()
{
- _isFalling = false;
me->SetReactState(REACT_PASSIVE);
- //! Confirmed sniff 3.3.5.a
- me->SetDisableGravity(true);
- me->SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
- //! end
+ DoCast(SPELL_FROST_SPHERE);
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
- me->SetSpeed(MOVE_RUN, 0.5f, false);
me->GetMotionMaster()->MoveRandom(20.0f);
- DoCast(SPELL_FROST_SPHERE);
}
void DamageTaken(Unit* /*who*/, uint32& damage)
@@ -591,9 +615,20 @@ class mob_frost_sphere : public CreatureScript
if (me->GetHealth() <= damage)
{
damage = 0;
- if (!_isFalling)
+ float floorZ = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ if (fabs(me->GetPositionZ() - floorZ) < 0.1f)
{
- _isFalling = true;
+ // we are close to the ground
+ me->GetMotionMaster()->MoveIdle();
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE);
+ DoCast(SPELL_PERMAFROST_MODEL);
+ DoCast(SPELL_PERMAFROST);
+ me->SetObjectScale(2.0f);
+ }
+ else
+ {
+ // we are in air
me->GetMotionMaster()->MoveIdle();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
//At hit the ground
@@ -612,16 +647,15 @@ class mob_frost_sphere : public CreatureScript
{
case POINT_FALL_GROUND:
me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE);
- me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
+ DoCast(SPELL_PERMAFROST_MODEL);
DoCast(SPELL_PERMAFROST_VISUAL);
DoCast(SPELL_PERMAFROST);
me->SetObjectScale(2.0f);
break;
+ default:
+ break;
}
}
-
- private:
- bool _isFalling;
};
CreatureAI* GetAI(Creature* creature) const
@@ -632,91 +666,223 @@ class mob_frost_sphere : public CreatureScript
class mob_anubarak_spike : public CreatureScript
{
-public:
- mob_anubarak_spike() : CreatureScript("mob_anubarak_spike") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_anubarak_spikeAI(creature);
- };
+ public:
+ mob_anubarak_spike() : CreatureScript("mob_anubarak_spike") { }
- struct mob_anubarak_spikeAI : public ScriptedAI
- {
- mob_anubarak_spikeAI(Creature* creature) : ScriptedAI(creature)
+ struct mob_anubarak_spikeAI : public ScriptedAI
{
- instance = creature->GetInstanceScript();
- }
-
- InstanceScript* instance;
- uint32 m_uiIncreaseSpeedTimer;
- uint8 m_uiSpeed;
- uint64 m_uiTargetGUID;
+ mob_anubarak_spikeAI(Creature* creature) : ScriptedAI(creature)
+ {
+ }
- void Reset()
- {
- // For an unknown reason this npc isn't recognize the Aura of Permafrost with this flags =/
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- m_uiTargetGUID = 0;
- }
+ void Reset()
+ {
+ _phase = PHASE_NO_MOVEMENT;
+ _phaseSwitchTimer = 1;
+ // make sure the spike has everyone on threat list
+ me->SetInCombatWithZone();
+ }
- bool CanAIAttack(Unit const* victim) const
- {
- return victim->GetTypeId() == TYPEID_PLAYER;
- }
+ bool CanAIAttack(Unit const* victim) const
+ {
+ return victim->GetTypeId() == TYPEID_PLAYER;
+ }
- void EnterCombat(Unit* who)
- {
- m_uiTargetGUID = who->GetGUID();
- DoCast(who, SPELL_MARK);
- me->SetSpeed(MOVE_RUN, 0.5f);
- m_uiSpeed = 0;
- m_uiIncreaseSpeedTimer = 1*IN_MILLISECONDS;
- me->TauntApply(who);
- }
+ void EnterCombat(Unit* who)
+ {
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ {
+ StartChase(target);
+ Talk(EMOTE_SPIKE, who->GetGUID());
+ }
+ }
- void DamageTaken(Unit* /*who*/, uint32& uiDamage)
- {
- uiDamage = 0;
- }
+ void DamageTaken(Unit* /*who*/, uint32& uiDamage)
+ {
+ uiDamage = 0;
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID);
- if (!target || !target->isAlive() || !target->HasAura(SPELL_MARK))
+ void UpdateAI(const uint32 diff)
{
- if (Creature* pAnubarak = Unit::GetCreature((*me), instance->GetData64(NPC_ANUBARAK)))
- pAnubarak->CastSpell(pAnubarak, SPELL_SPIKE_TELE, false);
- me->DisappearAndDie();
- return;
+ if (!UpdateVictim())
+ {
+ me->DisappearAndDie();
+ return;
+ }
+
+ if (_phaseSwitchTimer)
+ {
+ if (_phaseSwitchTimer <= diff)
+ {
+ switch (_phase)
+ {
+ case PHASE_NO_MOVEMENT:
+ DoCast(me, SPELL_SPIKE_SPEED1);
+ DoCast(me, SPELL_SPIKE_TRAIL);
+ _phase = PHASE_IMPALE_NORMAL;
+ if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ {
+ StartChase(target2);
+ Talk(EMOTE_SPIKE, target2->GetGUID());
+ }
+ _phaseSwitchTimer = 7*IN_MILLISECONDS;
+ return;
+ case PHASE_IMPALE_NORMAL:
+ DoCast(me, SPELL_SPIKE_SPEED2);
+ _phase = PHASE_IMPALE_MIDDLE;
+ _phaseSwitchTimer = 7*IN_MILLISECONDS;
+ return;
+ case PHASE_IMPALE_MIDDLE:
+ DoCast(me, SPELL_SPIKE_SPEED3);
+ _phase = PHASE_IMPALE_FAST;
+ _phaseSwitchTimer = 0;
+ return;
+ default:
+ return;
+ }
+ }
+ else
+ _phaseSwitchTimer -= diff;
+ }
}
- if (m_uiIncreaseSpeedTimer)
+ void MoveInLineOfSight(Unit* pWho)
{
- if (m_uiIncreaseSpeedTimer <= uiDiff)
+ if (!pWho)
+ return;
+
+ if (pWho->GetEntry() != NPC_FROST_SPHERE)
+ return;
+
+ if (_phase == PHASE_NO_MOVEMENT)
+ return;
+
+ if (me->IsWithinDist(pWho, 7.0f))
{
- switch (m_uiSpeed)
+ switch (_phase)
{
- case 0:
- DoCast(me, SPELL_SPIKE_SPEED1);
- DoCast(me, SPELL_SPIKE_TRAIL);
- m_uiSpeed = 1;
- m_uiIncreaseSpeedTimer = 7*IN_MILLISECONDS;
+ case PHASE_IMPALE_NORMAL:
+ me->RemoveAurasDueToSpell(SPELL_SPIKE_SPEED1);
break;
- case 1:
- DoCast(me, SPELL_SPIKE_SPEED2);
- m_uiSpeed = 2;
- m_uiIncreaseSpeedTimer = 7*IN_MILLISECONDS;
+ case PHASE_IMPALE_MIDDLE:
+ me->RemoveAurasDueToSpell(SPELL_SPIKE_SPEED2);
break;
- case 2:
- DoCast(me, SPELL_SPIKE_SPEED3);
- m_uiIncreaseSpeedTimer = 0;
+ case PHASE_IMPALE_FAST:
+ me->RemoveAurasDueToSpell(SPELL_SPIKE_SPEED3);
+ break;
+ default:
break;
}
- } else m_uiIncreaseSpeedTimer -= uiDiff;
+
+ me->CastSpell(me, SPELL_SPIKE_FAIL, true);
+
+ pWho->ToCreature()->DespawnOrUnsummon(3*IN_MILLISECONDS);
+
+ // After the spikes hit the icy surface they can't move for about ~5 seconds
+ _phase = PHASE_NO_MOVEMENT;
+ _phaseSwitchTimer = 5*IN_MILLISECONDS;
+ SetCombatMovement(false);
+ me->GetMotionMaster()->MoveIdle();
+ me->GetMotionMaster()->Clear();
+ }
+ }
+
+ void StartChase(Unit* who)
+ {
+ DoCast(who, SPELL_MARK);
+ me->SetSpeed(MOVE_RUN, 0.5f);
+ // make sure the Spine will really follow the one he should
+ me->getThreatManager().clearReferences();
+ me->SetInCombatWithZone();
+ me->getThreatManager().addThreat(who, std::numeric_limits<float>::max());
+ me->GetMotionMaster()->Clear(true);
+ me->GetMotionMaster()->MoveChase(who);
+ me->TauntApply(who);
+ }
+
+ private:
+ uint32 _phaseSwitchTimer;
+ PursuingSpikesPhases _phase;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_anubarak_spikeAI(creature);
+ };
+};
+
+class spell_impale : public SpellScriptLoader
+{
+ public:
+ spell_impale() : SpellScriptLoader("spell_impale") { }
+
+ class spell_impale_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_impale_SpellScript);
+
+ void HandleDamageCalc(SpellEffIndex /*effIndex*/)
+ {
+ Unit* target = GetHitUnit();
+ uint32 permafrost = sSpellMgr->GetSpellIdForDifficulty(SPELL_PERMAFROST, target);
+
+ // make sure Impale doesnt do damage if we are standing on permafrost
+ if (target && target->HasAura(permafrost))
+ SetHitDamage(0);
}
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_impale_SpellScript::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_impale_SpellScript();
}
- };
+};
+
+class spell_anubarak_leeching_swarm : public SpellScriptLoader
+{
+ public:
+ spell_anubarak_leeching_swarm() : SpellScriptLoader("spell_anubarak_leeching_swarm") { }
+ class spell_anubarak_leeching_swarm_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_anubarak_leeching_swarm_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG) || !sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
+ return false;
+ return true;
+ }
+
+ void HandleEffectPeriodic(AuraEffect const* aurEff)
+ {
+ Unit* caster = GetCaster();
+ if (Unit* target = GetTarget())
+ {
+ int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount());
+ if (lifeLeeched < 250)
+ lifeLeeched = 250;
+ // Damage
+ caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
+ // Heal
+ caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_anubarak_leeching_swarm_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_anubarak_leeching_swarm_AuraScript();
+ }
};
void AddSC_boss_anubarak_trial()
@@ -726,4 +892,7 @@ void AddSC_boss_anubarak_trial()
new mob_nerubian_burrower();
new mob_anubarak_spike();
new mob_frost_sphere();
+
+ new spell_impale();
+ new spell_anubarak_leeching_swarm();
}
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 3b0aeb958cb..a99aa373602 100755..100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp
@@ -16,27 +16,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: faction_champions
-SD%Complete: ??%
-SDComment: Scripts by Selector, modified by /dev/rsa
-SDCategory: Crusader Coliseum
-EndScriptData */
-
-// Known bugs:
-// All - untested
-// Pets aren't being summoned by their masters
-
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "trial_of_the_crusader.h"
+#include "Player.h"
+#include "GridNotifiers.h"
-enum eYell
+enum Yells
{
- SAY_GARROSH_KILL_ALLIANCE_PLAYER4 = -1649118,
- SAY_VARIAN_KILL_HORDE_PLAYER4 = -1649123,
+ SAY_KILL_PLAYER = 6
};
enum eAIs
@@ -44,234 +34,527 @@ enum eAIs
AI_MELEE = 0,
AI_RANGED = 1,
AI_HEALER = 2,
- AI_PET = 3,
+ AI_PET = 3
};
enum eSpells
{
- SPELL_ANTI_AOE = 68595,
- SPELL_PVP_TRINKET = 65547,
+ // generic
+ SPELL_ANTI_AOE = 68595,
+ SPELL_PVP_TRINKET = 65547,
+
+ // druid healer
+ SPELL_LIFEBLOOM = 66093,
+ SPELL_NOURISH = 66066,
+ SPELL_REGROWTH = 66067,
+ SPELL_REJUVENATION = 66065,
+ SPELL_TRANQUILITY = 66086,
+ SPELL_BARKSKIN = 65860,
+ SPELL_THORNS = 66068,
+ SPELL_NATURE_GRASP = 66071,
+
+ // shaman healer
+ SPELL_HEALING_WAVE = 66055,
+ SPELL_RIPTIDE = 66053,
+ SPELL_SPIRIT_CLEANSE = 66056, //friendly only
+ SPELL_HEROISM = 65983,
+ SPELL_BLOODLUST = 65980,
+ SPELL_HEX = 66054,
+ SPELL_EARTH_SHIELD = 66063,
+ SPELL_EARTH_SHOCK = 65973,
+ AURA_EXHAUSTION = 57723,
+ AURA_SATED = 57724,
+
+ // paladin healer
+ SPELL_HAND_OF_FREEDOM = 68757,
+ SPELL_DIVINE_SHIELD = 66010,
+ SPELL_CLEANSE = 66116,
+ SPELL_FLASH_OF_LIGHT = 66113,
+ SPELL_HOLY_LIGHT = 66112,
+ SPELL_HOLY_SHOCK = 66114,
+ SPELL_HAND_OF_PROTECTION = 66009,
+ SPELL_HAMMER_OF_JUSTICE = 66613,
+ SPELL_FORBEARANCE = 25771,
+
+ // priest healer
+ SPELL_RENEW = 66177,
+ SPELL_SHIELD = 66099,
+ SPELL_FLASH_HEAL = 66104,
+ SPELL_DISPEL = 65546,
+ SPELL_PSYCHIC_SCREAM = 65543,
+ SPELL_MANA_BURN = 66100,
+ SPELL_PENANCE = 66097,
+
+ // priest dps
+ SPELL_SILENCE = 65542,
+ SPELL_VAMPIRIC_TOUCH = 65490,
+ SPELL_SW_PAIN = 65541,
+ SPELL_MIND_FLAY = 65488,
+ SPELL_MIND_BLAST = 65492,
+ SPELL_HORROR = 65545,
+ SPELL_DISPERSION = 65544,
+ SPELL_SHADOWFORM = 16592,
+
+ // warlock
+ SPELL_HELLFIRE = 65816,
+ SPELL_CORRUPTION = 65810,
+ SPELL_CURSE_OF_AGONY = 65814,
+ SPELL_CURSE_OF_EXHAUSTION = 65815,
+ SPELL_FEAR = 65809,
+ SPELL_SEARING_PAIN = 65819,
+ SPELL_SHADOW_BOLT = 65821,
+ SPELL_UNSTABLE_AFFLICTION = 65812,
+ SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813,
+ SPELL_SUMMON_FELHUNTER = 67514,
+
+ // mage
+ SPELL_ARCANE_BARRAGE = 65799,
+ SPELL_ARCANE_BLAST = 65791,
+ SPELL_ARCANE_EXPLOSION = 65800,
+ SPELL_BLINK = 65793,
+ SPELL_COUNTERSPELL = 65790,
+ SPELL_FROST_NOVA = 65792,
+ SPELL_FROSTBOLT = 65807,
+ SPELL_ICE_BLOCK = 65802,
+ SPELL_POLYMORPH = 65801,
+
+ // hunter
+ SPELL_AIMED_SHOT = 65883,
+ SPELL_DETERRENCE = 65871,
+ SPELL_DISENGAGE = 65869,
+ SPELL_EXPLOSIVE_SHOT = 65866,
+ SPELL_FROST_TRAP = 65880,
+ SPELL_SHOOT = 65868,
+ SPELL_STEADY_SHOT = 65867,
+ SPELL_WING_CLIP = 66207,
+ SPELL_WYVERN_STING = 65877,
+ SPELL_CALL_PET = 67777,
+
+ // druid dps
+ SPELL_CYCLONE = 65859,
+ SPELL_ENTANGLING_ROOTS = 65857,
+ SPELL_FAERIE_FIRE = 65863,
+ SPELL_FORCE_OF_NATURE = 65861,
+ SPELL_INSECT_SWARM = 65855,
+ SPELL_MOONFIRE = 65856,
+ SPELL_STARFIRE = 65854,
+ SPELL_WRATH = 65862,
+
+ // warrior
+ SPELL_BLADESTORM = 65947,
+ SPELL_INTIMIDATING_SHOUT = 65930,
+ SPELL_MORTAL_STRIKE = 65926,
+ SPELL_CHARGE = 68764,
+ SPELL_DISARM = 65935,
+ SPELL_OVERPOWER = 65924,
+ SPELL_SUNDER_ARMOR = 65936,
+ SPELL_SHATTERING_THROW = 65940,
+ SPELL_RETALIATION = 65932,
+
+ // death knight
+ SPELL_CHAINS_OF_ICE = 66020,
+ SPELL_DEATH_COIL = 66019,
+ SPELL_DEATH_GRIP = 66017,
+ SPELL_FROST_STRIKE = 66047,
+ SPELL_ICEBOUND_FORTITUDE = 66023,
+ SPELL_ICY_TOUCH = 66021,
+ SPELL_STRANGULATE = 66018,
+ SPELL_DEATH_GRIP_PULL = 64431, // used at spellscript
+
+ // rogue
+ SPELL_FAN_OF_KNIVES = 65955,
+ SPELL_BLIND = 65960,
+ SPELL_CLOAK = 65961,
+ SPELL_BLADE_FLURRY = 65956,
+ SPELL_SHADOWSTEP = 66178,
+ SPELL_HEMORRHAGE = 65954,
+ SPELL_EVISCERATE = 65957,
+ SPELL_WOUND_POISON = 65962,
+
+ // shaman dps (some spells taken from shaman healer)
+ SPELL_LAVA_LASH = 65974,
+ SPELL_STORMSTRIKE = 65970,
+ SPELL_WINDFURY = 65976,
+
+ // paladin dps
+ SPELL_AVENGING_WRATH = 66011,
+ SPELL_CRUSADER_STRIKE = 66003,
+ SPELL_DIVINE_STORM = 66006,
+ SPELL_HAMMER_OF_JUSTICE_RET = 66007,
+ SPELL_JUDGEMENT_OF_COMMAND = 66005,
+ SPELL_REPENTANCE = 66008,
+ SPELL_SEAL_OF_COMMAND = 66004,
+
+ // warlock pet
+ SPELL_DEVOUR_MAGIC = 67518,
+ SPELL_SPELL_LOCK = 67519,
+
+ // hunter pet
+ SPELL_CLAW = 67793
};
-class boss_toc_champion_controller : public CreatureScript
+enum Events
{
-public:
- boss_toc_champion_controller() : CreatureScript("boss_toc_champion_controller") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_toc_champion_controllerAI (creature);
- }
-
- struct boss_toc_champion_controllerAI : public ScriptedAI
- {
- boss_toc_champion_controllerAI(Creature* creature) : ScriptedAI(creature), Summons(me)
- {
- instance = creature->GetInstanceScript();
- }
+ // generic
+ EVENT_THREAT = 1,
+ EVENT_REMOVE_CC = 2,
+
+ // druid healer
+ EVENT_LIFEBLOOM = 1,
+ EVENT_NOURISH = 2,
+ EVENT_REGROWTH = 3,
+ EVENT_REJUVENATION = 4,
+ EVENT_TRANQUILITY = 5,
+ EVENT_HEAL_BARKSKIN = 6,
+ EVENT_THORNS = 7,
+ EVENT_NATURE_GRASP = 8,
+
+ // shaman healer
+ EVENT_HEALING_WAVE = 1,
+ EVENT_RIPTIDE = 2,
+ EVENT_SPIRIT_CLEANSE = 3,
+ EVENT_HEAL_BLOODLUST_HEROISM = 4,
+ EVENT_HEX = 5,
+ EVENT_EARTH_SHIELD = 6,
+ EVENT_HEAL_EARTH_SHOCK = 7,
+
+ // paladin healer
+ EVENT_HAND_OF_FREEDOM = 1,
+ EVENT_HEAL_DIVINE_SHIELD = 2,
+ EVENT_CLEANSE = 3,
+ EVENT_FLASH_OF_LIGHT = 4,
+ EVENT_HOLY_LIGHT = 5,
+ EVENT_HOLY_SHOCK = 6,
+ EVENT_HEAL_HAND_OF_PROTECTION = 7,
+ EVENT_HAMMER_OF_JUSTICE = 8,
+
+ // priest healer
+ EVENT_RENEW = 1,
+ EVENT_SHIELD = 2,
+ EVENT_FLASH_HEAL = 3,
+ EVENT_HEAL_DISPEL = 4,
+ EVENT_HEAL_PSYCHIC_SCREAM = 5,
+ EVENT_MANA_BURN = 6,
+ EVENT_PENANCE = 7,
+
+ // priest dps
+ EVENT_SILENCE = 1,
+ EVENT_VAMPIRIC_TOUCH = 2,
+ EVENT_SW_PAIN = 3,
+ EVENT_MIND_BLAST = 4,
+ EVENT_HORROR = 5,
+ EVENT_DISPERSION = 6,
+ EVENT_DPS_DISPEL = 7,
+ EVENT_DPS_PSYCHIC_SCREAM = 8,
+
+ // warlock
+ EVENT_HELLFIRE = 1,
+ EVENT_CORRUPTION = 2,
+ EVENT_CURSE_OF_AGONY = 3,
+ EVENT_CURSE_OF_EXHAUSTION = 4,
+ EVENT_FEAR = 5,
+ EVENT_SEARING_PAIN = 6,
+ EVENT_UNSTABLE_AFFLICTION = 7,
+
+ // mage
+ EVENT_ARCANE_BARRAGE = 1,
+ EVENT_ARCANE_BLAST = 2,
+ EVENT_ARCANE_EXPLOSION = 3,
+ EVENT_BLINK = 4,
+ EVENT_COUNTERSPELL = 5,
+ EVENT_FROST_NOVA = 6,
+ EVENT_ICE_BLOCK = 7,
+ EVENT_POLYMORPH = 8,
+
+ // hunter
+ EVENT_AIMED_SHOT = 1,
+ EVENT_DETERRENCE = 2,
+ EVENT_DISENGAGE = 3,
+ EVENT_EXPLOSIVE_SHOT = 4,
+ EVENT_FROST_TRAP = 5,
+ EVENT_STEADY_SHOT = 6,
+ EVENT_WING_CLIP = 7,
+ EVENT_WYVERN_STING = 8,
+
+ // druid dps
+ EVENT_CYCLONE = 1,
+ EVENT_ENTANGLING_ROOTS = 2,
+ EVENT_FAERIE_FIRE = 3,
+ EVENT_FORCE_OF_NATURE = 4,
+ EVENT_INSECT_SWARM = 5,
+ EVENT_MOONFIRE = 6,
+ EVENT_STARFIRE = 7,
+ EVENT_DPS_BARKSKIN = 8,
+
+ // warrior
+ EVENT_BLADESTORM = 1,
+ EVENT_INTIMIDATING_SHOUT = 2,
+ EVENT_MORTAL_STRIKE = 3,
+ EVENT_WARR_CHARGE = 4,
+ EVENT_DISARM = 5,
+ EVENT_OVERPOWER = 6,
+ EVENT_SUNDER_ARMOR = 7,
+ EVENT_SHATTERING_THROW = 8,
+ EVENT_RETALIATION = 9,
+
+ // death knight
+ EVENT_CHAINS_OF_ICE = 1,
+ EVENT_DEATH_COIL = 2,
+ EVENT_DEATH_GRIP = 3,
+ EVENT_FROST_STRIKE = 4,
+ EVENT_ICEBOUND_FORTITUDE = 5,
+ EVENT_ICY_TOUCH = 6,
+ EVENT_STRANGULATE = 7,
+
+ // rogue
+ EVENT_FAN_OF_KNIVES = 1,
+ EVENT_BLIND = 2,
+ EVENT_CLOAK = 3,
+ EVENT_BLADE_FLURRY = 4,
+ EVENT_SHADOWSTEP = 5,
+ EVENT_HEMORRHAGE = 6,
+ EVENT_EVISCERATE = 7,
+ EVENT_WOUND_POISON = 8,
+
+ // shaman dps
+ EVENT_DPS_EARTH_SHOCK = 1,
+ EVENT_LAVA_LASH = 2,
+ EVENT_STORMSTRIKE = 3,
+ EVENT_DPS_BLOODLUST_HEROISM = 4,
+ EVENT_DEPLOY_TOTEM = 5,
+ EVENT_WINDFURY = 6,
+
+ // paladin dps
+ EVENT_AVENGING_WRATH = 1,
+ EVENT_CRUSADER_STRIKE = 2,
+ EVENT_DIVINE_STORM = 3,
+ EVENT_HAMMER_OF_JUSTICE_RET = 4,
+ EVENT_JUDGEMENT_OF_COMMAND = 5,
+ EVENT_REPENTANCE = 6,
+ EVENT_DPS_HAND_OF_PROTECTION = 7,
+ EVENT_DPS_DIVINE_SHIELD = 8,
+
+ // warlock pet
+ EVENT_DEVOUR_MAGIC = 1,
+ EVENT_SPELL_LOCK = 2
+};
- InstanceScript* instance;
- SummonList Summons;
- uint32 m_uiChampionsNotStarted;
- uint32 m_uiChampionsFailed;
- uint32 m_uiChampionsKilled;
- bool m_bInProgress;
+class boss_toc_champion_controller : public CreatureScript
+{
+ public:
+ boss_toc_champion_controller() : CreatureScript("boss_toc_champion_controller") { }
- void Reset()
+ struct boss_toc_champion_controllerAI : public ScriptedAI
{
- m_uiChampionsNotStarted = 0;
- m_uiChampionsFailed = 0;
- m_uiChampionsKilled = 0;
- m_bInProgress = false;
- }
+ boss_toc_champion_controllerAI(Creature* creature) : ScriptedAI(creature), _summons(me)
+ {
+ _instance = creature->GetInstanceScript();
+ }
- std::vector<uint32> SelectChampions(Team playerTeam)
- {
- std::vector<uint32> vHealersEntries;
- vHealersEntries.clear();
- vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION);
- vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY);
- vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE);
- vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION);
-
- std::vector<uint32> vOtherEntries;
- vOtherEntries.clear();
- vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT);
- vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER);
- vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE);
- vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE);
- vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK);
- vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR);
-
- uint8 healersSubtracted = 2;
- if (instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
- healersSubtracted = 1;
- for (uint8 i = 0; i < healersSubtracted; ++i)
+ void Reset()
{
- uint8 pos = urand(0, vHealersEntries.size()-1);
- switch (vHealersEntries[pos])
+ _championsNotStarted = 0;
+ _championsFailed = 0;
+ _championsKilled = 0;
+ _inProgress = false;
+ }
+
+ std::vector<uint32> SelectChampions(Team playerTeam)
+ {
+ std::vector<uint32> vHealersEntries;
+ vHealersEntries.clear();
+ vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DRUID_RESTORATION : NPC_ALLIANCE_DRUID_RESTORATION);
+ vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PALADIN_HOLY : NPC_ALLIANCE_PALADIN_HOLY);
+ vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_PRIEST_DISCIPLINE : NPC_ALLIANCE_PRIEST_DISCIPLINE);
+ vHealersEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_SHAMAN_RESTORATION : NPC_ALLIANCE_SHAMAN_RESTORATION);
+
+ std::vector<uint32> vOtherEntries;
+ vOtherEntries.clear();
+ vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_DEATH_KNIGHT : NPC_ALLIANCE_DEATH_KNIGHT);
+ vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_HUNTER : NPC_ALLIANCE_HUNTER);
+ vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_MAGE : NPC_ALLIANCE_MAGE);
+ vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_ROGUE : NPC_ALLIANCE_ROGUE);
+ vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARLOCK : NPC_ALLIANCE_WARLOCK);
+ vOtherEntries.push_back(playerTeam == ALLIANCE ? NPC_HORDE_WARRIOR : NPC_ALLIANCE_WARRIOR);
+
+ uint8 healersSubtracted = 2;
+ if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
+ healersSubtracted = 1;
+ for (uint8 i = 0; i < healersSubtracted; ++i)
{
- case NPC_ALLIANCE_DRUID_RESTORATION:
- vOtherEntries.push_back(NPC_ALLIANCE_DRUID_BALANCE);
- break;
- case NPC_HORDE_DRUID_RESTORATION:
- vOtherEntries.push_back(NPC_HORDE_DRUID_BALANCE);
- break;
- case NPC_ALLIANCE_PALADIN_HOLY:
- vOtherEntries.push_back(NPC_ALLIANCE_PALADIN_RETRIBUTION);
- break;
- case NPC_HORDE_PALADIN_HOLY:
- vOtherEntries.push_back(NPC_HORDE_PALADIN_RETRIBUTION);
- break;
- case NPC_ALLIANCE_PRIEST_DISCIPLINE:
- vOtherEntries.push_back(NPC_ALLIANCE_PRIEST_SHADOW);
- break;
- case NPC_HORDE_PRIEST_DISCIPLINE:
- vOtherEntries.push_back(NPC_HORDE_PRIEST_SHADOW);
- break;
- case NPC_ALLIANCE_SHAMAN_RESTORATION:
- vOtherEntries.push_back(NPC_ALLIANCE_SHAMAN_ENHANCEMENT);
- break;
- case NPC_HORDE_SHAMAN_RESTORATION:
- vOtherEntries.push_back(NPC_HORDE_SHAMAN_ENHANCEMENT);
- break;
+ uint8 pos = urand(0, vHealersEntries.size() - 1);
+ switch (vHealersEntries[pos])
+ {
+ case NPC_ALLIANCE_DRUID_RESTORATION:
+ vOtherEntries.push_back(NPC_ALLIANCE_DRUID_BALANCE);
+ break;
+ case NPC_HORDE_DRUID_RESTORATION:
+ vOtherEntries.push_back(NPC_HORDE_DRUID_BALANCE);
+ break;
+ case NPC_ALLIANCE_PALADIN_HOLY:
+ vOtherEntries.push_back(NPC_ALLIANCE_PALADIN_RETRIBUTION);
+ break;
+ case NPC_HORDE_PALADIN_HOLY:
+ vOtherEntries.push_back(NPC_HORDE_PALADIN_RETRIBUTION);
+ break;
+ case NPC_ALLIANCE_PRIEST_DISCIPLINE:
+ vOtherEntries.push_back(NPC_ALLIANCE_PRIEST_SHADOW);
+ break;
+ case NPC_HORDE_PRIEST_DISCIPLINE:
+ vOtherEntries.push_back(NPC_HORDE_PRIEST_SHADOW);
+ break;
+ case NPC_ALLIANCE_SHAMAN_RESTORATION:
+ vOtherEntries.push_back(NPC_ALLIANCE_SHAMAN_ENHANCEMENT);
+ break;
+ case NPC_HORDE_SHAMAN_RESTORATION:
+ vOtherEntries.push_back(NPC_HORDE_SHAMAN_ENHANCEMENT);
+ break;
+ default:
+ break;
+ }
+ vHealersEntries.erase(vHealersEntries.begin() + pos);
}
- vHealersEntries.erase(vHealersEntries.begin()+pos);
- }
- if (instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
- for (uint8 i = 0; i < 4; ++i)
- vOtherEntries.erase(vOtherEntries.begin()+urand(0, vOtherEntries.size()-1));
+ if (_instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_NORMAL || _instance->instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
+ for (uint8 i = 0; i < 4; ++i)
+ vOtherEntries.erase(vOtherEntries.begin() + urand(0, vOtherEntries.size() - 1));
- std::vector<uint32> vChampionEntries;
- vChampionEntries.clear();
- for (uint8 i = 0; i < vHealersEntries.size(); ++i)
- vChampionEntries.push_back(vHealersEntries[i]);
- for (uint8 i = 0; i < vOtherEntries.size(); ++i)
- vChampionEntries.push_back(vOtherEntries[i]);
+ std::vector<uint32> vChampionEntries;
+ vChampionEntries.clear();
+ for (uint8 i = 0; i < vHealersEntries.size(); ++i)
+ vChampionEntries.push_back(vHealersEntries[i]);
+ for (uint8 i = 0; i < vOtherEntries.size(); ++i)
+ vChampionEntries.push_back(vOtherEntries[i]);
- return vChampionEntries;
- }
+ return vChampionEntries;
+ }
- void SummonChampions(Team playerTeam)
- {
- std::vector<Position> vChampionJumpOrigin;
- if (playerTeam == ALLIANCE)
- for (uint8 i = 0; i < 5; i++)
- vChampionJumpOrigin.push_back(FactionChampionLoc[i]);
- else
- for (uint8 i = 5; i < 10; i++)
- vChampionJumpOrigin.push_back(FactionChampionLoc[i]);
+ void SummonChampions(Team playerTeam)
+ {
+ std::vector<Position> vChampionJumpOrigin;
+ if (playerTeam == ALLIANCE)
+ for (uint8 i = 0; i < 5; i++)
+ vChampionJumpOrigin.push_back(FactionChampionLoc[i]);
+ else
+ for (uint8 i = 5; i < 10; i++)
+ vChampionJumpOrigin.push_back(FactionChampionLoc[i]);
- std::vector<Position> vChampionJumpTarget;
- for (uint8 i = 10; i < 20; i++)
- vChampionJumpTarget.push_back(FactionChampionLoc[i]);
- std::vector<uint32> vChampionEntries = SelectChampions(playerTeam);
+ std::vector<Position> vChampionJumpTarget;
+ for (uint8 i = 10; i < 20; i++)
+ vChampionJumpTarget.push_back(FactionChampionLoc[i]);
+ std::vector<uint32> vChampionEntries = SelectChampions(playerTeam);
- for (uint8 i = 0; i < vChampionEntries.size(); ++i)
- {
- uint8 pos = urand(0, vChampionJumpTarget.size()-1);
- if (Creature* temp = me->SummonCreature(vChampionEntries[i], vChampionJumpOrigin[urand(0, vChampionJumpOrigin.size()-1)], TEMPSUMMON_MANUAL_DESPAWN))
+ for (uint8 i = 0; i < vChampionEntries.size(); ++i)
{
- Summons.Summon(temp);
- temp->SetReactState(REACT_PASSIVE);
- temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- if (playerTeam == ALLIANCE)
+ uint8 pos = urand(0, vChampionJumpTarget.size()-1);
+ if (Creature* temp = me->SummonCreature(vChampionEntries[i], vChampionJumpOrigin[urand(0, vChampionJumpOrigin.size()-1)], TEMPSUMMON_MANUAL_DESPAWN))
{
- temp->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0);
- temp->GetMotionMaster()->MoveJump(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f);
- temp->SetOrientation(0);
- }
- else
- {
- temp->SetHomePosition((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 3);
- temp->GetMotionMaster()->MoveJump((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f);
- temp->SetOrientation(3);
+ _summons.Summon(temp);
+ temp->SetReactState(REACT_PASSIVE);
+ temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ if (playerTeam == ALLIANCE)
+ {
+ temp->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0);
+ temp->GetMotionMaster()->MoveJump(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f);
+ temp->SetOrientation(0);
+ }
+ else
+ {
+ temp->SetHomePosition((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 3);
+ temp->GetMotionMaster()->MoveJump((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f);
+ temp->SetOrientation(3);
+ }
}
+ vChampionJumpTarget.erase(vChampionJumpTarget.begin()+pos);
}
- vChampionJumpTarget.erase(vChampionJumpTarget.begin()+pos);
}
- }
- void SetData(uint32 uiType, uint32 uiData)
- {
- switch (uiType)
+ void SetData(uint32 uiType, uint32 uiData)
{
- case 0:
- SummonChampions((Team)uiData);
- break;
- case 1:
- for (std::list<uint64>::iterator i = Summons.begin(); i != Summons.end(); ++i)
- {
- if (Creature* temp = Unit::GetCreature(*me, *i))
+ switch (uiType)
+ {
+ case 0:
+ SummonChampions((Team)uiData);
+ break;
+ case 1:
+ for (std::list<uint64>::iterator i = _summons.begin(); i != _summons.end(); ++i)
{
- temp->SetReactState(REACT_AGGRESSIVE);
- temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- }
- }
- break;
- case 2:
- switch (uiData)
- {
- case FAIL:
- m_uiChampionsFailed++;
- if (m_uiChampionsFailed + m_uiChampionsKilled >= Summons.size())
- {
- instance->SetData(TYPE_CRUSADERS, FAIL);
- Summons.DespawnAll();
- me->DespawnOrUnsummon();
- }
- break;
- case IN_PROGRESS:
- if (!m_bInProgress)
- {
- m_uiChampionsNotStarted = 0;
- m_uiChampionsFailed = 0;
- m_uiChampionsKilled = 0;
- m_bInProgress = true;
- Summons.DoZoneInCombat();
- instance->SetData(TYPE_CRUSADERS, IN_PROGRESS);
- }
- break;
- case DONE:
- m_uiChampionsKilled++;
- if (m_uiChampionsKilled == 1)
- instance->SetData(TYPE_CRUSADERS, SPECIAL);
- else if (m_uiChampionsKilled >= Summons.size())
+ if (Creature* temp = Unit::GetCreature(*me, *i))
{
- instance->SetData(TYPE_CRUSADERS, DONE);
- Summons.DespawnAll();
- me->DespawnOrUnsummon();
+ temp->SetReactState(REACT_AGGRESSIVE);
+ temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
}
- break;
- }
- break;
+ }
+ break;
+ case 2:
+ switch (uiData)
+ {
+ case FAIL:
+ _championsFailed++;
+ if (_championsFailed + _championsKilled >= _summons.size())
+ {
+ _instance->SetBossState(BOSS_CRUSADERS, FAIL);
+ _summons.DespawnAll();
+ me->DespawnOrUnsummon();
+ }
+ break;
+ case IN_PROGRESS:
+ if (!_inProgress)
+ {
+ _championsNotStarted = 0;
+ _championsFailed = 0;
+ _championsKilled = 0;
+ _inProgress = true;
+ _summons.DoZoneInCombat();
+ _instance->SetBossState(BOSS_CRUSADERS, IN_PROGRESS);
+ }
+ break;
+ case DONE:
+ _championsKilled++;
+ if (_championsKilled == 1)
+ _instance->SetBossState(BOSS_CRUSADERS, SPECIAL);
+ else if (_championsKilled >= _summons.size())
+ {
+ _instance->SetBossState(BOSS_CRUSADERS, DONE);
+ _summons.DespawnAll();
+ me->DespawnOrUnsummon();
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
}
- }
- };
+ private:
+ InstanceScript* _instance;
+ SummonList _summons;
+ uint32 _championsNotStarted;
+ uint32 _championsFailed;
+ uint32 _championsKilled;
+ bool _inProgress;
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_toc_champion_controllerAI (creature);
+ }
};
-struct boss_faction_championsAI : public ScriptedAI
+struct boss_faction_championsAI : public BossAI
{
- boss_faction_championsAI(Creature* creature, uint32 aitype) : ScriptedAI(creature)
+ boss_faction_championsAI(Creature* creature, uint32 aitype) : BossAI(creature, BOSS_CRUSADERS)
{
- instance = creature->GetInstanceScript();
- mAIType = aitype;
+ _aiType = aitype;
}
- InstanceScript* instance;
-
- uint64 championControllerGUID;
- uint32 mAIType;
- uint32 ThreatTimer;
- uint32 CCTimer;
-
void Reset()
{
- championControllerGUID = 0;
- CCTimer = rand()%10000;
- ThreatTimer = 5000;
+ _events.ScheduleEvent(EVENT_THREAT, 5*IN_MILLISECONDS);
+ if (IsHeroic() && (_aiType != AI_PET))
+ _events.ScheduleEvent(EVENT_REMOVE_CC, 5*IN_MILLISECONDS);
}
void JustReachedHome()
@@ -284,9 +567,9 @@ struct boss_faction_championsAI : public ScriptedAI
float CalculateThreat(float distance, float armor, uint32 health)
{
- float dist_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? 15.0f/(15.0f + distance) : 1.0f;
- float armor_mod = (mAIType == AI_MELEE || mAIType == AI_PET) ? armor / 16635.0f : 0.0f;
- float eh = (health+1) * (1.0f + armor_mod);
+ float dist_mod = (_aiType == AI_MELEE || _aiType == AI_PET) ? 15.0f / (15.0f + distance) : 1.0f;
+ float armor_mod = (_aiType == AI_MELEE || _aiType == AI_PET) ? armor / 16635.0f : 0.0f;
+ float eh = (health + 1) * (1.0f + armor_mod);
return dist_mod * 30000.0f / eh;
}
@@ -298,7 +581,7 @@ struct boss_faction_championsAI : public ScriptedAI
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && me->getThreatManager().getThreat(unit))
{
- if (unit->GetTypeId()==TYPEID_PLAYER)
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
float threat = CalculateThreat(me->GetDistance2d(unit), (float)unit->GetArmor(), unit->GetHealth());
me->getThreatManager().modifyThreatPercent(unit, -100);
@@ -312,8 +595,6 @@ struct boss_faction_championsAI : public ScriptedAI
{
if (me->getPowerType() == POWER_MANA)
me->ModifyPower(POWER_MANA, me->GetMaxPower(POWER_MANA) / 3);
- //else if (me->getPowerType() == POWER_ENERGY)
- // me->ModifyPower(POWER_ENERGY, 100);
}
void RemoveCC()
@@ -328,7 +609,7 @@ struct boss_faction_championsAI : public ScriptedAI
void JustDied(Unit* /*killer*/)
{
- if (mAIType != AI_PET)
+ if (_aiType != AI_PET)
if (instance)
if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, DONE);
@@ -337,7 +618,7 @@ struct boss_faction_championsAI : public ScriptedAI
void EnterCombat(Unit* /*who*/)
{
DoCast(me, SPELL_ANTI_AOE, true);
- me->SetInCombatWithZone();
+ _EnterCombat();
if (instance)
if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(2, IN_PROGRESS);
@@ -359,13 +640,14 @@ struct boss_faction_championsAI : public ScriptedAI
if (TeamInInstance == ALLIANCE)
{
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_VARIAN)))
- DoScriptText(SAY_VARIAN_KILL_HORDE_PLAYER4+urand(0, 3), temp); // + cause we are on negative
+ temp->AI()->Talk(SAY_KILL_PLAYER);
}
else
- if (Creature* temp = me->FindNearestCreature(NPC_GARROSH, 300.f))
- DoScriptText(SAY_GARROSH_KILL_ALLIANCE_PLAYER4+urand(0, 3), temp); // + cause we are on negative
+ if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_GARROSH)))
+ temp->AI()->Talk(SAY_KILL_PLAYER);
- instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
+
+ instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
}
@@ -376,7 +658,7 @@ struct boss_faction_championsAI : public ScriptedAI
std::list<Creature*>::const_iterator itr = lst.begin();
if (lst.empty())
return NULL;
- advance(itr, rand()%lst.size());
+ advance(itr, rand() % lst.size());
return (*itr);
}
@@ -400,7 +682,7 @@ struct boss_faction_championsAI : public ScriptedAI
std::list<HostileReference*>::const_iterator iter;
uint32 count = 0;
Unit* target;
- for (iter = tList.begin(); iter!=tList.end(); ++iter)
+ for (iter = tList.begin(); iter != tList.end(); ++iter)
{
target = Unit::GetUnit(*me, (*iter)->getUnitGuid());
if (target && me->GetDistance2d(target) < distance)
@@ -420,7 +702,7 @@ struct boss_faction_championsAI : public ScriptedAI
me->SetInCombatWith(who);
who->SetInCombatWith(me);
- if (mAIType == AI_MELEE || mAIType == AI_PET)
+ if (_aiType == AI_MELEE || _aiType == AI_PET)
DoStartMovement(who);
else
DoStartMovement(who, 20.0f);
@@ -428,1642 +710,1666 @@ struct boss_faction_championsAI : public ScriptedAI
}
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (ThreatTimer < uiDiff)
- {
- UpdatePower();
- UpdateThreat();
- ThreatTimer = 4000;
- }
- else ThreatTimer -= uiDiff;
+ _events.Update(diff);
- if (mAIType != AI_PET)
+ while (uint32 eventId = _events.ExecuteEvent())
{
- if (CCTimer < uiDiff)
- {
- RemoveCC();
- CCTimer = 8000+rand()%2000;
+ switch (eventId)
+ {
+ case EVENT_THREAT:
+ UpdatePower();
+ UpdateThreat();
+ _events.ScheduleEvent(EVENT_THREAT, 4*IN_MILLISECONDS);
+ return;
+ case EVENT_REMOVE_CC:
+ if (me->HasBreakableByDamageCrowdControlAura())
+ {
+ RemoveCC();
+ _events.RescheduleEvent(EVENT_REMOVE_CC, 2*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ _events.RescheduleEvent(EVENT_REMOVE_CC, 3*IN_MILLISECONDS);
+ return;
+ default:
+ return;
}
- else CCTimer -= uiDiff;
}
- if (mAIType == AI_MELEE || mAIType == AI_PET) DoMeleeAttackIfReady();
+ if (_aiType == AI_MELEE || _aiType == AI_PET)
+ DoMeleeAttackIfReady();
}
+
+ private:
+ uint32 _aiType;
+ // make sure that every bosses separate events dont mix with these _events
+ EventMap _events;
};
/********************************************************************
HEALERS
********************************************************************/
-enum eDruidSpells
-{
- SPELL_LIFEBLOOM = 66093,
- SPELL_NOURISH = 66066,
- SPELL_REGROWTH = 66067,
- SPELL_REJUVENATION = 66065,
- SPELL_TRANQUILITY = 66086,
- SPELL_BARKSKIN = 65860, //1 min cd
- SPELL_THORNS = 66068,
- SPELL_NATURE_GRASP = 66071, //1 min cd, self buff
-};
-
class mob_toc_druid : public CreatureScript
{
-public:
- mob_toc_druid() : CreatureScript("mob_toc_druid") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_druidAI (creature);
- }
-
- struct mob_toc_druidAI : public boss_faction_championsAI
- {
- mob_toc_druidAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
-
- uint32 m_uiNatureGraspTimer;
- uint32 m_uiTranquilityTimer;
- uint32 m_uiBarkskinTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiNatureGraspTimer = IN_MILLISECONDS;
- m_uiTranquilityTimer = IN_MILLISECONDS;
- m_uiBarkskinTimer = IN_MILLISECONDS;
- m_uiCommonTimer = IN_MILLISECONDS;
- SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_druid() : CreatureScript("mob_toc_druid") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_druidAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_druidAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_LIFEBLOOM, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_NOURISH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_REGROWTH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_REJUVENATION, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_TRANQUILITY, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEAL_BARKSKIN, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_THORNS, 2*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_NATURE_GRASP, urand(3*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 51799, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- if (m_uiNatureGraspTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- DoCast(me, SPELL_NATURE_GRASP);
- m_uiNatureGraspTimer = urand(40*IN_MILLISECONDS, 80*IN_MILLISECONDS);
- } else m_uiNatureGraspTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiTranquilityTimer <= uiDiff)
- {
- DoCastAOE(SPELL_TRANQUILITY);
- m_uiTranquilityTimer = urand(40*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- } else m_uiTranquilityTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiBarkskinTimer <= uiDiff)
- {
- if (HealthBelowPct(50))
- DoCast(me, SPELL_BARKSKIN);
- m_uiBarkskinTimer = urand(45*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- } else m_uiBarkskinTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 4))
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0:
- DoCast(me, SPELL_LIFEBLOOM);
- break;
- case 1:
- DoCast(me, SPELL_NOURISH);
- break;
- case 2:
- DoCast(me, SPELL_REGROWTH);
- break;
- case 3:
- DoCast(me, SPELL_REJUVENATION);
- break;
- case 4:
- if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_THORNS))
- DoCast(target, SPELL_THORNS);
- break;
+ switch (eventId)
+ {
+ case EVENT_LIFEBLOOM:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_LIFEBLOOM);
+ events.ScheduleEvent(EVENT_LIFEBLOOM, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_NOURISH:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_NOURISH);
+ events.ScheduleEvent(EVENT_NOURISH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_REGROWTH:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_REGROWTH);
+ events.ScheduleEvent(EVENT_REGROWTH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_REJUVENATION:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_REJUVENATION);
+ events.ScheduleEvent(EVENT_REJUVENATION, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_TRANQUILITY:
+ DoCastAOE(SPELL_TRANQUILITY);
+ events.ScheduleEvent(EVENT_TRANQUILITY, urand(15*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_BARKSKIN:
+ if (HealthBelowPct(30))
+ {
+ DoCast(me, SPELL_BARKSKIN);
+ events.RescheduleEvent(EVENT_HEAL_BARKSKIN, 60*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_HEAL_BARKSKIN, 3*IN_MILLISECONDS);
+ return;
+ case EVENT_THORNS:
+ if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_THORNS))
+ DoCast(target, SPELL_THORNS);
+ events.ScheduleEvent(EVENT_THORNS, urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ return;
+ case EVENT_NATURE_GRASP:
+ DoCast(me, SPELL_NATURE_GRASP);
+ events.ScheduleEvent(EVENT_NATURE_GRASP, 60*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_druidAI (creature);
}
- };
-
-};
-
-enum eShamanSpells
-{
- SPELL_HEALING_WAVE = 66055,
- SPELL_RIPTIDE = 66053,
- SPELL_SPIRIT_CLEANSE = 66056, //friendly only
- SPELL_HEROISM = 65983,
- SPELL_BLOODLUST = 65980,
- SPELL_HEX = 66054,
- SPELL_EARTH_SHIELD = 66063,
- SPELL_EARTH_SHOCK = 65973,
- AURA_EXHAUSTION = 57723,
- AURA_SATED = 57724,
};
class mob_toc_shaman : public CreatureScript
{
-public:
- mob_toc_shaman() : CreatureScript("mob_toc_shaman") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_shamanAI (creature);
- }
-
- struct mob_toc_shamanAI : public boss_faction_championsAI
- {
- mob_toc_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
-
- uint32 m_uiHeroismOrBloodlustTimer;
- uint32 m_uiHexTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiHeroismOrBloodlustTimer = IN_MILLISECONDS;
- m_uiHexTimer = IN_MILLISECONDS;
- m_uiCommonTimer = IN_MILLISECONDS;
- SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_shaman() : CreatureScript("mob_toc_shaman") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_shamanAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_HEALING_WAVE, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_RIPTIDE, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SPIRIT_CLEANSE, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEAL_BLOODLUST_HEROISM, 20*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_HEX, urand(5*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_EARTH_SHIELD, 1*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_HEAL_EARTH_SHOCK, urand(5*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- if (m_uiHeroismOrBloodlustTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (me->getFaction()) //Am i alliance?
- {
- if (!me->HasAura(AURA_EXHAUSTION))
- DoCastAOE(SPELL_HEROISM);
- }
- else
- if (!me->HasAura(AURA_SATED))
- DoCastAOE(SPELL_BLOODLUST);
- m_uiHeroismOrBloodlustTimer = 300*IN_MILLISECONDS;
- } else m_uiHeroismOrBloodlustTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiHexTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_HEX);
- m_uiHexTimer = urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiHexTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 5))
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0: case 1:
- DoCast(me, SPELL_HEALING_WAVE);
- break;
- case 2:
- DoCast(me, SPELL_RIPTIDE);
- break;
- case 3:
- DoCast(me, SPELL_EARTH_SHOCK);
- break;
- case 4:
- DoCast(me, SPELL_SPIRIT_CLEANSE);
- break;
- case 5:
- if (Unit* target = SelectRandomFriendlyMissingBuff(SPELL_EARTH_SHIELD))
- DoCast(target, SPELL_EARTH_SHIELD);
- break;
+ switch (eventId)
+ {
+ case EVENT_HEALING_WAVE:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_HEALING_WAVE);
+ events.ScheduleEvent(EVENT_HEALING_WAVE, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ return;
+ case EVENT_RIPTIDE:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_RIPTIDE);
+ events.ScheduleEvent(EVENT_RIPTIDE, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_SPIRIT_CLEANSE:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_SPIRIT_CLEANSE);
+ events.ScheduleEvent(EVENT_SPIRIT_CLEANSE, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_BLOODLUST_HEROISM:
+ if (me->getFaction()) // alliance = 1
+ {
+ if (!me->HasAura(AURA_EXHAUSTION))
+ DoCastAOE(SPELL_HEROISM);
+ }
+ else
+ {
+ if (!me->HasAura(AURA_SATED))
+ DoCastAOE(SPELL_BLOODLUST);
+ }
+ events.ScheduleEvent(EVENT_HEAL_BLOODLUST_HEROISM, 5*MINUTE*IN_MILLISECONDS);
+ return;
+ case EVENT_HEX:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ DoCast(target, SPELL_HEX);
+ events.ScheduleEvent(EVENT_HEX, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_EARTH_SHIELD:
+ if (Creature* target = SelectRandomFriendlyMissingBuff(SPELL_EARTH_SHIELD))
+ DoCast(target, SPELL_EARTH_SHIELD);
+ events.ScheduleEvent(EVENT_EARTH_SHIELD, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_EARTH_SHOCK:
+ if (Unit* target = SelectEnemyCaster(true))
+ DoCast(target, SPELL_EARTH_SHOCK);
+ events.ScheduleEvent(EVENT_HEAL_EARTH_SHOCK, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_shamanAI (creature);
}
- };
-
-};
-
-enum ePaladinSpells
-{
- SPELL_HAND_OF_FREEDOM = 68757, //25 sec cd
- SPELL_BUBBLE = 66010, //5 min cd
- SPELL_CLEANSE = 66116,
- SPELL_FLASH_OF_LIGHT = 66113,
- SPELL_HOLY_LIGHT = 66112,
- SPELL_HOLY_SHOCK = 66114,
- SPELL_HAND_OF_PROTECTION = 66009,
- SPELL_HAMMER_OF_JUSTICE = 66613,
};
class mob_toc_paladin : public CreatureScript
{
-public:
- mob_toc_paladin() : CreatureScript("mob_toc_paladin") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_paladinAI (creature);
- }
-
- struct mob_toc_paladinAI : public boss_faction_championsAI
- {
- mob_toc_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
-
- uint32 m_uiBubbleTimer;
- uint32 m_uiHandOfProtectionTimer;
- uint32 m_uiHolyShockTimer;
- uint32 m_uiHandOfFreedomTimer;
- uint32 m_uiHammerOfJusticeTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiBubbleTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- m_uiHandOfProtectionTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- m_uiHolyShockTimer = urand(6*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiHandOfFreedomTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- m_uiHammerOfJusticeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_paladin() : CreatureScript("mob_toc_paladin") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_paladinAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
-
- if (m_uiBubbleTimer <= uiDiff)
- {
- //cast bubble at 20% hp
- if (HealthBelowPct(20))
- DoCast(me, SPELL_BUBBLE);
- m_uiBubbleTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- } else m_uiBubbleTimer -= uiDiff;
-
- if (m_uiHandOfProtectionTimer <= uiDiff)
- {
- if (Unit* target = DoSelectLowestHpFriendly(40.0f))
- if (target->HealthBelowPct(15))
- DoCast(target, SPELL_HAND_OF_PROTECTION);
- m_uiHandOfProtectionTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- } else m_uiHandOfProtectionTimer -= uiDiff;
+ mob_toc_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_HAND_OF_FREEDOM, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEAL_DIVINE_SHIELD, 20*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_CLEANSE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FLASH_OF_LIGHT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HOLY_LIGHT, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HOLY_SHOCK, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 50771, 47079, EQUIP_NO_CHANGE);
+ }
- if (m_uiHolyShockTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_HOLY_SHOCK);
- m_uiHolyShockTimer = urand(6*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiHolyShockTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiHandOfFreedomTimer <= uiDiff)
- {
- if (Unit* target = SelectRandomFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM))
- DoCast(target, SPELL_HAND_OF_FREEDOM);
- m_uiHandOfFreedomTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiHandOfFreedomTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiHammerOfJusticeTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_HAMMER_OF_JUSTICE);
- m_uiHammerOfJusticeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiHammerOfJusticeTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 4))
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0: case 1:
- DoCast(me, SPELL_FLASH_OF_LIGHT);
- break;
- case 2: case 3:
- DoCast(me, SPELL_HOLY_LIGHT);
- break;
- case 4:
- DoCast(me, SPELL_CLEANSE);
- break;
+ switch (eventId)
+ {
+ case EVENT_HAND_OF_FREEDOM:
+ if (Unit* target = SelectRandomFriendlyMissingBuff(SPELL_HAND_OF_FREEDOM))
+ DoCast(target, SPELL_HAND_OF_FREEDOM);
+ events.ScheduleEvent(EVENT_HAND_OF_FREEDOM, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_DIVINE_SHIELD:
+ if (HealthBelowPct(30) && !me->HasAura(SPELL_FORBEARANCE))
+ {
+ DoCast(me, SPELL_DIVINE_SHIELD);
+ events.RescheduleEvent(EVENT_HEAL_DIVINE_SHIELD, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_HEAL_DIVINE_SHIELD, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_CLEANSE:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_CLEANSE);
+ events.ScheduleEvent(EVENT_CLEANSE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_FLASH_OF_LIGHT:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_FLASH_OF_LIGHT);
+ events.ScheduleEvent(EVENT_FLASH_OF_LIGHT, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ return;
+ case EVENT_HOLY_LIGHT:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_HOLY_LIGHT);
+ events.ScheduleEvent(EVENT_HOLY_LIGHT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_HOLY_SHOCK:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_HOLY_SHOCK);
+ events.ScheduleEvent(EVENT_HOLY_SHOCK, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_HAND_OF_PROTECTION:
+ if (Unit* target = DoSelectLowestHpFriendly(30.0f))
+ {
+ if (!target->HasAura(SPELL_FORBEARANCE))
+ {
+ DoCast(target, SPELL_HAND_OF_PROTECTION);
+ events.RescheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, 3*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_HEAL_HAND_OF_PROTECTION, 10*IN_MILLISECONDS);
+ return;
+ case EVENT_HAMMER_OF_JUSTICE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 15.0f, true))
+ DoCast(target, SPELL_HAMMER_OF_JUSTICE);
+ events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE, 40*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_paladinAI (creature);
}
- };
-
-};
-
-enum ePriestSpells
-{
- SPELL_RENEW = 66177,
- SPELL_SHIELD = 66099,
- SPELL_FLASH_HEAL = 66104,
- SPELL_DISPEL = 65546,
- SPELL_PSYCHIC_SCREAM = 65543,
- SPELL_MANA_BURN = 66100,
};
class mob_toc_priest : public CreatureScript
{
-public:
- mob_toc_priest() : CreatureScript("mob_toc_priest") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_priestAI (creature);
- }
-
- struct mob_toc_priestAI : public boss_faction_championsAI
- {
- mob_toc_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
-
- uint32 m_uiPsychicScreamTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiPsychicScreamTimer = IN_MILLISECONDS;
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_priest() : CreatureScript("mob_toc_priest") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_priestAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_HEALER) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_RENEW, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SHIELD, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FLASH_HEAL, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEAL_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEAL_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_MANA_BURN, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_PENANCE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- if (m_uiPsychicScreamTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (EnemiesInRange(10.0f) > 2)
- DoCastAOE(SPELL_PSYCHIC_SCREAM);
- m_uiPsychicScreamTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiPsychicScreamTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 5))
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0:
- DoCast(me, SPELL_RENEW);
- break;
- case 1:
- DoCast(me, SPELL_SHIELD);
- break;
- case 2: case 3:
- DoCast(me, SPELL_FLASH_HEAL);
- break;
- case 4:
- if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0) : DoSelectLowestHpFriendly(40.0f))
- DoCast(target, SPELL_DISPEL);
- break;
- case 5:
- DoCast(me, SPELL_MANA_BURN);
- break;
+ switch (eventId)
+ {
+ case EVENT_RENEW:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_RENEW);
+ events.ScheduleEvent(EVENT_RENEW, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ return;
+ case EVENT_SHIELD:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_SHIELD);
+ events.ScheduleEvent(EVENT_SHIELD, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_FLASH_HEAL:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_FLASH_HEAL);
+ events.ScheduleEvent(EVENT_FLASH_HEAL, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_DISPEL:
+ if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) : DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_DISPEL);
+ events.ScheduleEvent(EVENT_HEAL_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_HEAL_PSYCHIC_SCREAM:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_PSYCHIC_SCREAM);
+ events.ScheduleEvent(EVENT_HEAL_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_MANA_BURN:
+ if (Unit* target = SelectEnemyCaster(false))
+ DoCast(target, SPELL_MANA_BURN);
+ events.ScheduleEvent(EVENT_MANA_BURN, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_PENANCE:
+ if (Unit* target = DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_PENANCE);
+ events.ScheduleEvent(EVENT_PENANCE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_priestAI (creature);
}
- };
-
};
/********************************************************************
RANGED
********************************************************************/
-enum eShadowPriestSpells
-{
- SPELL_SILENCE = 65542,
- SPELL_VAMPIRIC_TOUCH = 65490,
- SPELL_SW_PAIN = 65541,
- SPELL_MIND_FLAY = 65488,
- SPELL_MIND_BLAST = 65492,
- SPELL_HORROR = 65545,
- SPELL_DISPERSION = 65544,
- SPELL_SHADOWFORM = 16592,
-};
-
class mob_toc_shadow_priest : public CreatureScript
{
-public:
- mob_toc_shadow_priest() : CreatureScript("mob_toc_shadow_priest") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_shadow_priestAI (creature);
- }
-
- struct mob_toc_shadow_priestAI : public boss_faction_championsAI
- {
- mob_toc_shadow_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
-
- uint32 m_uiPsychicScreamTimer;
- uint32 m_uiDispersionTimer;
- uint32 m_uiSilenceTimer;
- uint32 m_uiMindBlastTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiPsychicScreamTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiDispersionTimer = urand(1*IN_MILLISECONDS, 180*IN_MILLISECONDS);
- m_uiSilenceTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiMindBlastTimer = urand(3*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 50040, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- DoCast(me, SPELL_SHADOWFORM);
- }
-
- void EnterCombat(Unit* who)
- {
- boss_faction_championsAI::EnterCombat(who);
- }
+ public:
+ mob_toc_shadow_priest() : CreatureScript("mob_toc_shadow_priest") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_shadow_priestAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
-
- if (m_uiPsychicScreamTimer <= uiDiff)
- {
- if (EnemiesInRange(10.0f) > 2)
- DoCastAOE(SPELL_PSYCHIC_SCREAM);
- m_uiPsychicScreamTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiPsychicScreamTimer -= uiDiff;
+ mob_toc_shadow_priestAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_SILENCE, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_VAMPIRIC_TOUCH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SW_PAIN, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_MIND_BLAST, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HORROR, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DISPERSION, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DPS_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DPS_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 50040, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ DoCast(me, SPELL_SHADOWFORM);
+ }
- if (m_uiDispersionTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (HealthBelowPct(20))
- DoCast(me, SPELL_DISPERSION);
- m_uiDispersionTimer = urand(1*IN_MILLISECONDS, 180*IN_MILLISECONDS);
- } else m_uiDispersionTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiSilenceTimer <= uiDiff)
- {
- if (Unit* target = SelectEnemyCaster(false))
- DoCast(target, SPELL_SILENCE);
- m_uiSilenceTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiSilenceTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiMindBlastTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_MIND_BLAST);
- m_uiMindBlastTimer = urand(3*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- } else m_uiMindBlastTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 4))
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0: case 1:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_MIND_FLAY);
- break;
- case 2:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_VAMPIRIC_TOUCH);
- break;
- case 3:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_SW_PAIN);
- break;
- case 4:
- if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0) : DoSelectLowestHpFriendly(40.0f))
- DoCast(target, SPELL_DISPEL);
- break;
+ switch (eventId)
+ {
+ case EVENT_SILENCE:
+ if (Unit* target = SelectEnemyCaster(true))
+ DoCast(target, SPELL_SILENCE);
+ events.ScheduleEvent(EVENT_SILENCE, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_VAMPIRIC_TOUCH:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
+ DoCast(target, SPELL_VAMPIRIC_TOUCH);
+ events.ScheduleEvent(EVENT_VAMPIRIC_TOUCH, urand(10*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_SW_PAIN:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f, true))
+ DoCast(target, SPELL_SW_PAIN);
+ events.ScheduleEvent(EVENT_SW_PAIN, urand(10*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_MIND_BLAST:
+ DoCastVictim(SPELL_MIND_BLAST);
+ events.ScheduleEvent(EVENT_MIND_BLAST, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_HORROR:
+ DoCastVictim(SPELL_HORROR);
+ events.ScheduleEvent(EVENT_HORROR, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_DISPERSION:
+ if (HealthBelowPct(40))
+ {
+ DoCast(me, SPELL_DISPERSION);
+ events.RescheduleEvent(EVENT_DISPERSION, 180*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DISPERSION, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_DPS_DISPEL:
+ if (Unit* target = urand(0, 1) ? SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true) : DoSelectLowestHpFriendly(40.0f))
+ DoCast(target, SPELL_DISPEL);
+ events.ScheduleEvent(EVENT_DPS_DISPEL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_DPS_PSYCHIC_SCREAM:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_PSYCHIC_SCREAM);
+ events.ScheduleEvent(EVENT_DPS_PSYCHIC_SCREAM, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ DoSpellAttackIfReady(SPELL_MIND_FLAY);
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_shadow_priestAI (creature);
}
- };
-
-};
-
-enum WarlockSpells
-{
- SPELL_HELLFIRE = 65816,
- SPELL_CORRUPTION = 65810,
- SPELL_CURSE_OF_AGONY = 65814,
- SPELL_CURSE_OF_EXHAUSTION = 65815,
- SPELL_FEAR = 65809, // 8s
- SPELL_SEARING_PAIN = 65819,
- SPELL_SHADOW_BOLT = 65821,
- SPELL_UNSTABLE_AFFLICTION = 65812, // 15s
- SPELL_UNSTABLE_AFFLICTION_DISPEL = 65813,
- SPELL_SUMMON_FELHUNTER = 67514,
};
class mob_toc_warlock : public CreatureScript
{
-public:
- mob_toc_warlock() : CreatureScript("mob_toc_warlock") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_warlockAI (creature);
- }
-
- struct mob_toc_warlockAI : public boss_faction_championsAI
- {
- mob_toc_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED), Summons(me) {}
-
- SummonList Summons;
-
- uint32 m_uiFearTimer;
- uint32 m_uiHellfireTimer;
- uint32 m_uiUnstableAfflictionTimer;
- uint32 m_uiCommonTimer;
- uint32 m_uiSummonPetTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiFearTimer = urand(4*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiHellfireTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- m_uiUnstableAfflictionTimer = urand(2*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
-
- m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- DoCast(SPELL_SUMMON_FELHUNTER);
- }
+ public:
+ mob_toc_warlock() : CreatureScript("mob_toc_warlock") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_warlockAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_HELLFIRE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CORRUPTION, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CURSE_OF_AGONY, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CURSE_OF_EXHAUSTION, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FEAR, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SEARING_PAIN, urand(5*IN_MILLISECONDS, 12*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_UNSTABLE_AFFLICTION, urand(7*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 49992, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- if (m_uiFearTimer <= uiDiff)
+ void EnterCombat(Unit* who)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_FEAR);
- m_uiFearTimer = urand(4*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiFearTimer -= uiDiff;
+ boss_faction_championsAI::EnterCombat(who);
+ DoCast(SPELL_SUMMON_FELHUNTER);
+ }
- if (m_uiHellfireTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (EnemiesInRange(10.0f) > 2)
- DoCastAOE(SPELL_HELLFIRE);
- m_uiHellfireTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiHellfireTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiUnstableAfflictionTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_UNSTABLE_AFFLICTION);
- m_uiUnstableAfflictionTimer = urand(2*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- } else m_uiUnstableAfflictionTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiSummonPetTimer <= uiDiff)
- {
- m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiSummonPetTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 5))
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0: case 1:
- DoCastVictim(SPELL_SHADOW_BOLT);
- break;
- case 2:
- DoCastVictim(SPELL_SEARING_PAIN);
- break;
- case 3:
- DoCastVictim(SPELL_CORRUPTION);
- break;
- case 4:
- DoCastVictim(SPELL_CURSE_OF_AGONY);
- break;
- case 5:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_CURSE_OF_EXHAUSTION);
- break;
+ switch (eventId)
+ {
+ case EVENT_HELLFIRE:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_HELLFIRE);
+ events.ScheduleEvent(EVENT_HELLFIRE, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_CORRUPTION:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f))
+ DoCast(target, SPELL_CORRUPTION);
+ events.ScheduleEvent(EVENT_CORRUPTION, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_CURSE_OF_AGONY:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f))
+ DoCast(target, SPELL_CURSE_OF_AGONY);
+ events.ScheduleEvent(EVENT_CURSE_OF_AGONY, urand(20*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_CURSE_OF_EXHAUSTION:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f))
+ DoCast(target, SPELL_CURSE_OF_EXHAUSTION);
+ events.ScheduleEvent(EVENT_CURSE_OF_EXHAUSTION, urand(20*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_FEAR:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true))
+ DoCast(target, SPELL_FEAR);
+ events.ScheduleEvent(EVENT_FEAR, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_SEARING_PAIN:
+ DoCastVictim(SPELL_SEARING_PAIN);
+ events.ScheduleEvent(EVENT_SEARING_PAIN, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_UNSTABLE_AFFLICTION:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
+ DoCast(target, SPELL_UNSTABLE_AFFLICTION);
+ events.ScheduleEvent(EVENT_UNSTABLE_AFFLICTION, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
- boss_faction_championsAI::UpdateAI(uiDiff);
- }
- };
-
-};
+ DoSpellAttackIfReady(SPELL_SHADOW_BOLT);
+ }
+ };
-enum eMageSpells
-{
- SPELL_ARCANE_BARRAGE = 65799, //3s
- SPELL_ARCANE_BLAST = 65791,
- SPELL_ARCANE_EXPLOSION = 65800,
- SPELL_BLINK = 65793, //15s
- SPELL_COUNTERSPELL = 65790, //24s
- SPELL_FROST_NOVA = 65792, //25s
- SPELL_FROSTBOLT = 65807,
- SPELL_ICE_BLOCK = 65802, //5min
- SPELL_POLYMORPH = 65801, //15s
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_warlockAI (creature);
+ }
};
class mob_toc_mage : public CreatureScript
{
-public:
- mob_toc_mage() : CreatureScript("mob_toc_mage") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_mageAI (creature);
- }
-
- struct mob_toc_mageAI : public boss_faction_championsAI
- {
- mob_toc_mageAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
-
- uint32 m_uiCounterspellTimer;
- uint32 m_uiBlinkTimer;
- uint32 m_uiIceBlockTimer;
- uint32 m_uiPolymorphTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiCounterspellTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiBlinkTimer = urand(7*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiIceBlockTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- m_uiPolymorphTimer = urand(15*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_mage() : CreatureScript("mob_toc_mage") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_mageAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_mageAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(1*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ARCANE_BLAST, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_BLINK, urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_COUNTERSPELL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FROST_NOVA, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ICE_BLOCK, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_POLYMORPH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 47524, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- if (m_uiCounterspellTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (Unit* target = SelectEnemyCaster(false))
- DoCast(target, SPELL_COUNTERSPELL);
- m_uiCounterspellTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiCounterspellTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiBlinkTimer <= uiDiff)
- {
- if (HealthBelowPct(50) && EnemiesInRange(10.0f) > 3)
- {
- DoCastAOE(SPELL_FROST_NOVA);
- DoCast(SPELL_BLINK);
- }
- m_uiBlinkTimer = urand(7*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiBlinkTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiIceBlockTimer <= uiDiff)
- {
- if (HealthBelowPct(20))
- DoCast(me, SPELL_ICE_BLOCK);
- m_uiIceBlockTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- } else m_uiIceBlockTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiPolymorphTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_POLYMORPH);
- m_uiPolymorphTimer = urand(15*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiPolymorphTimer -= uiDiff;
-
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 2))
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0:
- DoCast(me, SPELL_ARCANE_BARRAGE);
- break;
- case 1:
- DoCastVictim(SPELL_ARCANE_BLAST);
- break;
- case 2:
- DoCastVictim(SPELL_FROSTBOLT);
- break;
+ switch (eventId)
+ {
+ case EVENT_ARCANE_BARRAGE:
+ DoCastVictim(SPELL_ARCANE_BARRAGE);
+ events.ScheduleEvent(EVENT_ARCANE_BARRAGE, urand(5*IN_MILLISECONDS, 7*IN_MILLISECONDS));
+ return;
+ case EVENT_ARCANE_BLAST:
+ DoCastVictim(SPELL_ARCANE_BLAST);
+ events.ScheduleEvent(EVENT_ARCANE_BLAST, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_ARCANE_EXPLOSION:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_ARCANE_EXPLOSION);
+ events.ScheduleEvent(EVENT_ARCANE_EXPLOSION, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_BLINK:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCast(SPELL_BLINK);
+ events.ScheduleEvent(EVENT_BLINK, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_COUNTERSPELL:
+ if (Unit* target = SelectEnemyCaster(true))
+ DoCast(target, SPELL_COUNTERSPELL);
+ events.ScheduleEvent(EVENT_COUNTERSPELL, 24*IN_MILLISECONDS);
+ return;
+ case EVENT_FROST_NOVA:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_FROST_NOVA);
+ events.ScheduleEvent(EVENT_FROST_NOVA, 25*IN_MILLISECONDS);
+ return;
+ case EVENT_ICE_BLOCK:
+ if (HealthBelowPct(30))
+ {
+ DoCast(SPELL_ICE_BLOCK);
+ events.RescheduleEvent(EVENT_ICE_BLOCK, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_ICE_BLOCK, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_POLYMORPH:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ DoCast(target, SPELL_POLYMORPH);
+ events.ScheduleEvent(EVENT_POLYMORPH, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ DoSpellAttackIfReady(SPELL_FROSTBOLT);
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_mageAI (creature);
}
- };
-
-};
-
-enum eHunterSpells
-{
- SPELL_AIMED_SHOT = 65883,
- SPELL_DETERRENCE = 65871, //90s
- SPELL_DISENGAGE = 65869, //30s
- SPELL_EXPLOSIVE_SHOT = 65866,
- SPELL_FROST_TRAP = 65880, //30s
- SPELL_SHOOT = 65868, //1.7s
- SPELL_STEADY_SHOT = 65867, //3s
- SPELL_WING_CLIP = 66207, //6s
- SPELL_WYVERN_STING = 65877, //60s
- SPELL_CALL_PET = 67777,
};
class mob_toc_hunter : public CreatureScript
{
-public:
- mob_toc_hunter() : CreatureScript("mob_toc_hunter") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_hunterAI (creature);
- }
-
- struct mob_toc_hunterAI : public boss_faction_championsAI
- {
- mob_toc_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED), Summons(me) {}
-
- SummonList Summons;
-
- uint32 m_uiDisengageTimer;
- uint32 m_uiDeterrenceTimer;
- uint32 m_uiWyvernStingTimer;
- uint32 m_uiFrostTrapTimer;
- uint32 m_uiWingClipTimer;
- uint32 m_uiCommonTimer;
- uint32 m_uiSummonPetTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiDisengageTimer = urand(12*IN_MILLISECONDS, 20*IN_MILLISECONDS);
- m_uiDeterrenceTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- m_uiWyvernStingTimer = urand(7*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- m_uiFrostTrapTimer = urand(12*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- m_uiWingClipTimer = urand(4*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 47156, EQUIP_NO_CHANGE, 48711);
-
- m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- DoCast(SPELL_CALL_PET);
- }
+ public:
+ mob_toc_hunter() : CreatureScript("mob_toc_hunter") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_hunterAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
-
- if (m_uiDisengageTimer <= uiDiff)
- {
- if (EnemiesInRange(10.0f) > 3)
- DoCast(SPELL_DISENGAGE);
- m_uiDisengageTimer = urand(12*IN_MILLISECONDS, 20*IN_MILLISECONDS);
- } else m_uiDisengageTimer -= uiDiff;
+ mob_toc_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_AIMED_SHOT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DETERRENCE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DISENGAGE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_EXPLOSIVE_SHOT, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FROST_TRAP, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_STEADY_SHOT, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_WING_CLIP, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_WYVERN_STING, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 47156, EQUIP_NO_CHANGE, 48711);
+ }
- if (m_uiDeterrenceTimer <= uiDiff)
+ void EnterCombat(Unit* who)
{
- if (HealthBelowPct(20))
- DoCast(SPELL_DETERRENCE);
- m_uiDeterrenceTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- } else m_uiDeterrenceTimer -= uiDiff;
+ boss_faction_championsAI::EnterCombat(who);
+ DoCast(SPELL_CALL_PET);
+ }
- if (m_uiWyvernStingTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- DoCastVictim(SPELL_WYVERN_STING);
- m_uiWyvernStingTimer = urand(7*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- } else m_uiWyvernStingTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiFrostTrapTimer <= uiDiff)
- {
- DoCast(SPELL_FROST_TRAP);
- m_uiFrostTrapTimer = urand(12*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiFrostTrapTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiWingClipTimer <= uiDiff)
- {
- if (me->GetDistance2d(me->getVictim()) < 5.0f)
- DoCastVictim(SPELL_WING_CLIP);
- m_uiWingClipTimer = urand(4*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- } else m_uiWingClipTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiSummonPetTimer <= uiDiff)
- {
- m_uiSummonPetTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiSummonPetTimer -= uiDiff;
-
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 3))
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0: case 1:
- DoCastVictim(SPELL_SHOOT);
- break;
- case 2:
- DoCastVictim(SPELL_EXPLOSIVE_SHOT);
- break;
- case 3:
- DoCastVictim(SPELL_AIMED_SHOT);
- break;
+ switch (eventId)
+ {
+ case EVENT_AIMED_SHOT:
+ DoCastVictim(SPELL_AIMED_SHOT);
+ events.ScheduleEvent(EVENT_AIMED_SHOT, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_DETERRENCE:
+ if (HealthBelowPct(30))
+ {
+ DoCast(SPELL_DETERRENCE);
+ events.RescheduleEvent(EVENT_DETERRENCE, 150*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DETERRENCE, 10*IN_MILLISECONDS);
+ return;
+ case EVENT_DISENGAGE:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCast(SPELL_DISENGAGE);
+ events.ScheduleEvent(EVENT_DISENGAGE, 30*IN_MILLISECONDS);
+ return;
+ case EVENT_EXPLOSIVE_SHOT:
+ DoCastVictim(SPELL_EXPLOSIVE_SHOT);
+ events.ScheduleEvent(EVENT_EXPLOSIVE_SHOT, urand(6*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_FROST_TRAP:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_FROST_TRAP);
+ events.ScheduleEvent(EVENT_FROST_TRAP, 30*IN_MILLISECONDS);
+ return;
+ case EVENT_STEADY_SHOT:
+ DoCastVictim(SPELL_STEADY_SHOT);
+ events.ScheduleEvent(EVENT_STEADY_SHOT, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_WING_CLIP:
+ if (me->GetDistance2d(me->getVictim()) < 6.0f)
+ DoCastVictim(SPELL_WING_CLIP);
+ events.ScheduleEvent(EVENT_WING_CLIP, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_WYVERN_STING:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ DoCast(target, SPELL_WYVERN_STING);
+ events.ScheduleEvent(EVENT_WYVERN_STING, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ DoSpellAttackIfReady(SPELL_SHOOT);
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_hunterAI (creature);
}
- };
-
-};
-
-enum eBoomkinSpells
-{
- SPELL_CYCLONE = 65859, //6s
- SPELL_ENTANGLING_ROOTS = 65857, //10s
- SPELL_FAERIE_FIRE = 65863,
- SPELL_FORCE_OF_NATURE = 65861, //180s
- SPELL_INSECT_SWARM = 65855,
- SPELL_MOONFIRE = 65856, //5s
- SPELL_STARFIRE = 65854,
- SPELL_WRATH = 65862,
};
class mob_toc_boomkin : public CreatureScript
{
-public:
- mob_toc_boomkin() : CreatureScript("mob_toc_boomkin") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_boomkinAI (creature);
- }
-
- struct mob_toc_boomkinAI : public boss_faction_championsAI
- {
- mob_toc_boomkinAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
-
- uint32 m_uiBarkskinTimer;
- uint32 m_uiCycloneTimer;
- uint32 m_uiEntanglingRootsTimer;
- uint32 m_uiFaerieFireTimer;
- uint32 m_uiCommonTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiBarkskinTimer = urand(5*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- m_uiCycloneTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- m_uiEntanglingRootsTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- m_uiFaerieFireTimer = urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_boomkin() : CreatureScript("mob_toc_boomkin") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_boomkinAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_boomkinAI(Creature* creature) : boss_faction_championsAI(creature, AI_RANGED) {}
- if (m_uiBarkskinTimer <= uiDiff)
+ void Reset()
{
- if (HealthBelowPct(50))
- DoCast(me, SPELL_BARKSKIN);
- m_uiBarkskinTimer = urand(5*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- } else m_uiBarkskinTimer -= uiDiff;
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_CYCLONE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ENTANGLING_ROOTS, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FAERIE_FIRE, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FORCE_OF_NATURE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_INSECT_SWARM, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_MOONFIRE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_STARFIRE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DPS_BARKSKIN, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
- if (m_uiCycloneTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_CYCLONE);
- m_uiCycloneTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiCycloneTimer -= uiDiff;
+ SetEquipmentSlots(false, 50966, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- if (m_uiEntanglingRootsTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_ENTANGLING_ROOTS);
- m_uiEntanglingRootsTimer = urand(5*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiEntanglingRootsTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiFaerieFireTimer <= uiDiff)
- {
- DoCastVictim(SPELL_FAERIE_FIRE);
- m_uiFaerieFireTimer = urand(10*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiFaerieFireTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiCommonTimer <= uiDiff)
- {
- switch (urand(0, 6))
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- case 0: case 1:
- DoCastVictim(SPELL_MOONFIRE);
- break;
- case 2:
- DoCastVictim(SPELL_INSECT_SWARM);
- break;
- case 3:
- DoCastVictim(SPELL_STARFIRE);
- break;
- case 4: case 5: case 6:
- DoCastVictim(SPELL_WRATH);
- break;
+ switch (eventId)
+ {
+ case EVENT_CYCLONE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ DoCast(target, SPELL_CYCLONE);
+ events.ScheduleEvent(EVENT_CYCLONE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_ENTANGLING_ROOTS:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
+ DoCast(target, SPELL_ENTANGLING_ROOTS);
+ events.ScheduleEvent(EVENT_ENTANGLING_ROOTS, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_FAERIE_FIRE:
+ DoCastVictim(SPELL_FAERIE_FIRE);
+ events.ScheduleEvent(EVENT_FAERIE_FIRE, urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ return;
+ case EVENT_FORCE_OF_NATURE:
+ DoCastVictim(SPELL_FORCE_OF_NATURE);
+ events.ScheduleEvent(EVENT_FORCE_OF_NATURE, 180*IN_MILLISECONDS);
+ return;
+ case EVENT_INSECT_SWARM:
+ DoCastVictim(SPELL_INSECT_SWARM);
+ events.ScheduleEvent(EVENT_INSECT_SWARM, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_MOONFIRE:
+ DoCastVictim(SPELL_MOONFIRE);
+ events.ScheduleEvent(EVENT_MOONFIRE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_STARFIRE:
+ DoCastVictim(SPELL_STARFIRE);
+ events.ScheduleEvent(EVENT_STARFIRE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_DPS_BARKSKIN:
+ if (HealthBelowPct(30))
+ {
+ DoCast(me, SPELL_BARKSKIN);
+ events.RescheduleEvent(EVENT_DPS_BARKSKIN, 60*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DPS_BARKSKIN, 5*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
}
- m_uiCommonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiCommonTimer -= uiDiff;
+ DoSpellAttackIfReady(SPELL_WRATH);
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_boomkinAI (creature);
}
- };
-
};
/********************************************************************
MELEE
********************************************************************/
-enum eWarriorSpells
-{
- SPELL_BLADESTORM = 65947,
- SPELL_INTIMIDATING_SHOUT = 65930,
- SPELL_MORTAL_STRIKE = 65926,
- SPELL_CHARGE = 68764,
- SPELL_DISARM = 65935,
- SPELL_OVERPOWER = 65924,
- SPELL_SUNDER_ARMOR = 65936,
- SPELL_SHATTERING_THROW = 65940,
- SPELL_RETALIATION = 65932,
-};
-
class mob_toc_warrior : public CreatureScript
{
-public:
- mob_toc_warrior() : CreatureScript("mob_toc_warrior") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_warriorAI (creature);
- }
-
- struct mob_toc_warriorAI : public boss_faction_championsAI
- {
- mob_toc_warriorAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
-
- uint32 m_uiBladestormTimer;
- uint32 m_uiIntimidatingShoutTimer;
- uint32 m_uiMortalStrikeTimer;
- uint32 m_uiSunderArmorTimer;
- uint32 m_uiChargeTimer;
- uint32 m_uiRetaliationTimer;
- uint32 m_uiOverpowerTimer;
- uint32 m_uiShatteringThrowTimer;
- uint32 m_uiDisarmTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiBladestormTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- m_uiIntimidatingShoutTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- m_uiMortalStrikeTimer = urand(6*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiSunderArmorTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiChargeTimer = urand(3*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiRetaliationTimer = urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- m_uiOverpowerTimer = urand(30*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- m_uiShatteringThrowTimer = urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiDisarmTimer = urand(20*IN_MILLISECONDS, 80*IN_MILLISECONDS);
- SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_warrior() : CreatureScript("mob_toc_warrior") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_warriorAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
-
- if (m_uiBladestormTimer <= uiDiff)
- {
- DoCastVictim(SPELL_BLADESTORM);
- m_uiBladestormTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiBladestormTimer -= uiDiff;
-
- if (m_uiIntimidatingShoutTimer <= uiDiff)
- {
- DoCast(me, SPELL_INTIMIDATING_SHOUT);
- m_uiIntimidatingShoutTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- } else m_uiIntimidatingShoutTimer -= uiDiff;
-
- if (m_uiMortalStrikeTimer <= uiDiff)
- {
- DoCastVictim(SPELL_MORTAL_STRIKE);
- m_uiMortalStrikeTimer = urand(6*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiMortalStrikeTimer -= uiDiff;
-
- if (m_uiSunderArmorTimer <= uiDiff)
- {
- DoCastVictim(SPELL_SUNDER_ARMOR);
- m_uiSunderArmorTimer = urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiSunderArmorTimer -= uiDiff;
-
- if (m_uiChargeTimer <= uiDiff)
- {
- DoCastVictim(SPELL_CHARGE);
- m_uiChargeTimer = urand(3*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiChargeTimer -= uiDiff;
+ mob_toc_warriorAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_BLADESTORM, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_INTIMIDATING_SHOUT, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_MORTAL_STRIKE, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_WARR_CHARGE, 1*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_DISARM, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_OVERPOWER, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SUNDER_ARMOR, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SHATTERING_THROW, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_RETALIATION, urand(5*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 47427, 46964, EQUIP_NO_CHANGE);
+ }
- if (m_uiRetaliationTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- DoCastVictim(SPELL_RETALIATION);
- m_uiRetaliationTimer = urand(30*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- } else m_uiRetaliationTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiOverpowerTimer <= uiDiff)
- {
- DoCastVictim(SPELL_OVERPOWER);
- m_uiOverpowerTimer = urand(30*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- } else m_uiOverpowerTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiShatteringThrowTimer <= uiDiff)
- {
- DoCastVictim(SPELL_SHATTERING_THROW);
- m_uiShatteringThrowTimer = urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiShatteringThrowTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiDisarmTimer <= uiDiff)
- {
- DoCastVictim(SPELL_DISARM);
- m_uiDisarmTimer = urand(20*IN_MILLISECONDS, 80*IN_MILLISECONDS);
- } else m_uiDisarmTimer -= uiDiff;
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_BLADESTORM:
+ DoCastVictim(SPELL_BLADESTORM);
+ events.ScheduleEvent(EVENT_BLADESTORM, 150*IN_MILLISECONDS);
+ return;
+ case EVENT_INTIMIDATING_SHOUT:
+ DoCastAOE(SPELL_INTIMIDATING_SHOUT);
+ events.ScheduleEvent(EVENT_INTIMIDATING_SHOUT, 120*IN_MILLISECONDS);
+ return;
+ case EVENT_MORTAL_STRIKE:
+ DoCastVictim(SPELL_MORTAL_STRIKE);
+ events.ScheduleEvent(EVENT_MORTAL_STRIKE, urand(10*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_WARR_CHARGE:
+ DoCastVictim(SPELL_CHARGE);
+ events.ScheduleEvent(EVENT_WARR_CHARGE, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_DISARM:
+ DoCastVictim(SPELL_DISARM);
+ events.ScheduleEvent(EVENT_DISARM, urand(15*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ return;
+ case EVENT_OVERPOWER:
+ DoCastVictim(SPELL_OVERPOWER);
+ events.ScheduleEvent(EVENT_OVERPOWER, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ return;
+ case EVENT_SUNDER_ARMOR:
+ DoCastVictim(SPELL_SUNDER_ARMOR);
+ events.ScheduleEvent(EVENT_SUNDER_ARMOR, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ return;
+ case EVENT_SHATTERING_THROW:
+ if (me->getVictim()->HasAuraWithMechanic(1<<MECHANIC_IMMUNE_SHIELD))
+ {
+ DoCastVictim(SPELL_SHATTERING_THROW);
+ events.RescheduleEvent(EVENT_SHATTERING_THROW, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_SHATTERING_THROW, 3*IN_MILLISECONDS);
+ return;
+ case EVENT_RETALIATION:
+ if (HealthBelowPct(50))
+ {
+ DoCast(SPELL_RETALIATION);
+ events.RescheduleEvent(EVENT_RETALIATION, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_RETALIATION, 5*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
+ }
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_warriorAI (creature);
}
- };
-
-};
-
-enum eDeathKnightSpells
-{
- SPELL_CHAINS_OF_ICE = 66020, //8sec
- SPELL_DEATH_COIL = 66019, //5sec
- SPELL_DEATH_GRIP = 66017, //35sec
- SPELL_FROST_STRIKE = 66047, //6sec
- SPELL_ICEBOUND_FORTITUDE = 66023, //1min
- SPELL_ICY_TOUCH = 66021, //8sec
- SPELL_STRANGULATE = 66018, //2min
};
class mob_toc_dk : public CreatureScript
{
-public:
- mob_toc_dk() : CreatureScript("mob_toc_dk") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_dkAI (creature);
- }
-
- struct mob_toc_dkAI : public boss_faction_championsAI
- {
- mob_toc_dkAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
-
- uint32 m_uiIceboundFortitudeTimer;
- uint32 m_uiChainsOfIceTimer;
- uint32 m_uiDeathCoilTimer;
- uint32 m_uiStrangulateTimer;
- uint32 m_uiFrostStrikeTimer;
- uint32 m_uiIcyTouchTimer;
- uint32 m_uiDeathGripTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiIceboundFortitudeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- m_uiChainsOfIceTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiDeathCoilTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiStrangulateTimer = urand(10*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- m_uiFrostStrikeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiIcyTouchTimer = urand(8*IN_MILLISECONDS, 12*IN_MILLISECONDS);
- m_uiDeathGripTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE);
- }
+ public:
+ mob_toc_dk() : CreatureScript("mob_toc_dk") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_dkAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
-
- if (m_uiIceboundFortitudeTimer <= uiDiff)
- {
- if (HealthBelowPct(50))
- DoCast(me, SPELL_ICEBOUND_FORTITUDE);
- m_uiIceboundFortitudeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- } else m_uiIceboundFortitudeTimer -= uiDiff;
-
- if (m_uiChainsOfIceTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_CHAINS_OF_ICE);
- m_uiChainsOfIceTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiChainsOfIceTimer -= uiDiff;
-
- if (m_uiDeathCoilTimer <= uiDiff)
- {
- DoCastVictim(SPELL_DEATH_COIL);
- m_uiDeathCoilTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiDeathCoilTimer -= uiDiff;
+ mob_toc_dkAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_CHAINS_OF_ICE, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DEATH_COIL, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DEATH_GRIP, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_FROST_STRIKE, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ICEBOUND_FORTITUDE, urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ICY_TOUCH, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_STRANGULATE, urand(5*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 47518, 51021, EQUIP_NO_CHANGE);
+ }
- if (m_uiStrangulateTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (Unit* target = SelectEnemyCaster(false))
- DoCast(target, SPELL_STRANGULATE);
- m_uiStrangulateTimer = urand(10*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- } else m_uiStrangulateTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiFrostStrikeTimer <= uiDiff)
- {
- DoCastVictim(SPELL_FROST_STRIKE);
- m_uiFrostStrikeTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiFrostStrikeTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiIcyTouchTimer <= uiDiff)
- {
- DoCastVictim(SPELL_ICY_TOUCH);
- m_uiIcyTouchTimer = urand(8*IN_MILLISECONDS, 12*IN_MILLISECONDS);
- } else m_uiIcyTouchTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiDeathGripTimer <= uiDiff)
- {
- if (me->IsInRange(me->getVictim(), 10.0f, 30.0f, false))
- DoCastVictim(SPELL_DEATH_GRIP);
- m_uiDeathGripTimer = urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiDeathGripTimer -= uiDiff;
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_CHAINS_OF_ICE:
+ DoCastVictim(SPELL_CHAINS_OF_ICE);
+ events.ScheduleEvent(EVENT_CHAINS_OF_ICE, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_DEATH_COIL:
+ DoCastVictim(SPELL_DEATH_COIL);
+ events.ScheduleEvent(EVENT_DEATH_COIL, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_DEATH_GRIP:
+ if (me->IsInRange(me->getVictim(), 5.0f, 30.0f, false))
+ {
+ DoCast(me->getVictim(), SPELL_DEATH_GRIP);
+ events.RescheduleEvent(EVENT_DEATH_GRIP, 35*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DEATH_GRIP, 3*IN_MILLISECONDS);
+ return;
+ case EVENT_FROST_STRIKE:
+ DoCastVictim(SPELL_FROST_STRIKE);
+ events.ScheduleEvent(EVENT_FROST_STRIKE, urand(6*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_ICEBOUND_FORTITUDE:
+ if (HealthBelowPct(50))
+ {
+ DoCast(SPELL_ICEBOUND_FORTITUDE);
+ events.RescheduleEvent(EVENT_ICEBOUND_FORTITUDE, 60*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_ICEBOUND_FORTITUDE, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_ICY_TOUCH:
+ DoCastVictim(SPELL_ICY_TOUCH);
+ events.ScheduleEvent(EVENT_ICY_TOUCH, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_STRANGULATE:
+ if (Unit* target = SelectEnemyCaster(false))
+ {
+ DoCast(target, SPELL_STRANGULATE);
+ events.RescheduleEvent(EVENT_STRANGULATE, 120*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_STRANGULATE, 5*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
+ }
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_dkAI (creature);
}
- };
-
-};
-
-enum eRogueSpells
-{
- SPELL_FAN_OF_KNIVES = 65955, //2sec
- SPELL_BLIND = 65960, //2min
- SPELL_CLOAK = 65961, //90sec
- SPELL_BLADE_FLURRY = 65956, //2min
- SPELL_SHADOWSTEP = 66178, //30sec
- SPELL_HEMORRHAGE = 65954,
- SPELL_EVISCERATE = 65957,
};
class mob_toc_rogue : public CreatureScript
{
-public:
- mob_toc_rogue() : CreatureScript("mob_toc_rogue") { }
+ public:
+ mob_toc_rogue() : CreatureScript("mob_toc_rogue") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_rogueAI (creature);
- }
+ struct mob_toc_rogueAI : public boss_faction_championsAI
+ {
+ mob_toc_rogueAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_FAN_OF_KNIVES, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_BLIND, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CLOAK, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_BLADE_FLURRY, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SHADOWSTEP, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HEMORRHAGE, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_EVISCERATE, urand(20*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_WOUND_POISON, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE);
+ me->setPowerType(POWER_ENERGY);
+ me->SetMaxPower(POWER_ENERGY, 100);
+ }
- struct mob_toc_rogueAI : public boss_faction_championsAI
- {
- mob_toc_rogueAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- uint32 m_uiFanOfKnivesTimer;
- uint32 m_uiHemorrhageTimer;
- uint32 m_uiEviscerateTimer;
- uint32 m_uiShadowstepTimer;
- uint32 m_uiBlindTimer;
- uint32 m_uiCloakTimer;
- uint32 m_uiBladeFlurryTimer;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_FAN_OF_KNIVES:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCastAOE(SPELL_FAN_OF_KNIVES);
+ events.ScheduleEvent(EVENT_FAN_OF_KNIVES, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_BLIND:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ DoCast(target, SPELL_BLIND);
+ events.ScheduleEvent(EVENT_BLIND, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_CLOAK:
+ if (HealthBelowPct(50))
+ {
+ DoCast(SPELL_CLOAK);
+ events.RescheduleEvent(EVENT_CLOAK, 90*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_CLOAK, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_BLADE_FLURRY:
+ if (EnemiesInRange(10.0f) >= 2)
+ {
+ DoCast(SPELL_BLADE_FLURRY);
+ events.RescheduleEvent(EVENT_BLADE_FLURRY, 120*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_BLADE_FLURRY, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_SHADOWSTEP:
+ if (me->IsInRange(me->getVictim(), 10.0f, 40.0f, false))
+ {
+ DoCast(me->getVictim(), SPELL_SHADOWSTEP);
+ events.RescheduleEvent(EVENT_SHADOWSTEP, 30*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_SHADOWSTEP, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_HEMORRHAGE:
+ DoCastVictim(SPELL_HEMORRHAGE);
+ events.ScheduleEvent(EVENT_HEMORRHAGE, urand(3*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_EVISCERATE:
+ DoCastVictim(SPELL_EVISCERATE);
+ events.ScheduleEvent(EVENT_EVISCERATE, urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS));
+ return;
+ case EVENT_WOUND_POISON:
+ DoCastVictim(SPELL_WOUND_POISON);
+ events.ScheduleEvent(EVENT_WOUND_POISON, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
+ }
+ }
+ };
- void Reset()
+ CreatureAI* GetAI(Creature* creature) const
{
- boss_faction_championsAI::Reset();
- m_uiFanOfKnivesTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- m_uiHemorrhageTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- m_uiEviscerateTimer = urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS);
- m_uiShadowstepTimer = urand(10*IN_MILLISECONDS, 80*IN_MILLISECONDS);
- m_uiBlindTimer = urand(7*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- m_uiCloakTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- m_uiBladeFlurryTimer = urand(12*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- SetEquipmentSlots(false, 47422, 49982, EQUIP_NO_CHANGE);
+ return new mob_toc_rogueAI (creature);
}
+};
+
+class mob_toc_enh_shaman : public CreatureScript
+{
+ public:
+ mob_toc_enh_shaman() : CreatureScript("mob_toc_enh_shaman") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_toc_enh_shamanAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_enh_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_DPS_EARTH_SHOCK, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_LAVA_LASH, urand(3*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_STORMSTRIKE, urand(2*IN_MILLISECONDS, 5*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DPS_BLOODLUST_HEROISM, 20*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_DEPLOY_TOTEM, 1*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_WINDFURY, urand(20*IN_MILLISECONDS, 50*IN_MILLISECONDS));
+
+ _totemCount = 0;
+ _totemOldCenterX = me->GetPositionX();
+ _totemOldCenterY = me->GetPositionY();
+ SetEquipmentSlots(false, 51803, 48013, EQUIP_NO_CHANGE);
+ summons.DespawnAll();
+ }
- if (m_uiFanOfKnivesTimer <= uiDiff)
+ void JustSummoned(Creature* summoned)
{
- if (EnemiesInRange(15.0f) > 2)
- DoCastAOE(SPELL_FAN_OF_KNIVES);
- m_uiFanOfKnivesTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- } else m_uiFanOfKnivesTimer -= uiDiff;
+ summons.Summon(summoned);
+ }
- if (m_uiHemorrhageTimer <= uiDiff)
+ void SummonedCreatureDespawn(Creature* /*pSummoned*/)
{
- DoCastVictim(SPELL_HEMORRHAGE);
- m_uiHemorrhageTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- } else m_uiHemorrhageTimer -= uiDiff;
+ --_totemCount;
+ }
- if (m_uiEviscerateTimer <= uiDiff)
+ void DeployTotem()
{
- DoCastVictim(SPELL_EVISCERATE);
- m_uiEviscerateTimer = urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS);
- } else m_uiEviscerateTimer -= uiDiff;
+ _totemCount = 4;
+ _totemOldCenterX = me->GetPositionX();
+ _totemOldCenterY = me->GetPositionY();
+ /*
+ -Windfury (16% melee haste)
+ -Grounding (redirects one harmful magic spell to the totem)
- if (m_uiShadowstepTimer <= uiDiff)
- {
- if (me->IsInRange(me->getVictim(), 10.0f, 40.0f))
- DoCastVictim(SPELL_SHADOWSTEP);
- m_uiShadowstepTimer = urand(10*IN_MILLISECONDS, 80*IN_MILLISECONDS);
- } else m_uiShadowstepTimer -= uiDiff;
+ -Healing Stream (unable to find amount of healing in our logs)
- if (m_uiBlindTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
- if (me->IsInRange(target, 0.0f, 15.0f, false))
- DoCast(target, SPELL_BLIND);
- m_uiBlindTimer = urand(7*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- } else m_uiBlindTimer -= uiDiff;
+ -Tremor (prevents fear effects)
+ -Strength of Earth (155 strength and agil for the opposing team)
- if (m_uiCloakTimer <= uiDiff)
- {
- if (HealthBelowPct(50))
- DoCast(me, SPELL_CLOAK);
- m_uiCloakTimer = urand(20*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- } else m_uiCloakTimer -= uiDiff;
+ -Searing (average ~3500 damage on a random target every ~3.5 seconds)
+ */
+ }
- if (m_uiBladeFlurryTimer <= uiDiff)
+ void JustDied(Unit* killer)
{
- DoCastVictim(SPELL_BLADE_FLURRY);
- m_uiBladeFlurryTimer = urand(12*IN_MILLISECONDS, 120*IN_MILLISECONDS);
- } else m_uiBladeFlurryTimer -= uiDiff;
-
- boss_faction_championsAI::UpdateAI(uiDiff);
- }
- };
-
-};
-
-enum eEnhShamanSpells
-{
- SPELL_EARTH_SHOCK_ENH = 65973,
- SPELL_LAVA_LASH = 65974,
- SPELL_STORMSTRIKE = 65970,
-};
-
-class mob_toc_enh_shaman : public CreatureScript
-{
-public:
- mob_toc_enh_shaman() : CreatureScript("mob_toc_enh_shaman") { }
+ boss_faction_championsAI::JustDied(killer);
+ summons.DespawnAll();
+ }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_enh_shamanAI (creature);
- }
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
- struct mob_toc_enh_shamanAI : public boss_faction_championsAI
- {
- mob_toc_enh_shamanAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE), Summons(me) {}
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- SummonList Summons;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- uint32 m_uiHeroismOrBloodlustTimer;
- uint32 m_uiEarthShockTimer;
- uint32 m_uiStormstrikeTimer;
- uint32 m_uiLavaLashTimer;
- uint32 m_uiDeployTotemTimer;
- uint8 m_uiTotemCount;
- float m_fTotemOldCenterX, m_fTotemOldCenterY;
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_DPS_EARTH_SHOCK:
+ if (Unit* target = SelectEnemyCaster(true))
+ DoCast(target, SPELL_EARTH_SHOCK);
+ events.ScheduleEvent(EVENT_DPS_EARTH_SHOCK, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_LAVA_LASH:
+ DoCastVictim(SPELL_LAVA_LASH);
+ events.ScheduleEvent(EVENT_LAVA_LASH, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_STORMSTRIKE:
+ DoCastVictim(SPELL_STORMSTRIKE);
+ events.ScheduleEvent(EVENT_STORMSTRIKE, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_DPS_BLOODLUST_HEROISM:
+ if (me->getFaction()) //Am i alliance?
+ {
+ if (!me->HasAura(AURA_EXHAUSTION))
+ DoCastAOE(SPELL_HEROISM);
+ }
+ else
+ {
+ if (!me->HasAura(AURA_SATED))
+ DoCastAOE(SPELL_BLOODLUST);
+ }
+ events.ScheduleEvent(EVENT_DPS_BLOODLUST_HEROISM, 5*MINUTE*IN_MILLISECONDS);
+ return;
+ case EVENT_DEPLOY_TOTEM:
+ if (_totemCount < 4 || me->GetDistance2d(_totemOldCenterX, _totemOldCenterY) > 20.0f)
+ DeployTotem();
+ events.ScheduleEvent(EVENT_DEPLOY_TOTEM, 1*IN_MILLISECONDS);
+ return;
+ case EVENT_WINDFURY:
+ DoCastVictim(SPELL_WINDFURY);
+ events.ScheduleEvent(EVENT_WINDFURY, urand(20*IN_MILLISECONDS, 60*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
+ }
+ }
+ private:
+ uint8 _totemCount;
+ float _totemOldCenterX, _totemOldCenterY;
+ };
- void Reset()
+ CreatureAI* GetAI(Creature* creature) const
{
- boss_faction_championsAI::Reset();
- m_uiHeroismOrBloodlustTimer = urand(25*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- m_uiEarthShockTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- m_uiStormstrikeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- m_uiLavaLashTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- m_uiDeployTotemTimer = urand(1*IN_MILLISECONDS, 3*IN_MILLISECONDS);
- m_uiTotemCount = 0;
- m_fTotemOldCenterX = me->GetPositionX();
- m_fTotemOldCenterY = me->GetPositionY();
- SetEquipmentSlots(false, 51803, 48013, EQUIP_NO_CHANGE);
- Summons.DespawnAll();
+ return new mob_toc_enh_shamanAI (creature);
}
+};
- void JustSummoned(Creature* summoned)
- {
- Summons.Summon(summoned);
- }
+class mob_toc_retro_paladin : public CreatureScript
+{
+ public:
+ mob_toc_retro_paladin() : CreatureScript("mob_toc_retro_paladin") { }
- void SummonedCreatureDespawn(Creature* /*pSummoned*/)
+ struct mob_toc_retro_paladinAI : public boss_faction_championsAI
{
- --m_uiTotemCount;
- }
+ mob_toc_retro_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_AVENGING_WRATH, urand(25*IN_MILLISECONDS, 35*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_CRUSADER_STRIKE, urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DIVINE_STORM, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE_RET, urand(10*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_JUDGEMENT_OF_COMMAND, urand(5*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_REPENTANCE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_DPS_DIVINE_SHIELD, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ SetEquipmentSlots(false, 47519, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
+ }
- void DeployTotem()
- {
- m_uiTotemCount = 4;
- m_fTotemOldCenterX = me->GetPositionX();
- m_fTotemOldCenterY = me->GetPositionY();
- /*
- -Windfury (16% melee haste)
- -Grounding (redirects one harmful magic spell to the totem)
+ void EnterCombat(Unit* who)
+ {
+ boss_faction_championsAI::EnterCombat(who);
+ DoCast(SPELL_SEAL_OF_COMMAND);
+ }
- -Healing Stream (unable to find amount of healing in our logs)
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
- -Tremor (prevents fear effects)
- -Strength of Earth (155 strength and agil for the opposing team)
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- -Searing (average ~3500 damage on a random target every ~3.5 seconds)
- */
- }
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_AVENGING_WRATH:
+ DoCast(SPELL_AVENGING_WRATH);
+ events.ScheduleEvent(EVENT_AVENGING_WRATH, 180*IN_MILLISECONDS);
+ return;
+ case EVENT_CRUSADER_STRIKE:
+ DoCastVictim(SPELL_CRUSADER_STRIKE);
+ events.ScheduleEvent(EVENT_CRUSADER_STRIKE, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_DIVINE_STORM:
+ if (EnemiesInRange(10.0f) >= 2)
+ DoCast(SPELL_DIVINE_STORM);
+ events.ScheduleEvent(EVENT_DIVINE_STORM, urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS));
+ return;
+ case EVENT_HAMMER_OF_JUSTICE_RET:
+ DoCastVictim(SPELL_HAMMER_OF_JUSTICE_RET);
+ events.ScheduleEvent(EVENT_HAMMER_OF_JUSTICE_RET, 40*IN_MILLISECONDS);
+ return;
+ case EVENT_JUDGEMENT_OF_COMMAND:
+ DoCastVictim(SPELL_JUDGEMENT_OF_COMMAND);
+ events.ScheduleEvent(EVENT_JUDGEMENT_OF_COMMAND, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_REPENTANCE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
+ DoCast(target, SPELL_REPENTANCE);
+ events.ScheduleEvent(EVENT_REPENTANCE, 60*IN_MILLISECONDS);
+ return;
+ case EVENT_DPS_HAND_OF_PROTECTION:
+ if (Unit* target = DoSelectLowestHpFriendly(30.0f))
+ {
+ if (!target->HasAura(SPELL_FORBEARANCE))
+ {
+ DoCast(target, SPELL_HAND_OF_PROTECTION);
+ events.RescheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, 5*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DPS_HAND_OF_PROTECTION, 5*IN_MILLISECONDS);
+ return;
+ case EVENT_DPS_DIVINE_SHIELD:
+ if (HealthBelowPct(30) && !me->HasAura(SPELL_FORBEARANCE))
+ {
+ DoCast(me, SPELL_DIVINE_SHIELD);
+ events.RescheduleEvent(EVENT_DPS_DIVINE_SHIELD, 5*MINUTE*IN_MILLISECONDS);
+ }
+ else
+ events.RescheduleEvent(EVENT_DPS_DIVINE_SHIELD, 5*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
+ }
+ }
+ };
- void JustDied(Unit* killer)
+ CreatureAI* GetAI(Creature* creature) const
{
- boss_faction_championsAI::JustDied(killer);
- Summons.DespawnAll();
+ return new mob_toc_retro_paladinAI (creature);
}
+};
- void UpdateAI(const uint32 uiDiff)
+class mob_toc_pet_warlock : public CreatureScript
+{
+ public:
+ mob_toc_pet_warlock() : CreatureScript("mob_toc_pet_warlock") { }
+
+ struct mob_toc_pet_warlockAI : public boss_faction_championsAI
{
- if (!UpdateVictim())
- return;
+ mob_toc_pet_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {}
- if (m_uiHeroismOrBloodlustTimer <= uiDiff)
+ void Reset()
{
- if (me->getFaction()) //Am i alliance?
- {
- if (!me->HasAura(AURA_EXHAUSTION))
- DoCastAOE(SPELL_HEROISM);
- }
- else
- if (!me->HasAura(AURA_SATED))
- DoCastAOE(SPELL_BLOODLUST);
- m_uiHeroismOrBloodlustTimer = urand(25*IN_MILLISECONDS, 60*IN_MILLISECONDS);
- } else m_uiHeroismOrBloodlustTimer -= uiDiff;
+ boss_faction_championsAI::Reset();
+ events.ScheduleEvent(EVENT_DEVOUR_MAGIC, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_SPELL_LOCK, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ }
- if (m_uiEarthShockTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- DoCastVictim(SPELL_EARTH_SHOCK_ENH);
- m_uiEarthShockTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- } else m_uiEarthShockTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiStormstrikeTimer <= uiDiff)
- {
- DoCastVictim(SPELL_STORMSTRIKE);
- m_uiStormstrikeTimer = urand(5*IN_MILLISECONDS, 90*IN_MILLISECONDS);
- } else m_uiStormstrikeTimer -= uiDiff;
+ events.Update(diff);
+ boss_faction_championsAI::UpdateAI(diff);
- if (m_uiLavaLashTimer <= uiDiff)
- {
- DoCastVictim(SPELL_LAVA_LASH);
- m_uiLavaLashTimer = urand(5*IN_MILLISECONDS, 8*IN_MILLISECONDS);
- } else m_uiLavaLashTimer -= uiDiff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (m_uiDeployTotemTimer <= uiDiff)
- {
- if (m_uiTotemCount < 4 || me->GetDistance2d(m_fTotemOldCenterX, m_fTotemOldCenterY) > 20.0f)
- DeployTotem();
- m_uiDeployTotemTimer = urand(1*IN_MILLISECONDS, 3*IN_MILLISECONDS);
- } else m_uiDeployTotemTimer -= uiDiff;
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_DEVOUR_MAGIC:
+ DoCastVictim(SPELL_DEVOUR_MAGIC);
+ events.ScheduleEvent(EVENT_DEVOUR_MAGIC, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_SPELL_LOCK:
+ DoCast(SPELL_SPELL_LOCK);
+ events.ScheduleEvent(EVENT_SPELL_LOCK, urand(24*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
+ }
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_toc_pet_warlockAI (creature);
}
- };
-
};
-enum eRetroPaladinSpells
+class mob_toc_pet_hunter : public CreatureScript
{
- SPELL_AVENGING_WRATH = 66011, //3min cd
- SPELL_CRUSADER_STRIKE = 66003, //6sec cd
- SPELL_DIVINE_SHIELD = 66010, //5min cd
- SPELL_DIVINE_STORM = 66006, //10sec cd
- SPELL_HAMMER_OF_JUSTICE_RET = 66007, //40sec cd
- SPELL_HAND_OF_PROTECTION_RET = 66009, //5min cd
- SPELL_JUDGEMENT_OF_COMMAND = 66005, //8sec cd
- SPELL_REPENTANCE = 66008, //60sec cd
- SPELL_SEAL_OF_COMMAND = 66004, //no cd
-};
+ public:
+ mob_toc_pet_hunter() : CreatureScript("mob_toc_pet_hunter") { }
-class mob_toc_retro_paladin : public CreatureScript
-{
-public:
- mob_toc_retro_paladin() : CreatureScript("mob_toc_retro_paladin") { }
+ struct mob_toc_pet_hunterAI : public boss_faction_championsAI
+ {
+ mob_toc_pet_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {}
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_retro_paladinAI (creature);
- }
+ void Reset()
+ {
+ boss_faction_championsAI::Reset();
+ _clawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS);
+ }
- struct mob_toc_retro_paladinAI : public boss_faction_championsAI
- {
- mob_toc_retro_paladinAI(Creature* creature) : boss_faction_championsAI(creature, AI_MELEE) {}
+ void UpdateAI(const uint32 diff)
+ {
+ if (!UpdateVictim())
+ return;
- uint32 m_uiRepeteanceTimer;
- uint32 m_uiCrusaderStrikeTimer;
- uint32 m_uiAvengingWrathTimer;
- uint32 m_uiDivineShieldTimer;
- uint32 m_uiDivineStormTimer;
- uint32 m_uiJudgementOfCommandTimer;
+ boss_faction_championsAI::UpdateAI(diff);
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiRepeteanceTimer = 60*IN_MILLISECONDS;
- m_uiCrusaderStrikeTimer = urand(6*IN_MILLISECONDS, 18*IN_MILLISECONDS);
- m_uiAvengingWrathTimer = 180*IN_MILLISECONDS;
- m_uiDivineShieldTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- m_uiDivineStormTimer = 10*IN_MILLISECONDS;
- m_uiJudgementOfCommandTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- SetEquipmentSlots(false, 47519, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
- }
+ if (_clawTimer <= diff)
+ {
+ DoCastVictim(SPELL_CLAW);
+ _clawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS);
+ }
+ else
+ _clawTimer -= diff;
+ }
+ private:
+ uint32 _clawTimer;
+ };
- void EnterCombat(Unit* who)
+ CreatureAI* GetAI(Creature* creature) const
{
- boss_faction_championsAI::EnterCombat(who);
- DoCast(SPELL_SEAL_OF_COMMAND);
+ return new mob_toc_pet_hunterAI (creature);
}
+};
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
-
- if (m_uiRepeteanceTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_REPENTANCE);
- m_uiRepeteanceTimer = 60*IN_MILLISECONDS;
- } else m_uiRepeteanceTimer -= uiDiff;
-
- if (m_uiCrusaderStrikeTimer <= uiDiff)
- {
- DoCastVictim(SPELL_CRUSADER_STRIKE);
- m_uiCrusaderStrikeTimer = urand(6*IN_MILLISECONDS, 18*IN_MILLISECONDS);
- } else m_uiCrusaderStrikeTimer -= uiDiff;
+class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader
+{
+ public:
+ spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { }
- if (m_uiAvengingWrathTimer <= uiDiff)
- {
- DoCastVictim(SPELL_AVENGING_WRATH);
- m_uiAvengingWrathTimer = 180*IN_MILLISECONDS;
- } else m_uiAvengingWrathTimer -= uiDiff;
+ class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript);
- if (m_uiDivineShieldTimer <= uiDiff)
+ bool Validate(SpellInfo const* /*spell*/)
{
- if (HealthBelowPct(20))
- DoCast(me, SPELL_DIVINE_SHIELD);
- m_uiDivineShieldTimer = urand(0*IN_MILLISECONDS, 360*IN_MILLISECONDS);
- } else m_uiDivineShieldTimer -= uiDiff;
+ if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL))
+ return false;
+ return true;
+ }
- if (m_uiDivineStormTimer <= uiDiff)
+ void HandleDispel(DispelInfo* dispelInfo)
{
- DoCastVictim(SPELL_DIVINE_STORM);
- m_uiDivineStormTimer = 10*IN_MILLISECONDS;
- } else m_uiDivineStormTimer -= uiDiff;
+ if (Unit* caster = GetCaster())
+ caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0));
+ }
- if (m_uiJudgementOfCommandTimer <= uiDiff)
+ void Register()
{
- DoCastVictim(SPELL_JUDGEMENT_OF_COMMAND);
- m_uiJudgementOfCommandTimer = urand(8*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiJudgementOfCommandTimer -= uiDiff;
+ AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel);
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_faction_champion_warl_unstable_affliction_AuraScript();
}
- };
-
-};
-
-enum eWarlockPetSpells
-{
- SPELL_DEVOUR_MAGIC = 67518,
- SPELL_SPELL_LOCK = 67519,
};
-class mob_toc_pet_warlock : public CreatureScript
+class spell_faction_champion_death_grip : public SpellScriptLoader
{
-public:
- mob_toc_pet_warlock() : CreatureScript("mob_toc_pet_warlock") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_pet_warlockAI (creature);
- }
-
- struct mob_toc_pet_warlockAI : public boss_faction_championsAI
- {
- mob_toc_pet_warlockAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {}
-
- uint32 m_uiDevourMagicTimer;
- uint32 m_uiSpellLockTimer;
-
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiDevourMagicTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- m_uiSpellLockTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- }
+ public:
+ spell_faction_champion_death_grip() : SpellScriptLoader("spell_faction_champion_death_grip") { }
- void UpdateAI(const uint32 uiDiff)
+ class spell_faction_champion_death_grip_SpellScript : public SpellScript
{
- if (!UpdateVictim())
- return;
+ PrepareSpellScript(spell_faction_champion_death_grip_SpellScript);
- if (m_uiDevourMagicTimer <= uiDiff)
+ bool Validate(SpellInfo const* /*spell*/)
{
- DoCastVictim(SPELL_DEVOUR_MAGIC);
- m_uiDevourMagicTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiDevourMagicTimer -= uiDiff;
+ if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_GRIP_PULL))
+ return false;
+ return true;
+ }
- if (m_uiSpellLockTimer <= uiDiff)
+ void HandleDummy(SpellEffIndex /*effIndex*/)
{
- DoCastVictim(SPELL_SPELL_LOCK);
- m_uiSpellLockTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiSpellLockTimer -= uiDiff;
+ if (Unit* target = GetHitUnit())
+ {
+ if (Unit* caster = GetCaster())
+ target->CastSpell(caster, SPELL_DEATH_GRIP_PULL);
+ }
+ }
- boss_faction_championsAI::UpdateAI(uiDiff);
- }
- };
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_faction_champion_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
-};
+ };
-enum eHunterPetSpells
-{
- SPELL_CLAW = 67793,
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_faction_champion_death_grip_SpellScript();
+ }
};
-class mob_toc_pet_hunter : public CreatureScript
+class spell_toc_bloodlust : public SpellScriptLoader
{
-public:
- mob_toc_pet_hunter() : CreatureScript("mob_toc_pet_hunter") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_toc_pet_hunterAI (creature);
- }
+ public:
+ spell_toc_bloodlust() : SpellScriptLoader("spell_toc_bloodlust") { }
- struct mob_toc_pet_hunterAI : public boss_faction_championsAI
- {
- mob_toc_pet_hunterAI(Creature* creature) : boss_faction_championsAI(creature, AI_PET) {}
+ class spell_toc_bloodlust_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_toc_bloodlust_SpellScript);
- uint32 m_uiClawTimer;
+ bool Validate(SpellInfo const* /*spellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(AURA_SATED))
+ return false;
+ return true;
+ }
- void Reset()
- {
- boss_faction_championsAI::Reset();
- m_uiClawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- }
+ void RemoveInvalidTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(Trinity::UnitAuraCheck(true, AURA_SATED));
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
+ void ApplyDebuff()
+ {
+ if (Unit* target = GetHitUnit())
+ target->CastSpell(target, AURA_SATED, true);
+ }
- if (m_uiClawTimer <= uiDiff)
+ void Register()
{
- DoCastVictim(SPELL_CLAW);
- m_uiClawTimer = urand(5*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- } else m_uiClawTimer -= uiDiff;
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_bloodlust_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
+ AfterHit += SpellHitFn(spell_toc_bloodlust_SpellScript::ApplyDebuff);
+ }
+ };
- boss_faction_championsAI::UpdateAI(uiDiff);
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_toc_bloodlust_SpellScript();
}
- };
};
-class spell_faction_champion_warl_unstable_affliction : public SpellScriptLoader
+class spell_toc_heroism : public SpellScriptLoader
{
public:
- spell_faction_champion_warl_unstable_affliction() : SpellScriptLoader("spell_faction_champion_warl_unstable_affliction") { }
+ spell_toc_heroism() : SpellScriptLoader("spell_toc_heroism") { }
- class spell_faction_champion_warl_unstable_affliction_AuraScript : public AuraScript
+ class spell_toc_heroism_SpellScript : public SpellScript
{
- PrepareAuraScript(spell_faction_champion_warl_unstable_affliction_AuraScript);
+ PrepareSpellScript(spell_toc_heroism_SpellScript);
- bool Validate(SpellInfo const* /*spell*/)
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL))
+ if (!sSpellMgr->GetSpellInfo(AURA_EXHAUSTION))
return false;
return true;
}
- void HandleDispel(DispelInfo* dispelInfo)
+ void RemoveInvalidTargets(std::list<WorldObject*>& targets)
{
- if (Unit* caster = GetCaster())
- caster->CastSpell(dispelInfo->GetDispeller(), SPELL_UNSTABLE_AFFLICTION_DISPEL, true, NULL, GetEffect(EFFECT_0));
+ targets.remove_if(Trinity::UnitAuraCheck(true, AURA_EXHAUSTION));
+ }
+
+ void ApplyDebuff()
+ {
+ if (Unit* target = GetHitUnit())
+ target->CastSpell(target, AURA_EXHAUSTION, true);
}
void Register()
{
- AfterDispel += AuraDispelFn(spell_faction_champion_warl_unstable_affliction_AuraScript::HandleDispel);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_heroism_SpellScript::RemoveInvalidTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_toc_heroism_SpellScript::RemoveInvalidTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY);
+ AfterHit += SpellHitFn(spell_toc_heroism_SpellScript::ApplyDebuff);
}
};
- AuraScript* GetAuraScript() const
+ SpellScript* GetSpellScript() const
{
- return new spell_faction_champion_warl_unstable_affliction_AuraScript();
+ return new spell_toc_heroism_SpellScript();
}
};
@@ -2086,5 +2392,9 @@ void AddSC_boss_faction_champions()
new mob_toc_retro_paladin();
new mob_toc_pet_warlock();
new mob_toc_pet_hunter();
+
new spell_faction_champion_warl_unstable_affliction();
+ new spell_faction_champion_death_grip();
+ new spell_toc_bloodlust();
+ new spell_toc_heroism();
}
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 a7328b43826..e2068cabb95 100755..100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp
@@ -16,43 +16,25 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: trial_of_the_crusader
-SD%Complete: ??%
-SDComment: based on /dev/rsa
-SDCategory: Crusader Coliseum
-EndScriptData */
-
-// Known bugs:
-// Some visuals aren't appearing right sometimes
-//
-// TODO:
-// Redone summon's scripts in SAI
-// Add immunities to the boss and summons
-
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
+#include "SpellScript.h"
enum Yells
{
- SAY_INTRO = -1649030,
- SAY_AGGRO = -1649031,
- SAY_DEATH = -1649032,
- EMOTE_INCINERATE = -1649033,
- SAY_INCINERATE = -1649034,
- EMOTE_LEGION_FLAME = -1649035,
- EMOTE_NETHER_PORTAL = -1649036,
- SAY_NETHER_PORTAL = -1649037,
- EMOTE_INFERNAL_ERUPTION = -1649038,
- SAY_INFERNAL_ERUPTION = -1649039,
-};
-
-enum Equipment
-{
- EQUIP_MAIN = 47266,
- EQUIP_OFFHAND = 46996,
- EQUIP_RANGED = 47267,
- EQUIP_DONE = EQUIP_NO_CHANGE,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ EMOTE_LEGION_FLAME = 2,
+ EMOTE_NETHER_PORTAL = 3,
+ SAY_MISTRESS_OF_PAIN = 4,
+ EMOTE_INCINERATE = 5,
+ SAY_INCINERATE = 6,
+ EMOTE_INFERNAL_ERUPTION = 7,
+ SAY_INFERNAL_ERUPTION = 8,
+ SAY_KILL_PLAYER = 9,
+ SAY_DEATH = 10,
+ SAY_BERSERK = 11
};
enum Summons
@@ -61,7 +43,7 @@ enum Summons
NPC_INFERNAL_VOLCANO = 34813,
NPC_FEL_INFERNAL = 34815, // immune to all CC on Heroic (stuns, banish, interrupt, etc)
NPC_NETHER_PORTAL = 34825,
- NPC_MISTRESS_OF_PAIN = 34826,
+ NPC_MISTRESS_OF_PAIN = 34826
};
enum BossSpells
@@ -81,438 +63,530 @@ enum BossSpells
SPELL_BERSERK = 64238, // unused
// Mistress of Pain spells
- SPELL_SHIVAN_SLASH = 67098,
- SPELL_SPINNING_STRIKE = 66283,
- SPELL_MISTRESS_KISS = 67077,
- SPELL_FEL_INFERNO = 67047,
- SPELL_FEL_STREAK = 66494,
+ SPELL_SHIVAN_SLASH = 67098,
+ SPELL_SPINNING_STRIKE = 66283,
+ SPELL_MISTRESS_KISS = 66336,
+ 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
};
-/*######
-## boss_jaraxxus
-######*/
+enum Events
+{
+ // Lord Jaraxxus
+ EVENT_FEL_FIREBALL = 1,
+ EVENT_FEL_LIGHTNING = 2,
+ EVENT_INCINERATE_FLESH = 3,
+ EVENT_NETHER_POWER = 4,
+ EVENT_LEGION_FLAME = 5,
+ EVENT_SUMMONO_NETHER_PORTAL = 6,
+ EVENT_SUMMON_INFERNAL_ERUPTION = 7,
+
+ // Mistress of Pain
+ EVENT_SHIVAN_SLASH = 8,
+ EVENT_SPINNING_STRIKE = 9,
+ EVENT_MISTRESS_KISS = 10
+};
class boss_jaraxxus : public CreatureScript
{
-public:
- boss_jaraxxus() : CreatureScript("boss_jaraxxus") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_jaraxxusAI(creature);
- }
-
- struct boss_jaraxxusAI : public ScriptedAI
- {
- boss_jaraxxusAI(Creature* creature) : ScriptedAI(creature), Summons(me)
- {
- instance = creature->GetInstanceScript();
- Reset();
- }
-
- InstanceScript* instance;
-
- SummonList Summons;
+ public:
+ boss_jaraxxus() : CreatureScript("boss_jaraxxus") { }
- uint32 m_uiFelFireballTimer;
- uint32 m_uiFelLightningTimer;
- uint32 m_uiIncinerateFleshTimer;
- uint32 m_uiNetherPowerTimer;
- uint32 m_uiLegionFlameTimer;
- uint32 m_uiSummonNetherPortalTimer;
- uint32 m_uiSummonInfernalEruptionTimer;
-
- void Reset()
+ struct boss_jaraxxusAI : public BossAI
{
- if (instance)
- instance->SetData(TYPE_JARAXXUS, NOT_STARTED);
- SetEquipmentSlots(false, EQUIP_MAIN, EQUIP_OFFHAND, EQUIP_RANGED);
- m_uiFelFireballTimer = 5*IN_MILLISECONDS;
- m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- m_uiNetherPowerTimer = 40*IN_MILLISECONDS;
- m_uiLegionFlameTimer = 30*IN_MILLISECONDS;
- m_uiSummonNetherPortalTimer = 1*MINUTE*IN_MILLISECONDS;
- m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS;
- Summons.DespawnAll();
- }
+ boss_jaraxxusAI(Creature* creature) : BossAI(creature, BOSS_JARAXXUS)
+ {
+ }
- void JustReachedHome()
- {
- if (instance)
- instance->SetData(TYPE_JARAXXUS, FAIL);
- DoCast(me, SPELL_JARAXXUS_CHAINS);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->SetReactState(REACT_PASSIVE);
- }
+ void Reset()
+ {
+ _Reset();
+ events.ScheduleEvent(EVENT_FEL_FIREBALL, 5*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_FEL_LIGHTNING, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_INCINERATE_FLESH, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_LEGION_FLAME, 30*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SUMMONO_NETHER_PORTAL, 20*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SUMMON_INFERNAL_ERUPTION, 80*IN_MILLISECONDS);
+ }
- void KilledUnit(Unit* who)
- {
- if (who->GetTypeId() == TYPEID_PLAYER)
+ void JustReachedHome()
{
+ _JustReachedHome();
if (instance)
- instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
+ instance->SetBossState(BOSS_JARAXXUS, FAIL);
+ DoCast(me, SPELL_JARAXXUS_CHAINS);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
- }
- void JustDied(Unit* /*killer*/)
- {
- Summons.DespawnAll();
- DoScriptText(SAY_DEATH, me);
- if (instance)
- instance->SetData(TYPE_JARAXXUS, DONE);
- }
-
- void JustSummoned(Creature* summoned)
- {
- Summons.Summon(summoned);
- }
-
- void EnterCombat(Unit* /*who*/)
- {
- me->SetInCombatWithZone();
- if (instance)
- instance->SetData(TYPE_JARAXXUS, IN_PROGRESS);
- DoScriptText(SAY_AGGRO, me);
- }
-
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
-
- if (m_uiSummonInfernalEruptionTimer <= uiDiff)
+ void KilledUnit(Unit* who)
{
- DoScriptText(EMOTE_INFERNAL_ERUPTION, me);
- DoScriptText(SAY_INFERNAL_ERUPTION, me);
- DoCast(SPELL_INFERNAL_ERUPTION);
- m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS;
- } else m_uiSummonInfernalEruptionTimer -= uiDiff;
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ {
+ Talk(SAY_KILL_PLAYER);
+ if (instance)
+ instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
+ }
+ }
- if (m_uiSummonNetherPortalTimer <= uiDiff)
+ void JustDied(Unit* /*killer*/)
{
- DoScriptText(EMOTE_NETHER_PORTAL, me);
- DoScriptText(SAY_NETHER_PORTAL, me);
- DoCast(SPELL_NETHER_PORTAL);
- m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS;
- } else m_uiSummonNetherPortalTimer -= uiDiff;
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
- if (m_uiFelFireballTimer <= uiDiff)
+ void JustSummoned(Creature* summoned)
{
- DoCastVictim(SPELL_FEL_FIREBALL);
- m_uiFelFireballTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiFelFireballTimer -= uiDiff;
+ summons.Summon(summoned);
+ }
- if (m_uiFelLightningTimer <= uiDiff)
+ void EnterCombat(Unit* /*who*/)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
- DoCast(target, SPELL_FEL_LIGHTING);
- m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
- } else m_uiFelLightningTimer -= uiDiff;
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ }
- if (m_uiIncinerateFleshTimer <= uiDiff)
+ void UpdateAI(const uint32 diff)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))
- {
- DoScriptText(EMOTE_INCINERATE, me, target);
- DoScriptText(SAY_INCINERATE, me);
- DoCast(target, SPELL_INCINERATE_FLESH);
- }
- m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiIncinerateFleshTimer -= uiDiff;
+ if (!UpdateVictim())
+ return;
- if (m_uiNetherPowerTimer <= uiDiff)
- {
- me->CastCustomSpell(SPELL_NETHER_POWER, SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5, 10, 5,10), me, true);
- m_uiNetherPowerTimer = 40*IN_MILLISECONDS;
- } else m_uiNetherPowerTimer -= uiDiff;
+ events.Update(diff);
- if (m_uiLegionFlameTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- DoScriptText(EMOTE_LEGION_FLAME, me, target);
- DoCast(target, SPELL_LEGION_FLAME);
+ switch (eventId)
+ {
+ case EVENT_FEL_FIREBALL:
+ DoCastVictim(SPELL_FEL_FIREBALL);
+ events.ScheduleEvent(EVENT_FEL_FIREBALL, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_FEL_LIGHTNING:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_LORD_HITTIN))
+ DoCast(target, SPELL_FEL_LIGHTING);
+ events.ScheduleEvent(EVENT_FEL_LIGHTNING, urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS));
+ return;
+ case EVENT_INCINERATE_FLESH:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_LORD_HITTIN))
+ {
+ Talk(EMOTE_INCINERATE, target->GetGUID());
+ Talk(SAY_INCINERATE);
+ DoCast(target, SPELL_INCINERATE_FLESH);
+ }
+ events.ScheduleEvent(EVENT_INCINERATE_FLESH, urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ return;
+ case EVENT_NETHER_POWER:
+ me->CastCustomSpell(SPELL_NETHER_POWER, SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5, 10, 5,10), me, true);
+ events.ScheduleEvent(EVENT_NETHER_POWER, 40*IN_MILLISECONDS);
+ return;
+ case EVENT_LEGION_FLAME:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_LORD_HITTIN))
+ {
+ Talk(EMOTE_LEGION_FLAME, target->GetGUID());
+ DoCast(target, SPELL_LEGION_FLAME);
+ }
+ events.ScheduleEvent(EVENT_LEGION_FLAME, 30*IN_MILLISECONDS);
+ return;
+ case EVENT_SUMMONO_NETHER_PORTAL:
+ Talk(EMOTE_NETHER_PORTAL);
+ Talk(SAY_MISTRESS_OF_PAIN);
+ DoCast(SPELL_NETHER_PORTAL);
+ events.ScheduleEvent(EVENT_SUMMONO_NETHER_PORTAL, 2*MINUTE*IN_MILLISECONDS);
+ return;
+ case EVENT_SUMMON_INFERNAL_ERUPTION:
+ Talk(EMOTE_INFERNAL_ERUPTION);
+ Talk(SAY_INFERNAL_ERUPTION);
+ DoCast(SPELL_INFERNAL_ERUPTION);
+ events.ScheduleEvent(EVENT_SUMMON_INFERNAL_ERUPTION, 2*MINUTE*IN_MILLISECONDS);
+ return;
+ }
}
- m_uiLegionFlameTimer = 30*IN_MILLISECONDS;
- } else m_uiLegionFlameTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
- };
+ DoMeleeAttackIfReady();
+ }
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_jaraxxusAI(creature);
+ }
};
class mob_legion_flame : public CreatureScript
{
-public:
- mob_legion_flame() : CreatureScript("mob_legion_flame") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_legion_flameAI(creature);
- }
+ public:
+ mob_legion_flame() : CreatureScript("mob_legion_flame") { }
- struct mob_legion_flameAI : public Scripted_NoMovementAI
- {
- mob_legion_flameAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ struct mob_legion_flameAI : public Scripted_NoMovementAI
{
- Reset();
- }
+ mob_legion_flameAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ }
- void Reset()
- {
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetInCombatWithZone();
- DoCast(SPELL_LEGION_FLAME_EFFECT);
- }
+ void Reset()
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ me->SetInCombatWithZone();
+ DoCast(SPELL_LEGION_FLAME_EFFECT);
+ }
+
+ void UpdateAI(const uint32 /*diff*/)
+ {
+ UpdateVictim();
+ if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS)
+ me->DespawnOrUnsummon();
+ }
+ private:
+ InstanceScript* _instance;
+ };
- void UpdateAI(const uint32 /*uiDiff*/)
+ CreatureAI* GetAI(Creature* creature) const
{
- UpdateVictim();
+ return new mob_legion_flameAI(creature);
}
- };
-
};
class mob_infernal_volcano : public CreatureScript
{
-public:
- mob_infernal_volcano() : CreatureScript("mob_infernal_volcano") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_infernal_volcanoAI(creature);
- }
+ public:
+ mob_infernal_volcano() : CreatureScript("mob_infernal_volcano") { }
- struct mob_infernal_volcanoAI : public Scripted_NoMovementAI
- {
- mob_infernal_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature), Summons(me)
+ struct mob_infernal_volcanoAI : public Scripted_NoMovementAI
{
- instance = creature->GetInstanceScript();
- Reset();
- }
+ mob_infernal_volcanoAI(Creature* creature) : Scripted_NoMovementAI(creature), _summons(me)
+ {
+ }
- InstanceScript* instance;
+ void Reset()
+ {
+ me->SetReactState(REACT_PASSIVE);
- SummonList Summons;
+ if (!IsHeroic())
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
+ else
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
- void Reset()
- {
- me->SetReactState(REACT_PASSIVE);
+ _summons.DespawnAll();
+ }
- if (!IsHeroic())
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
- else
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
+ void IsSummonedBy(Unit* /*summoner*/)
+ {
+ DoCast(SPELL_INFERNAL_ERUPTION_EFFECT);
+ }
- Summons.DespawnAll();
- }
+ void JustSummoned(Creature* summoned)
+ {
+ _summons.Summon(summoned);
+ // makes immediate corpse despawn of summoned Felflame Infernals
+ summoned->SetCorpseDelay(0);
+ }
- void IsSummonedBy(Unit* /*summoner*/)
- {
- DoCast(SPELL_INFERNAL_ERUPTION_EFFECT);
- }
+ void JustDied(Unit* /*killer*/)
+ {
+ // used to despawn corpse immediately
+ me->DespawnOrUnsummon();
+ }
- void JustSummoned(Creature* summoned)
- {
- Summons.Summon(summoned);
- // makes immediate corpse despawn of summoned Felflame Infernals
- summoned->SetCorpseDelay(0);
- }
+ void UpdateAI(uint32 const /*diff*/) {}
+
+ private:
+ SummonList _summons;
+ };
- void JustDied(Unit* /*killer*/)
+ CreatureAI* GetAI(Creature* creature) const
{
- // used to despawn corpse immediately
- me->DespawnOrUnsummon();
+ return new mob_infernal_volcanoAI(creature);
}
- };
-
};
class mob_fel_infernal : public CreatureScript
{
-public:
- mob_fel_infernal() : CreatureScript("mob_fel_infernal") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_fel_infernalAI(creature);
- }
+ public:
+ mob_fel_infernal() : CreatureScript("mob_fel_infernal") { }
- struct mob_fel_infernalAI : public ScriptedAI
- {
- mob_fel_infernalAI(Creature* creature) : ScriptedAI(creature)
+ struct mob_fel_infernalAI : public ScriptedAI
{
- instance = creature->GetInstanceScript();
- Reset();
- }
-
- InstanceScript* instance;
- uint32 m_uiFelStreakTimer;
+ mob_fel_infernalAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ }
- void Reset()
- {
- m_uiFelStreakTimer = 30*IN_MILLISECONDS;
- me->SetInCombatWithZone();
- }
+ void Reset()
+ {
+ _felStreakTimer = 30*IN_MILLISECONDS;
+ me->SetInCombatWithZone();
+ }
- /*void SpellHitTarget(Unit* target, const SpellInfo* pSpell)
- {
- if (pSpell->Id == SPELL_FEL_STREAK)
- DoCastAOE(SPELL_FEL_INFERNO); //66517
- }*/
+ void UpdateAI(const uint32 diff)
+ {
+ if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS)
+ {
+ me->DespawnOrUnsummon();
+ return;
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (!UpdateVictim())
- return;
+ if (!UpdateVictim())
+ return;
- if (instance && instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS)
- me->DespawnOrUnsummon();
+ if (_felStreakTimer <= diff)
+ {
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ DoCast(target, SPELL_FEL_STREAK);
+ _felStreakTimer = 30*IN_MILLISECONDS;
+ }
+ else
+ _felStreakTimer -= diff;
- if (m_uiFelStreakTimer <= uiDiff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_FEL_STREAK);
- m_uiFelStreakTimer = 30*IN_MILLISECONDS;
- } else m_uiFelStreakTimer -= uiDiff;
+ DoMeleeAttackIfReady();
+ }
+ private:
+ uint32 _felStreakTimer;
+ InstanceScript* _instance;
+ };
- DoMeleeAttackIfReady();
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_fel_infernalAI(creature);
}
- };
-
};
class mob_nether_portal : public CreatureScript
{
-public:
- mob_nether_portal() : CreatureScript("mob_nether_portal") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_nether_portalAI(creature);
- }
+ public:
+ mob_nether_portal() : CreatureScript("mob_nether_portal") { }
- struct mob_nether_portalAI : public ScriptedAI
- {
- mob_nether_portalAI(Creature* creature) : ScriptedAI(creature), Summons(me)
+ struct mob_nether_portalAI : public ScriptedAI
{
- instance = creature->GetInstanceScript();
- Reset();
- }
+ mob_nether_portalAI(Creature* creature) : ScriptedAI(creature), _summons(me)
+ {
+ }
- InstanceScript* instance;
+ void Reset()
+ {
+ me->SetReactState(REACT_PASSIVE);
- SummonList Summons;
+ if (!IsHeroic())
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
+ else
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
- void Reset()
- {
- me->SetReactState(REACT_PASSIVE);
+ _summons.DespawnAll();
+ }
- if (!IsHeroic())
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
- else
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED);
+ void IsSummonedBy(Unit* /*summoner*/)
+ {
+ DoCast(SPELL_NETHER_PORTAL_EFFECT);
+ }
- Summons.DespawnAll();
- }
+ void JustSummoned(Creature* summoned)
+ {
+ _summons.Summon(summoned);
+ // makes immediate corpse despawn of summoned Mistress of Pain
+ summoned->SetCorpseDelay(0);
+ }
- void IsSummonedBy(Unit* /*summoner*/)
- {
- DoCast(SPELL_NETHER_PORTAL_EFFECT);
- }
+ void JustDied(Unit* /*killer*/)
+ {
+ // used to despawn corpse immediately
+ me->DespawnOrUnsummon();
+ }
- void JustSummoned(Creature* summoned)
- {
- Summons.Summon(summoned);
- // makes immediate corpse despawn of summoned Mistress of Pain
- summoned->SetCorpseDelay(0);
- }
+ void UpdateAI(uint32 const /*diff*/) {}
+
+ private:
+ SummonList _summons;
+ };
- void JustDied(Unit* /*killer*/)
+ CreatureAI* GetAI(Creature* creature) const
{
- // used to despawn corpse immediately
- me->DespawnOrUnsummon();
+ return new mob_nether_portalAI(creature);
}
- };
-
};
class mob_mistress_of_pain : public CreatureScript
{
-public:
- mob_mistress_of_pain() : CreatureScript("mob_mistress_of_pain") { }
+ public:
+ mob_mistress_of_pain() : CreatureScript("mob_mistress_of_pain") { }
+
+ struct mob_mistress_of_painAI : public ScriptedAI
+ {
+ mob_mistress_of_painAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ if (_instance)
+ _instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, INCREASE);
+ }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_mistress_of_painAI(creature);
- }
+ void Reset()
+ {
+ _events.ScheduleEvent(EVENT_SHIVAN_SLASH, 30*IN_MILLISECONDS);
+ _events.ScheduleEvent(EVENT_SPINNING_STRIKE, 30*IN_MILLISECONDS);
+ if (IsHeroic())
+ _events.ScheduleEvent(EVENT_MISTRESS_KISS, 15*IN_MILLISECONDS);
+ me->SetInCombatWithZone();
+ }
- struct mob_mistress_of_painAI : public ScriptedAI
- {
- mob_mistress_of_painAI(Creature* creature) : ScriptedAI(creature)
+ void JustDied(Unit* /*killer*/)
+ {
+ if (_instance)
+ _instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (_instance && _instance->GetBossState(BOSS_JARAXXUS) != IN_PROGRESS)
+ {
+ me->DespawnOrUnsummon();
+ return;
+ }
+
+ if (!UpdateVictim())
+ return;
+
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_SHIVAN_SLASH:
+ DoCastVictim(SPELL_SHIVAN_SLASH);
+ _events.ScheduleEvent(EVENT_SHIVAN_SLASH, 30*IN_MILLISECONDS);
+ return;
+ case EVENT_SPINNING_STRIKE:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ DoCast(target, SPELL_SPINNING_STRIKE);
+ _events.ScheduleEvent(EVENT_SPINNING_STRIKE, 30*IN_MILLISECONDS);
+ return;
+ case EVENT_MISTRESS_KISS:
+ DoCast(me, SPELL_MISTRESS_KISS);
+ _events.ScheduleEvent(EVENT_MISTRESS_KISS, 30*IN_MILLISECONDS);
+ return;
+ default:
+ break;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ private:
+ InstanceScript* _instance;
+ EventMap _events;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
{
- instance = creature->GetInstanceScript();
- if (instance)
- instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, INCREASE);
- Reset();
+ return new mob_mistress_of_painAI(creature);
}
+};
- InstanceScript* instance;
- uint32 m_uiShivanSlashTimer;
- uint32 m_uiSpinningStrikeTimer;
- uint32 m_uiMistressKissTimer;
+class spell_mistress_kiss : public SpellScriptLoader
+{
+ public:
+ spell_mistress_kiss() : SpellScriptLoader("spell_mistress_kiss") { }
- void Reset()
+ class spell_mistress_kiss_AuraScript : public AuraScript
{
- m_uiShivanSlashTimer = 30*IN_MILLISECONDS;
- m_uiSpinningStrikeTimer = 30*IN_MILLISECONDS;
- m_uiMistressKissTimer = 15*IN_MILLISECONDS;
- me->SetInCombatWithZone();
- }
+ PrepareAuraScript(spell_mistress_kiss_AuraScript);
+
+ bool Load()
+ {
+ if (GetCaster())
+ if (sSpellMgr->GetSpellIdForDifficulty(SPELL_MISTRESS_KISS_DAMAGE_SILENCE, GetCaster()))
+ return true;
+ return false;
+ }
+
+ void HandleDummyTick(AuraEffect const* /*aurEff*/)
+ {
+ Unit* caster = GetCaster();
+ Unit* target = GetTarget();
+ if (caster && target)
+ {
+ if (target->HasUnitState(UNIT_STATE_CASTING))
+ {
+ caster->CastSpell(target, SPELL_MISTRESS_KISS_DAMAGE_SILENCE, true);
+ target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
+ }
+ }
+ }
- void JustDied(Unit* /*killer*/)
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_mistress_kiss_AuraScript::HandleDummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
{
- if (instance)
- instance->SetData(DATA_MISTRESS_OF_PAIN_COUNT, DECREASE);
+ return new spell_mistress_kiss_AuraScript();
}
+};
- void UpdateAI(const uint32 uiDiff)
+class spell_mistress_kiss_area : public SpellScriptLoader
+{
+ public:
+ spell_mistress_kiss_area() : SpellScriptLoader("spell_mistress_kiss_area") {}
+
+ class spell_mistress_kiss_area_SpellScript : public SpellScript
{
- if (instance && instance->GetData(TYPE_JARAXXUS) != IN_PROGRESS)
+ PrepareSpellScript(spell_mistress_kiss_area_SpellScript)
+
+ bool Load()
{
- me->DespawnOrUnsummon();
- return;
+ if (GetCaster())
+ if (sSpellMgr->GetSpellIdForDifficulty(SPELL_MISTRESS_KISS_DEBUFF, GetCaster()))
+ return true;
+ return false;
}
- if (!UpdateVictim())
- return;
-
- if (m_uiShivanSlashTimer <= uiDiff)
+ void HandleScript(SpellEffIndex /*effIndex*/)
{
- DoCastVictim(SPELL_SHIVAN_SLASH);
- m_uiShivanSlashTimer = 30*IN_MILLISECONDS;
- } else m_uiShivanSlashTimer -= uiDiff;
+ Unit* caster = GetCaster();
+ Unit* target = GetHitUnit();
+ if (caster && target)
+ caster->CastSpell(target, SPELL_MISTRESS_KISS_DEBUFF, true);
+ }
- if (m_uiSpinningStrikeTimer <= uiDiff)
+ void FilterTargets(std::list<WorldObject*>& targets)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
- DoCast(target, SPELL_SPINNING_STRIKE);
- m_uiSpinningStrikeTimer = 30*IN_MILLISECONDS;
- } else m_uiSpinningStrikeTimer -= uiDiff;
+ // 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);
+ }
+ }
- if (IsHeroic() && m_uiMistressKissTimer <= uiDiff)
+ void Register()
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
- DoCast(target, SPELL_MISTRESS_KISS);
- m_uiMistressKissTimer = 30*IN_MILLISECONDS;
- } else m_uiMistressKissTimer -= uiDiff;
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mistress_kiss_area_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ }
+ };
- DoMeleeAttackIfReady();
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_mistress_kiss_area_SpellScript();
}
- };
-
};
void AddSC_boss_jaraxxus()
@@ -523,4 +597,7 @@ void AddSC_boss_jaraxxus()
new mob_fel_infernal();
new mob_nether_portal();
new mob_mistress_of_pain();
+
+ new spell_mistress_kiss();
+ new spell_mistress_kiss_area();
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
index 5bda32941c2..2d09feef089 100755..100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp
@@ -15,35 +15,29 @@
* 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
-SDName: northrend_beasts
-SD%Complete: 90%
-SDComment: based on /dev/rsa
-SDCategory:
-EndScriptData */
// Known bugs:
-// Gormok - Not implemented as a vehicle
-// - Snobold Firebomb
-// - Snobolled (creature at back)
-// Snakes - miss the 1-hitkill from emerging
-// - visual changes between mobile and stationary models seems not to work sometimes
+// Gormok - Snobolled (creature at back)
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "trial_of_the_crusader.h"
+#include "Vehicle.h"
+#include "Player.h"
+#include "SpellScript.h"
enum Yells
{
- //Gormok
- SAY_SNOBOLLED = -1649000,
- //Acidmaw & Dreadscale
- SAY_SUBMERGE = -1649010,
- SAY_EMERGE = -1649011,
- SAY_BERSERK = -1649012,
- //Icehowl
- SAY_TRAMPLE_STARE = -1649020,
- SAY_TRAMPLE_FAIL = -1649021,
- SAY_TRAMPLE_START = -1649022,
+ // Gormok
+ EMOTE_SNOBOLLED = 0,
+
+ // Acidmaw & Dreadscale
+ EMOTE_ENRAGE = 0,
+
+ // Icehowl
+ EMOTE_TRAMPLE_START = 0,
+ EMOTE_TRAMPLE_CRASH = 1,
+ EMOTE_TRAMPLE_FAIL = 2
};
enum Equipment
@@ -51,7 +45,7 @@ enum Equipment
EQUIP_MAIN = 50760,
EQUIP_OFFHAND = 48040,
EQUIP_RANGED = 47267,
- EQUIP_DONE = EQUIP_NO_CHANGE,
+ EQUIP_DONE = EQUIP_NO_CHANGE
};
enum Model
@@ -59,13 +53,15 @@ enum Model
MODEL_ACIDMAW_STATIONARY = 29815,
MODEL_ACIDMAW_MOBILE = 29816,
MODEL_DREADSCALE_STATIONARY = 26935,
- MODEL_DREADSCALE_MOBILE = 24564,
+ MODEL_DREADSCALE_MOBILE = 24564
};
-enum Summons
+enum BeastSummons
{
NPC_SNOBOLD_VASSAL = 34800,
+ NPC_FIRE_BOMB = 34854,
NPC_SLIME_POOL = 35176,
+ MAX_SNOBOLDS = 4
};
enum BossSpells
@@ -106,332 +102,446 @@ enum BossSpells
SPELL_ARCTIC_BREATH = 66689,
SPELL_TRAMPLE = 66734,
SPELL_FROTHING_RAGE = 66759,
- SPELL_STAGGERED_DAZE = 66758,
+ SPELL_STAGGERED_DAZE = 66758
};
-class boss_gormok : public CreatureScript
+enum MyActions
{
-public:
- boss_gormok() : CreatureScript("boss_gormok") { }
+ ACTION_ENABLE_FIRE_BOMB = 1,
+ ACTION_DISABLE_FIRE_BOMB = 2
+};
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_gormokAI(creature);
- }
+enum Events
+{
+ // Gormok
+ EVENT_IMPALE = 1,
+ EVENT_STAGGERING_STOMP = 2,
+ EVENT_THROW = 3,
+
+ // Snobold
+ EVENT_FIRE_BOMB = 4,
+ EVENT_BATTER = 5,
+ EVENT_HEAD_CRACK = 6,
+
+ // Acidmaw & Dreadscale
+ EVENT_BITE = 7,
+ EVENT_SPEW = 8,
+ EVENT_SLIME_POOL = 9,
+ EVENT_SPIT = 10,
+ EVENT_SPRAY = 11,
+ EVENT_SWEEP = 12,
+ EVENT_SUBMERGE = 13,
+ EVENT_EMERGE = 14,
+ EVENT_SUMMON_ACIDMAW = 15,
+
+ // Icehowl
+ EVENT_FEROCIOUS_BUTT = 16,
+ EVENT_MASSIVE_CRASH = 17,
+ EVENT_WHIRL = 18,
+ EVENT_ARCTIC_BREATH = 19,
+ EVENT_TRAMPLE = 20
+};
- struct boss_gormokAI : public ScriptedAI
- {
- boss_gormokAI(Creature* creature) : ScriptedAI(creature), Summons(me)
- {
- instance = creature->GetInstanceScript();
- }
+enum Phases
+{
+ PHASE_MOBILE = 1,
+ PHASE_STATIONARY = 2,
+ PHASE_SUBMERGED = 3,
- InstanceScript* instance;
+ PHASE_MASK_MOBILE = 1 << PHASE_MOBILE,
+ PHASE_MASK_STATIONARY = 1 << PHASE_STATIONARY
+};
- uint32 m_uiImpaleTimer;
- uint32 m_uiStaggeringStompTimer;
- SummonList Summons;
- uint32 m_uiSummonTimer;
- uint32 m_uiSummonCount;
+class boss_gormok : public CreatureScript
+{
+ public:
+ boss_gormok() : CreatureScript("boss_gormok") { }
- void Reset()
+ struct boss_gormokAI : public BossAI
{
- m_uiImpaleTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- m_uiStaggeringStompTimer = 15*IN_MILLISECONDS;
- m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);;
-
- if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL ||
- GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
- m_uiSummonCount = 5;
- else
- m_uiSummonCount = 4;
-
- Summons.DespawnAll();
- }
+ boss_gormokAI(Creature* creature) : BossAI(creature, BOSS_BEASTS)
+ {
+ }
- void EnterEvadeMode()
- {
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- ScriptedAI::EnterEvadeMode();
- }
+ void Reset()
+ {
+ events.ScheduleEvent(EVENT_IMPALE, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_STAGGERING_STOMP, 15*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_THROW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
- void MovementInform(uint32 type, uint32 pointId)
- {
- if (type != POINT_MOTION_TYPE)
- return;
+ summons.DespawnAll();
+ }
- switch (pointId)
+ void EnterEvadeMode()
{
- case 0:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetReactState(REACT_AGGRESSIVE);
- me->SetInCombatWithZone();
- break;
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ ScriptedAI::EnterEvadeMode();
}
- }
-
- void JustDied(Unit* /*killer*/)
- {
- if (instance)
- instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_DONE);
- }
- void JustReachedHome()
- {
- if (instance)
+ void MovementInform(uint32 type, uint32 pointId)
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
+ if (type != POINT_MOTION_TYPE)
+ return;
+
+ switch (pointId)
+ {
+ case 0:
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->SetInCombatWithZone();
+ break;
+ default:
+ break;
+ }
}
- me->DespawnOrUnsummon();
- }
- void EnterCombat(Unit* /*who*/)
- {
- me->SetInCombatWithZone();
- instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_IN_PROGRESS);
- }
+ void JustDied(Unit* /*killer*/)
+ {
+ if (instance)
+ instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_DONE);
+ }
- void JustSummoned(Creature* summon)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
+ void JustReachedHome()
{
- if (summon->GetEntry() == NPC_SNOBOLD_VASSAL)
+ if (instance)
{
- summon->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 10.0f, 20.0f);
- DoCast(me, SPELL_RISING_ANGER);
- --m_uiSummonCount;
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
}
- summon->AI()->AttackStart(target);
+ me->DespawnOrUnsummon();
}
- Summons.Summon(summon);
- }
- void SummonedCreatureDespawn(Creature* summon)
- {
- if (summon->GetEntry() == NPC_SNOBOLD_VASSAL)
- if (summon->isAlive())
- ++m_uiSummonCount;
- Summons.Despawn(summon);
- }
+ void EnterCombat(Unit* /*who*/)
+ {
+ _EnterCombat();
+ me->SetInCombatWithZone();
+ instance->SetData(TYPE_NORTHREND_BEASTS, GORMOK_IN_PROGRESS);
- void UpdateAI(uint32 const diff)
- {
- if (!UpdateVictim())
- return;
+ for (uint8 i = 0; i < MAX_SNOBOLDS; i++)
+ {
+ if (Creature* pSnobold = DoSpawnCreature(NPC_SNOBOLD_VASSAL, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0))
+ {
+ pSnobold->EnterVehicle(me, i);
+ pSnobold->SetInCombatWithZone();
+ pSnobold->AI()->DoAction(ACTION_ENABLE_FIRE_BOMB);
+ }
+ }
+ }
- if (m_uiImpaleTimer <= diff)
+ void DamageTaken(Unit* /*who*/, uint32& damage)
{
- DoCastVictim(SPELL_IMPALE);
- m_uiImpaleTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS);
- } else m_uiImpaleTimer -= diff;
+ // despawn the remaining passengers on death
+ if (damage >= me->GetHealth())
+ for (uint8 i = 0; i < MAX_SNOBOLDS; ++i)
+ if (Unit* pSnobold = me->GetVehicleKit()->GetPassenger(i))
+ pSnobold->ToCreature()->DespawnOrUnsummon();
+ }
- if (m_uiStaggeringStompTimer <= diff)
+ void UpdateAI(uint32 const diff)
{
- DoCastVictim(SPELL_STAGGERING_STOMP);
- m_uiStaggeringStompTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS);
- } else m_uiStaggeringStompTimer -= diff;
+ if (!UpdateVictim())
+ return;
- if (m_uiSummonTimer <= diff)
- {
- if (m_uiSummonCount > 0)
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
- me->SummonCreature(NPC_SNOBOLD_VASSAL, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN);
- DoScriptText(SAY_SNOBOLLED, me);
+ switch (eventId)
+ {
+ case EVENT_IMPALE:
+ DoCastVictim(SPELL_IMPALE);
+ events.ScheduleEvent(EVENT_IMPALE, urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS));
+ return;
+ case EVENT_STAGGERING_STOMP:
+ DoCastVictim(SPELL_STAGGERING_STOMP);
+ events.ScheduleEvent(EVENT_STAGGERING_STOMP, 15*IN_MILLISECONDS);
+ return;
+ case EVENT_THROW:
+ for (uint8 i = 0; i < MAX_SNOBOLDS; ++i)
+ {
+ if (Unit* pSnobold = me->GetVehicleKit()->GetPassenger(i))
+ {
+ pSnobold->ExitVehicle();
+ pSnobold->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ pSnobold->ToCreature()->SetReactState(REACT_AGGRESSIVE);
+ pSnobold->ToCreature()->AI()->DoAction(ACTION_DISABLE_FIRE_BOMB);
+ pSnobold->CastSpell(me, SPELL_RISING_ANGER, true);
+ Talk(EMOTE_SNOBOLLED);
+ break;
+ }
+ }
+ events.ScheduleEvent(EVENT_THROW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ default:
+ return;
+ }
}
- m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiSummonTimer -= diff;
- DoMeleeAttackIfReady();
- }
- };
+ DoMeleeAttackIfReady();
+ }
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_gormokAI(creature);
+ }
};
class mob_snobold_vassal : public CreatureScript
{
-public:
- mob_snobold_vassal() : CreatureScript("mob_snobold_vassal") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_snobold_vassalAI(creature);
- }
+ public:
+ mob_snobold_vassal() : CreatureScript("mob_snobold_vassal") { }
- struct mob_snobold_vassalAI : public ScriptedAI
- {
- mob_snobold_vassalAI(Creature* creature) : ScriptedAI(creature)
+ struct mob_snobold_vassalAI : public ScriptedAI
{
- instance = creature->GetInstanceScript();
- if (instance)
- instance->SetData(DATA_SNOBOLD_COUNT, INCREASE);
- }
-
- InstanceScript* instance;
- uint32 m_uiFireBombTimer;
- uint32 m_uiBatterTimer;
- uint32 m_uiHeadCrackTimer;
- uint64 m_uiBossGUID;
- uint64 m_uiTargetGUID;
- bool m_bTargetDied;
+ mob_snobold_vassalAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ if (_instance)
+ _instance->SetData(DATA_SNOBOLD_COUNT, INCREASE);
+ }
- void Reset()
- {
- m_uiFireBombTimer = 15000;
- m_uiBatterTimer = 5000;
- m_uiHeadCrackTimer = 25000;
+ void Reset()
+ {
+ _events.ScheduleEvent(EVENT_BATTER, 5*IN_MILLISECONDS);
+ _events.ScheduleEvent(EVENT_HEAD_CRACK, 25*IN_MILLISECONDS);
- m_uiTargetGUID = 0;
- m_bTargetDied = false;
- if (instance)
- m_uiBossGUID = instance->GetData64(NPC_GORMOK);
- //Workaround for Snobold
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- }
+ _targetGUID = 0;
+ _targetDied = false;
- void EnterEvadeMode()
- {
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- ScriptedAI::EnterEvadeMode();
- }
+ if (_instance)
+ _bossGUID = _instance->GetData64(NPC_GORMOK);
+ //Workaround for Snobold
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ }
- void EnterCombat(Unit* who)
- {
- m_uiTargetGUID = who->GetGUID();
- me->TauntApply(who);
- DoCast(who, SPELL_SNOBOLLED);
- }
+ void EnterEvadeMode()
+ {
+ ScriptedAI::EnterEvadeMode();
+ }
- void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
- {
- if (pDoneBy->GetGUID()==m_uiTargetGUID)
- uiDamage = 0;
- }
+ void EnterCombat(Unit* who)
+ {
+ _targetGUID = who->GetGUID();
+ me->TauntApply(who);
+ DoCast(who, SPELL_SNOBOLLED);
+ }
- void MovementInform(uint32 type, uint32 pointId)
- {
- if (type != POINT_MOTION_TYPE)
- return;
+ void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
+ {
+ if (pDoneBy->GetGUID() == _targetGUID)
+ uiDamage = 0;
+ }
- switch (pointId)
+ void MovementInform(uint32 type, uint32 pointId)
{
- case 0:
- if (m_bTargetDied)
- me->DespawnOrUnsummon();
- break;
+ if (type != POINT_MOTION_TYPE)
+ return;
+
+ switch (pointId)
+ {
+ case 0:
+ if (_targetDied)
+ me->DespawnOrUnsummon();
+ break;
+ default:
+ break;
+ }
}
- }
- void JustDied(Unit* /*killer*/)
- {
- if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID))
- if (target->isAlive())
- target->RemoveAurasDueToSpell(SPELL_SNOBOLLED);
- if (instance)
- instance->SetData(DATA_SNOBOLD_COUNT, DECREASE);
- }
+ void JustDied(Unit* /*killer*/)
+ {
+ if (Unit* target = Unit::GetPlayer(*me, _targetGUID))
+ if (target->isAlive())
+ target->RemoveAurasDueToSpell(SPELL_SNOBOLLED);
+ if (_instance)
+ _instance->SetData(DATA_SNOBOLD_COUNT, DECREASE);
+ }
- void UpdateAI(uint32 const diff)
- {
- if (m_bTargetDied || !UpdateVictim())
- return;
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_ENABLE_FIRE_BOMB:
+ _events.ScheduleEvent(EVENT_FIRE_BOMB, urand(5*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ break;
+ case ACTION_DISABLE_FIRE_BOMB:
+ _events.CancelEvent(EVENT_FIRE_BOMB);
+ break;
+ default:
+ break;
+ }
+ }
- if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID))
+ void UpdateAI(uint32 const diff)
{
- if (!target->isAlive())
+ if (!UpdateVictim() || _targetDied)
+ return;
+
+ if (Unit* target = Unit::GetPlayer(*me, _targetGUID))
{
- if (instance)
+ if (!target->isAlive())
{
- Unit* gormok = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_GORMOK));
- if (gormok && gormok->isAlive())
- {
- SetCombatMovement(false);
- m_bTargetDied = true;
- me->GetMotionMaster()->MoveJump(gormok->GetPositionX(), gormok->GetPositionY(), gormok->GetPositionZ(), 15.0f, 15.0f);
- }
- else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0))
+ if (_instance)
{
- m_uiTargetGUID = target2->GetGUID();
- me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f);
+ Unit* gormok = ObjectAccessor::GetCreature(*me, _instance->GetData64(NPC_GORMOK));
+ if (gormok && gormok->isAlive())
+ {
+ SetCombatMovement(false);
+ _targetDied = true;
+
+ // looping through Gormoks seats
+ for (uint8 i = 0; i < MAX_SNOBOLDS; i++)
+ {
+ if (!gormok->GetVehicleKit()->GetPassenger(i))
+ {
+ me->EnterVehicle(gormok, i);
+ DoAction(ACTION_ENABLE_FIRE_BOMB);
+ break;
+ }
+ }
+ }
+ else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ {
+ _targetGUID = target2->GetGUID();
+ me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f);
+ }
}
}
}
+
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_FIRE_BOMB:
+ if (me->GetVehicleBase())
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, -me->GetVehicleBase()->GetCombatReach(), true))
+ me->CastSpell(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), SPELL_FIRE_BOMB, true);
+ _events.ScheduleEvent(EVENT_FIRE_BOMB, 20*IN_MILLISECONDS);
+ return;
+ case EVENT_HEAD_CRACK:
+ // commented out while SPELL_SNOBOLLED gets fixed
+ //if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID))
+ DoCastVictim(SPELL_HEAD_CRACK);
+ _events.ScheduleEvent(EVENT_HEAD_CRACK, 30*IN_MILLISECONDS);
+ return;
+ case EVENT_BATTER:
+ // commented out while SPELL_SNOBOLLED gets fixed
+ //if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID))
+ DoCastVictim(SPELL_BATTER);
+ _events.ScheduleEvent(EVENT_BATTER, 10*IN_MILLISECONDS);
+ return;
+ default:
+ return;
+ }
+ }
+
+ // do melee attack only when not on Gormoks back
+ if (!me->GetVehicleBase())
+ DoMeleeAttackIfReady();
}
+ private:
+ EventMap _events;
+ InstanceScript* _instance;
+ uint64 _bossGUID;
+ uint64 _targetGUID;
+ bool _targetDied;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new mob_snobold_vassalAI(creature);
+ }
+};
- if (m_uiFireBombTimer < diff)
+class npc_firebomb : public CreatureScript
+{
+ public:
+ npc_firebomb() : CreatureScript("npc_firebomb") { }
+
+ struct npc_firebombAI : public ScriptedAI
+ {
+ npc_firebombAI(Creature* creature) : ScriptedAI(creature)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_FIRE_BOMB);
- m_uiFireBombTimer = 20000;
+ _instance = creature->GetInstanceScript();
}
- else m_uiFireBombTimer -= diff;
- if (m_uiBatterTimer < diff)
+ void Reset()
{
- if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID))
- DoCast(target, SPELL_BATTER);
- m_uiBatterTimer = 10000;
+ DoCast(me, SPELL_FIRE_BOMB_DOT, true);
+ SetCombatMovement(false);
+ me->SetReactState(REACT_PASSIVE);
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
}
- else m_uiBatterTimer -= diff;
- if (m_uiHeadCrackTimer < diff)
+ void UpdateAI(uint32 const /*diff*/)
{
- if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID))
- DoCast(target, SPELL_HEAD_CRACK);
- m_uiHeadCrackTimer = 35000;
+ if (_instance->GetData(TYPE_NORTHREND_BEASTS) != GORMOK_IN_PROGRESS)
+ me->DespawnOrUnsummon();
}
- else m_uiHeadCrackTimer -= diff;
- DoMeleeAttackIfReady();
- }
- };
+ private:
+ InstanceScript* _instance;
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_firebombAI(creature);
+ }
};
-struct boss_jormungarAI : public ScriptedAI
+struct boss_jormungarAI : public BossAI
{
- boss_jormungarAI(Creature* creature) : ScriptedAI(creature)
+ boss_jormungarAI(Creature* creature) : BossAI(creature, BOSS_BEASTS)
{
- instanceScript = creature->GetInstanceScript();
}
void Reset()
{
- enraged = false;
- biteTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- spewTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- slimePoolTimer = 15*IN_MILLISECONDS;
- spitTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- sprayTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- sweepTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
+ Enraged = false;
+
+ events.ScheduleEvent(EVENT_SPIT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_SPRAY, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_SWEEP, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_BITE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_SPEW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_SLIME_POOL, 15*IN_MILLISECONDS, 0, PHASE_MOBILE);
}
void JustDied(Unit* /*killer*/)
{
- if (instanceScript)
+ if (instance)
{
- if (Creature* otherWorm = Unit::GetCreature(*me, instanceScript->GetData64(otherWormEntry)))
+ if (Creature* otherWorm = Unit::GetCreature(*me, instance->GetData64(OtherWormEntry)))
{
if (!otherWorm->isAlive())
{
- instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_DONE);
+ instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_DONE);
me->DespawnOrUnsummon();
otherWorm->DespawnOrUnsummon();
}
else
- instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_SPECIAL);
+ instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_SPECIAL);
}
}
}
void JustReachedHome()
{
- if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) != FAIL)
- {
- instanceScript->SetData(TYPE_NORTHREND_BEASTS, FAIL);
- }
+ // prevent losing 2 attempts at once on heroics
+ if (instance && instance->GetData(TYPE_NORTHREND_BEASTS) != FAIL)
+ instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
me->DespawnOrUnsummon();
}
@@ -439,17 +549,16 @@ struct boss_jormungarAI : public ScriptedAI
void KilledUnit(Unit* who)
{
if (who->GetTypeId() == TYPEID_PLAYER)
- {
- if (instanceScript)
- instanceScript->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
- }
+ if (instance)
+ instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
void EnterCombat(Unit* /*who*/)
{
+ _EnterCombat();
me->SetInCombatWithZone();
- if (instanceScript)
- instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_IN_PROGRESS);
+ if (instance)
+ instance->SetData(TYPE_NORTHREND_BEASTS, SNAKES_IN_PROGRESS);
}
void UpdateAI(uint32 const diff)
@@ -457,554 +566,597 @@ struct boss_jormungarAI : public ScriptedAI
if (!UpdateVictim())
return;
- if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL && !enraged)
+ if (!Enraged && instance && instance->GetData(TYPE_NORTHREND_BEASTS) == SNAKES_SPECIAL)
{
- DoScriptText(SAY_EMERGE, me);
me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
DoCast(SPELL_ENRAGE);
- enraged = true;
- DoScriptText(SAY_BERSERK, me);
- switch (stage)
- {
- case 0:
- break;
- case 4:
- stage = 5;
- submergeTimer = 5*IN_MILLISECONDS;
- break;
- default:
- stage = 7;
- }
+ Enraged = true;
+ Talk(EMOTE_ENRAGE);
}
- switch (stage)
- {
- case 0: // Mobile
- if (biteTimer <= diff)
- {
- DoCastVictim(biteSpell);
- biteTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else biteTimer -= diff;
+ events.Update(diff);
- if (spewTimer <= diff)
- {
- DoCastAOE(spewSpell);
- spewTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else spewTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (slimePoolTimer <= diff)
- {
- /* Spell summon has only 30s duration */
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_EMERGE:
+ Emerge();
+ return;
+ case EVENT_SUBMERGE:
+ Submerge();
+ return;
+ case EVENT_BITE:
+ DoCastVictim(BiteSpell);
+ events.ScheduleEvent(EVENT_BITE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE);
+ return;
+ case EVENT_SPEW:
+ DoCastAOE(SpewSpell);
+ events.ScheduleEvent(EVENT_SPEW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE);
+ return;
+ case EVENT_SLIME_POOL:
DoCast(me, SUMMON_SLIME_POOL);
- slimePoolTimer = 30*IN_MILLISECONDS;
- } else slimePoolTimer -= diff;
-
- if (submergeTimer <= diff && !enraged)
- {
- stage = 1;
- submergeTimer = 5*IN_MILLISECONDS;
- } else submergeTimer -= diff;
-
- DoMeleeAttackIfReady();
- break;
- case 1: // Submerge
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- DoCast(me, SPELL_SUBMERGE_0);
- DoScriptText(SAY_SUBMERGE, me);
- me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
- stage = 2;
- case 2: // Wait til emerge
- if (submergeTimer <= diff)
- {
- stage = 3;
- submergeTimer = 50*IN_MILLISECONDS;
- } else submergeTimer -= diff;
- break;
- case 3: // Emerge
- me->SetDisplayId(modelStationary);
- DoScriptText(SAY_EMERGE, me);
- me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
- DoCast(me, SPELL_EMERGE_0);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
- SetCombatMovement(false);
- me->GetMotionMaster()->MoveIdle();
- stage = 4;
- break;
- case 4: // Stationary
- if (sprayTimer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, spraySpell);
- sprayTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else sprayTimer -= diff;
-
- if (sweepTimer <= diff)
- {
+ events.ScheduleEvent(EVENT_SLIME_POOL, 30*IN_MILLISECONDS, 0, PHASE_MOBILE);
+ return;
+ case EVENT_SUMMON_ACIDMAW:
+ if (Creature* acidmaw = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN))
+ {
+ acidmaw->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ acidmaw->SetReactState(REACT_AGGRESSIVE);
+ acidmaw->SetInCombatWithZone();
+ acidmaw->CastSpell(acidmaw, SPELL_EMERGE_0);
+ }
+ return;
+ case EVENT_SPRAY:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ DoCast(target, SpraySpell);
+ events.ScheduleEvent(EVENT_SPRAY, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ return;
+ case EVENT_SWEEP:
DoCastAOE(SPELL_SWEEP_0);
- sweepTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else sweepTimer -= diff;
-
- if (submergeTimer <= diff)
- {
- stage = 5;
- submergeTimer = 10*IN_MILLISECONDS;
- } else submergeTimer -= diff;
-
- DoSpellAttackIfReady(spitSpell);
- break;
- case 5: // Submerge
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- DoCast(me, SPELL_SUBMERGE_0);
- DoScriptText(SAY_SUBMERGE, me);
- me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
- stage = 6;
- case 6: // Wait til emerge
- if (submergeTimer <= diff)
- {
- stage = 7;
- submergeTimer = 45*IN_MILLISECONDS;
- } else submergeTimer -= diff;
- break;
- case 7: // Emerge
- me->SetDisplayId(modelMobile);
- DoScriptText(SAY_EMERGE, me);
- me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
- DoCast(me, SPELL_EMERGE_0);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
- SetCombatMovement(true);
- me->GetMotionMaster()->MoveChase(me->getVictim());
- stage = 0;
- break;
+ events.ScheduleEvent(EVENT_SWEEP, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ return;
+ default:
+ return;
+ }
}
+ if (events.GetPhaseMask() & PHASE_MASK_MOBILE)
+ DoMeleeAttackIfReady();
+ if (events.GetPhaseMask() & PHASE_MASK_STATIONARY)
+ DoSpellAttackIfReady(SpitSpell);
}
- InstanceScript* instanceScript;
+ void Submerge()
+ {
+ DoCast(me, SPELL_SUBMERGE_0);
+ me->RemoveAurasDueToSpell(SPELL_EMERGE_0);
+ me->SetInCombatWithZone();
+ events.SetPhase(PHASE_SUBMERGED);
+ events.ScheduleEvent(EVENT_EMERGE, 5*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ());
+ WasMobile = !WasMobile;
+ }
- uint32 otherWormEntry;
+ void Emerge()
+ {
+ DoCast(me, SPELL_EMERGE_0);
+ me->SetDisplayId(ModelMobile);
+ me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ me->GetMotionMaster()->Clear();
+
+ // if the worm was mobile before submerging, make him stationary now
+ if (WasMobile)
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
+ SetCombatMovement(false);
+ me->SetDisplayId(ModelStationary);
+ events.SetPhase(PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_SUBMERGE, 45*IN_MILLISECONDS, 0, PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_SPIT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_SPRAY, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ events.ScheduleEvent(EVENT_SWEEP, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_STATIONARY);
+ }
+ else
+ {
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
+ SetCombatMovement(true);
+ me->GetMotionMaster()->MoveChase(me->getVictim());
+ me->SetDisplayId(ModelMobile);
+ events.SetPhase(PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_SUBMERGE, 45*IN_MILLISECONDS, 0, PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_BITE, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_SPEW, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS), 0, PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_SLIME_POOL, 15*IN_MILLISECONDS, 0, PHASE_MOBILE);
+ }
+ }
- uint32 modelStationary;
- uint32 modelMobile;
+ protected:
+ uint32 OtherWormEntry;
+ uint32 ModelStationary;
+ uint32 ModelMobile;
- uint32 biteSpell;
- uint32 spewSpell;
- uint32 spitSpell;
- uint32 spraySpell;
+ uint32 BiteSpell;
+ uint32 SpewSpell;
+ uint32 SpitSpell;
+ uint32 SpraySpell;
- uint32 biteTimer;
- uint32 spewTimer;
- uint32 slimePoolTimer;
- uint32 spitTimer;
- uint32 sprayTimer;
- uint32 sweepTimer;
- uint32 submergeTimer;
- uint8 stage;
- bool enraged;
+ Phases Phase;
+ bool Enraged;
+ bool WasMobile;
};
class boss_acidmaw : public CreatureScript
{
public:
- boss_acidmaw() : CreatureScript("boss_acidmaw") { }
+ boss_acidmaw() : CreatureScript("boss_acidmaw") { }
- struct boss_acidmawAI : public boss_jormungarAI
- {
- boss_acidmawAI(Creature* creature) : boss_jormungarAI(creature) { }
+ struct boss_acidmawAI : public boss_jormungarAI
+ {
+ boss_acidmawAI(Creature* creature) : boss_jormungarAI(creature) { }
- void Reset()
+ void Reset()
+ {
+ boss_jormungarAI::Reset();
+ BiteSpell = SPELL_PARALYTIC_BITE;
+ SpewSpell = SPELL_ACID_SPEW;
+ SpitSpell = SPELL_ACID_SPIT;
+ SpraySpell = SPELL_PARALYTIC_SPRAY;
+ ModelStationary = MODEL_ACIDMAW_STATIONARY;
+ ModelMobile = MODEL_ACIDMAW_MOBILE;
+ OtherWormEntry = NPC_DREADSCALE;
+
+ WasMobile = true;
+ Emerge();
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
{
- boss_jormungarAI::Reset();
- biteSpell = SPELL_PARALYTIC_BITE;
- spewSpell = SPELL_ACID_SPEW;
- spitSpell = SPELL_ACID_SPIT;
- spraySpell = SPELL_PARALYTIC_SPRAY;
- modelStationary = MODEL_ACIDMAW_STATIONARY;
- modelMobile = MODEL_ACIDMAW_MOBILE;
- otherWormEntry = NPC_DREADSCALE;
-
- submergeTimer = 500;
- DoCast(me, SPELL_SUBMERGE_0);
- stage = 2;
+ return new boss_acidmawAI(creature);
}
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_acidmawAI(creature);
- }
};
class boss_dreadscale : public CreatureScript
{
-public:
- boss_dreadscale() : CreatureScript("boss_dreadscale") { }
+ public:
+ boss_dreadscale() : CreatureScript("boss_dreadscale") { }
- struct boss_dreadscaleAI : public boss_jormungarAI
- {
- boss_dreadscaleAI(Creature* creature) : boss_jormungarAI(creature)
+ struct boss_dreadscaleAI : public boss_jormungarAI
{
- instanceScript = creature->GetInstanceScript();
- }
+ boss_dreadscaleAI(Creature* creature) : boss_jormungarAI(creature)
+ {
+ }
- InstanceScript* instanceScript;
+ void Reset()
+ {
+ boss_jormungarAI::Reset();
+ BiteSpell = SPELL_BURNING_BITE;
+ SpewSpell = SPELL_MOLTEN_SPEW;
+ SpitSpell = SPELL_FIRE_SPIT;
+ SpraySpell = SPELL_BURNING_SPRAY;
+ ModelStationary = MODEL_DREADSCALE_STATIONARY;
+ ModelMobile = MODEL_DREADSCALE_MOBILE;
+ OtherWormEntry = NPC_ACIDMAW;
+
+ events.SetPhase(PHASE_MOBILE);
+ events.ScheduleEvent(EVENT_SUMMON_ACIDMAW, 3*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_SUBMERGE, 45*IN_MILLISECONDS, 0, PHASE_MOBILE);
+ WasMobile = false;
+ }
- void Reset()
- {
- boss_jormungarAI::Reset();
- biteSpell = SPELL_BURNING_BITE;
- spewSpell = SPELL_MOLTEN_SPEW;
- spitSpell = SPELL_FIRE_SPIT;
- spraySpell = SPELL_BURNING_SPRAY;
- modelStationary = MODEL_DREADSCALE_STATIONARY;
- modelMobile = MODEL_DREADSCALE_MOBILE;
- otherWormEntry = NPC_ACIDMAW;
-
- submergeTimer = 45 * IN_MILLISECONDS;
- stage = 0;
- }
+ void MovementInform(uint32 type, uint32 pointId)
+ {
+ if (type != POINT_MOTION_TYPE)
+ return;
- void MovementInform(uint32 type, uint32 pointId)
- {
- if (type != POINT_MOTION_TYPE)
- return;
+ switch (pointId)
+ {
+ case 0:
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->SetInCombatWithZone();
+ break;
+ default:
+ break;
+ }
+ }
- switch (pointId)
+ void EnterEvadeMode()
{
- case 0:
- instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR));
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetReactState(REACT_AGGRESSIVE);
- me->SetInCombatWithZone();
- if (Creature* otherWorm = Unit::GetCreature(*me, instanceScript->GetData64(otherWormEntry)))
- {
- otherWorm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- otherWorm->SetReactState(REACT_AGGRESSIVE);
- otherWorm->SetVisible(true);
- otherWorm->SetInCombatWithZone();
- }
- break;
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ boss_jormungarAI::EnterEvadeMode();
}
- }
- void EnterEvadeMode()
- {
- instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR));
- boss_jormungarAI::EnterEvadeMode();
- }
+ void JustReachedHome()
+ {
+ if (instance)
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- void JustReachedHome()
- {
- if (instanceScript)
- instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR));
+ boss_jormungarAI::JustReachedHome();
+ }
+ };
- boss_jormungarAI::JustReachedHome();
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_dreadscaleAI(creature);
}
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_dreadscaleAI(creature);
- }
};
class mob_slime_pool : public CreatureScript
{
-public:
- mob_slime_pool() : CreatureScript("mob_slime_pool") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_slime_poolAI(creature);
- }
-
- struct mob_slime_poolAI : public ScriptedAI
- {
- mob_slime_poolAI(Creature* creature) : ScriptedAI(creature)
- {
- }
+ public:
+ mob_slime_pool() : CreatureScript("mob_slime_pool") { }
- bool casted;
- void Reset()
+ struct mob_slime_poolAI : public ScriptedAI
{
- casted = false;
- me->SetReactState(REACT_PASSIVE);
- }
+ mob_slime_poolAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _instance = creature->GetInstanceScript();
+ }
- void UpdateAI(uint32 const /*diff*/)
- {
- if (!casted)
+ void Reset()
{
- casted = true;
- DoCast(me, SPELL_SLIME_POOL_EFFECT);
+ _cast = false;
+ me->SetReactState(REACT_PASSIVE);
}
- }
- };
-};
+ void UpdateAI(uint32 const /*diff*/)
+ {
+ if (!_cast)
+ {
+ _cast = true;
+ DoCast(me, SPELL_SLIME_POOL_EFFECT);
+ }
-class boss_icehowl : public CreatureScript
-{
-public:
- boss_icehowl() : CreatureScript("boss_icehowl") { }
+ if (_instance->GetData(TYPE_NORTHREND_BEASTS) != SNAKES_IN_PROGRESS && _instance->GetData(TYPE_NORTHREND_BEASTS) != SNAKES_SPECIAL)
+ me->DespawnOrUnsummon();
+ }
+ private:
+ InstanceScript* _instance;
+ bool _cast;
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_icehowlAI(creature);
- }
+ };
- struct boss_icehowlAI : public ScriptedAI
- {
- boss_icehowlAI(Creature* creature) : ScriptedAI(creature)
+ CreatureAI* GetAI(Creature* creature) const
{
- instance = creature->GetInstanceScript();
+ return new mob_slime_poolAI(creature);
}
+};
+
+class spell_gormok_fire_bomb : public SpellScriptLoader
+{
+ public:
+ spell_gormok_fire_bomb() : SpellScriptLoader("spell_gormok_fire_bomb") {}
- InstanceScript* instance;
-
- uint32 m_uiFerociousButtTimer;
- uint32 m_uiArticBreathTimer;
- uint32 m_uiWhirlTimer;
- uint32 m_uiMassiveCrashTimer;
- uint32 m_uiTrampleTimer;
- float m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ;
- uint64 m_uiTrampleTargetGUID;
- bool m_bMovementStarted;
- bool m_bMovementFinish;
- bool m_bTrampleCasted;
- uint8 m_uiStage;
- Unit* target;
-
- void Reset()
+ class spell_gormok_fire_bomb_SpellScript : public SpellScript
{
- m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- m_uiMassiveCrashTimer = 30*IN_MILLISECONDS;
- m_uiTrampleTimer = IN_MILLISECONDS;
- m_bMovementStarted = false;
- m_bMovementFinish = false;
- m_bTrampleCasted = false;
- m_uiTrampleTargetGUID = 0;
- m_fTrampleTargetX = 0;
- m_fTrampleTargetY = 0;
- m_fTrampleTargetZ = 0;
- m_uiStage = 0;
- }
+ PrepareSpellScript(spell_gormok_fire_bomb_SpellScript);
+
+ void TriggerFireBomb(SpellEffIndex /*effIndex*/)
+ {
+ if (const WorldLocation* pos = GetExplTargetDest())
+ {
+ if (Unit* caster = GetCaster())
+ caster->SummonCreature(NPC_FIRE_BOMB, pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30*IN_MILLISECONDS);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHit += SpellEffectFn(spell_gormok_fire_bomb_SpellScript::TriggerFireBomb, EFFECT_0, SPELL_EFFECT_TRIGGER_MISSILE);
+ }
+ };
- void JustDied(Unit* /*killer*/)
+ SpellScript* GetSpellScript() const
{
- if (instance)
- instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE);
+ return new spell_gormok_fire_bomb_SpellScript();
}
+};
- void MovementInform(uint32 type, uint32 pointId)
+class boss_icehowl : public CreatureScript
+{
+ public:
+ boss_icehowl() : CreatureScript("boss_icehowl") { }
+
+ struct boss_icehowlAI : public BossAI
{
- if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
- return;
+ boss_icehowlAI(Creature* creature) : BossAI(creature, BOSS_BEASTS)
+ {
+ }
- switch (pointId)
+ void Reset()
{
- case 0:
- if (me->GetDistance2d(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()) < 6.0f)
- {
- // Middle of the room
- m_uiStage = 1;
- }
- else
- {
- // Landed from Hop backwards (start trample)
- if (Unit::GetPlayer(*me, m_uiTrampleTargetGUID))
+ events.ScheduleEvent(EVENT_FEROCIOUS_BUTT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_ARCTIC_BREATH, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_WHIRL, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ events.ScheduleEvent(EVENT_MASSIVE_CRASH, 30*IN_MILLISECONDS);
+ _movementStarted = false;
+ _movementFinish = false;
+ _trampleCasted = false;
+ _trampleTargetGUID = 0;
+ _trampleTargetX = 0;
+ _trampleTargetY = 0;
+ _trampleTargetZ = 0;
+ _stage = 0;
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ _JustDied();
+ if (instance)
+ instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE);
+ }
+
+ void MovementInform(uint32 type, uint32 pointId)
+ {
+ if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE)
+ return;
+
+ switch (pointId)
+ {
+ case 0:
+ if (_stage != 0)
{
- m_uiStage = 4;
+ if (me->GetDistance2d(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()) < 6.0f)
+ // Middle of the room
+ _stage = 1;
+ else
+ {
+ // Landed from Hop backwards (start trample)
+ if (Unit::GetPlayer(*me, _trampleTargetGUID))
+ _stage = 4;
+ else
+ _stage = 6;
+ }
}
- else
- m_uiStage = 6;
- }
- break;
- case 1: // Finish trample
- m_bMovementFinish = true;
- break;
- case 2:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- me->SetReactState(REACT_AGGRESSIVE);
- me->SetInCombatWithZone();
- break;
+ break;
+ case 1: // Finish trample
+ _movementFinish = true;
+ break;
+ case 2:
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->SetInCombatWithZone();
+ break;
+ default:
+ break;
+ }
}
- }
- void EnterEvadeMode()
- {
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- ScriptedAI::EnterEvadeMode();
- }
-
- void JustReachedHome()
- {
- if (instance)
+ void EnterEvadeMode()
{
instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
+ ScriptedAI::EnterEvadeMode();
}
- me->DespawnOrUnsummon();
- }
- void KilledUnit(Unit* who)
- {
- if (who->GetTypeId() == TYPEID_PLAYER)
+ void JustReachedHome()
{
if (instance)
- instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
+ {
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ instance->SetData(TYPE_NORTHREND_BEASTS, FAIL);
+ }
+ me->DespawnOrUnsummon();
}
- }
- void EnterCombat(Unit* /*who*/)
- {
- if (instance)
- instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS);
- me->SetInCombatWithZone();
- }
-
- void SpellHitTarget(Unit* target, SpellInfo const* spell)
- {
- if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER)
+ void KilledUnit(Unit* who)
{
- if (!m_bTrampleCasted)
+ if (who->GetTypeId() == TYPEID_PLAYER)
{
- DoCast(me, SPELL_FROTHING_RAGE, true);
- m_bTrampleCasted = true;
+ if (instance)
+ instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
- }
- void UpdateAI(uint32 const diff)
- {
- if (!UpdateVictim())
- return;
+ void EnterCombat(Unit* /*who*/)
+ {
+ _EnterCombat();
+ if (instance)
+ instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_IN_PROGRESS);
+ }
- switch (m_uiStage)
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
{
- case 0:
- if (m_uiFerociousButtTimer <= diff)
+ if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (!_trampleCasted)
{
- DoCastVictim(SPELL_FEROCIOUS_BUTT);
- m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiFerociousButtTimer -= diff;
+ DoCast(me, SPELL_FROTHING_RAGE, true);
+ _trampleCasted = true;
+ }
+ }
+ }
- if (m_uiArticBreathTimer <= diff)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- DoCast(target, SPELL_ARCTIC_BREATH);
- m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS);
- } else m_uiArticBreathTimer -= diff;
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim())
+ return;
- if (m_uiWhirlTimer <= diff)
- {
- DoCastAOE(SPELL_WHIRL);
- m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
- } else m_uiWhirlTimer -= diff;
+ events.Update(diff);
- if (m_uiMassiveCrashTimer <= diff)
- {
- me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room
- m_uiStage = 7; //Invalid (Do nothing more than move)
- m_uiMassiveCrashTimer = 30*IN_MILLISECONDS;
- } else m_uiMassiveCrashTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- DoMeleeAttackIfReady();
- break;
- case 1:
- DoCastAOE(SPELL_MASSIVE_CRASH);
- m_uiStage = 2;
- break;
- case 2:
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true))
- {
- m_uiTrampleTargetGUID = target->GetGUID();
- me->SetTarget(m_uiTrampleTargetGUID);
- DoScriptText(SAY_TRAMPLE_STARE, me, target);
- m_bTrampleCasted = false;
- SetCombatMovement(false);
- me->GetMotionMaster()->MoveIdle();
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- m_uiTrampleTimer = 4*IN_MILLISECONDS;
- m_uiStage = 3;
- } else m_uiStage = 6;
- break;
- case 3:
- if (m_uiTrampleTimer <= diff)
+ switch (_stage)
+ {
+ case 0:
{
- if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID))
+ while (uint32 eventId = events.ExecuteEvent())
{
- m_bTrampleCasted = false;
- m_bMovementStarted = true;
- m_fTrampleTargetX = target->GetPositionX();
- m_fTrampleTargetY = target->GetPositionY();
- m_fTrampleTargetZ = target->GetPositionZ();
- me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX,
- 2*me->GetPositionY()-m_fTrampleTargetY,
- me->GetPositionZ(),
- 10.0f, 20.0f); // 2: Hop Backwards
- m_uiStage = 7; //Invalid (Do nothing more than move)
- } else m_uiStage = 6;
- } else m_uiTrampleTimer -= diff;
- break;
- case 4:
- DoScriptText(SAY_TRAMPLE_START, me);
- me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1);
- me->SetTarget(0);
- m_uiStage = 5;
- break;
- case 5:
- if (m_bMovementFinish)
- {
- if (m_uiTrampleTimer <= diff) DoCastAOE(SPELL_TRAMPLE);
- m_bMovementFinish = false;
- m_uiStage = 6;
- return;
+ switch (eventId)
+ {
+ case EVENT_FEROCIOUS_BUTT:
+ DoCastVictim(SPELL_FEROCIOUS_BUTT);
+ events.ScheduleEvent(EVENT_FEROCIOUS_BUTT, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_ARCTIC_BREATH:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ DoCast(target, SPELL_ARCTIC_BREATH);
+ return;
+ case EVENT_WHIRL:
+ DoCastAOE(SPELL_WHIRL);
+ events.ScheduleEvent(EVENT_WHIRL, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
+ return;
+ case EVENT_MASSIVE_CRASH:
+ me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 20.0f, 20.0f); // 1: Middle of the room
+ SetCombatMovement(false);
+ me->AttackStop();
+ _stage = 7; //Invalid (Do nothing more than move)
+ return;
+ default:
+ break;
+ }
+ }
+ DoMeleeAttackIfReady();
+ break;
}
- if (m_uiTrampleTimer <= diff)
- {
- Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers();
- for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
+ case 1:
+ DoCastAOE(SPELL_MASSIVE_CRASH);
+ me->StopMoving();
+ me->AttackStop();
+ _stage = 2;
+ break;
+ case 2:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
+ {
+ me->StopMoving();
+ me->AttackStop();
+ _trampleTargetGUID = target->GetGUID();
+ me->SetTarget(_trampleTargetGUID);
+ _trampleCasted = false;
+ SetCombatMovement(false);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveIdle();
+ events.ScheduleEvent(EVENT_TRAMPLE, 4*IN_MILLISECONDS);
+ _stage = 3;
+ }
+ else
+ _stage = 6;
+ break;
+ case 3:
+ while (uint32 eventId = events.ExecuteEvent())
{
- if (Unit* player = itr->getSource())
- if (player->isAlive() && player->IsWithinDistInMap(me, 6.0f))
+ switch (eventId)
+ {
+ case EVENT_TRAMPLE:
{
- DoCastAOE(SPELL_TRAMPLE);
- m_uiTrampleTimer = IN_MILLISECONDS;
+ if (Unit* target = Unit::GetPlayer(*me, _trampleTargetGUID))
+ {
+ me->StopMoving();
+ me->AttackStop();
+ _trampleCasted = false;
+ _movementStarted = true;
+ _trampleTargetX = target->GetPositionX();
+ _trampleTargetY = target->GetPositionY();
+ _trampleTargetZ = target->GetPositionZ();
+ // 2: Hop Backwards
+ me->GetMotionMaster()->MoveJump(2*me->GetPositionX() - _trampleTargetX, 2*me->GetPositionY() - _trampleTargetY, me->GetPositionZ(), 30.0f, 20.0f);
+ _stage = 7; //Invalid (Do nothing more than move)
+ }
+ else
+ _stage = 6;
break;
}
+ default:
+ break;
+ }
}
- } else m_uiTrampleTimer -= diff;
- break;
- case 6:
- if (!m_bTrampleCasted)
- {
- DoCast(me, SPELL_STAGGERED_DAZE);
- DoScriptText(SAY_TRAMPLE_FAIL, me);
- }
- m_bMovementStarted = false;
- me->GetMotionMaster()->MovementExpired();
- me->GetMotionMaster()->MoveChase(me->getVictim());
- SetCombatMovement(true);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- m_uiStage = 0;
- break;
+ break;
+ case 4:
+ me->StopMoving();
+ me->AttackStop();
+ Talk(EMOTE_TRAMPLE_START, _trampleTargetGUID);
+ me->GetMotionMaster()->MoveCharge(_trampleTargetX, _trampleTargetY, _trampleTargetZ, 42, 1);
+ me->SetTarget(0);
+ _stage = 5;
+ break;
+ case 5:
+ if (_movementFinish)
+ {
+ DoCastAOE(SPELL_TRAMPLE);
+ _movementFinish = false;
+ _stage = 6;
+ return;
+ }
+ if (events.ExecuteEvent() == EVENT_TRAMPLE)
+ {
+ Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
+ {
+ if (Unit* player = itr->getSource())
+ {
+ if (player->isAlive() && player->IsWithinDistInMap(me, 6.0f))
+ {
+ DoCastAOE(SPELL_TRAMPLE);
+ events.ScheduleEvent(EVENT_TRAMPLE, 4*IN_MILLISECONDS);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case 6:
+ if (!_trampleCasted)
+ {
+ DoCast(me, SPELL_STAGGERED_DAZE);
+ Talk(EMOTE_TRAMPLE_CRASH);
+ }
+ else
+ {
+ DoCast(me, SPELL_FROTHING_RAGE, true);
+ Talk(EMOTE_TRAMPLE_FAIL);
+ }
+ _movementStarted = false;
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
+ SetCombatMovement(true);
+ me->GetMotionMaster()->MovementExpired();
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveChase(me->getVictim());
+ AttackStart(me->getVictim());
+ events.ScheduleEvent(EVENT_MASSIVE_CRASH, 40*IN_MILLISECONDS);
+ events.ScheduleEvent(EVENT_ARCTIC_BREATH, urand(15*IN_MILLISECONDS, 25*IN_MILLISECONDS));
+ _stage = 0;
+ break;
+ default:
+ break;
+ }
}
- }
- };
+ private:
+ float _trampleTargetX, _trampleTargetY, _trampleTargetZ;
+ uint64 _trampleTargetGUID;
+ bool _movementStarted;
+ bool _movementFinish;
+ bool _trampleCasted;
+ uint8 _stage;
+ Unit* _target;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_icehowlAI(creature);
+ }
};
void AddSC_boss_northrend_beasts()
{
new boss_gormok();
new mob_snobold_vassal();
+ new npc_firebomb();
+ new spell_gormok_fire_bomb();
+
new boss_acidmaw();
new boss_dreadscale();
new mob_slime_pool();
+
new boss_icehowl();
}
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
index cf84abb482f..01d3bcbfe90 100755..100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp
@@ -16,39 +16,38 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: trial_of_the_crusader
-SD%Complete: ??%
-SDComment: based on /dev/rsa
-SDCategory: Crusader Coliseum
-EndScriptData */
-
// Known bugs:
// - They should be floating but they aren't respecting the floor =(
// - Hardcoded bullets spawner
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
#include "trial_of_the_crusader.h"
enum Yells
{
- SAY_AGGRO = -1649040,
- SAY_DEATH = -1649041,
- SAY_BERSERK = -1649042,
- EMOTE_SHIELD = -1649043,
- SAY_SHIELD = -1649044,
- SAY_KILL1 = -1649045,
- SAY_KILL2 = -1649046,
- EMOTE_LIGHT_VORTEX = -1649047,
- SAY_LIGHT_VORTEX = -1649048,
- EMOTE_DARK_VORTEX = -1649049,
- SAY_DARK_VORTEX = -1649050,
+ SAY_AGGRO = 0,
+ SAY_NIGHT = 1,
+ SAY_LIGHT = 2,
+ EMOTE_VORTEX = 3,
+ EMOTE_TWINK_PACT = 4,
+ SAY_TWINK_PACT = 5,
+ SAY_KILL_PLAYER = 6,
+ SAY_BERSERK = 7,
+ SAY_DEATH = 8
};
enum Equipment
{
EQUIP_MAIN_1 = 9423,
- EQUIP_MAIN_2 = 37377,
+ EQUIP_MAIN_2 = 37377
};
enum Summons
@@ -56,7 +55,7 @@ enum Summons
NPC_BULLET_CONTROLLER = 34743,
NPC_BULLET_DARK = 34628,
- NPC_BULLET_LIGHT = 34630,
+ NPC_BULLET_LIGHT = 34630
};
enum BossSpells
@@ -66,6 +65,7 @@ enum BossSpells
SPELL_LIGHT_SHIELD = 65858,
SPELL_LIGHT_TWIN_PACT = 65876,
SPELL_LIGHT_VORTEX = 66046,
+ SPELL_LIGHT_VORTEX_DAMAGE = 66048,
SPELL_LIGHT_TOUCH = 67297,
SPELL_LIGHT_ESSENCE = 65686,
SPELL_EMPOWERED_LIGHT = 65748,
@@ -77,17 +77,18 @@ enum BossSpells
SPELL_DARK_SHIELD = 65874,
SPELL_DARK_TWIN_PACT = 65875,
SPELL_DARK_VORTEX = 66058,
+ SPELL_DARK_VORTEX_DAMAGE = 66059,
SPELL_DARK_TOUCH = 67282,
SPELL_DARK_ESSENCE = 65684,
SPELL_EMPOWERED_DARK = 65724,
SPELL_TWIN_EMPATHY_DARK = 66132,
SPELL_UNLEASHED_DARK = 65808,
- SPELL_CONTROLLER_PERIODIC = 66149,
+ SPELL_CONTROLLER_PERIODIC = 66149,
SPELL_POWER_TWINS = 65879,
SPELL_BERSERK = 64238,
SPELL_POWERING_UP = 67590,
- SPELL_SURGE_OF_SPEED = 65828,
+ SPELL_SURGE_OF_SPEED = 65828
};
#define SPELL_DARK_ESSENCE_HELPER RAID_MODE<uint32>(65684, 67176, 67177, 67178)
@@ -100,13 +101,12 @@ enum BossSpells
enum Actions
{
- ACTION_VORTEX,
- ACTION_PACT
+ ACTION_VORTEX = 0,
+ ACTION_PACT = 1
};
-/*######
-## boss_twin_base
-######*/
+#define ESSENCE_REMOVE 0
+#define ESSENCE_APPLY 1
class OrbsDespawner : public BasicEvent
{
@@ -139,61 +139,36 @@ class OrbsDespawner : public BasicEvent
Creature* _creature;
};
-struct boss_twin_baseAI : public ScriptedAI
+struct boss_twin_baseAI : public BossAI
{
- boss_twin_baseAI(Creature* creature) : ScriptedAI(creature), Summons(me)
+ boss_twin_baseAI(Creature* creature) : BossAI(creature, BOSS_VALKIRIES)
{
- instance = creature->GetInstanceScript();
}
- InstanceScript* instance;
- SummonList Summons;
-
- AuraStateType m_uiAuraState;
-
- uint8 m_uiStage;
- bool m_bIsBerserk;
- uint32 m_uiWeapon;
- uint32 m_uiSpecialAbilityTimer;
- uint32 m_uiSpikeTimer;
- uint32 m_uiTouchTimer;
- uint32 m_uiBerserkTimer;
-
- int32 m_uiVortexSay;
- int32 m_uiVortexEmote;
- uint32 m_uiSisterNpcId;
- uint32 m_uiMyEmphatySpellId;
- uint32 m_uiOtherEssenceSpellId;
- uint32 m_uiSurgeSpellId;
- uint32 m_uiVortexSpellId;
- uint32 m_uiShieldSpellId;
- uint32 m_uiTwinPactSpellId;
- uint32 m_uiSpikeSpellId;
- uint32 m_uiTouchSpellId;
-
- void Reset() {
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
+ void Reset()
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
- me->ModifyAuraState(m_uiAuraState, true);
- /* Uncomment this once that they are flying above the ground
+ me->ModifyAuraState(AuraState, true);
+ /* Uncomment this once that they are floating above the ground
me->SetLevitate(true);
me->SetFlying(true); */
- m_bIsBerserk = false;
+ IsBerserk = false;
- m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS;
- m_uiSpikeTimer = 20*IN_MILLISECONDS;
- m_uiTouchTimer = urand(10, 15)*IN_MILLISECONDS;
- m_uiBerserkTimer = IsHeroic() ? 6*MINUTE*IN_MILLISECONDS : 10*MINUTE*IN_MILLISECONDS;
+ SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS;
+ SpikeTimer = 20*IN_MILLISECONDS;
+ TouchTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
+ BerserkTimer = IsHeroic() ? 6*MINUTE*IN_MILLISECONDS : 10*MINUTE*IN_MILLISECONDS;
- Summons.DespawnAll();
+ summons.DespawnAll();
}
void JustReachedHome()
{
if (instance)
- instance->SetData(TYPE_VALKIRIES, FAIL);
+ instance->SetBossState(BOSS_VALKIRIES, FAIL);
- Summons.DespawnAll();
+ summons.DespawnAll();
me->DespawnOrUnsummon();
}
@@ -205,10 +180,11 @@ struct boss_twin_baseAI : public ScriptedAI
switch (uiId)
{
case 1:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
break;
+ default:
+ break;
}
}
@@ -216,15 +192,15 @@ struct boss_twin_baseAI : public ScriptedAI
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(urand(0, 1) ? SAY_KILL1 : SAY_KILL2, me);
+ Talk(SAY_KILL_PLAYER);
if (instance)
- instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE, 0);
+ instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
void JustSummoned(Creature* summoned)
{
- Summons.Summon(summoned);
+ summons.Summon(summoned);
}
void SummonedCreatureDespawn(Creature* summoned)
@@ -242,13 +218,15 @@ struct boss_twin_baseAI : public ScriptedAI
case NPC_BULLET_CONTROLLER:
me->m_Events.AddEvent(new OrbsDespawner(me), me->m_Events.CalculateTime(100));
break;
+ default:
+ break;
}
- Summons.Despawn(summoned);
+ summons.Despawn(summoned);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
if (Creature* pSister = GetSister())
@@ -257,24 +235,22 @@ struct boss_twin_baseAI : public ScriptedAI
{
me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
pSister->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
-
- instance->SetData(TYPE_VALKIRIES, DONE);
- Summons.DespawnAll();
+ _JustDied();
}
else
{
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
- instance->SetData(TYPE_VALKIRIES, SPECIAL);
+ instance->SetBossState(BOSS_VALKIRIES, SPECIAL);
}
}
}
- Summons.DespawnAll();
+ summons.DespawnAll();
}
// Called when sister pointer needed
Creature* GetSister()
{
- return Unit::GetCreature((*me), instance->GetData64(m_uiSisterNpcId));
+ return Unit::GetCreature((*me), instance->GetData64(SisterNpcId));
}
void EnterCombat(Unit* /*who*/)
@@ -284,14 +260,14 @@ struct boss_twin_baseAI : public ScriptedAI
{
if (Creature* pSister = GetSister())
{
- me->AddAura(m_uiMyEmphatySpellId, pSister);
+ me->AddAura(MyEmphatySpellId, pSister);
pSister->SetInCombatWithZone();
}
- instance->SetData(TYPE_VALKIRIES, IN_PROGRESS);
+ instance->SetBossState(BOSS_VALKIRIES, IN_PROGRESS);
}
- DoScriptText(SAY_AGGRO, me);
- DoCast(me, m_uiSurgeSpellId);
+ Talk(SAY_AGGRO);
+ DoCast(me, SurgeSpellId);
}
void DoAction(const int32 action)
@@ -299,214 +275,221 @@ struct boss_twin_baseAI : public ScriptedAI
switch (action)
{
case ACTION_VORTEX:
- m_uiStage = me->GetEntry() == NPC_LIGHTBANE ? 2 : 1;
+ Stage = me->GetEntry() == NPC_LIGHTBANE ? 2 : 1;
break;
case ACTION_PACT:
- m_uiStage = me->GetEntry() == NPC_LIGHTBANE ? 1 : 2;
+ Stage = me->GetEntry() == NPC_LIGHTBANE ? 1 : 2;
+ break;
+ default:
break;
}
}
void EnableDualWield(bool mode = true)
{
- SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : int32(EQUIP_UNEQUIP), EQUIP_UNEQUIP);
+ SetEquipmentSlots(false, Weapon, mode ? Weapon : int32(EQUIP_UNEQUIP), EQUIP_UNEQUIP);
me->SetCanDualWield(mode);
me->UpdateDamagePhysical(mode ? OFF_ATTACK : BASE_ATTACK);
}
- void UpdateAI(const uint32 uiDiff)
+ void UpdateAI(const uint32 diff)
{
if (!instance || !UpdateVictim())
return;
- switch (m_uiStage)
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ switch (Stage)
{
case 0:
break;
case 1: // Vortex
- if (m_uiSpecialAbilityTimer <= uiDiff)
+ if (SpecialAbilityTimer <= diff)
{
if (Creature* pSister = GetSister())
pSister->AI()->DoAction(ACTION_VORTEX);
- DoScriptText(m_uiVortexEmote, me);
- DoScriptText(m_uiVortexSay, me);
- DoCastAOE(m_uiVortexSpellId);
- m_uiStage = 0;
- m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS;
+ Talk(VortexEmote);
+ DoCastAOE(VortexSpellId);
+ Stage = 0;
+ SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS;
}
else
- m_uiSpecialAbilityTimer -= uiDiff;
+ SpecialAbilityTimer -= diff;
break;
- case 2: // Shield+Pact
- if (m_uiSpecialAbilityTimer <= uiDiff)
+ case 2: // Shield + Pact
+ if (SpecialAbilityTimer <= diff)
{
- DoScriptText(EMOTE_SHIELD, me);
- DoScriptText(SAY_SHIELD, me);
+ Talk(EMOTE_TWINK_PACT);
+ Talk(SAY_TWINK_PACT);
if (Creature* pSister = GetSister())
{
pSister->AI()->DoAction(ACTION_PACT);
pSister->CastSpell(pSister, SPELL_POWER_TWINS, false);
}
- DoCast(me, m_uiShieldSpellId);
- DoCast(me, m_uiTwinPactSpellId);
- m_uiStage = 0;
- m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS;
+ DoCast(me, ShieldSpellId);
+ DoCast(me, TwinPactSpellId);
+ Stage = 0;
+ SpecialAbilityTimer = 1*MINUTE*IN_MILLISECONDS;
}
else
- m_uiSpecialAbilityTimer -= uiDiff;
+ SpecialAbilityTimer -= diff;
break;
default:
break;
}
- if (m_uiSpikeTimer <= uiDiff)
+ if (SpikeTimer <= diff)
{
- DoCastVictim(m_uiSpikeSpellId);
- m_uiSpikeTimer = 20*IN_MILLISECONDS;
+ DoCastVictim(SpikeSpellId);
+ SpikeTimer = 20*IN_MILLISECONDS;
}
else
- m_uiSpikeTimer -= uiDiff;
+ SpikeTimer -= diff;
- if (IsHeroic() && m_uiTouchTimer <= uiDiff)
+ if (IsHeroic() && TouchTimer <= diff)
{
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true, m_uiOtherEssenceSpellId))
- me->CastCustomSpell(m_uiTouchSpellId, SPELLVALUE_MAX_TARGETS, 1, target, false);
- m_uiTouchTimer = urand(10, 15)*IN_MILLISECONDS;
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, OtherEssenceSpellId))
+ me->CastCustomSpell(TouchSpellId, SPELLVALUE_MAX_TARGETS, 1, target, false);
+ TouchTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);
}
else
- m_uiTouchTimer -= uiDiff;
+ TouchTimer -= diff;
- if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff)
+ if (!IsBerserk && BerserkTimer <= diff)
{
DoCast(me, SPELL_BERSERK);
- DoScriptText(SAY_BERSERK, me);
- m_bIsBerserk = true;
+ Talk(SAY_BERSERK);
+ IsBerserk = true;
}
else
- m_uiBerserkTimer -= uiDiff;
+ BerserkTimer -= diff;
DoMeleeAttackIfReady();
}
-};
-/*######
-## boss_fjola
-######*/
+ protected:
+ AuraStateType AuraState;
+
+ uint8 Stage;
+ bool IsBerserk;
+
+ uint32 Weapon;
+ uint32 SpecialAbilityTimer;
+ uint32 SpikeTimer;
+ uint32 TouchTimer;
+ uint32 BerserkTimer;
+
+ int32 VortexEmote;
+ uint32 SisterNpcId;
+ uint32 MyEmphatySpellId;
+ uint32 OtherEssenceSpellId;
+ uint32 SurgeSpellId;
+ uint32 VortexSpellId;
+ uint32 ShieldSpellId;
+ uint32 TwinPactSpellId;
+ uint32 SpikeSpellId;
+ uint32 TouchSpellId;
+};
class boss_fjola : public CreatureScript
{
-public:
- boss_fjola() : CreatureScript("boss_fjola") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_fjolaAI(creature);
- }
+ public:
+ boss_fjola() : CreatureScript("boss_fjola") { }
- struct boss_fjolaAI : public boss_twin_baseAI
- {
- boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature)
+ struct boss_fjolaAI : public boss_twin_baseAI
{
- instance = creature->GetInstanceScript();
- }
+ boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature)
+ {
+ }
- InstanceScript* instance;
-
- void Reset() {
- boss_twin_baseAI::Reset();
- SetEquipmentSlots(false, EQUIP_MAIN_1, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
- m_uiStage = 0;
- m_uiWeapon = EQUIP_MAIN_1;
- m_uiAuraState = AURA_STATE_UNKNOWN22;
- m_uiVortexEmote = EMOTE_LIGHT_VORTEX;
- m_uiVortexSay = SAY_LIGHT_VORTEX;
- m_uiSisterNpcId = NPC_DARKBANE;
- m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK;
- m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER;
- m_uiSurgeSpellId = SPELL_LIGHT_SURGE;
- m_uiVortexSpellId = SPELL_LIGHT_VORTEX;
- m_uiShieldSpellId = SPELL_LIGHT_SHIELD;
- m_uiTwinPactSpellId = SPELL_LIGHT_TWIN_PACT;
- m_uiTouchSpellId = SPELL_LIGHT_TOUCH;
- m_uiSpikeSpellId = SPELL_LIGHT_TWIN_SPIKE;
+ void Reset()
+ {
+ SetEquipmentSlots(false, EQUIP_MAIN_1, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
+ Stage = 0;
+ Weapon = EQUIP_MAIN_1;
+ AuraState = AURA_STATE_UNKNOWN22;
+ VortexEmote = EMOTE_VORTEX;
+ SisterNpcId = NPC_DARKBANE;
+ MyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK;
+ OtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER;
+ SurgeSpellId = SPELL_LIGHT_SURGE;
+ VortexSpellId = SPELL_LIGHT_VORTEX;
+ ShieldSpellId = SPELL_LIGHT_SHIELD;
+ TwinPactSpellId = SPELL_LIGHT_TWIN_PACT;
+ TouchSpellId = SPELL_LIGHT_TOUCH;
+ SpikeSpellId = SPELL_LIGHT_TWIN_SPIKE;
+
+ if (instance)
+ instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT);
+ boss_twin_baseAI::Reset();
+ }
- if (instance)
+ void EnterCombat(Unit* who)
{
- instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT);
+ if (instance)
+ instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT);
+
+ me->SummonCreature(NPC_BULLET_CONTROLLER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN);
+ boss_twin_baseAI::EnterCombat(who);
}
- }
- void EnterCombat(Unit* who)
- {
- if (instance)
+ void EnterEvadeMode()
{
- instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT);
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ boss_twin_baseAI::EnterEvadeMode();
}
- me->SummonCreature(NPC_BULLET_CONTROLLER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN);
- boss_twin_baseAI::EnterCombat(who);
- }
+ void JustReachedHome()
+ {
+ if (instance)
+ instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- void EnterEvadeMode()
- {
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- boss_twin_baseAI::EnterEvadeMode();
- }
+ boss_twin_baseAI::JustReachedHome();
+ }
+ };
- void JustReachedHome()
+ CreatureAI* GetAI(Creature* creature) const
{
- if (instance)
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
-
- boss_twin_baseAI::JustReachedHome();
+ return new boss_fjolaAI(creature);
}
- };
-
};
-/*######
-## boss_eydis
-######*/
-
class boss_eydis : public CreatureScript
{
-public:
- boss_eydis() : CreatureScript("boss_eydis") { }
+ public:
+ boss_eydis() : CreatureScript("boss_eydis") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_eydisAI(creature);
- }
+ struct boss_eydisAI : public boss_twin_baseAI
+ {
+ boss_eydisAI(Creature* creature) : boss_twin_baseAI(creature) {}
- struct boss_eydisAI : public boss_twin_baseAI
- {
- boss_eydisAI(Creature* creature) : boss_twin_baseAI(creature) {}
-
- void Reset() {
- boss_twin_baseAI::Reset();
- SetEquipmentSlots(false, EQUIP_MAIN_2, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
- m_uiStage = 1;
- m_uiWeapon = EQUIP_MAIN_2;
- m_uiAuraState = AURA_STATE_UNKNOWN19;
- m_uiVortexEmote = EMOTE_DARK_VORTEX;
- m_uiVortexSay = SAY_DARK_VORTEX;
- m_uiSisterNpcId = NPC_LIGHTBANE;
- m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT;
- m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER;
- m_uiSurgeSpellId = SPELL_DARK_SURGE;
- m_uiVortexSpellId = SPELL_DARK_VORTEX;
- m_uiShieldSpellId = SPELL_DARK_SHIELD;
- m_uiTwinPactSpellId = SPELL_DARK_TWIN_PACT;
- m_uiTouchSpellId = SPELL_DARK_TOUCH;
- m_uiSpikeSpellId = SPELL_DARK_TWIN_SPIKE;
- }
- };
+ void Reset()
+ {
+ SetEquipmentSlots(false, EQUIP_MAIN_2, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
+ Stage = 1;
+ Weapon = EQUIP_MAIN_2;
+ AuraState = AURA_STATE_UNKNOWN19;
+ VortexEmote = EMOTE_VORTEX;
+ SisterNpcId = NPC_LIGHTBANE;
+ MyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT;
+ OtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER;
+ SurgeSpellId = SPELL_DARK_SURGE;
+ VortexSpellId = SPELL_DARK_VORTEX;
+ ShieldSpellId = SPELL_DARK_SHIELD;
+ TwinPactSpellId = SPELL_DARK_TWIN_PACT;
+ TouchSpellId = SPELL_DARK_TOUCH;
+ SpikeSpellId = SPELL_DARK_TWIN_SPIKE;
+ boss_twin_baseAI::Reset();
+ }
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_eydisAI(creature);
+ }
};
-#define ESSENCE_REMOVE 0
-#define ESSENCE_APPLY 1
-
class mob_essence_of_twin : public CreatureScript
{
public:
@@ -516,16 +499,16 @@ class mob_essence_of_twin : public CreatureScript
{
mob_essence_of_twinAI(Creature* creature) : ScriptedAI(creature) { }
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 data) const
{
uint32 spellReturned = 0;
switch (me->GetEntry())
{
case NPC_LIGHT_ESSENCE:
- spellReturned = data == ESSENCE_REMOVE? SPELL_DARK_ESSENCE_HELPER : SPELL_LIGHT_ESSENCE_HELPER;
+ spellReturned = (data == ESSENCE_REMOVE) ? SPELL_DARK_ESSENCE_HELPER : SPELL_LIGHT_ESSENCE_HELPER;
break;
case NPC_DARK_ESSENCE:
- spellReturned = data == ESSENCE_REMOVE? SPELL_LIGHT_ESSENCE_HELPER : SPELL_DARK_ESSENCE_HELPER;
+ spellReturned = (data == ESSENCE_REMOVE) ? SPELL_LIGHT_ESSENCE_HELPER : SPELL_DARK_ESSENCE_HELPER;
break;
default:
break;
@@ -553,12 +536,8 @@ struct mob_unleashed_ballAI : public ScriptedAI
{
mob_unleashed_ballAI(Creature* creature) : ScriptedAI(creature)
{
- instance = creature->GetInstanceScript();
}
- InstanceScript* instance;
- uint32 m_uiRangeCheckTimer;
-
void MoveToNextPoint()
{
float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f;
@@ -575,13 +554,13 @@ struct mob_unleashed_ballAI : public ScriptedAI
void Reset()
{
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
me->SetDisableGravity(true);
me->SetCanFly(true);
SetCombatMovement(false);
MoveToNextPoint();
- m_uiRangeCheckTimer = IN_MILLISECONDS;
+ RangeCheckTimer = 0.5*IN_MILLISECONDS;
}
void MovementInform(uint32 uiType, uint32 uiId)
@@ -597,160 +576,112 @@ struct mob_unleashed_ballAI : public ScriptedAI
else
me->DisappearAndDie();
break;
+ default:
+ break;
}
}
+
+ protected:
+ uint32 RangeCheckTimer;
};
class mob_unleashed_dark : public CreatureScript
{
-public:
- mob_unleashed_dark() : CreatureScript("mob_unleashed_dark") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_unleashed_darkAI(creature);
- }
-
- struct mob_unleashed_darkAI : public mob_unleashed_ballAI
- {
- mob_unleashed_darkAI(Creature* creature) : mob_unleashed_ballAI(creature) {}
+ public:
+ mob_unleashed_dark() : CreatureScript("mob_unleashed_dark") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_unleashed_darkAI : public mob_unleashed_ballAI
{
- if (m_uiRangeCheckTimer < uiDiff)
+ mob_unleashed_darkAI(Creature* creature) : mob_unleashed_ballAI(creature) {}
+
+ void UpdateAI(const uint32 diff)
{
- if (me->SelectNearestPlayer(2.0f))
+ if (RangeCheckTimer < diff)
+ {
+ if (me->SelectNearestPlayer(3.0f))
{
- DoCastAOE(SPELL_UNLEASHED_DARK);
+ DoCastAOE(SPELL_UNLEASHED_DARK_HELPER);
me->GetMotionMaster()->MoveIdle();
- me->DespawnOrUnsummon(500);
+ me->DespawnOrUnsummon(1*IN_MILLISECONDS);
}
- m_uiRangeCheckTimer = IN_MILLISECONDS;
+ RangeCheckTimer = 0.5*IN_MILLISECONDS;
+ }
+ else
+ RangeCheckTimer -= diff;
}
- else m_uiRangeCheckTimer -= uiDiff;
- }
+ };
- void SpellHitTarget(Unit* who, SpellInfo const* spell)
+ CreatureAI* GetAI(Creature* creature) const
{
- if (spell->Id == SPELL_UNLEASHED_DARK_HELPER)
- {
- if (who->HasAura(SPELL_DARK_ESSENCE_HELPER))
- who->CastSpell(who, SPELL_POWERING_UP, true);
- }
+ return new mob_unleashed_darkAI(creature);
}
- };
-
};
class mob_unleashed_light : public CreatureScript
{
-public:
- mob_unleashed_light() : CreatureScript("mob_unleashed_light") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_unleashed_lightAI(creature);
- }
-
- struct mob_unleashed_lightAI : public mob_unleashed_ballAI
- {
- mob_unleashed_lightAI(Creature* creature) : mob_unleashed_ballAI(creature) {}
+ public:
+ mob_unleashed_light() : CreatureScript("mob_unleashed_light") { }
- void UpdateAI(const uint32 uiDiff)
+ struct mob_unleashed_lightAI : public mob_unleashed_ballAI
{
- if (m_uiRangeCheckTimer < uiDiff)
+ mob_unleashed_lightAI(Creature* creature) : mob_unleashed_ballAI(creature) {}
+
+ void UpdateAI(const uint32 diff)
{
- if (me->SelectNearestPlayer(2.0f))
+ if (RangeCheckTimer < diff)
+ {
+ if (me->SelectNearestPlayer(3.0f))
{
- DoCastAOE(SPELL_UNLEASHED_LIGHT);
+ DoCastAOE(SPELL_UNLEASHED_LIGHT_HELPER);
me->GetMotionMaster()->MoveIdle();
- me->DespawnOrUnsummon(500);
+ me->DespawnOrUnsummon(1*IN_MILLISECONDS);
}
- m_uiRangeCheckTimer = IN_MILLISECONDS;
+ RangeCheckTimer = 0.5*IN_MILLISECONDS;
+ }
+ else
+ RangeCheckTimer -= diff;
}
- else m_uiRangeCheckTimer -= uiDiff;
- }
+ };
- void SpellHitTarget(Unit* who, SpellInfo const* spell)
+ CreatureAI* GetAI(Creature* creature) const
{
- if (spell->Id == SPELL_UNLEASHED_LIGHT_HELPER)
- {
- if (who->HasAura(SPELL_LIGHT_ESSENCE_HELPER))
- who->CastSpell(who, SPELL_POWERING_UP, true);
- }
+ return new mob_unleashed_lightAI(creature);
}
- };
-
};
class mob_bullet_controller : public CreatureScript
{
-public:
- mob_bullet_controller() : CreatureScript("mob_bullet_controller") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_bullet_controllerAI(creature);
- }
-
- struct mob_bullet_controllerAI : public Scripted_NoMovementAI
- {
- mob_bullet_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature)
- {
- Reset();
- }
-
- void Reset()
- {
- DoCastAOE(SPELL_CONTROLLER_PERIODIC);
- }
-
- void UpdateAI(const uint32 /*uiDiff*/)
- {
- UpdateVictim();
- }
- };
-};
-
-class spell_powering_up : public SpellScriptLoader
-{
public:
- spell_powering_up() : SpellScriptLoader("spell_powering_up") { }
+ mob_bullet_controller() : CreatureScript("mob_bullet_controller") { }
- class spell_powering_up_AuraScript : public AuraScript
+ struct mob_bullet_controllerAI : public Scripted_NoMovementAI
{
- PrepareAuraScript(spell_powering_up_AuraScript);
-
- void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ mob_bullet_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature)
{
- if (Unit* target = GetTarget())
- {
- if (Aura* pAura = target->GetAura(GetId()))
- {
- if (pAura->GetStackAmount() == 100)
- {
- if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2206, EFFECT_1))
- target->CastSpell(target, SPELL_EMPOWERED_DARK, true);
-
- if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2845, EFFECT_1))
- target->CastSpell(target, SPELL_EMPOWERED_LIGHT, true);
+ Reset();
+ }
- target->RemoveAurasDueToSpell(GetId());
- }
- }
- }
+ void Reset()
+ {
+ DoCastAOE(SPELL_CONTROLLER_PERIODIC);
}
- void Register()
+ void UpdateAI(const uint32 /*diff*/)
{
- OnEffectApply += AuraEffectApplyFn(spell_powering_up_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ UpdateVictim();
}
};
- AuraScript* GetAuraScript() const
+ CreatureAI* GetAI(Creature* creature) const
{
- return new spell_powering_up_AuraScript();
+ return new mob_bullet_controllerAI(creature);
}
+};
+
+class spell_powering_up : public SpellScriptLoader
+{
+ public:
+ spell_powering_up() : SpellScriptLoader("spell_powering_up") { }
class spell_powering_up_SpellScript : public SpellScript
{
@@ -758,20 +689,39 @@ class spell_powering_up : public SpellScriptLoader
PrepareSpellScript(spell_powering_up_SpellScript)
uint32 spellId;
+ uint32 poweringUp;
bool Load()
{
spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster());
if (!sSpellMgr->GetSpellInfo(spellId))
return false;
+
+ poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, GetCaster());
+ if (!sSpellMgr->GetSpellInfo(poweringUp))
+ return false;
+
return true;
}
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (Unit* target = GetExplTargetUnit())
- if (urand(0, 99) < 15)
- target->CastSpell(target, spellId, true);
+ if (Unit* target = GetHitUnit())
+ {
+ if (Aura* pAura = target->GetAura(poweringUp))
+ {
+ if (pAura->GetStackAmount() >= 100)
+ {
+ if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2206, EFFECT_1))
+ target->CastSpell(target, SPELL_EMPOWERED_DARK, true);
+
+ if (target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2845, EFFECT_1))
+ target->CastSpell(target, SPELL_EMPOWERED_LIGHT, true);
+
+ target->RemoveAurasDueToSpell(poweringUp);
+ }
+ }
+ }
}
void Register()
@@ -805,10 +755,68 @@ class spell_valkyr_essences : public SpellScriptLoader
return true;
}
- void Absorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & /*absorbAmount*/)
+ void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & /*absorbAmount*/)
{
- if (urand(0, 99) < 5)
- GetTarget()->CastSpell(GetTarget(), spellId, true);
+ if (Unit* owner = GetUnitOwner())
+ {
+ if (dmgInfo.GetSpellInfo())
+ {
+ if (uint32 poweringUp = sSpellMgr->GetSpellIdForDifficulty(SPELL_POWERING_UP, owner))
+ {
+ if (urand(0, 99) < 5)
+ GetTarget()->CastSpell(GetTarget(), spellId, true);
+
+ // Twin Vortex part
+ uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner);
+ uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner);
+ int32 stacksCount = int32(dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue()) * 0.001 - 1;
+
+ if (lightVortex && darkVortex && stacksCount)
+ {
+ if (dmgInfo.GetSpellInfo()->Id == darkVortex || dmgInfo.GetSpellInfo()->Id == lightVortex)
+ {
+ Aura* pAura = owner->GetAura(poweringUp);
+ if (pAura)
+ {
+ pAura->ModStackAmount(stacksCount);
+ owner->CastSpell(owner, poweringUp, true);
+ }
+ else
+ {
+ owner->CastSpell(owner, poweringUp, true);
+ if (Aura* pTemp = owner->GetAura(poweringUp))
+ pTemp->ModStackAmount(stacksCount);
+ }
+ }
+ }
+
+ // Picking floating balls
+ uint32 unleashedDark = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_DARK, owner);
+ uint32 unleashedLight = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNLEASHED_LIGHT, owner);
+
+ if (unleashedDark && unleashedLight)
+ {
+ if (dmgInfo.GetSpellInfo()->Id == unleashedDark || dmgInfo.GetSpellInfo()->Id == unleashedLight)
+ {
+ // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
+ Aura* pAura = owner->GetAura(poweringUp);
+ if (pAura)
+ {
+ // 2 lines together add the correct amount of buff stacks
+ pAura->ModStackAmount(stacksCount);
+ owner->CastSpell(owner, poweringUp, true);
+ }
+ else
+ {
+ owner->CastSpell(owner, poweringUp, true);
+ if (Aura* pTemp = owner->GetAura(poweringUp))
+ pTemp->ModStackAmount(stacksCount);
+ }
+ }
+ }
+ }
+ }
+ }
}
void Register()
@@ -877,6 +885,7 @@ void AddSC_boss_twin_valkyr()
new mob_unleashed_dark();
new mob_essence_of_twin();
new mob_bullet_controller();
+
new spell_powering_up();
new spell_valkyr_essences();
new spell_power_of_the_twins();
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
index 1966e26b128..fb084ec1e3c 100755..100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp
@@ -16,15 +16,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: instance_trial_of_the_crusader
-SD%Complete: 80%
-SDComment: by /dev/rsa
-SDCategory: Trial of the Crusader
-EndScriptData */
-
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "trial_of_the_crusader.h"
+#include "Player.h"
+#include "TemporarySummon.h"
class instance_trial_of_the_crusader : public InstanceMapScript
{
@@ -35,79 +31,54 @@ class instance_trial_of_the_crusader : public InstanceMapScript
{
instance_trial_of_the_crusader_InstanceMapScript(Map* map) : InstanceScript(map) {}
- uint32 EncounterStatus[MAX_ENCOUNTERS];
- uint32 TrialCounter;
- uint32 EventStage;
- uint32 EventTimer;
- uint32 EventNPCId;
- uint32 NorthrendBeasts;
- std::string SaveDataBuffer;
- bool NeedSave;
-
- uint64 BarrentGUID;
- uint64 TirionGUID;
- uint64 FizzlebangGUID;
- uint64 GarroshGUID;
- uint64 VarianGUID;
-
- uint64 GormokGUID;
- uint64 AcidmawGUID;
- uint64 DreadscaleGUID;
- uint64 IcehowlGUID;
- uint64 JaraxxusGUID;
- uint64 ChampionsControllerGUID;
- uint64 DarkbaneGUID;
- uint64 LightbaneGUID;
- uint64 AnubarakGUID;
-
- uint64 CrusadersCacheGUID;
- uint64 FloorGUID;
-
- uint64 TributeChestGUID;
-
- uint64 MainGateDoorGUID;
- uint64 EastPortcullisGUID;
- uint64 WebDoorGUID;
-
- // Achievement stuff
- uint32 NotOneButTwoJormungarsTimer;
- uint32 ResilienceWillFixItTimer;
- uint8 SnoboldCount;
- uint8 MistressOfPainCount;
- bool TributeToImmortalityElegible;
-
void Initialize()
{
- for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
- EncounterStatus[i] = NOT_STARTED;
-
+ SetBossNumber(MAX_ENCOUNTERS);
TrialCounter = 50;
EventStage = 0;
-
- TributeChestGUID = 0;
-
- MainGateDoorGUID = 0;
- EastPortcullisGUID = 0;
- WebDoorGUID = 0;
-
NorthrendBeasts = NOT_STARTED;
-
EventTimer = 1000;
-
NotOneButTwoJormungarsTimer = 0;
ResilienceWillFixItTimer = 0;
SnoboldCount = 0;
MistressOfPainCount = 0;
- TributeToImmortalityElegible = true;
-
+ TributeToImmortalityEligible = true;
NeedSave = false;
+
+ TirionFordringGUID = 0;
+ BarrentGUID = 0;
+ TirionGUID = 0;
+ FizzlebangGUID = 0;
+ GarroshGUID = 0;
+ VarianGUID = 0;
+ GormokGUID = 0;
+ AcidmawGUID = 0;
+ DreadscaleGUID = 0;
+ IcehowlGUID = 0;
+ JaraxxusGUID = 0;
+ ChampionsControllerGUID = 0;
+ DarkbaneGUID = 0;
+ LightbaneGUID = 0;
+ AnubarakGUID = 0;
+
+ TributeChestGUID = 0;
+ MainGateDoorGUID = 0;
+ EastPortcullisGUID = 0;
+ WebDoorGUID = 0;
+ CrusadersCacheGUID = 0;
+ FloorGUID = 0;
}
bool IsEncounterInProgress() const
{
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
- if (EncounterStatus[i] == IN_PROGRESS)
+ if (GetBossState(i) == IN_PROGRESS)
return true;
+
+ // Special state is set at Faction Champions after first champ dead, encounter is still in combat
+ if (GetBossState(BOSS_CRUSADERS) == SPECIAL)
+ return true;
+
return false;
}
@@ -118,12 +89,26 @@ class instance_trial_of_the_crusader : public InstanceMapScript
player->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 1);
player->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, GetData(TYPE_COUNTER));
}
+ else
+ player->SendUpdateWorldState(UPDATE_STATE_UI_SHOW, 0);
+
+ // make sure Anub'arak isnt missing and floor is destroyed after a crash
+ if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE)
+ {
+ Creature* anubArak = Unit::GetCreature(*player, GetData64(NPC_ANUBARAK));
+ if (!anubArak)
+ anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
+
+ if (GameObject* floor = GameObject::GetGameObject(*player, GetData64(GO_ARGENT_COLISEUM_FLOOR)))
+ floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
+ }
}
void OpenDoor(uint64 guid)
{
if (!guid)
return;
+
if (GameObject* go = instance->GetGameObject(guid))
go->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
}
@@ -132,6 +117,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
{
if (!guid)
return;
+
if (GameObject* go = instance->GetGameObject(guid))
go->SetGoState(GO_STATE_READY);
}
@@ -142,10 +128,15 @@ class instance_trial_of_the_crusader : public InstanceMapScript
{
case NPC_BARRENT:
BarrentGUID = creature->GetGUID();
+ if (!TrialCounter)
+ creature->DespawnOrUnsummon();
break;
case NPC_TIRION:
TirionGUID = creature->GetGUID();
break;
+ case NPC_TIRION_FORDRING:
+ TirionFordringGUID = creature->GetGUID();
+ break;
case NPC_FIZZLEBANG:
FizzlebangGUID = creature->GetGUID();
break;
@@ -183,6 +174,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case NPC_ANUBARAK:
AnubarakGUID = creature->GetGUID();
break;
+ default:
+ break;
}
}
@@ -229,26 +222,41 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case GO_TRIBUTE_CHEST_25H_99:
TributeChestGUID = go->GetGUID();
break;
+ default:
+ break;
}
}
- void SetData(uint32 type, uint32 data)
+ bool SetBossState(uint32 type, EncounterState state)
{
+ if (!InstanceScript::SetBossState(type, state))
+ return false;
+
switch (type)
{
- case TYPE_JARAXXUS:
- if (data == DONE)
+ case BOSS_BEASTS:
+ break;
+ case BOSS_JARAXXUS:
+ // Cleanup Icehowl
+ if (Creature* icehowl = instance->GetCreature(IcehowlGUID))
+ icehowl->DespawnOrUnsummon();
+ if (state == DONE)
EventStage = 2000;
break;
- case TYPE_CRUSADERS:
- switch (data)
+ case BOSS_CRUSADERS:
+ // Cleanup Jaraxxus
+ if (Creature* jaraxxus = instance->GetCreature(JaraxxusGUID))
+ jaraxxus->DespawnOrUnsummon();
+ if (Creature* fizzlebang = instance->GetCreature(FizzlebangGUID))
+ fizzlebang->DespawnOrUnsummon();
+ switch (state)
{
case IN_PROGRESS:
ResilienceWillFixItTimer = 0;
break;
case SPECIAL: //Means the first blood
ResilienceWillFixItTimer = 60*IN_MILLISECONDS;
- data = IN_PROGRESS;
+ state = IN_PROGRESS;
break;
case DONE:
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFEAT_FACTION_CHAMPIONS);
@@ -257,18 +265,23 @@ class instance_trial_of_the_crusader : public InstanceMapScript
DoRespawnGameObject(CrusadersCacheGUID, 7*DAY);
EventStage = 3100;
break;
+ default:
+ break;
}
break;
- case TYPE_VALKIRIES:
- switch (data)
+ case BOSS_VALKIRIES:
+ // Cleanup chest
+ if (GameObject* cache = instance->GetGameObject(CrusadersCacheGUID))
+ cache->Delete();
+ switch (state)
{
case FAIL:
- if (EncounterStatus[TYPE_VALKIRIES] == NOT_STARTED)
- data = NOT_STARTED;
+ if (GetBossState(BOSS_VALKIRIES) == NOT_STARTED)
+ state = NOT_STARTED;
break;
case SPECIAL:
- if (EncounterStatus[TYPE_VALKIRIES] == SPECIAL)
- data = DONE;
+ if (GetBossState(BOSS_VALKIRIES) == SPECIAL)
+ state = DONE;
break;
case DONE:
if (instance->GetPlayers().getFirst()->getSource()->GetTeam() == ALLIANCE)
@@ -276,49 +289,122 @@ class instance_trial_of_the_crusader : public InstanceMapScript
else
EventStage = 4030;
break;
+ default:
+ break;
}
break;
- case TYPE_ANUBARAK:
- switch (data)
+ case BOSS_LICH_KING:
+ break;
+ case BOSS_ANUBARAK:
+ switch (state)
{
case DONE:
+ {
EventStage = 6000;
- break;
- case SPECIAL:
uint32 tributeChest = 0;
if (instance->GetSpawnMode() == RAID_DIFFICULTY_10MAN_HEROIC)
{
if (TrialCounter >= 50)
tributeChest = GO_TRIBUTE_CHEST_10H_99;
else
+ {
if (TrialCounter >= 45)
tributeChest = GO_TRIBUTE_CHEST_10H_50;
else
+ {
if (TrialCounter >= 25)
tributeChest = GO_TRIBUTE_CHEST_10H_45;
else
tributeChest = GO_TRIBUTE_CHEST_10H_25;
+ }
+ }
}
else if (instance->GetSpawnMode() == RAID_DIFFICULTY_25MAN_HEROIC)
{
if (TrialCounter >= 50)
tributeChest = GO_TRIBUTE_CHEST_25H_99;
else
+ {
if (TrialCounter >= 45)
tributeChest = GO_TRIBUTE_CHEST_25H_50;
else
+ {
if (TrialCounter >= 25)
tributeChest = GO_TRIBUTE_CHEST_25H_45;
else
tributeChest = GO_TRIBUTE_CHEST_25H_25;
+ }
+ }
}
+
if (tributeChest)
if (Creature* tirion = instance->GetCreature(TirionGUID))
- if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, 0, 0, 0, 0, 90000000))
+ if (GameObject* chest = tirion->SummonGameObject(tributeChest, 805.62f, 134.87f, 142.16f, 3.27f, 0, 0, 0, 0, WEEK))
chest->SetRespawnTime(chest->GetRespawnDelay());
break;
+ }
+ default:
+ break;
}
break;
+ default:
+ break;
+ }
+
+ if (IsEncounterInProgress())
+ {
+ CloseDoor(GetData64(GO_EAST_PORTCULLIS));
+ CloseDoor(GetData64(GO_WEB_DOOR));
+ }
+ else
+ {
+ OpenDoor(GetData64(GO_EAST_PORTCULLIS));
+ OpenDoor(GetData64(GO_WEB_DOOR));
+ }
+
+ if (type < MAX_ENCOUNTERS)
+ {
+ sLog->outInfo(LOG_FILTER_TSCR, "[ToCr] BossState(type %u) %u = state %u;", type, GetBossState(type), state);
+ if (state == FAIL)
+ {
+ if (instance->IsHeroic())
+ {
+ --TrialCounter;
+ // decrease attempt counter at wipe
+ Map::PlayerList const &PlayerList = instance->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
+ if (Player* player = itr->getSource())
+ player->SendUpdateWorldState(UPDATE_STATE_UI_COUNT, TrialCounter);
+
+ // if theres no more attemps allowed
+ if (!TrialCounter)
+ {
+ if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
+ announcer->ToCreature()->DespawnOrUnsummon();
+
+ if (Creature* anubArak = instance->GetCreature(GetData64(NPC_ANUBARAK)))
+ anubArak->DespawnOrUnsummon();
+ }
+ }
+ NeedSave = true;
+ EventStage = (type == BOSS_BEASTS ? 666 : 0);
+ state = NOT_STARTED;
+ }
+
+ if (state == DONE || NeedSave)
+ {
+ if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
+ announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ Save();
+ }
+ }
+ return true;
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ switch (type)
+ {
case TYPE_COUNTER:
TrialCounter = data;
data = DONE;
@@ -338,7 +424,6 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case GORMOK_DONE:
EventStage = 200;
SetData(TYPE_NORTHREND_BEASTS, IN_PROGRESS);
- SetData(TYPE_BEASTS, IN_PROGRESS);
break;
case SNAKES_IN_PROGRESS:
NotOneButTwoJormungarsTimer = 0;
@@ -351,15 +436,16 @@ class instance_trial_of_the_crusader : public InstanceMapScript
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_WORMS_KILLED_IN_10_SECONDS);
EventStage = 300;
SetData(TYPE_NORTHREND_BEASTS, IN_PROGRESS);
- SetData(TYPE_BEASTS, IN_PROGRESS);
break;
case ICEHOWL_DONE:
EventStage = 400;
SetData(TYPE_NORTHREND_BEASTS, DONE);
- SetData(TYPE_BEASTS, DONE);
+ SetBossState(BOSS_BEASTS, DONE);
break;
case FAIL:
- SetData(TYPE_BEASTS, FAIL);
+ SetBossState(BOSS_BEASTS, FAIL);
+ break;
+ default:
break;
}
break;
@@ -376,44 +462,15 @@ class instance_trial_of_the_crusader : public InstanceMapScript
else if (data == DECREASE)
--MistressOfPainCount;
break;
- case DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE:
- TributeToImmortalityElegible = false;
+ case DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE:
+ TributeToImmortalityEligible = false;
+ break;
+ default:
break;
- }
- if (IsEncounterInProgress())
- {
- CloseDoor(GetData64(GO_EAST_PORTCULLIS));
- CloseDoor(GetData64(GO_WEB_DOOR));
- }
- else
- {
- OpenDoor(GetData64(GO_EAST_PORTCULLIS));
- OpenDoor(GetData64(GO_WEB_DOOR));
- }
-
- if (type < MAX_ENCOUNTERS)
- {
- sLog->outDetail("[ToCr] EncounterStatus[type %u] %u = data %u;", type, EncounterStatus[type], data);
- if (data == FAIL)
- {
- --TrialCounter;
- NeedSave = true;
- EventStage = (type == TYPE_BEASTS ? 666 : 0);
- data = NOT_STARTED;
- }
-
- EncounterStatus[type] = data;
-
- if (data == DONE || NeedSave == true)
- {
- if (Unit* announcer = instance->GetCreature(GetData64(NPC_BARRENT)))
- announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
- Save();
- }
}
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
@@ -421,6 +478,8 @@ class instance_trial_of_the_crusader : public InstanceMapScript
return BarrentGUID;
case NPC_TIRION:
return TirionGUID;
+ case NPC_TIRION_FORDRING:
+ return TirionFordringGUID;
case NPC_FIZZLEBANG:
return FizzlebangGUID;
case NPC_GARROSH:
@@ -462,22 +521,10 @@ class instance_trial_of_the_crusader : public InstanceMapScript
return 0;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
- case TYPE_BEASTS:
- return EncounterStatus[TYPE_BEASTS];
- case TYPE_JARAXXUS:
- return EncounterStatus[TYPE_JARAXXUS];
- case TYPE_CRUSADERS:
- return EncounterStatus[TYPE_CRUSADERS];
- case TYPE_VALKIRIES:
- return EncounterStatus[TYPE_VALKIRIES];
- case TYPE_LICH_KING:
- return EncounterStatus[TYPE_LICH_KING];
- case TYPE_ANUBARAK:
- return EncounterStatus[TYPE_ANUBARAK];
case TYPE_COUNTER:
return TrialCounter;
case TYPE_EVENT:
@@ -528,7 +575,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case 6000:
case 6005:
case 6010:
- EventNPCId = NPC_TIRION;
+ return NPC_TIRION;
break;
case 5010:
case 5030:
@@ -537,7 +584,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case 5060:
case 5070:
case 5080:
- EventNPCId = NPC_LICH_KING_1;
+ return NPC_LICH_KING_1;
break;
case 120:
case 122:
@@ -546,7 +593,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case 3051:
case 3071:
case 4020:
- EventNPCId = NPC_VARIAN;
+ return NPC_VARIAN;
break;
case 130:
case 132:
@@ -555,7 +602,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case 3070:
case 3081:
case 4030:
- EventNPCId = NPC_GARROSH;
+ return NPC_GARROSH;
break;
case 1110:
case 1120:
@@ -567,13 +614,12 @@ class instance_trial_of_the_crusader : public InstanceMapScript
case 1142:
case 1144:
case 1150:
- EventNPCId = NPC_FIZZLEBANG;
+ return NPC_FIZZLEBANG;
break;
default:
- EventNPCId = NPC_TIRION;
+ return NPC_TIRION;
break;
};
- return EventNPCId;
default:
break;
}
@@ -591,7 +637,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
NotOneButTwoJormungarsTimer -= diff;
}
- if (GetData(TYPE_CRUSADERS) == IN_PROGRESS && ResilienceWillFixItTimer)
+ if (GetBossState(BOSS_CRUSADERS) == SPECIAL && ResilienceWillFixItTimer)
{
if (ResilienceWillFixItTimer <= diff)
ResilienceWillFixItTimer = 0;
@@ -607,7 +653,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
std::ostringstream saveStream;
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
- saveStream << EncounterStatus[i] << ' ';
+ saveStream << GetBossState(i) << ' ';
saveStream << TrialCounter;
SaveDataBuffer = saveStream.str();
@@ -636,10 +682,11 @@ class instance_trial_of_the_crusader : public InstanceMapScript
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
{
- loadStream >> EncounterStatus[i];
-
- if (EncounterStatus[i] == IN_PROGRESS)
- EncounterStatus[i] = NOT_STARTED;
+ uint32 tmpState;
+ loadStream >> tmpState;
+ if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
+ tmpState = NOT_STARTED;
+ SetBossState(i, EncounterState(tmpState));
}
loadStream >> TrialCounter;
@@ -675,13 +722,54 @@ class instance_trial_of_the_crusader : public InstanceMapScript
return TrialCounter == 50;
case A_TRIBUTE_TO_IMMORTALITY_HORDE:
case A_TRIBUTE_TO_IMMORTALITY_ALLIANCE:
- return TrialCounter == 50 && TributeToImmortalityElegible;
+ return TrialCounter == 50 && TributeToImmortalityEligible;
case A_TRIBUTE_TO_DEDICATED_INSANITY:
return false/*uiGrandCrusaderAttemptsLeft == 50 && !bHasAtAnyStagePlayerEquippedTooGoodItem*/;
+ default:
+ break;
}
return false;
}
+
+ protected:
+ uint32 TrialCounter;
+ uint32 EventStage;
+ uint32 EventTimer;
+ uint32 NorthrendBeasts;
+ bool NeedSave;
+ std::string SaveDataBuffer;
+
+ uint64 BarrentGUID;
+ uint64 TirionGUID;
+ uint64 TirionFordringGUID;
+ uint64 FizzlebangGUID;
+ uint64 GarroshGUID;
+ uint64 VarianGUID;
+
+ uint64 GormokGUID;
+ uint64 AcidmawGUID;
+ uint64 DreadscaleGUID;
+ uint64 IcehowlGUID;
+ uint64 JaraxxusGUID;
+ uint64 ChampionsControllerGUID;
+ uint64 DarkbaneGUID;
+ uint64 LightbaneGUID;
+ uint64 AnubarakGUID;
+
+ uint64 CrusadersCacheGUID;
+ uint64 FloorGUID;
+ uint64 TributeChestGUID;
+ uint64 MainGateDoorGUID;
+ uint64 EastPortcullisGUID;
+ uint64 WebDoorGUID;
+
+ // Achievement stuff
+ uint32 NotOneButTwoJormungarsTimer;
+ uint32 ResilienceWillFixItTimer;
+ uint8 SnoboldCount;
+ uint8 MistressOfPainCount;
+ bool TributeToImmortalityEligible;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
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 2643b8d60c7..b4d35afa8fb 100755..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
@@ -16,61 +16,69 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* ScriptData
-SDName: Trial Of the crusader
-SD%Complete: ??%
-SDComment: event script based on /dev/rsa
-SDCategory: trial_of_the_crusader
-EndScriptData */
-
//Known Bugs:
// - Need better implementation of Gossip and correct gossip text and option
-// - Misses Dalaran Teleport at the end.
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "trial_of_the_crusader.h"
+#include "Player.h"
enum eYells
{
- SAY_STAGE_0_01 = -1649070,
- SAY_STAGE_0_02 = -1649071,
- SAY_STAGE_0_03a = -1649072,
- SAY_STAGE_0_03h = -1649073,
- SAY_STAGE_0_04 = -1649074,
- SAY_STAGE_0_05 = -1649075,
- SAY_STAGE_0_06 = -1649076,
- SAY_STAGE_0_WIPE = -1649077,
- SAY_STAGE_1_01 = -1649080,
- SAY_STAGE_1_02 = -1649081,
- SAY_STAGE_1_03 = -1649082,
- SAY_STAGE_1_04 = -1649083,
- SAY_STAGE_1_05 = -1649030, //INTRO Jaraxxus
- SAY_STAGE_1_06 = -1649084,
- SAY_STAGE_1_07 = -1649086,
- SAY_STAGE_1_08 = -1649087,
- SAY_STAGE_1_09 = -1649088,
- SAY_STAGE_1_10 = -1649089,
- SAY_STAGE_1_11 = -1649090,
- SAY_STAGE_2_01 = -1649091,
- SAY_STAGE_2_02a = -1649092,
- SAY_STAGE_2_02h = -1649093,
- SAY_STAGE_2_03 = -1649094,
- SAY_STAGE_2_04a = -1649095,
- SAY_STAGE_2_04h = -1649096,
- SAY_STAGE_2_05a = -1649097,
- SAY_STAGE_2_05h = -1649098,
- SAY_STAGE_2_06 = -1649099,
- SAY_STAGE_3_01 = -1649100,
- SAY_STAGE_3_02 = -1649101,
- SAY_STAGE_3_03a = -1649102,
- SAY_STAGE_3_03h = -1649103,
- SAY_STAGE_4_01 = -1649104,
- SAY_STAGE_4_02 = -1649105,
- SAY_STAGE_4_03 = -1649106,
- SAY_STAGE_4_04 = -1649107,
- SAY_STAGE_4_05 = -1649108,
- SAY_STAGE_4_06 = -1649109,
- SAY_STAGE_4_07 = -1649110,
+ // Highlord Tirion Fordring - 34996
+ SAY_STAGE_0_01 = 0,
+ SAY_STAGE_0_02 = 1,
+ SAY_STAGE_0_04 = 2,
+ SAY_STAGE_0_05 = 3,
+ SAY_STAGE_0_06 = 4,
+ SAY_STAGE_0_WIPE = 5,
+ SAY_STAGE_1_01 = 6,
+ SAY_STAGE_1_07 = 7,
+ SAY_STAGE_1_08 = 8,
+ SAY_STAGE_1_11 = 9,
+ SAY_STAGE_2_01 = 10,
+ SAY_STAGE_2_03 = 11,
+ SAY_STAGE_2_06 = 12,
+ SAY_STAGE_3_01 = 13,
+ SAY_STAGE_3_02 = 14,
+ SAY_STAGE_4_01 = 15,
+ SAY_STAGE_4_03 = 16,
+
+ // Varian Wrynn
+ SAY_STAGE_0_03a = 0,
+ SAY_STAGE_1_10 = 1,
+ SAY_STAGE_2_02a = 2,
+ SAY_STAGE_2_04a = 3,
+ SAY_STAGE_2_05a = 4,
+ SAY_STAGE_3_03a = 5,
+
+ // Garrosh
+ SAY_STAGE_0_03h = 0,
+ SAY_STAGE_1_09 = 1,
+ SAY_STAGE_2_02h = 2,
+ SAY_STAGE_2_04h = 3,
+ SAY_STAGE_2_05h = 4,
+ SAY_STAGE_3_03h = 5,
+
+ // Wilfred Fizzlebang
+ SAY_STAGE_1_02 = 0,
+ SAY_STAGE_1_03 = 1,
+ SAY_STAGE_1_04 = 2,
+ SAY_STAGE_1_06 = 3,
+
+ // Lord Jaraxxus
+ SAY_STAGE_1_05 = 0,
+
+ // The Lich King
+ SAY_STAGE_4_02 = 0,
+ SAY_STAGE_4_05 = 1,
+ SAY_STAGE_4_04 = 2,
+
+ // Highlord Tirion Fordring - 36095
+ SAY_STAGE_4_06 = 0,
+ SAY_STAGE_4_07 = 1
};
struct _Messages
@@ -83,34 +91,30 @@ struct _Messages
static _Messages _GossipMessage[]=
{
- {MSG_BEASTS, GOSSIP_ACTION_INFO_DEF+1, false, TYPE_BEASTS},
- {MSG_JARAXXUS, GOSSIP_ACTION_INFO_DEF+2, false, TYPE_JARAXXUS},
- {MSG_CRUSADERS, GOSSIP_ACTION_INFO_DEF+3, false, TYPE_CRUSADERS},
- {MSG_VALKIRIES, GOSSIP_ACTION_INFO_DEF+4, false, TYPE_VALKIRIES},
- {MSG_LICH_KING, GOSSIP_ACTION_INFO_DEF+5, false, TYPE_ANUBARAK},
- {MSG_ANUBARAK, GOSSIP_ACTION_INFO_DEF+6, true, TYPE_ANUBARAK}
+ {MSG_BEASTS, GOSSIP_ACTION_INFO_DEF + 1, false, BOSS_BEASTS},
+ {MSG_JARAXXUS, GOSSIP_ACTION_INFO_DEF + 2, false, BOSS_JARAXXUS},
+ {MSG_CRUSADERS, GOSSIP_ACTION_INFO_DEF + 3, false, BOSS_CRUSADERS},
+ {MSG_VALKIRIES, GOSSIP_ACTION_INFO_DEF + 4, false, BOSS_VALKIRIES},
+ {MSG_LICH_KING, GOSSIP_ACTION_INFO_DEF + 5, false, BOSS_ANUBARAK},
+ {MSG_ANUBARAK, GOSSIP_ACTION_INFO_DEF + 6, true, BOSS_ANUBARAK}
};
enum
{
- NUM_MESSAGES = 6,
+ NUM_MESSAGES = 6
};
class npc_announcer_toc10 : public CreatureScript
{
public:
-
npc_announcer_toc10() : CreatureScript("npc_announcer_toc10") { }
struct npc_announcer_toc10AI : public ScriptedAI
{
npc_announcer_toc10AI(Creature* creature) : ScriptedAI(creature)
{
- instance = creature->GetInstanceScript();
}
- InstanceScript* instance;
-
void Reset()
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -125,20 +129,20 @@ class npc_announcer_toc10 : public CreatureScript
bool OnGossipHello(Player* player, Creature* creature)
{
- InstanceScript* instanceScript = creature->GetInstanceScript();
- if (!instanceScript)
+ InstanceScript* instance = creature->GetInstanceScript();
+ if (!instance)
return true;
char const* _message = "We are ready!";
- if (player->isInCombat() || instanceScript->IsEncounterInProgress() || instanceScript->GetData(TYPE_EVENT))
+ if (player->isInCombat() || instance->IsEncounterInProgress() || instance->GetData(TYPE_EVENT))
return true;
uint8 i = 0;
for (; i < NUM_MESSAGES; ++i)
{
- if ((!_GossipMessage[i].state && instanceScript->GetData(_GossipMessage[i].encounter) != DONE)
- || (_GossipMessage[i].state && instanceScript->GetData(_GossipMessage[i].encounter) == DONE))
+ if ((!_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) != DONE)
+ || (_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) == DONE))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, _message, GOSSIP_SENDER_MAIN, _GossipMessage[i].id);
break;
@@ -149,75 +153,65 @@ class npc_announcer_toc10 : public CreatureScript
return true;
}
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/)
{
player->PlayerTalkClass->ClearMenus();
player->CLOSE_GOSSIP_MENU();
- InstanceScript* instanceScript = creature->GetInstanceScript();
- if (!instanceScript)
+ InstanceScript* instance = creature->GetInstanceScript();
+ if (!instance)
return true;
- switch (action)
+ if (instance->GetBossState(BOSS_BEASTS) != DONE)
{
- case GOSSIP_ACTION_INFO_DEF+1:
- if (instanceScript->GetData(TYPE_BEASTS) != DONE)
- {
- instanceScript->SetData(TYPE_EVENT, 110);
- instanceScript->SetData(TYPE_NORTHREND_BEASTS, NOT_STARTED);
- instanceScript->SetData(TYPE_BEASTS, NOT_STARTED);
- }
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- if (Creature* jaraxxus = Unit::GetCreature(*player, instanceScript->GetData64(NPC_JARAXXUS)))
- {
- jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS);
- jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- jaraxxus->SetReactState(REACT_AGGRESSIVE);
- jaraxxus->SetInCombatWithZone();
- }
- else if (instanceScript->GetData(TYPE_JARAXXUS) != DONE)
- {
- instanceScript->SetData(TYPE_EVENT, 1010);
- instanceScript->SetData(TYPE_JARAXXUS, NOT_STARTED);
- }
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- if (instanceScript->GetData(TYPE_CRUSADERS) != DONE)
- {
- if (player->GetTeam() == ALLIANCE)
- instanceScript->SetData(TYPE_EVENT, 3000);
- else
- instanceScript->SetData(TYPE_EVENT, 3001);
- instanceScript->SetData(TYPE_CRUSADERS, NOT_STARTED);
- }
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- if (instanceScript->GetData(TYPE_VALKIRIES) != DONE)
- {
- instanceScript->SetData(TYPE_EVENT, 4000);
- instanceScript->SetData(TYPE_VALKIRIES, NOT_STARTED);
- }
- break;
- case GOSSIP_ACTION_INFO_DEF+5:
+ instance->SetData(TYPE_EVENT, 110);
+ instance->SetData(TYPE_NORTHREND_BEASTS, NOT_STARTED);
+ instance->SetBossState(BOSS_BEASTS, NOT_STARTED);
+ }
+ else if (instance->GetBossState(BOSS_JARAXXUS) != DONE)
+ {
+ // if Jaraxxus is spawned, but the raid wiped
+ if (Creature* jaraxxus = Unit::GetCreature(*player, instance->GetData64(NPC_JARAXXUS)))
{
- if (instanceScript->GetData(TYPE_LICH_KING) != DONE && !player->isGameMaster())
- return true;
-
- if (GameObject* floor = GameObject::GetGameObject(*player, instanceScript->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
- floor->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ jaraxxus->RemoveAurasDueToSpell(SPELL_JARAXXUS_CHAINS);
+ jaraxxus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ jaraxxus->SetReactState(REACT_DEFENSIVE);
+ jaraxxus->SetInCombatWithZone();
+ }
+ else
+ {
+ instance->SetData(TYPE_EVENT, 1010);
+ instance->SetBossState(BOSS_JARAXXUS, NOT_STARTED);
+ }
+ }
+ else if (instance->GetBossState(BOSS_CRUSADERS) != DONE)
+ {
+ if (player->GetTeam() == ALLIANCE)
+ instance->SetData(TYPE_EVENT, 3000);
+ else
+ instance->SetData(TYPE_EVENT, 3001);
+ instance->SetBossState(BOSS_CRUSADERS, NOT_STARTED);
+ }
+ else if (instance->GetBossState(BOSS_VALKIRIES) != DONE)
+ {
+ instance->SetData(TYPE_EVENT, 4000);
+ instance->SetBossState(BOSS_VALKIRIES, NOT_STARTED);
+ }
+ else if (instance->GetBossState(BOSS_LICH_KING) != DONE)
+ {
+ if (GameObject* floor = GameObject::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
+ floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
- creature->CastSpell(creature, 69016, false);
+ creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false);
+ creature->CastSpell(creature, SPELL_DESTROY_FLOOR_KNOCKUP, false);
- Creature* anubArak = Unit::GetCreature(*creature, instanceScript->GetData64(NPC_ANUBARAK));
- if (!anubArak || !anubArak->isAlive())
- anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
+ Creature* anubArak = Unit::GetCreature(*creature, instance->GetData64(NPC_ANUBARAK));
+ if (!anubArak || !anubArak->isAlive())
+ anubArak = creature->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
- instanceScript->SetData(TYPE_ANUBARAK, NOT_STARTED);
+ instance->SetBossState(BOSS_ANUBARAK, NOT_STARTED);
- if (creature->IsVisible())
- creature->SetVisible(false);
- break;
- }
+ if (creature->IsVisible())
+ creature->SetVisible(false);
}
creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
return true;
@@ -232,114 +226,130 @@ class npc_announcer_toc10 : public CreatureScript
class boss_lich_king_toc : public CreatureScript
{
public:
-
boss_lich_king_toc() : CreatureScript("boss_lich_king_toc") { }
struct boss_lich_king_tocAI : public ScriptedAI
{
boss_lich_king_tocAI(Creature* creature) : ScriptedAI(creature)
{
- instance = creature->GetInstanceScript();
+ _instance = creature->GetInstanceScript();
}
- InstanceScript* instance;
- uint32 m_uiUpdateTimer;
-
void Reset()
{
- m_uiUpdateTimer = 0;
+ _updateTimer = 0;
me->SetReactState(REACT_PASSIVE);
- if (Creature* summoned = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5, TEMPSUMMON_TIMED_DESPAWN, 60000))
+ if (Creature* summoned = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5, TEMPSUMMON_TIMED_DESPAWN, 1*MINUTE*IN_MILLISECONDS))
{
summoned->CastSpell(summoned, 51807, false);
- summoned->SetDisplayId(11686);
+ summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2);
}
- if (instance) instance->SetData(TYPE_LICH_KING, IN_PROGRESS);
+ if (_instance)
+ _instance->SetBossState(BOSS_LICH_KING, IN_PROGRESS);
me->SetWalk(true);
}
void MovementInform(uint32 uiType, uint32 uiId)
{
- if (uiType != POINT_MOTION_TYPE)
+ if (uiType != POINT_MOTION_TYPE || !_instance)
return;
+
switch (uiId)
{
case 0:
- instance->SetData(TYPE_EVENT, 5030);
+ _instance->SetData(TYPE_EVENT, 5030);
break;
case 1:
- instance->SetData(TYPE_EVENT, 5050);
+ _instance->SetData(TYPE_EVENT, 5050);
+ break;
+ default:
break;
}
}
void UpdateAI(const uint32 uiDiff)
{
- if (!instance)
+ if (!_instance)
return;
- if (instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1)
+ if (_instance->GetData(TYPE_EVENT_NPC) != NPC_LICH_KING_1)
return;
- m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
- if (m_uiUpdateTimer <= uiDiff)
+ _updateTimer = _instance->GetData(TYPE_EVENT_TIMER);
+ if (_updateTimer <= uiDiff)
{
- switch (instance->GetData(TYPE_EVENT))
+ switch (_instance->GetData(TYPE_EVENT))
{
case 5010:
- DoScriptText(SAY_STAGE_4_02, me);
- m_uiUpdateTimer = 3000;
+ Talk(SAY_STAGE_4_02);
+ _updateTimer = 3*IN_MILLISECONDS;
me->GetMotionMaster()->MovePoint(0, LichKingLoc[0]);
- instance->SetData(TYPE_EVENT, 5020);
+ _instance->SetData(TYPE_EVENT, 5020);
break;
case 5030:
- DoScriptText(SAY_STAGE_4_04, me);
+ Talk(SAY_STAGE_4_04);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
- m_uiUpdateTimer = 10000;
- instance->SetData(TYPE_EVENT, 5040);
+ _updateTimer = 10*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5040);
break;
case 5040:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
me->GetMotionMaster()->MovePoint(1, LichKingLoc[1]);
- m_uiUpdateTimer = 1000;
- instance->SetData(TYPE_EVENT, 0);
+ _updateTimer = 1*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 5050:
me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 5060);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5060);
break;
case 5060:
- DoScriptText(SAY_STAGE_4_05, me);
+ Talk(SAY_STAGE_4_05);
me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
- m_uiUpdateTimer = 2500;
- instance->SetData(TYPE_EVENT, 5070);
+ _updateTimer = 2.5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5070);
break;
case 5070:
me->CastSpell(me, 68198, false);
- m_uiUpdateTimer = 1500;
- instance->SetData(TYPE_EVENT, 5080);
+ _updateTimer = 1.5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5080);
break;
case 5080:
- if (GameObject* go = instance->instance->GetGameObject(instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
- go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
- me->CastSpell(me, 69016, false);
- if (instance)
+ if (GameObject* go = _instance->instance->GetGameObject(_instance->GetData64(GO_ARGENT_COLISEUM_FLOOR)))
+ {
+ go->SetDisplayId(DISPLAYID_DESTROYED_FLOOR);
+ go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN);
+ go->SetGoState(GO_STATE_ACTIVE);
+ }
+
+ me->CastSpell(me, SPELL_CORPSE_TELEPORT, false);
+ me->CastSpell(me, SPELL_DESTROY_FLOOR_KNOCKUP, false);
+
+ if (_instance)
{
- instance->SetData(TYPE_LICH_KING, DONE);
- Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_ANUBARAK));
+ _instance->SetBossState(BOSS_LICH_KING, DONE);
+ Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_ANUBARAK));
if (!temp || !temp->isAlive())
temp = me->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
- instance->SetData(TYPE_EVENT, 0);
+ _instance->SetData(TYPE_EVENT, 0);
}
me->DespawnOrUnsummon();
- m_uiUpdateTimer = 20000;
+ _updateTimer = 20*IN_MILLISECONDS;
+ break;
+ default:
break;
}
- } else m_uiUpdateTimer -= uiDiff;
- instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer);
+ }
+ else
+ _updateTimer -= uiDiff;
+
+ _instance->SetData(TYPE_EVENT_TIMER, _updateTimer);
}
+
+ private:
+ InstanceScript* _instance;
+ uint32 _updateTimer;
};
CreatureAI* GetAI(Creature* creature) const
@@ -351,27 +361,20 @@ class boss_lich_king_toc : public CreatureScript
class npc_fizzlebang_toc : public CreatureScript
{
public:
-
npc_fizzlebang_toc() : CreatureScript("npc_fizzlebang_toc") { }
struct npc_fizzlebang_tocAI : public ScriptedAI
{
- npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), Summons(me)
+ npc_fizzlebang_tocAI(Creature* creature) : ScriptedAI(creature), _summons(me)
{
- instance = me->GetInstanceScript();
+ _instance = me->GetInstanceScript();
}
- InstanceScript* instance;
- SummonList Summons;
- uint32 m_uiUpdateTimer;
- uint64 m_uiPortalGUID;
- uint64 m_uiTriggerGUID;
-
void JustDied(Unit* killer)
{
- DoScriptText(SAY_STAGE_1_06, me, killer);
- instance->SetData(TYPE_EVENT, 1180);
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
+ Talk(SAY_STAGE_1_06, killer->GetGUID());
+ _instance->SetData(TYPE_EVENT, 1180);
+ if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
{
temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
temp->SetReactState(REACT_AGGRESSIVE);
@@ -382,7 +385,7 @@ class npc_fizzlebang_toc : public CreatureScript
void Reset()
{
me->SetWalk(true);
- m_uiPortalGUID = 0;
+ _portalGUID = 0;
me->GetMotionMaster()->MovePoint(1, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY()-60, ToCCommonLoc[10].GetPositionZ());
}
@@ -395,61 +398,63 @@ class npc_fizzlebang_toc : public CreatureScript
{
case 1:
me->SetWalk(false);
- if (instance)
+ if (_instance)
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- instance->SetData(TYPE_EVENT, 1120);
- instance->SetData(TYPE_EVENT_TIMER, 1000);
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->SetData(TYPE_EVENT, 1120);
+ _instance->SetData(TYPE_EVENT_TIMER, 1*IN_MILLISECONDS);
}
break;
+ default:
+ break;
}
}
void JustSummoned(Creature* summoned)
{
- Summons.Summon(summoned);
+ _summons.Summon(summoned);
}
void UpdateAI(const uint32 uiDiff)
{
- if (!instance)
+ if (!_instance)
return;
- if (instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG)
+ if (_instance->GetData(TYPE_EVENT_NPC) != NPC_FIZZLEBANG)
return;
- m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
- if (m_uiUpdateTimer <= uiDiff)
+ _updateTimer = _instance->GetData(TYPE_EVENT_TIMER);
+ if (_updateTimer <= uiDiff)
{
- switch (instance->GetData(TYPE_EVENT))
+ switch (_instance->GetData(TYPE_EVENT))
{
case 1110:
- instance->SetData(TYPE_EVENT, 1120);
- m_uiUpdateTimer = 4000;
+ _instance->SetData(TYPE_EVENT, 1120);
+ _updateTimer = 4*IN_MILLISECONDS;
break;
case 1120:
- DoScriptText(SAY_STAGE_1_02, me);
- instance->SetData(TYPE_EVENT, 1130);
- m_uiUpdateTimer = 12000;
+ Talk(SAY_STAGE_1_02);
+ _instance->SetData(TYPE_EVENT, 1130);
+ _updateTimer = 12*IN_MILLISECONDS;
break;
case 1130:
me->GetMotionMaster()->MovementExpired();
- DoScriptText(SAY_STAGE_1_03, me);
+ Talk(SAY_STAGE_1_03);
me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI);
if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN))
{
- m_uiTriggerGUID = pTrigger->GetGUID();
+ _triggerGUID = pTrigger->GetGUID();
pTrigger->SetObjectScale(2.0f);
- pTrigger->SetDisplayId(22862);
+ pTrigger->SetDisplayId(pTrigger->ToCreature()->GetCreatureTemplate()->Modelid1);
pTrigger->CastSpell(pTrigger, SPELL_WILFRED_PORTAL, false);
}
- instance->SetData(TYPE_EVENT, 1132);
- m_uiUpdateTimer = 4000;
+ _instance->SetData(TYPE_EVENT, 1132);
+ _updateTimer = 4*IN_MILLISECONDS;
break;
case 1132:
me->GetMotionMaster()->MovementExpired();
- instance->SetData(TYPE_EVENT, 1134);
- m_uiUpdateTimer = 4000;
+ _instance->SetData(TYPE_EVENT, 1134);
+ _updateTimer = 4*IN_MILLISECONDS;
break;
case 1134:
me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI);
@@ -458,44 +463,44 @@ class npc_fizzlebang_toc : public CreatureScript
pPortal->SetReactState(REACT_PASSIVE);
pPortal->SetObjectScale(2.0f);
pPortal->CastSpell(pPortal, SPELL_WILFRED_PORTAL, false);
- m_uiPortalGUID = pPortal->GetGUID();
+ _portalGUID = pPortal->GetGUID();
}
- m_uiUpdateTimer = 4000;
- instance->SetData(TYPE_EVENT, 1135);
+ _updateTimer = 4*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 1135);
break;
case 1135:
- instance->SetData(TYPE_EVENT, 1140);
- m_uiUpdateTimer = 3000;
+ _instance->SetData(TYPE_EVENT, 1140);
+ _updateTimer = 3*IN_MILLISECONDS;
break;
case 1140:
- DoScriptText(SAY_STAGE_1_04, me);
+ Talk(SAY_STAGE_1_04);
if (Creature* temp = me->SummonCreature(NPC_JARAXXUS, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 5.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME))
{
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
temp->SetReactState(REACT_PASSIVE);
temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()-10, ToCCommonLoc[1].GetPositionZ());
}
- instance->SetData(TYPE_EVENT, 1142);
- m_uiUpdateTimer = 5000;
+ _instance->SetData(TYPE_EVENT, 1142);
+ _updateTimer = 5*IN_MILLISECONDS;
break;
case 1142:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
temp->SetTarget(me->GetGUID());
- if (Creature* pTrigger = Unit::GetCreature(*me, m_uiTriggerGUID))
+ if (Creature* pTrigger = Unit::GetCreature(*me, _triggerGUID))
pTrigger->DespawnOrUnsummon();
- if (Creature* pPortal = Unit::GetCreature(*me, m_uiPortalGUID))
+ if (Creature* pPortal = Unit::GetCreature(*me, _portalGUID))
pPortal->DespawnOrUnsummon();
- instance->SetData(TYPE_EVENT, 1144);
- m_uiUpdateTimer = 10000;
+ _instance->SetData(TYPE_EVENT, 1144);
+ _updateTimer = 10*IN_MILLISECONDS;
break;
case 1144:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
- DoScriptText(SAY_STAGE_1_05, temp);
- instance->SetData(TYPE_EVENT, 1150);
- m_uiUpdateTimer = 5000;
+ if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
+ temp->AI()->Talk(SAY_STAGE_1_05);
+ _instance->SetData(TYPE_EVENT, 1150);
+ _updateTimer = 5*IN_MILLISECONDS;
break;
case 1150:
- if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(NPC_JARAXXUS)))
+ if (Creature* temp = Unit::GetCreature(*me, _instance->GetData64(NPC_JARAXXUS)))
{
//1-shot Fizzlebang
temp->CastSpell(me, 67888, false);
@@ -503,13 +508,22 @@ class npc_fizzlebang_toc : public CreatureScript
temp->AddThreat(me, 1000.0f);
temp->AI()->AttackStart(me);
}
- instance->SetData(TYPE_EVENT, 1160);
- m_uiUpdateTimer = 3000;
+ _instance->SetData(TYPE_EVENT, 1160);
+ _updateTimer = 3*IN_MILLISECONDS;
break;
}
- } else m_uiUpdateTimer -= uiDiff;
- instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer);
+ }
+ else
+ _updateTimer -= uiDiff;
+ _instance->SetData(TYPE_EVENT_TIMER, _updateTimer);
}
+
+ private:
+ InstanceScript* _instance;
+ SummonList _summons;
+ uint32 _updateTimer;
+ uint64 _portalGUID;
+ uint64 _triggerGUID;
};
CreatureAI* GetAI(Creature* creature) const
@@ -521,53 +535,49 @@ class npc_fizzlebang_toc : public CreatureScript
class npc_tirion_toc : public CreatureScript
{
public:
-
npc_tirion_toc() : CreatureScript("npc_tirion_toc") { }
struct npc_tirion_tocAI : public ScriptedAI
{
npc_tirion_tocAI(Creature* creature) : ScriptedAI(creature)
{
- instance = me->GetInstanceScript();
+ _instance = me->GetInstanceScript();
}
- InstanceScript* instance;
- uint32 m_uiUpdateTimer;
-
void Reset() {}
void AttackStart(Unit* /*who*/) {}
void UpdateAI(const uint32 uiDiff)
{
- if (!instance)
+ if (!_instance)
return;
- if (instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION)
+ if (_instance->GetData(TYPE_EVENT_NPC) != NPC_TIRION)
return;
- m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
- if (m_uiUpdateTimer <= uiDiff)
+ _updateTimer = _instance->GetData(TYPE_EVENT_TIMER);
+ if (_updateTimer <= uiDiff)
{
- switch (instance->GetData(TYPE_EVENT))
+ switch (_instance->GetData(TYPE_EVENT))
{
case 110:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_01, me);
- m_uiUpdateTimer = 22000;
- instance->SetData(TYPE_EVENT, 120);
+ Talk(SAY_STAGE_0_01);
+ _updateTimer = 22*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 120);
break;
case 140:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_02, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 150);
+ Talk(SAY_STAGE_0_02);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 150);
break;
case 150:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
- if (instance->GetData(TYPE_BEASTS) != DONE)
+ if (_instance->GetBossState(BOSS_BEASTS) != DONE)
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS))
{
@@ -576,157 +586,136 @@ class npc_tirion_toc : public CreatureScript
temp->SetReactState(REACT_PASSIVE);
}
}
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 155);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 155);
break;
case 155:
- instance->SetData(TYPE_BEASTS, IN_PROGRESS);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 160);
+ // keep the raid in combat for the whole encounter, pauses included
+ me->SetInCombatWithZone();
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 160);
break;
case 200:
- DoScriptText(SAY_STAGE_0_04, me);
- m_uiUpdateTimer = 8000;
- instance->SetData(TYPE_EVENT, 205);
- break;
- case 205:
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 210);
- break;
- case 210:
- if (instance->GetData(TYPE_BEASTS) != DONE)
+ Talk(SAY_STAGE_0_04);
+ if (_instance->GetBossState(BOSS_BEASTS) != DONE)
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN))
{
- temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ());
- temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
- temp->SetReactState(REACT_PASSIVE);
- }
- if (Creature* temp = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN))
- {
- temp->SetVisible(true);
+ temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ());
temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
temp->SetReactState(REACT_PASSIVE);
}
}
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 220);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 220);
break;
case 220:
- instance->SetData(TYPE_EVENT, 230);
+ _instance->SetData(TYPE_EVENT, 230);
break;
case 300:
- DoScriptText(SAY_STAGE_0_05, me);
- m_uiUpdateTimer = 8000;
- instance->SetData(TYPE_EVENT, 305);
- break;
- case 305:
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 310);
- break;
- case 310:
- if (instance->GetData(TYPE_BEASTS) != DONE)
+ Talk(SAY_STAGE_0_05);
+ if (_instance->GetBossState(BOSS_BEASTS) != DONE)
{
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN))
{
temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ());
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
-
}
}
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 315);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 315);
break;
case 315:
- instance->SetData(TYPE_EVENT, 320);
+ _instance->SetData(TYPE_EVENT, 320);
break;
case 400:
- DoScriptText(SAY_STAGE_0_06, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 0);
+ Talk(SAY_STAGE_0_06);
+ me->getThreatManager().clearReferences();
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 666:
- DoScriptText(SAY_STAGE_0_WIPE, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 0);
+ Talk(SAY_STAGE_0_WIPE);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 1010:
- DoScriptText(SAY_STAGE_1_01, me);
- m_uiUpdateTimer = 7000;
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
+ Talk(SAY_STAGE_1_01);
+ _updateTimer = 7*IN_MILLISECONDS;
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME);
- instance->SetData(TYPE_EVENT, 0);
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 1180:
- DoScriptText(SAY_STAGE_1_07, me);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 0);
+ Talk(SAY_STAGE_1_07);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 2000:
- DoScriptText(SAY_STAGE_1_08, me);
- m_uiUpdateTimer = 18000;
- instance->SetData(TYPE_EVENT, 2010);
+ Talk(SAY_STAGE_1_08);
+ _updateTimer = 18*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 2010);
break;
case 2030:
- DoScriptText(SAY_STAGE_1_11, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 0);
+ Talk(SAY_STAGE_1_11);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 3000:
- DoScriptText(SAY_STAGE_2_01, me);
- m_uiUpdateTimer = 12000;
- instance->SetData(TYPE_EVENT, 3050);
+ Talk(SAY_STAGE_2_01);
+ _updateTimer = 12*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3050);
break;
case 3001:
- DoScriptText(SAY_STAGE_2_01, me);
- m_uiUpdateTimer = 12000;
- instance->SetData(TYPE_EVENT, 3051);
+ Talk(SAY_STAGE_2_01);
+ _updateTimer = 10*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3051);
break;
case 3060:
- DoScriptText(SAY_STAGE_2_03, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 3070);
+ Talk(SAY_STAGE_2_03);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3070);
break;
case 3061:
- DoScriptText(SAY_STAGE_2_03, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 3071);
+ Talk(SAY_STAGE_2_03);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3071);
break;
//Summoning crusaders
case 3091:
if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1]))
pChampionController->AI()->SetData(0, HORDE);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 3092);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3092);
break;
//Summoning crusaders
case 3090:
if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1]))
pChampionController->AI()->SetData(0, ALLIANCE);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 3092);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3092);
break;
case 3092:
- if (Creature* pChampionController = Unit::GetCreature((*me), instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
+ if (Creature* pChampionController = Unit::GetCreature((*me), _instance->GetData64(NPC_CHAMPIONS_CONTROLLER)))
pChampionController->AI()->SetData(1, NOT_STARTED);
- instance->SetData(TYPE_EVENT, 3095);
+ _instance->SetData(TYPE_EVENT, 3095);
break;
//Crusaders battle end
case 3100:
- DoScriptText(SAY_STAGE_2_06, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 0);
+ Talk(SAY_STAGE_2_06);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 4000:
- DoScriptText(SAY_STAGE_3_01, me);
- m_uiUpdateTimer = 13000;
- instance->SetData(TYPE_EVENT, 4010);
+ Talk(SAY_STAGE_3_01);
+ _updateTimer = 13*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 4010);
break;
case 4010:
- DoScriptText(SAY_STAGE_3_02, me);
+ Talk(SAY_STAGE_3_02);
if (Creature* temp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME))
{
temp->SetVisible(false);
@@ -741,74 +730,88 @@ class npc_tirion_toc : public CreatureScript
temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[2].GetPositionX(), TwinValkyrsLoc[2].GetPositionY(), TwinValkyrsLoc[2].GetPositionZ());
temp->SummonCreature(NPC_DARK_ESSENCE, TwinValkyrsLoc[3].GetPositionX(), TwinValkyrsLoc[3].GetPositionY(), TwinValkyrsLoc[3].GetPositionZ());
}
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 4015);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 4015);
break;
case 4015:
- instance->DoUseDoorOrButton(instance->GetData64(GO_MAIN_GATE_DOOR));
- if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(NPC_LIGHTBANE)))
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_LIGHTBANE)))
{
temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ());
temp->SetVisible(true);
}
- if (Creature* temp = Unit::GetCreature((*me), instance->GetData64(NPC_DARKBANE)))
+ if (Creature* temp = Unit::GetCreature((*me), _instance->GetData64(NPC_DARKBANE)))
{
temp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ());
temp->SetVisible(true);
}
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 4016);
+ _updateTimer = 10*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 4016);
break;
case 4016:
- instance->SetData(TYPE_EVENT, 4017);
+ _instance->DoUseDoorOrButton(_instance->GetData64(GO_MAIN_GATE_DOOR));
+ _instance->SetData(TYPE_EVENT, 4017);
break;
case 4040:
- m_uiUpdateTimer = 60000;
- instance->SetData(TYPE_EVENT, 5000);
+ _updateTimer = 1*MINUTE*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5000);
break;
case 5000:
- DoScriptText(SAY_STAGE_4_01, me);
- m_uiUpdateTimer = 10000;
- instance->SetData(TYPE_EVENT, 5005);
+ Talk(SAY_STAGE_4_01);
+ _updateTimer = 10*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5005);
break;
case 5005:
- m_uiUpdateTimer = 8000;
- instance->SetData(TYPE_EVENT, 5010);
- me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5);
+ _updateTimer = 8*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 5010);
+ me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5);
break;
case 5020:
- DoScriptText(SAY_STAGE_4_03, me);
- m_uiUpdateTimer = 1000;
- instance->SetData(TYPE_EVENT, 0);
+ Talk(SAY_STAGE_4_03);
+ _updateTimer = 1*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 0);
break;
case 6000:
- me->NearTeleportTo(AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 4.0f);
- m_uiUpdateTimer = 20000;
- instance->SetData(TYPE_EVENT, 6005);
+ me->SummonCreature(NPC_TIRION_FORDRING, EndSpawnLoc[0].GetPositionX(), EndSpawnLoc[0].GetPositionY(), EndSpawnLoc[0].GetPositionZ());
+ me->SummonCreature(NPC_ARGENT_MAGE, EndSpawnLoc[1].GetPositionX(), EndSpawnLoc[1].GetPositionY(), EndSpawnLoc[1].GetPositionZ());
+ me->SummonGameObject(GO_PORTAL_TO_DALARAN, EndSpawnLoc[2].GetPositionX(), EndSpawnLoc[2].GetPositionY(), EndSpawnLoc[2].GetPositionZ(), 5, 0, 0, 0, 0, 0);
+ _updateTimer = 20*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 6005);
break;
case 6005:
- DoScriptText(SAY_STAGE_4_06, me);
- m_uiUpdateTimer = 20000;
- instance->SetData(TYPE_EVENT, 6010);
+ if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
+ tirionFordring->AI()->Talk(SAY_STAGE_4_06);
+ _updateTimer = 20*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 6010);
break;
case 6010:
if (IsHeroic())
{
- DoScriptText(SAY_STAGE_4_07, me);
- m_uiUpdateTimer = 60000;
- instance->SetData(TYPE_ANUBARAK, SPECIAL);
- instance->SetData(TYPE_EVENT, 6020);
- } else instance->SetData(TYPE_EVENT, 6030);
+ if (Creature* tirionFordring = Unit::GetCreature((*me), _instance->GetData64(NPC_TIRION_FORDRING)))
+ tirionFordring->AI()->Talk(SAY_STAGE_4_07);
+ _updateTimer = 1*MINUTE*IN_MILLISECONDS;
+ _instance->SetBossState(BOSS_ANUBARAK, SPECIAL);
+ _instance->SetData(TYPE_EVENT, 6020);
+ }
+ else
+ _instance->SetData(TYPE_EVENT, 6030);
break;
case 6020:
me->DespawnOrUnsummon();
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 6030);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 6030);
+ break;
+ default:
break;
}
- } else m_uiUpdateTimer -= uiDiff;
- instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer);
+ }
+ else
+ _updateTimer -= uiDiff;
+ _instance->SetData(TYPE_EVENT_TIMER, _updateTimer);
}
+ private:
+ InstanceScript* _instance;
+ uint32 _updateTimer;
};
CreatureAI* GetAI(Creature* creature) const
@@ -820,76 +823,79 @@ class npc_tirion_toc : public CreatureScript
class npc_garrosh_toc : public CreatureScript
{
public:
-
npc_garrosh_toc() : CreatureScript("npc_garrosh_toc") { }
struct npc_garrosh_tocAI : public ScriptedAI
{
npc_garrosh_tocAI(Creature* creature) : ScriptedAI(creature)
{
- instance = me->GetInstanceScript();
+ _instance = me->GetInstanceScript();
}
- InstanceScript* instance;
- uint32 m_uiUpdateTimer;
-
void Reset() {}
void AttackStart(Unit* /*who*/) {}
void UpdateAI(const uint32 uiDiff)
{
- if (!instance)
+ if (!_instance)
return;
- if (instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH)
+ if (_instance->GetData(TYPE_EVENT_NPC) != NPC_GARROSH)
return;
- m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
- if (m_uiUpdateTimer <= uiDiff)
+ _updateTimer = _instance->GetData(TYPE_EVENT_TIMER);
+ if (_updateTimer <= uiDiff)
{
- switch (instance->GetData(TYPE_EVENT))
+ switch (_instance->GetData(TYPE_EVENT))
{
case 130:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_03h, me);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 132);
+ Talk(SAY_STAGE_0_03h);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 132);
break;
case 132:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 140);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 140);
break;
case 2010:
- DoScriptText(SAY_STAGE_1_09, me);
- m_uiUpdateTimer = 9000;
- instance->SetData(TYPE_EVENT, 2020);
+ Talk(SAY_STAGE_1_09);
+ _updateTimer = 9*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 2020);
break;
case 3050:
- DoScriptText(SAY_STAGE_2_02h, me);
- m_uiUpdateTimer = 15000;
- instance->SetData(TYPE_EVENT, 3060);
+ Talk(SAY_STAGE_2_02h);
+ _updateTimer = 15*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3060);
break;
case 3070:
- DoScriptText(SAY_STAGE_2_04h, me);
- m_uiUpdateTimer = 6000;
- instance->SetData(TYPE_EVENT, 3080);
+ Talk(SAY_STAGE_2_04h);
+ _updateTimer = 6*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3080);
break;
case 3081:
- DoScriptText(SAY_STAGE_2_05h, me);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 3091);
+ Talk(SAY_STAGE_2_05h);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3091);
break;
case 4030:
- DoScriptText(SAY_STAGE_3_03h, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 4040);
+ Talk(SAY_STAGE_3_03h);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 4040);
+ break;
+ default:
break;
}
- } else m_uiUpdateTimer -= uiDiff;
- instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer);
+ }
+ else
+ _updateTimer -= uiDiff;
+ _instance->SetData(TYPE_EVENT_TIMER, _updateTimer);
}
+ private:
+ InstanceScript* _instance;
+ uint32 _updateTimer;
};
CreatureAI* GetAI(Creature* creature) const
@@ -901,76 +907,79 @@ class npc_garrosh_toc : public CreatureScript
class npc_varian_toc : public CreatureScript
{
public:
-
npc_varian_toc() : CreatureScript("npc_varian_toc") { }
struct npc_varian_tocAI : public ScriptedAI
{
npc_varian_tocAI(Creature* creature) : ScriptedAI(creature)
{
- instance = me->GetInstanceScript();
+ _instance = me->GetInstanceScript();
}
- InstanceScript* instance;
- uint32 m_uiUpdateTimer;
-
void Reset() {}
void AttackStart(Unit* /*who*/) {}
void UpdateAI(const uint32 uiDiff)
{
- if (!instance)
+ if (!_instance)
return;
- if (instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN)
+ if (_instance->GetData(TYPE_EVENT_NPC) != NPC_VARIAN)
return;
- m_uiUpdateTimer = instance->GetData(TYPE_EVENT_TIMER);
- if (m_uiUpdateTimer <= uiDiff)
+ _updateTimer = _instance->GetData(TYPE_EVENT_TIMER);
+ if (_updateTimer <= uiDiff)
{
- switch (instance->GetData(TYPE_EVENT))
+ switch (_instance->GetData(TYPE_EVENT))
{
case 120:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_TALK);
- DoScriptText(SAY_STAGE_0_03a, me);
- m_uiUpdateTimer = 2000;
- instance->SetData(TYPE_EVENT, 122);
+ Talk(SAY_STAGE_0_03a);
+ _updateTimer = 2*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 122);
break;
case 122:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 130);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 130);
break;
case 2020:
- DoScriptText(SAY_STAGE_1_10, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 2030);
+ Talk(SAY_STAGE_1_10);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 2030);
break;
case 3051:
- DoScriptText(SAY_STAGE_2_02a, me);
- m_uiUpdateTimer = 10000;
- instance->SetData(TYPE_EVENT, 3061);
+ Talk(SAY_STAGE_2_02a);
+ _updateTimer = 17*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3061);
break;
case 3071:
- DoScriptText(SAY_STAGE_2_04a, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 3081);
+ Talk(SAY_STAGE_2_04a);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3081);
break;
case 3080:
- DoScriptText(SAY_STAGE_2_05a, me);
- m_uiUpdateTimer = 3000;
- instance->SetData(TYPE_EVENT, 3090);
+ Talk(SAY_STAGE_2_05a);
+ _updateTimer = 3*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 3090);
break;
case 4020:
- DoScriptText(SAY_STAGE_3_03a, me);
- m_uiUpdateTimer = 5000;
- instance->SetData(TYPE_EVENT, 4040);
+ Talk(SAY_STAGE_3_03a);
+ _updateTimer = 5*IN_MILLISECONDS;
+ _instance->SetData(TYPE_EVENT, 4040);
+ break;
+ default:
break;
}
- } else m_uiUpdateTimer -= uiDiff;
- instance->SetData(TYPE_EVENT_TIMER, m_uiUpdateTimer);
+ }
+ else
+ _updateTimer -= uiDiff;
+ _instance->SetData(TYPE_EVENT_TIMER, _updateTimer);
}
+ private:
+ InstanceScript* _instance;
+ uint32 _updateTimer;
};
CreatureAI* GetAI(Creature* creature) const
@@ -981,8 +990,8 @@ class npc_varian_toc : public CreatureScript
void AddSC_trial_of_the_crusader()
{
- new npc_announcer_toc10();
new boss_lich_king_toc();
+ new npc_announcer_toc10();
new npc_fizzlebang_toc();
new npc_tirion_toc();
new npc_garrosh_toc();
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
index 99525b6fb32..70fe03c5e0f 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h
@@ -7,12 +7,12 @@
enum
{
- TYPE_BEASTS = 0,
- TYPE_JARAXXUS = 1,
- TYPE_CRUSADERS = 2,
- TYPE_VALKIRIES = 3,
- TYPE_LICH_KING = 4,
- TYPE_ANUBARAK = 5,
+ BOSS_BEASTS = 0,
+ BOSS_JARAXXUS = 1,
+ BOSS_CRUSADERS = 2,
+ BOSS_VALKIRIES = 3,
+ BOSS_LICH_KING = 4, // not really a boss but oh well
+ BOSS_ANUBARAK = 5,
MAX_ENCOUNTERS = 6,
TYPE_COUNTER = 8,
@@ -24,22 +24,26 @@ enum
DATA_SNOBOLD_COUNT = 301,
DATA_MISTRESS_OF_PAIN_COUNT = 302,
- DATA_TRIBUTE_TO_IMMORTALITY_ELEGIBLE = 303,
+ DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE = 303,
INCREASE = 501,
DECREASE = 502,
SPELL_WILFRED_PORTAL = 68424,
SPELL_JARAXXUS_CHAINS = 67924,
+ SPELL_CORPSE_TELEPORT = 69016,
+ SPELL_DESTROY_FLOOR_KNOCKUP = 68193,
DESPAWN_TIME = 300000,
+
+ DISPLAYID_DESTROYED_FLOOR = 9060
};
const Position ToCSpawnLoc[]=
{
{563.912f, 261.625f, 394.73f, 4.70437f}, // 0 Center
{575.451f, 261.496f, 394.73f, 4.6541f}, // 1 Left
- {549.951f, 261.55f, 394.73f, 4.74835f}, // 2 Right
+ {549.951f, 261.55f, 394.73f, 4.74835f} // 2 Right
};
const Position ToCCommonLoc[]=
@@ -53,8 +57,8 @@ const Position ToCCommonLoc[]=
{563.833008f, 195.244995f, 394.585561f, 0}, // 5 - Center
{573.5f, 180.5f, 395.14f, 0}, // 6 Move 0 Right
{553.5f, 180.5f, 395.14f, 0}, // 7 Move 0 Left
- {585.5f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
- {545.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
+ {573.0f, 170.0f, 395.14f, 0}, // 8 Move 1 Right
+ {555.5f, 170.0f, 395.14f, 0}, // 9 Move 1 Left
{563.8f, 216.1f, 395.1f, 0}, // 10 Behind the door
{575.042358f, 195.260727f, 395.137146f, 0}, // 5
@@ -68,7 +72,7 @@ const Position ToCCommonLoc[]=
{558.811610f, 195.985779f, 394.671661f, 0}, // 13
{567.641724f, 195.351501f, 394.659943f, 0}, // 14
{560.633972f, 195.391708f, 395.137543f, 0}, // 15
- {565.816956f, 195.477921f, 395.136810f, 0}, // 16
+ {565.816956f, 195.477921f, 395.136810f, 0} // 16
};
const Position JaraxxusLoc[]=
@@ -76,7 +80,7 @@ const Position JaraxxusLoc[]=
{508.104767f, 138.247345f, 395.128052f, 0}, // 0 - Fizzlebang start location
{548.610596f, 139.807800f, 394.321838f, 0}, // 1 - fizzlebang end
{581.854187f, 138.0f, 394.319f, 0}, // 2 - Portal Right
- {550.558838f, 138.0f, 394.319f, 0}, // 3 - Portal Left
+ {550.558838f, 138.0f, 394.319f, 0} // 3 - Portal Left
};
const Position FactionChampionLoc[]=
@@ -102,21 +106,21 @@ const Position FactionChampionLoc[]=
{528.958f, 131.47f, 394.73f, 0}, // 16 - Horde Final Pos 6
{526.309f, 116.667f, 394.833f, 0}, // 17 - Horde Final Pos 7
{524.238f, 122.411f, 394.819f, 0}, // 18 - Horde Final Pos 8
- {521.901f, 128.488f, 394.832f, 0}, // 19 - Horde Final Pos 9
+ {521.901f, 128.488f, 394.832f, 0} // 19 - Horde Final Pos 9
};
const Position TwinValkyrsLoc[]=
{
- {586.060242f, 117.514809f, 394.314026f, 0}, // 0 - Dark essence 1
- {541.602112f, 161.879837f, 394.587952f, 0}, // 1 - Dark essence 2
- {541.021118f, 117.262932f, 395.314819f, 0}, // 2 - Light essence 1
- {586.200562f, 162.145523f, 394.626129f, 0}, // 3 - Light essence 2
+ {586.060242f, 117.514809f, 394.41f, 0}, // 0 - Dark essence 1
+ {541.602112f, 161.879837f, 394.41f, 0}, // 1 - Dark essence 2
+ {541.021118f, 117.262932f, 394.41f, 0}, // 2 - Light essence 1
+ {586.200562f, 162.145523f, 394.41f, 0} // 3 - Light essence 2
};
const Position LichKingLoc[]=
{
{563.549f, 152.474f, 394.393f, 0}, // 0 - Lich king start
- {563.547f, 141.613f, 393.908f, 0}, // 1 - Lich king end
+ {563.547f, 141.613f, 393.908f, 0} // 1 - Lich king end
};
const Position AnubarakLoc[]=
@@ -126,13 +130,20 @@ const Position AnubarakLoc[]=
{694.886353f, 102.484665f, 142.119614f, 0}, // 3 - Nerub Spawn
{694.500671f, 185.363968f, 142.117905f, 0}, // 5 - Nerub Spawn
{731.987244f, 83.3824690f, 142.119614f, 0}, // 2 - Nerub Spawn
- {740.184509f, 193.443390f, 142.117584f, 0}, // 4 - Nerub Spawn
+ {740.184509f, 193.443390f, 142.117584f, 0} // 4 - Nerub Spawn
+};
+
+const Position EndSpawnLoc[]=
+{
+ {648.9167f, 131.0208f, 141.6161f, 0}, // 0 - Highlord Tirion Fordring
+ {649.1614f, 142.0399f, 141.3057f ,0}, // 1 - Argent Mage
+ {644.6250f, 149.2743f, 140.6015f ,0} // 2 - Portal to Dalaran
};
enum euiWorldStates
{
UPDATE_STATE_UI_SHOW = 4390,
- UPDATE_STATE_UI_COUNT = 4389,
+ UPDATE_STATE_UI_COUNT = 4389
};
enum eNorthrendBeasts
@@ -145,7 +156,7 @@ enum eNorthrendBeasts
SNAKES_SPECIAL = 2003,
SNAKES_DONE = 2004,
ICEHOWL_IN_PROGRESS = 3000,
- ICEHOWL_DONE = 3001,
+ ICEHOWL_DONE = 3001
};
enum eAnnouncerMessages
@@ -155,13 +166,15 @@ enum eAnnouncerMessages
MSG_CRUSADERS = 724003,
MSG_VALKIRIES = 724004,
MSG_LICH_KING = 724005,
- MSG_ANUBARAK = 724006,
+ MSG_ANUBARAK = 724006
};
enum eCreature
{
NPC_BARRENT = 34816,
NPC_TIRION = 34996,
+ NPC_TIRION_FORDRING = 36095,
+ NPC_ARGENT_MAGE = 36097,
NPC_FIZZLEBANG = 35458,
NPC_GARROSH = 34995,
NPC_VARIAN = 34990,
@@ -218,7 +231,7 @@ enum eCreature
NPC_DARK_ESSENCE = 34567,
NPC_LIGHT_ESSENCE = 34568,
- NPC_ANUBARAK = 34564,
+ NPC_ANUBARAK = 34564
};
enum eGameObject
@@ -244,6 +257,7 @@ enum eGameObject
GO_MAIN_GATE_DOOR = 195647,
GO_EAST_PORTCULLIS = 195648,
GO_WEB_DOOR = 195485,
+ GO_PORTAL_TO_DALARAN = 195682
};
enum eAchievementData
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
index 95acc79231d..759f8df7153 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp
@@ -19,7 +19,8 @@
* Comment: MAYBE need more improve the "Raptor Call".
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
@@ -153,7 +154,7 @@ class boss_dred : public CreatureScript
++raptorsKilled;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_KING_DRED)
return raptorsKilled;
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
index 9ff8ee9c9ed..1ad776a0b46 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
enum Spells
@@ -35,12 +36,11 @@ enum Spells
//not in db
enum Yells
{
- SAY_AGGRO = -1600000,
- SAY_KILL = -1600001,
- SAY_DEATH = -1600002,
- SAY_NECRO_ADD = -1600003,
- SAY_REUBBLE_1 = -1600004,
- SAY_REUBBLE_2 = -1600005
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_DEATH = 2,
+ SAY_NECRO_ADD = 3,
+ SAY_REUBBLE = 4
};
enum Creatures
@@ -122,7 +122,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
Phase = PHASE_1;
uiCrystalHandlerTimer = 30*IN_MILLISECONDS;
uiTimer = 1*IN_MILLISECONDS;
@@ -158,7 +158,7 @@ public:
{
if (uiCrystalHandlerTimer <= diff)
{
- DoScriptText(SAY_NECRO_ADD, me);
+ Talk(SAY_NECRO_ADD);
Creature* pCrystalHandler = me->SummonCreature(CREATURE_CRYSTAL_HANDLER, CrystalHandlerSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20*IN_MILLISECONDS);
pCrystalHandler->GetMotionMaster()->MovePoint(0, AddDestinyPoint);
uiCrystalHandlerTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS);
@@ -180,7 +180,7 @@ public:
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_NOVOS_EVENT, DONE);
lSummons.DespawnAll();
@@ -190,7 +190,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void JustSummoned(Creature* summon)
@@ -207,7 +207,7 @@ public:
ohNovos = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_OH_NOVOS)
return ohNovos ? 1 : 0;
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
index b1d588a0d0d..4cbabe2449a 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "drak_tharon_keep.h"
+#include "Player.h"
enum Spells
{
@@ -42,14 +44,11 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1600011,
- SAY_KILL_1 = -1600012,
- SAY_KILL_2 = -1600013,
- SAY_FLESH_1 = -1600014,
- SAY_FLESH_2 = -1600015,
- SAY_SKELETON_1 = -1600016,
- SAY_SKELETON_2 = -1600017,
- SAY_DEATH = -1600018
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_FLESH = 2,
+ SAY_SKELETON = 3,
+ SAY_DEATH = 4
};
enum Models
{
@@ -102,7 +101,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_THARON_JA_EVENT, IN_PROGRESS);
@@ -148,7 +147,7 @@ public:
case GOING_FLESH:
if (uiPhaseTimer < diff)
{
- DoScriptText(RAND(SAY_FLESH_1, SAY_FLESH_2), me);
+ Talk(SAY_FLESH);
me->SetDisplayId(MODEL_FLESH);
std::list<Unit*> playerList;
@@ -198,7 +197,7 @@ public:
case GOING_SKELETAL:
if (uiPhaseTimer < diff)
{
- DoScriptText(RAND(SAY_SKELETON_1, SAY_SKELETON_2), me);
+ Talk(SAY_SKELETON);
me->DeMorph();
Phase = SKELETAL;
uiPhaseTimer = 20*IN_MILLISECONDS;
@@ -222,12 +221,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index 26e4e9db99e..60001e048a3 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -19,7 +19,9 @@
* Comment: TODO: spawn troll waves
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "drak_tharon_keep.h"
enum Spells
@@ -37,11 +39,11 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1600006,
- SAY_KILL = -1600007,
- SAY_CONSUME = -1600008,
- SAY_EXPLODE = -1600009,
- SAY_DEATH = -1600010
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_CONSUME = 2,
+ SAY_EXPLODE = 3,
+ SAY_DEATH = 4
};
enum Creatures
@@ -84,7 +86,7 @@ public:
uiConsumeTimer = 15*IN_MILLISECONDS;
uiAuraCountTimer = 15500;
uiCrushTimer = urand(1*IN_MILLISECONDS, 5*IN_MILLISECONDS);
- uiInfectedWoundTimer = urand(60*IN_MILLISECONDS, 10*IN_MILLISECONDS);
+ uiInfectedWoundTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
uiExplodeCorpseTimer = 3*IN_MILLISECONDS;
uiSpawnTimer = urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS);
@@ -100,7 +102,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_TROLLGORE_EVENT, IN_PROGRESS);
@@ -122,7 +124,7 @@ public:
if (uiConsumeTimer <= diff)
{
- DoScriptText(SAY_CONSUME, me);
+ Talk(SAY_CONSUME);
DoCast(SPELL_CONSUME);
uiConsumeTimer = 15*IN_MILLISECONDS;
} else uiConsumeTimer -= diff;
@@ -149,7 +151,7 @@ public:
if (uiExplodeCorpseTimer <= diff)
{
DoCast(SPELL_CORPSE_EXPLODE);
- DoScriptText(SAY_EXPLODE, me);
+ Talk(SAY_EXPLODE);
uiExplodeCorpseTimer = urand(15*IN_MILLISECONDS, 19*IN_MILLISECONDS);
} else uiExplodeCorpseTimer -= diff;
@@ -158,7 +160,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
lSummons.DespawnAll();
@@ -166,7 +168,7 @@ public:
instance->SetData(DATA_TROLLGORE_EVENT, DONE);
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_CONSUMPTION_JUNCTION)
return consumptionJunction ? 1 : 0;
@@ -178,7 +180,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void JustSummoned(Creature* summon)
diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
index aff3f1b8e36..552798e96eb 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "drak_tharon_keep.h"
#define MAX_ENCOUNTER 4
@@ -69,6 +70,7 @@ public:
void Initialize()
{
+ memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
uiTrollgore = 0;
uiNovos = 0;
uiDred = 0;
@@ -127,7 +129,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -172,7 +174,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -189,16 +191,12 @@ public:
{
OUT_SAVE_INST_DATA;
- std::string str_data;
-
std::ostringstream saveStream;
saveStream << "D K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' '
<< m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- str_data = saveStream.str();
-
OUT_SAVE_INST_DATA_COMPLETE;
- return str_data;
+ return saveStream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
index 5b6bf14c29e..1940ff4e2af 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -15,18 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "forge_of_souls.h"
enum Yells
{
- SAY_AGGRO = -1632001,
- SAY_SLAY_1 = -1632002,
- SAY_SLAY_2 = -1632003,
- SAY_DEATH = -1632004,
- SAY_SOUL_STORM = -1632005,
- SAY_CORRUPT_SOUL = -1632006,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SOUL_STORM = 3,
+ SAY_CORRUPT_SOUL = 4,
};
enum Spells
@@ -96,7 +97,7 @@ class boss_bronjahm : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->RemoveAurasDueToSpell(SPELL_SOULSTORM_CHANNEL);
instance->SetBossState(DATA_BRONJAHM, IN_PROGRESS);
@@ -104,7 +105,7 @@ class boss_bronjahm : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
instance->SetBossState(DATA_BRONJAHM, DONE);
}
@@ -112,7 +113,7 @@ class boss_bronjahm : public CreatureScript
void KilledUnit(Unit* who)
{
if (who->GetTypeId() == TYPEID_PLAYER)
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
@@ -161,13 +162,13 @@ class boss_bronjahm : public CreatureScript
case EVENT_CORRUPT_SOUL:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
{
- DoScriptText(SAY_CORRUPT_SOUL, me);
+ Talk(SAY_CORRUPT_SOUL);
DoCast(target, SPELL_CORRUPT_SOUL);
}
events.ScheduleEvent(EVENT_CORRUPT_SOUL, urand(25000, 35000), 0, PHASE_1);
break;
case EVENT_SOULSTORM:
- DoScriptText(SAY_SOUL_STORM, me);
+ Talk(SAY_SOUL_STORM);
me->CastSpell(me, SPELL_SOULSTORM_VISUAL, true);
me->CastSpell(me, SPELL_SOULSTORM, false);
break;
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 ad49f6cbce8..248fe3c6eb0 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
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "forge_of_souls.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*
* TODO:
@@ -26,40 +29,32 @@
enum Yells
{
- SAY_FACE_ANGER_AGGRO = -1632010,
- SAY_FACE_DESIRE_AGGRO = -1632011,
- SAY_FACE_ANGER_SLAY_1 = -1632012,
- SAY_FACE_SORROW_SLAY_1 = -1632013,
- SAY_FACE_DESIRE_SLAY_1 = -1632014,
- SAY_FACE_ANGER_SLAY_2 = -1632015,
- SAY_FACE_SORROW_SLAY_2 = -1632016,
- SAY_FACE_DESIRE_SLAY_2 = -1632017,
- SAY_FACE_SORROW_DEATH = -1632019,
- SAY_FACE_DESIRE_DEATH = -1632020,
- EMOTE_MIRRORED_SOUL = -1632021,
- EMOTE_UNLEASH_SOUL = -1632022,
- SAY_FACE_ANGER_UNLEASH_SOUL = -1632023,
- SAY_FACE_SORROW_UNLEASH_SOUL = -1632024,
- SAY_FACE_DESIRE_UNLEASH_SOUL = -1632025,
- EMOTE_WAILING_SOUL = -1632026,
- SAY_FACE_ANGER_WAILING_SOUL = -1632027,
- SAY_FACE_DESIRE_WAILING_SOUL = -1632028,
-
- SAY_JAINA_OUTRO = -1632029,
- SAY_SYLVANAS_OUTRO = -1632030,
+ SAY_FACE_AGGRO = 0,
+ SAY_FACE_ANGER_SLAY = 1,
+ SAY_FACE_SORROW_SLAY = 2,
+ SAY_FACE_DESIRE_SLAY = 3,
+ SAY_FACE_DEATH = 4,
+ EMOTE_MIRRORED_SOUL = 5,
+ EMOTE_UNLEASH_SOUL = 6,
+ SAY_FACE_UNLEASH_SOUL = 7,
+ EMOTE_WAILING_SOUL = 8,
+ SAY_FACE_WAILING_SOUL = 9,
+
+ SAY_JAINA_OUTRO = 0,
+ SAY_SYLVANAS_OUTRO = 0
};
enum Spells
{
- SPELL_PHANTOM_BLAST = 68982,
- H_SPELL_PHANTOM_BLAST = 70322,
- SPELL_MIRRORED_SOUL = 69051,
- SPELL_WELL_OF_SOULS = 68820,
- SPELL_UNLEASHED_SOULS = 68939,
- SPELL_WAILING_SOULS_STARTING = 68912, // Initial spell cast at begining of wailing souls phase
- SPELL_WAILING_SOULS_BEAM = 68875, // the beam visual
- SPELL_WAILING_SOULS = 68873, // the actual spell
- H_SPELL_WAILING_SOULS = 70324,
+ SPELL_PHANTOM_BLAST = 68982,
+ H_SPELL_PHANTOM_BLAST = 70322,
+ SPELL_MIRRORED_SOUL = 69051,
+ SPELL_WELL_OF_SOULS = 68820,
+ SPELL_UNLEASHED_SOULS = 68939,
+ SPELL_WAILING_SOULS_STARTING = 68912, // Initial spell cast at begining of wailing souls phase
+ SPELL_WAILING_SOULS_BEAM = 68875, // the beam visual
+ SPELL_WAILING_SOULS = 68873, // the actual spell
+ H_SPELL_WAILING_SOULS = 70324,
// 68871, 68873, 68875, 68876, 68899, 68912, 70324,
// 68899 trigger 68871
};
@@ -154,7 +149,7 @@ class boss_devourer_of_souls : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_FACE_ANGER_AGGRO, SAY_FACE_DESIRE_AGGRO), me);
+ Talk(SAY_FACE_AGGRO);
if (!me->FindNearestCreature(NPC_CRUCIBLE_OF_SOULS, 60)) // Prevent double spawn
instance->instance->SummonCreature(NPC_CRUCIBLE_OF_SOULS, CrucibleSummonPos);
@@ -193,20 +188,20 @@ class boss_devourer_of_souls : public CreatureScript
switch (me->GetDisplayId())
{
case DISPLAY_ANGER:
- textId = RAND(SAY_FACE_ANGER_SLAY_1, SAY_FACE_ANGER_SLAY_2);
+ textId = SAY_FACE_ANGER_SLAY;
break;
case DISPLAY_SORROW:
- textId = RAND(SAY_FACE_SORROW_SLAY_1, SAY_FACE_SORROW_SLAY_2);
+ textId = SAY_FACE_SORROW_SLAY;
break;
case DISPLAY_DESIRE:
- textId = RAND(SAY_FACE_DESIRE_SLAY_1, SAY_FACE_DESIRE_SLAY_2);
+ textId = SAY_FACE_DESIRE_SLAY;
break;
default:
break;
}
if (textId)
- DoScriptText(textId, me);
+ Talk(textId);
}
void JustDied(Unit* /*killer*/)
@@ -215,7 +210,7 @@ class boss_devourer_of_souls : public CreatureScript
Position spawnPoint = {5618.139f, 2451.873f, 705.854f, 0};
- DoScriptText(RAND(SAY_FACE_SORROW_DEATH, SAY_FACE_DESIRE_DEATH), me);
+ Talk(SAY_FACE_DEATH);
instance->SetData(DATA_DEVOURER_EVENT, DONE);
@@ -231,9 +226,9 @@ class boss_devourer_of_souls : public CreatureScript
{
summon->GetMotionMaster()->MovePoint(0, outroPositions[i].movePosition);
if (summon->GetEntry() == NPC_JAINA_PART2)
- DoScriptText(SAY_JAINA_OUTRO, summon);
+ summon->AI()->Talk(SAY_JAINA_OUTRO);
else if (summon->GetEntry() == NPC_SYLVANAS_PART2)
- DoScriptText(SAY_SYLVANAS_OUTRO, summon);
+ summon->AI()->Talk(SAY_SYLVANAS_OUTRO);
}
}
}
@@ -244,7 +239,7 @@ class boss_devourer_of_souls : public CreatureScript
threeFaced = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_THREE_FACED)
return threeFaced;
@@ -276,7 +271,7 @@ class boss_devourer_of_souls : public CreatureScript
{
mirroredSoulTarget = target->GetGUID();
DoCast(target, SPELL_MIRRORED_SOUL);
- DoScriptText(EMOTE_MIRRORED_SOUL, me);
+ Talk(EMOTE_MIRRORED_SOUL);
}
events.ScheduleEvent(EVENT_MIRRORED_SOUL, urand(15000, 30000));
break;
@@ -289,8 +284,8 @@ class boss_devourer_of_souls : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_UNLEASHED_SOULS);
me->SetDisplayId(DISPLAY_SORROW);
- DoScriptText(RAND(SAY_FACE_ANGER_UNLEASH_SOUL, SAY_FACE_SORROW_UNLEASH_SOUL, SAY_FACE_DESIRE_UNLEASH_SOUL), me);
- DoScriptText(EMOTE_UNLEASH_SOUL, me);
+ Talk(SAY_FACE_UNLEASH_SOUL);
+ Talk(EMOTE_UNLEASH_SOUL);
events.ScheduleEvent(EVENT_UNLEASHED_SOULS, 30000);
events.ScheduleEvent(EVENT_FACE_ANGER, 5000);
break;
@@ -300,8 +295,8 @@ class boss_devourer_of_souls : public CreatureScript
case EVENT_WAILING_SOULS:
me->SetDisplayId(DISPLAY_DESIRE);
- DoScriptText(RAND(SAY_FACE_ANGER_WAILING_SOUL, SAY_FACE_DESIRE_WAILING_SOUL), me);
- DoScriptText(EMOTE_WAILING_SOUL, me);
+ Talk(SAY_FACE_WAILING_SOUL);
+ Talk(EMOTE_WAILING_SOUL);
DoCast(me, SPELL_WAILING_SOULS_STARTING);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
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 1469e26fd20..895efd84580 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "forge_of_souls.h"
+#include "Player.h"
enum Events
{
@@ -39,21 +42,21 @@ enum Events
enum Yells
{
- SAY_JAINA_INTRO_1 = -1632040,
- SAY_JAINA_INTRO_2 = -1632041,
- SAY_JAINA_INTRO_3 = -1632042,
- SAY_JAINA_INTRO_4 = -1632043,
- SAY_JAINA_INTRO_5 = -1632044,
- SAY_JAINA_INTRO_6 = -1632045,
- SAY_JAINA_INTRO_7 = -1632046,
- SAY_JAINA_INTRO_8 = -1632047,
-
- SAY_SYLVANAS_INTRO_1 = -1632050,
- SAY_SYLVANAS_INTRO_2 = -1632051,
- SAY_SYLVANAS_INTRO_3 = -1632052,
- SAY_SYLVANAS_INTRO_4 = -1632053,
- SAY_SYLVANAS_INTRO_5 = -1632054,
- SAY_SYLVANAS_INTRO_6 = -1632055,
+ SAY_JAINA_INTRO_1 = 0,
+ SAY_JAINA_INTRO_2 = 1,
+ SAY_JAINA_INTRO_3 = 2,
+ SAY_JAINA_INTRO_4 = 3,
+ SAY_JAINA_INTRO_5 = 4,
+ SAY_JAINA_INTRO_6 = 5,
+ SAY_JAINA_INTRO_7 = 6,
+ SAY_JAINA_INTRO_8 = 7,
+
+ SAY_SYLVANAS_INTRO_1 = 0,
+ SAY_SYLVANAS_INTRO_2 = 1,
+ SAY_SYLVANAS_INTRO_3 = 2,
+ SAY_SYLVANAS_INTRO_4 = 3,
+ SAY_SYLVANAS_INTRO_5 = 4,
+ SAY_SYLVANAS_INTRO_6 = 5,
};
enum eSylvanas
@@ -117,32 +120,32 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_INTRO_1:
- DoScriptText(SAY_SYLVANAS_INTRO_1, me);
+ Talk(SAY_SYLVANAS_INTRO_1);
events.ScheduleEvent(EVENT_INTRO_2, 11500);
break;
case EVENT_INTRO_2:
- DoScriptText(SAY_SYLVANAS_INTRO_2, me);
+ Talk(SAY_SYLVANAS_INTRO_2);
events.ScheduleEvent(EVENT_INTRO_3, 10500);
break;
case EVENT_INTRO_3:
- DoScriptText(SAY_SYLVANAS_INTRO_3, me);
+ Talk(SAY_SYLVANAS_INTRO_3);
events.ScheduleEvent(EVENT_INTRO_4, 9500);
break;
case EVENT_INTRO_4:
- DoScriptText(SAY_SYLVANAS_INTRO_4, me);
+ Talk(SAY_SYLVANAS_INTRO_4);
events.ScheduleEvent(EVENT_INTRO_5, 10500);
break;
case EVENT_INTRO_5:
- DoScriptText(SAY_SYLVANAS_INTRO_5, me);
+ Talk(SAY_SYLVANAS_INTRO_5);
events.ScheduleEvent(EVENT_INTRO_6, 9500);
break;
case EVENT_INTRO_6:
- DoScriptText(SAY_SYLVANAS_INTRO_6, me);
+ Talk(SAY_SYLVANAS_INTRO_6);
// End of Intro
phase = PHASE_NORMAL;
break;
@@ -243,42 +246,42 @@ public:
switch (events.ExecuteEvent())
{
case EVENT_INTRO_1:
- DoScriptText(SAY_JAINA_INTRO_1, me);
+ Talk(SAY_JAINA_INTRO_1);
events.ScheduleEvent(EVENT_INTRO_2, 8000);
break;
case EVENT_INTRO_2:
- DoScriptText(SAY_JAINA_INTRO_2, me);
+ Talk(SAY_JAINA_INTRO_2);
events.ScheduleEvent(EVENT_INTRO_3, 8500);
break;
case EVENT_INTRO_3:
- DoScriptText(SAY_JAINA_INTRO_3, me);
+ Talk(SAY_JAINA_INTRO_3);
events.ScheduleEvent(EVENT_INTRO_4, 8000);
break;
case EVENT_INTRO_4:
- DoScriptText(SAY_JAINA_INTRO_4, me);
+ Talk(SAY_JAINA_INTRO_4);
events.ScheduleEvent(EVENT_INTRO_5, 10000);
break;
case EVENT_INTRO_5:
- DoScriptText(SAY_JAINA_INTRO_5, me);
+ Talk(SAY_JAINA_INTRO_5);
events.ScheduleEvent(EVENT_INTRO_6, 8000);
break;
case EVENT_INTRO_6:
- DoScriptText(SAY_JAINA_INTRO_6, me);
+ Talk(SAY_JAINA_INTRO_6);
events.ScheduleEvent(EVENT_INTRO_7, 12000);
break;
case EVENT_INTRO_7:
- DoScriptText(SAY_JAINA_INTRO_7, me);
+ Talk(SAY_JAINA_INTRO_7);
events.ScheduleEvent(EVENT_INTRO_8, 8000);
break;
case EVENT_INTRO_8:
- DoScriptText(SAY_JAINA_INTRO_8, me);
+ Talk(SAY_JAINA_INTRO_8);
// End of Intro
phase = PHASE_NORMAL;
break;
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
index bad4b8e38b2..3afc248ab9d 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "forge_of_souls.h"
+#include "Player.h"
#define MAX_ENCOUNTER 2
@@ -71,7 +73,7 @@ class instance_forge_of_souls : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -84,7 +86,7 @@ class instance_forge_of_souls : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
index 9cfcb78f6f1..bb3028518ec 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp
@@ -15,17 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_reflection.h"
enum Yells
{
- SAY_AGGRO = -1668050,
- SAY_SLAY_1 = -1668051,
- SAY_SLAY_2 = -1668052,
- SAY_DEATH = -1668053,
- SAY_IMPENDING_DESPAIR = -1668054,
- SAY_DEFILING_HORROR = -1668055,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_IMPENDING_DESPAIR = 3,
+ SAY_DEFILING_HORROR = 4,
};
enum Spells
@@ -73,7 +73,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS);
@@ -84,7 +84,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_FALRIC_EVENT, DONE);
@@ -92,7 +92,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -115,7 +115,7 @@ public:
case EVENT_IMPENDING_DESPAIR:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
{
- DoScriptText(SAY_IMPENDING_DESPAIR, me);
+ Talk(SAY_IMPENDING_DESPAIR);
DoCast(target, SPELL_IMPENDING_DESPAIR);
}
events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 13000);
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
index a9bfb603794..697e8cfb664 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp
@@ -15,17 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_reflection.h"
enum Yells
{
- SAY_AGGRO = -1668060,
- SAY_SLAY_1 = -1668061,
- SAY_SLAY_2 = -1668062,
- SAY_DEATH = -1668063,
- SAY_CORRUPTED_FLESH_1 = -1668064,
- SAY_CORRUPTED_FLESH_2 = -1668065,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_CORRUPTED_FLESH = 3
};
enum Spells
@@ -69,7 +68,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_MARWYN_EVENT, IN_PROGRESS);
@@ -81,7 +80,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MARWYN_EVENT, DONE);
@@ -89,7 +88,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -114,7 +113,7 @@ public:
events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000);
break;
case EVENT_CORRUPTED_FLESH:
- DoScriptText(RAND(SAY_CORRUPTED_FLESH_1, SAY_CORRUPTED_FLESH_2), me);
+ Talk(SAY_CORRUPTED_FLESH);
DoCast(SPELL_CORRUPTED_FLESH);
events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000);
break;
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 2abb60d5de2..c1a3a432407 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp
@@ -15,57 +15,62 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "halls_of_reflection.h"
+#include "Player.h"
enum Yells
{
- SAY_JAINA_INTRO_1 = -1668001,
- SAY_JAINA_INTRO_2 = -1668002,
- SAY_JAINA_INTRO_3 = -1668003,
- SAY_JAINA_INTRO_4 = -1668004,
- SAY_UTHER_INTRO_A2_1 = -1668005,
- SAY_JAINA_INTRO_5 = -1668006,
- SAY_UTHER_INTRO_A2_2 = -1668007,
- SAY_JAINA_INTRO_6 = -1668008,
- SAY_UTHER_INTRO_A2_3 = -1668009,
- SAY_JAINA_INTRO_7 = -1668010,
- SAY_UTHER_INTRO_A2_4 = -1668011,
- SAY_JAINA_INTRO_8 = -1668012,
- SAY_UTHER_INTRO_A2_5 = -1668013,
- SAY_JAINA_INTRO_9 = -1668014,
- SAY_UTHER_INTRO_A2_6 = -1668015,
- SAY_UTHER_INTRO_A2_7 = -1668016,
- SAY_JAINA_INTRO_10 = -1668017,
- SAY_UTHER_INTRO_A2_8 = -1668018,
- SAY_JAINA_INTRO_11 = -1668019,
- SAY_UTHER_INTRO_A2_9 = -1668020,
-
- SAY_SYLVANAS_INTRO_1 = -1668021,
- SAY_SYLVANAS_INTRO_2 = -1668022,
- SAY_SYLVANAS_INTRO_3 = -1668023,
- SAY_UTHER_INTRO_H2_1 = -1668024,
- SAY_SYLVANAS_INTRO_4 = -1668025,
- SAY_UTHER_INTRO_H2_2 = -1668026,
- SAY_SYLVANAS_INTRO_5 = -1668027,
- SAY_UTHER_INTRO_H2_3 = -1668028,
- SAY_SYLVANAS_INTRO_6 = -1668029,
- SAY_UTHER_INTRO_H2_4 = -1668030,
- SAY_SYLVANAS_INTRO_7 = -1668031,
- SAY_UTHER_INTRO_H2_5 = -1668032,
- SAY_UTHER_INTRO_H2_6 = -1668033,
- SAY_SYLVANAS_INTRO_8 = -1668034,
- SAY_UTHER_INTRO_H2_7 = -1668035,
-
- SAY_LK_INTRO_1 = -1668036,
- SAY_LK_INTRO_2 = -1668037,
- SAY_LK_INTRO_3 = -1668038,
- SAY_FALRIC_INTRO_1 = -1668039,
- SAY_MARWYN_INTRO_1 = -1668040,
- SAY_FALRIC_INTRO_2 = -1668041,
-
- SAY_JAINA_INTRO_END = -1668042,
- SAY_SYLVANAS_INTRO_END = -1668043,
+ SAY_JAINA_INTRO_1 = 0,
+ SAY_JAINA_INTRO_2 = 1,
+ SAY_JAINA_INTRO_3 = 2,
+ SAY_JAINA_INTRO_4 = 3,
+ SAY_JAINA_INTRO_5 = 4,
+ SAY_JAINA_INTRO_6 = 5,
+ SAY_JAINA_INTRO_7 = 6,
+ SAY_JAINA_INTRO_8 = 7,
+ SAY_JAINA_INTRO_9 = 8,
+ SAY_JAINA_INTRO_10 = 9,
+ SAY_JAINA_INTRO_11 = 10,
+ SAY_JAINA_INTRO_END = 11,
+
+ SAY_SYLVANAS_INTRO_1 = 0,
+ SAY_SYLVANAS_INTRO_2 = 1,
+ SAY_SYLVANAS_INTRO_3 = 2,
+ SAY_SYLVANAS_INTRO_4 = 3,
+ SAY_SYLVANAS_INTRO_5 = 4,
+ SAY_SYLVANAS_INTRO_6 = 5,
+ SAY_SYLVANAS_INTRO_7 = 6,
+ SAY_SYLVANAS_INTRO_8 = 7,
+ SAY_SYLVANAS_INTRO_END = 8,
+
+ SAY_UTHER_INTRO_A2_1 = 0,
+ SAY_UTHER_INTRO_A2_2 = 1,
+ SAY_UTHER_INTRO_A2_3 = 2,
+ SAY_UTHER_INTRO_A2_4 = 3,
+ SAY_UTHER_INTRO_A2_5 = 4,
+ SAY_UTHER_INTRO_A2_6 = 5,
+ SAY_UTHER_INTRO_A2_7 = 6,
+ SAY_UTHER_INTRO_A2_8 = 7,
+ SAY_UTHER_INTRO_A2_9 = 8,
+ SAY_UTHER_INTRO_H2_1 = 9,
+ SAY_UTHER_INTRO_H2_2 = 10,
+ SAY_UTHER_INTRO_H2_3 = 11,
+ SAY_UTHER_INTRO_H2_4 = 12,
+ SAY_UTHER_INTRO_H2_5 = 13,
+ SAY_UTHER_INTRO_H2_6 = 14,
+ SAY_UTHER_INTRO_H2_7 = 15,
+
+ SAY_LK_INTRO_1 = 0,
+ SAY_LK_INTRO_2 = 1,
+ SAY_LK_INTRO_3 = 2,
+
+ SAY_FALRIC_INTRO_1 = 5,
+ SAY_FALRIC_INTRO_2 = 6,
+
+ SAY_MARWYN_INTRO_1 = 4
};
enum Events
@@ -211,8 +216,8 @@ public:
}
InstanceScript* instance;
- uint64 uiUther;
- uint64 uiLichKing;
+ uint64 utherGUID;
+ uint64 lichkingGUID;
EventMap events;
@@ -220,8 +225,8 @@ public:
{
events.Reset();
- uiUther = 0;
- uiLichKing = 0;
+ utherGUID = 0;
+ lichkingGUID = 0;
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -257,11 +262,11 @@ public:
// A2 Intro Events
case EVENT_INTRO_A2_1:
- DoScriptText(SAY_JAINA_INTRO_3, me);
+ Talk(SAY_JAINA_INTRO_3);
events.ScheduleEvent(EVENT_INTRO_A2_2, 5000);
break;
case EVENT_INTRO_A2_2:
- DoScriptText(SAY_JAINA_INTRO_4, me);
+ Talk(SAY_JAINA_INTRO_4);
events.ScheduleEvent(EVENT_INTRO_A2_3, 10000);
break;
case EVENT_INTRO_A2_3:
@@ -271,197 +276,197 @@ public:
break;
case EVENT_INTRO_A2_4:
// spawn UTHER during speach 2
- if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
+ if (Creature* uther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
{
- pUther->GetMotionMaster()->MoveIdle();
- pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
- uiUther = pUther->GetGUID();
+ uther->GetMotionMaster()->MoveIdle();
+ uther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
+ utherGUID = uther->GetGUID();
}
events.ScheduleEvent(EVENT_INTRO_A2_5, 2000);
break;
case EVENT_INTRO_A2_5:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_1, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_1);
events.ScheduleEvent(EVENT_INTRO_A2_6, 3000);
break;
case EVENT_INTRO_A2_6:
- DoScriptText(SAY_JAINA_INTRO_5, me);
+ Talk(SAY_JAINA_INTRO_5);
events.ScheduleEvent(EVENT_INTRO_A2_7, 6000);
break;
case EVENT_INTRO_A2_7:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_2, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_2);
events.ScheduleEvent(EVENT_INTRO_A2_8, 6500);
break;
case EVENT_INTRO_A2_8:
- DoScriptText(SAY_JAINA_INTRO_6, me);
+ Talk(SAY_JAINA_INTRO_6);
events.ScheduleEvent(EVENT_INTRO_A2_9, 2000);
break;
case EVENT_INTRO_A2_9:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_3, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_3);
events.ScheduleEvent(EVENT_INTRO_A2_10, 9000);
break;
case EVENT_INTRO_A2_10:
- DoScriptText(SAY_JAINA_INTRO_7, me);
+ Talk(SAY_JAINA_INTRO_7);
events.ScheduleEvent(EVENT_INTRO_A2_11, 5000);
break;
case EVENT_INTRO_A2_11:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_4, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_4);
events.ScheduleEvent(EVENT_INTRO_A2_12, 11000);
break;
case EVENT_INTRO_A2_12:
- DoScriptText(SAY_JAINA_INTRO_8, me);
+ Talk(SAY_JAINA_INTRO_8);
events.ScheduleEvent(EVENT_INTRO_A2_13, 4000);
break;
case EVENT_INTRO_A2_13:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_5, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_5);
events.ScheduleEvent(EVENT_INTRO_A2_14, 12500);
break;
case EVENT_INTRO_A2_14:
- DoScriptText(SAY_JAINA_INTRO_9, me);
+ Talk(SAY_JAINA_INTRO_9);
events.ScheduleEvent(EVENT_INTRO_A2_15, 10000);
break;
case EVENT_INTRO_A2_15:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_6, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_6);
events.ScheduleEvent(EVENT_INTRO_A2_16, 22000);
break;
case EVENT_INTRO_A2_16:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_A2_7, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_7);
events.ScheduleEvent(EVENT_INTRO_A2_17, 4000);
break;
case EVENT_INTRO_A2_17:
- DoScriptText(SAY_JAINA_INTRO_10, me);
+ Talk(SAY_JAINA_INTRO_10);
events.ScheduleEvent(EVENT_INTRO_A2_18, 2000);
break;
case EVENT_INTRO_A2_18:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
{
- pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
- DoScriptText(SAY_UTHER_INTRO_A2_8, pUther);
+ uther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_8);
}
events.ScheduleEvent(EVENT_INTRO_A2_19, 11000);
break;
case EVENT_INTRO_A2_19:
- DoScriptText(SAY_JAINA_INTRO_11, me);
+ Talk(SAY_JAINA_INTRO_11);
events.ScheduleEvent(EVENT_INTRO_LK_1, 2000);
break;
// H2 Intro Events
case EVENT_INTRO_H2_1:
- DoScriptText(SAY_SYLVANAS_INTRO_1, me);
+ Talk(SAY_SYLVANAS_INTRO_1);
events.ScheduleEvent(EVENT_INTRO_H2_2, 8000);
break;
case EVENT_INTRO_H2_2:
- DoScriptText(SAY_SYLVANAS_INTRO_2, me);
+ Talk(SAY_SYLVANAS_INTRO_2);
events.ScheduleEvent(EVENT_INTRO_H2_3, 6000);
break;
case EVENT_INTRO_H2_3:
- DoScriptText(SAY_SYLVANAS_INTRO_3, me);
+ Talk(SAY_SYLVANAS_INTRO_3);
// TODO: she's doing some kind of spell casting emote
events.ScheduleEvent(EVENT_INTRO_H2_4, 6000);
break;
case EVENT_INTRO_H2_4:
// spawn UTHER during speach 2
- if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
+ if (Creature* uther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
{
- pUther->GetMotionMaster()->MoveIdle();
- pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
- uiUther = pUther->GetGUID();
+ uther->GetMotionMaster()->MoveIdle();
+ uther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas
+ utherGUID = uther->GetGUID();
}
events.ScheduleEvent(EVENT_INTRO_H2_5, 2000);
break;
case EVENT_INTRO_H2_5:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_H2_1, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_1);
events.ScheduleEvent(EVENT_INTRO_H2_6, 11000);
break;
case EVENT_INTRO_H2_6:
- DoScriptText(SAY_SYLVANAS_INTRO_4, me);
+ Talk(SAY_SYLVANAS_INTRO_4);
events.ScheduleEvent(EVENT_INTRO_H2_7, 3000);
break;
case EVENT_INTRO_H2_7:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_H2_2, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_2);
events.ScheduleEvent(EVENT_INTRO_H2_8, 6000);
break;
case EVENT_INTRO_H2_8:
- DoScriptText(SAY_SYLVANAS_INTRO_5, me);
+ Talk(SAY_SYLVANAS_INTRO_5);
events.ScheduleEvent(EVENT_INTRO_H2_9, 5000);
break;
case EVENT_INTRO_H2_9:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_H2_3, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_3);
events.ScheduleEvent(EVENT_INTRO_H2_10, 19000);
break;
case EVENT_INTRO_H2_10:
- DoScriptText(SAY_SYLVANAS_INTRO_6, me);
+ Talk(SAY_SYLVANAS_INTRO_6);
events.ScheduleEvent(EVENT_INTRO_H2_11, 1500);
break;
case EVENT_INTRO_H2_11:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_H2_4, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_4);
events.ScheduleEvent(EVENT_INTRO_H2_12, 19500);
break;
case EVENT_INTRO_H2_12:
- DoScriptText(SAY_SYLVANAS_INTRO_7, me);
+ Talk(SAY_SYLVANAS_INTRO_7);
events.ScheduleEvent(EVENT_INTRO_H2_13, 2000);
break;
case EVENT_INTRO_H2_13:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
{
- pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
- DoScriptText(SAY_UTHER_INTRO_H2_5, pUther);
+ uther->HandleEmoteCommand(EMOTE_ONESHOT_NO);
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_5);
}
events.ScheduleEvent(EVENT_INTRO_H2_14, 12000);
break;
case EVENT_INTRO_H2_14:
- if (Creature* pUther = me->GetCreature(*me, uiUther))
- DoScriptText(SAY_UTHER_INTRO_H2_6, pUther);
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_6);
events.ScheduleEvent(EVENT_INTRO_H2_15, 8000);
break;
case EVENT_INTRO_H2_15:
- DoScriptText(SAY_SYLVANAS_INTRO_8, me);
+ Talk(SAY_SYLVANAS_INTRO_8);
events.ScheduleEvent(EVENT_INTRO_LK_1, 2000);
break;
// Remaining Intro Events common for both faction
case EVENT_INTRO_LK_1:
// Spawn LK in front of door, and make him move to the sword.
- if (Creature* pLichKing = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
+ if (Creature* lichking = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN))
{
- pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos);
- pLichKing->SetReactState(REACT_PASSIVE);
- uiLichKing = pLichKing->GetGUID();
+ lichking->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos);
+ lichking->SetReactState(REACT_PASSIVE);
+ lichkingGUID = lichking->GetGUID();
}
- if (Creature* pUther = me->GetCreature(*me, uiUther))
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
{
if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- DoScriptText(SAY_UTHER_INTRO_A2_9, pUther);
+ uther->AI()->Talk(SAY_UTHER_INTRO_A2_9);
else
- DoScriptText(SAY_UTHER_INTRO_H2_7, pUther);
+ uther->AI()->Talk(SAY_UTHER_INTRO_H2_7);
}
events.ScheduleEvent(EVENT_INTRO_LK_2, 11000);
break;
case EVENT_INTRO_LK_2:
- if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
- DoScriptText(SAY_LK_INTRO_1, pLichKing);
+ if (Creature* lichking = me->GetCreature(*me, lichkingGUID))
+ lichking->AI()->Talk(SAY_LK_INTRO_1);
events.ScheduleEvent(EVENT_INTRO_LK_3, 2000);
break;
case EVENT_INTRO_LK_3:
// The Lich King banishes Uther to the abyss.
- if (Creature* pUther = me->GetCreature(*me, uiUther))
+ if (Creature* uther = me->GetCreature(*me, utherGUID))
{
- pUther->DisappearAndDie();
- uiUther = 0;
+ uther->DisappearAndDie();
+ utherGUID = 0;
}
// He steps forward and removes the runeblade from the heap of skulls.
@@ -470,8 +475,8 @@ public:
break;
case EVENT_INTRO_LK_4:
- if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
- DoScriptText(SAY_LK_INTRO_2, pLichKing);
+ if (Creature* lichking = me->GetCreature(*me, lichkingGUID))
+ lichking->AI()->Talk(SAY_LK_INTRO_2);
events.ScheduleEvent(EVENT_INTRO_LK_5, 10000);
break;
@@ -482,41 +487,41 @@ public:
if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
pMarwyn->SetVisible(true);
- if (Creature* pLichKing = me->GetCreature(*me, uiLichKing))
+ if (Creature* lichking = me->GetCreature(*me, lichkingGUID))
{
- pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
- DoScriptText(SAY_LK_INTRO_3, pLichKing);
+ lichking->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
+ lichking->AI()->Talk(SAY_LK_INTRO_3);
}
events.ScheduleEvent(EVENT_INTRO_LK_6, 8000);
break;
case EVENT_INTRO_LK_6:
- if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
- DoScriptText(SAY_FALRIC_INTRO_1, pFalric);
+ if (Creature* falric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
+ falric->AI()->Talk(SAY_FALRIC_INTRO_1);
events.ScheduleEvent(EVENT_INTRO_LK_7, 2000);
break;
case EVENT_INTRO_LK_7:
- if (Creature* pMarwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
- DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn);
+ if (Creature* marwyn = me->GetCreature(*me, instance->GetData64(DATA_MARWYN)))
+ marwyn->AI()->Talk(SAY_MARWYN_INTRO_1);
events.ScheduleEvent(EVENT_INTRO_LK_8, 2000);
break;
case EVENT_INTRO_LK_8:
- if (Creature* pFalric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
- DoScriptText(SAY_FALRIC_INTRO_2, pFalric);
+ if (Creature* falric = me->GetCreature(*me, instance->GetData64(DATA_FALRIC)))
+ falric->AI()->Talk(SAY_FALRIC_INTRO_2);
events.ScheduleEvent(EVENT_INTRO_LK_9, 5000);
break;
case EVENT_INTRO_LK_9:
if (instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- DoScriptText(SAY_JAINA_INTRO_END, me);
+ Talk(SAY_JAINA_INTRO_END);
else
- DoScriptText(SAY_SYLVANAS_INTRO_END, me);
+ Talk(SAY_SYLVANAS_INTRO_END);
me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos);
// TODO: Loralen/Koreln shall run also
diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
index 3c4d05854bb..2e0c3364bbd 100644
--- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "halls_of_reflection.h"
+#include "Player.h"
#define MAX_ENCOUNTER 3
@@ -242,7 +245,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -256,7 +259,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
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 a3b8c5df4e7..e8557482420 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp
@@ -15,20 +15,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuras.h"
#include "pit_of_saron.h"
enum Yells
{
- SAY_AGGRO = 0,
- SAY_PHASE2 = 1,
- SAY_PHASE3 = 2,
- SAY_DEATH = 3,
- SAY_SLAY = 4,
- SAY_THROW_SARONITE = 5,
- SAY_CAST_DEEP_FREEZE = 6,
-
- SAY_TYRANNUS_DEATH = -1658007, // todo
+ SAY_AGGRO = 0,
+ SAY_PHASE2 = 1,
+ SAY_PHASE3 = 2,
+ SAY_DEATH = 3,
+ SAY_SLAY = 4,
+ SAY_THROW_SARONITE = 5,
+ SAY_CAST_DEEP_FREEZE = 6,
+
+ SAY_TYRANNUS_DEATH = 0
};
enum Spells
@@ -45,16 +48,6 @@ enum Spells
#define SPELL_PERMAFROST_HELPER RAID_MODE<uint32>(68786, 70336)
#define SPELL_FORGE_BLADE_HELPER RAID_MODE<uint32>(68774, 70334)
-enum Events
-{
- EVENT_THROW_SARONITE = 1,
- EVENT_CHILLING_WAVE = 2,
- EVENT_DEEP_FREEZE = 3,
- EVENT_JUMP = 4,
- EVENT_FORGING = 5,
- EVENT_RESUME_ATTACK = 6,
-};
-
enum Phases
{
PHASE_ONE = 1,
@@ -79,6 +72,15 @@ Position const southForgePos = {639.257f, -210.1198f, 529.015f, 0.523599f};
class boss_garfrost : public CreatureScript
{
+enum Events
+{
+ EVENT_THROW_SARONITE = 1,
+ EVENT_CHILLING_WAVE = 2,
+ EVENT_DEEP_FREEZE = 3,
+ EVENT_JUMP = 4,
+ EVENT_FORGING = 5,
+ EVENT_RESUME_ATTACK = 6,
+};
public:
boss_garfrost() : CreatureScript("boss_garfrost") { }
@@ -127,7 +129,7 @@ class boss_garfrost : public CreatureScript
Talk(SAY_DEATH);
if (Creature* tyrannus = me->GetCreature(*me, instance->GetData64(DATA_TYRANNUS)))
- DoScriptText(SAY_TYRANNUS_DEATH, tyrannus);
+ tyrannus->AI()->Talk(SAY_TYRANNUS_DEATH);
instance->SetBossState(DATA_GARFROST, DONE);
}
@@ -157,15 +159,19 @@ class boss_garfrost : public CreatureScript
void MovementInform(uint32 type, uint32 id)
{
- if (type != POINT_MOTION_TYPE || id != POINT_FORGE)
+ if (type != EFFECT_MOTION_TYPE || id != POINT_FORGE)
return;
if (events.GetPhaseMask() & PHASE_TWO_MASK)
+ {
DoCast(me, SPELL_FORGE_BLADE);
+ SetEquipmentSlots(false, EQUIP_ID_SWORD);
+ }
if (events.GetPhaseMask() & PHASE_THREE_MASK)
{
me->RemoveAurasDueToSpell(SPELL_FORGE_BLADE_HELPER);
DoCast(me, SPELL_FORGE_MACE);
+ SetEquipmentSlots(false, EQUIP_ID_MACE);
}
events.ScheduleEvent(EVENT_RESUME_ATTACK, 5000);
}
@@ -177,13 +183,9 @@ class boss_garfrost : public CreatureScript
if (Aura* aura = target->GetAura(SPELL_PERMAFROST_HELPER))
_permafrostStack = std::max<uint32>(_permafrostStack, aura->GetStackAmount());
}
- else if (spell->Id == SPELL_FORGE_BLADE)
- SetEquipmentSlots(false, EQUIP_ID_SWORD);
- else if (spell->Id == SPELL_FORGE_MACE)
- SetEquipmentSlots(false, EQUIP_ID_MACE);
}
- uint32 GetData(uint32 /*type*/)
+ uint32 GetData(uint32 /*type*/) const
{
return _permafrostStack;
}
@@ -205,7 +207,7 @@ class boss_garfrost : public CreatureScript
case EVENT_THROW_SARONITE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
- Talk(SAY_THROW_SARONITE);
+ Talk(SAY_THROW_SARONITE, target->GetGUID());
DoCast(target, SPELL_THROW_SARONITE);
}
events.ScheduleEvent(EVENT_THROW_SARONITE, urand(12500, 20000));
@@ -217,7 +219,7 @@ class boss_garfrost : public CreatureScript
case EVENT_DEEP_FREEZE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
- Talk(SAY_CAST_DEEP_FREEZE);
+ Talk(SAY_CAST_DEEP_FREEZE, target->GetGUID());
DoCast(target, SPELL_DEEP_FREEZE);
}
events.ScheduleEvent(EVENT_DEEP_FREEZE, 35000, 0, PHASE_THREE);
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
index fa260cb298d..ed196d2cd0c 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp
@@ -15,9 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "pit_of_saron.h"
#include "Vehicle.h"
+#include "Player.h"
enum Spells
{
@@ -44,33 +48,30 @@ enum Spells
enum Yells
{
// Krick
- SAY_KRICK_AGGRO = -1658010,
- SAY_KRICK_SLAY_1 = -1658011,
- SAY_KRICK_SLAY_2 = -1658012,
- SAY_KRICK_BARRAGE_1 = -1658013,
- SAY_KRICK_BARRAGE_2 = -1658014,
- SAY_KRICK_POISON_NOVA = -1658015,
- SAY_KRICK_CHASE_1 = -1658016,
- SAY_KRICK_CHASE_2 = -1658017,
- SAY_KRICK_CHASE_3 = -1658018,
+ SAY_KRICK_AGGRO = 0,
+ SAY_KRICK_SLAY = 1,
+ SAY_KRICK_BARRAGE_1 = 2,
+ SAY_KRICK_BARRAGE_2 = 3,
+ SAY_KRICK_POISON_NOVA = 4,
+ SAY_KRICK_CHASE = 5,
+ SAY_KRICK_OUTRO_1 = 6,
+ SAY_KRICK_OUTRO_3 = 7,
+ SAY_KRICK_OUTRO_5 = 8,
+ SAY_KRICK_OUTRO_8 = 9,
// Ick
- SAY_ICK_POISON_NOVA = -1658020,
- SAY_ICK_CHASE_1 = -1658021,
+ SAY_ICK_POISON_NOVA = 0,
+ SAY_ICK_CHASE_1 = 1,
// OUTRO
- SAY_KRICK_OUTRO_1 = -1658030,
- SAY_JAYNA_OUTRO_2 = -1658031,
- SAY_SYLVANAS_OUTRO_2 = -1658032,
- SAY_KRICK_OUTRO_3 = -1658033,
- SAY_JAYNA_OUTRO_4 = -1658034,
- SAY_SYLVANAS_OUTRO_4 = -1658035,
- SAY_KRICK_OUTRO_5 = -1658036,
- SAY_TYRANNUS_OUTRO_7 = -1658037,
- SAY_KRICK_OUTRO_8 = -1658038,
- SAY_TYRANNUS_OUTRO_9 = -1658039,
- SAY_JAYNA_OUTRO_10 = -1658040,
- SAY_SYLVANAS_OUTRO_10 = -1658041,
+ SAY_JAYNA_OUTRO_2 = 0,
+ SAY_JAYNA_OUTRO_4 = 1,
+ SAY_JAYNA_OUTRO_10 = 2,
+ SAY_SYLVANAS_OUTRO_2 = 0,
+ SAY_SYLVANAS_OUTRO_4 = 1,
+ SAY_SYLVANAS_OUTRO_10 = 2,
+ SAY_TYRANNUS_OUTRO_7 = 1,
+ SAY_TYRANNUS_OUTRO_9 = 2,
};
enum Events
@@ -163,7 +164,7 @@ class boss_ick : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
if (Creature* krick = GetKrick())
- DoScriptText(SAY_KRICK_AGGRO, krick);
+ krick->AI()->Talk(SAY_KRICK_AGGRO);
events.ScheduleEvent(EVENT_MIGHTY_KICK, 20000);
events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000);
@@ -225,13 +226,13 @@ class boss_ick : public CreatureScript
case EVENT_TOXIC_WASTE:
if (Creature* krick = GetKrick())
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- krick->CastSpell(target, SPELL_TOXIC_WASTE, false);
+ krick->CastSpell(target, SPELL_TOXIC_WASTE, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
events.ScheduleEvent(EVENT_TOXIC_WASTE, urand(7000, 10000));
break;
case EVENT_SHADOW_BOLT:
if (Creature* krick = GetKrick())
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
- krick->CastSpell(target, SPELL_SHADOW_BOLT, false);
+ krick->CastSpell(target, SPELL_SHADOW_BOLT, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000);
return;
case EVENT_MIGHTY_KICK:
@@ -246,8 +247,8 @@ class boss_ick : public CreatureScript
case EVENT_EXPLOSIVE_BARRAGE:
if (Creature* krick = GetKrick())
{
- DoScriptText(SAY_KRICK_BARRAGE_1, krick);
- DoScriptText(SAY_KRICK_BARRAGE_2, krick);
+ krick->AI()->Talk(SAY_KRICK_BARRAGE_1);
+ krick->AI()->Talk(SAY_KRICK_BARRAGE_2);
krick->CastSpell(krick, SPELL_EXPLOSIVE_BARRAGE_KRICK, true);
DoCast(me, SPELL_EXPLOSIVE_BARRAGE_ICK);
}
@@ -255,14 +256,14 @@ class boss_ick : public CreatureScript
break;
case EVENT_POISON_NOVA:
if (Creature* krick = GetKrick())
- DoScriptText(SAY_KRICK_POISON_NOVA, krick);
+ krick->AI()->Talk(SAY_KRICK_POISON_NOVA);
- DoScriptText(SAY_ICK_POISON_NOVA, me);
+ Talk(SAY_ICK_POISON_NOVA);
DoCast(me, SPELL_POISON_NOVA);
break;
case EVENT_PURSUIT:
if (Creature* krick = GetKrick())
- DoScriptText(RAND(SAY_KRICK_CHASE_1, SAY_KRICK_CHASE_2, SAY_KRICK_CHASE_3), krick);
+ krick->AI()->Talk(SAY_KRICK_CHASE);
DoCast(me, SPELL_PURSUIT);
break;
default:
@@ -324,7 +325,7 @@ class boss_krick : public CreatureScript
if (victim == me)
return;
- DoScriptText(RAND(SAY_KRICK_SLAY_1, SAY_KRICK_SLAY_2), me);
+ Talk(SAY_KRICK_SLAY);
}
void JustSummoned(Creature* summon)
@@ -358,7 +359,7 @@ class boss_krick : public CreatureScript
if (type != POINT_MOTION_TYPE || id != POINT_KRICK_INTRO)
return;
- DoScriptText(SAY_KRICK_OUTRO_1, me);
+ Talk(SAY_KRICK_OUTRO_1);
_phase = PHASE_OUTRO;
_events.Reset();
_events.ScheduleEvent(EVENT_OUTRO_1, 1000);
@@ -400,28 +401,28 @@ class boss_krick : public CreatureScript
jainaOrSylvanas->SetFacingToObject(me);
me->SetFacingToObject(jainaOrSylvanas);
if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- DoScriptText(SAY_JAYNA_OUTRO_2, jainaOrSylvanas);
+ jainaOrSylvanas->AI()->Talk(SAY_JAYNA_OUTRO_2);
else
- DoScriptText(SAY_SYLVANAS_OUTRO_2, jainaOrSylvanas);
+ jainaOrSylvanas->AI()->Talk(SAY_SYLVANAS_OUTRO_2);
}
_events.ScheduleEvent(EVENT_OUTRO_3, 5000);
break;
case EVENT_OUTRO_3:
- DoScriptText(SAY_KRICK_OUTRO_3, me);
+ Talk(SAY_KRICK_OUTRO_3);
_events.ScheduleEvent(EVENT_OUTRO_4, 18000);
break;
case EVENT_OUTRO_4:
if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _outroNpcGUID))
{
if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- DoScriptText(SAY_JAYNA_OUTRO_4, jainaOrSylvanas);
+ jainaOrSylvanas->AI()->Talk(SAY_JAYNA_OUTRO_4);
else
- DoScriptText(SAY_SYLVANAS_OUTRO_4, jainaOrSylvanas);
+ jainaOrSylvanas->AI()->Talk(SAY_SYLVANAS_OUTRO_4);
}
_events.ScheduleEvent(EVENT_OUTRO_5, 5000);
break;
case EVENT_OUTRO_5:
- DoScriptText(SAY_KRICK_OUTRO_5, me);
+ Talk(SAY_KRICK_OUTRO_5);
_events.ScheduleEvent(EVENT_OUTRO_6, 1000);
break;
case EVENT_OUTRO_6:
@@ -435,7 +436,7 @@ class boss_krick : public CreatureScript
break;
case EVENT_OUTRO_7:
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
- DoScriptText(SAY_TYRANNUS_OUTRO_7, tyrannus);
+ tyrannus->AI()->Talk(SAY_TYRANNUS_OUTRO_7);
_events.ScheduleEvent(EVENT_OUTRO_8, 5000);
break;
case EVENT_OUTRO_8:
@@ -446,7 +447,7 @@ class boss_krick : public CreatureScript
_events.ScheduleEvent(EVENT_OUTRO_9, 2000);
break;
case EVENT_OUTRO_9:
- DoScriptText(SAY_KRICK_OUTRO_8, me);
+ Talk(SAY_KRICK_OUTRO_8);
// TODO: Tyrannus starts killing Krick.
// there shall be some visual spell effect
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
@@ -468,16 +469,16 @@ class boss_krick : public CreatureScript
break;
case EVENT_OUTRO_12:
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannusGUID))
- DoScriptText(SAY_TYRANNUS_OUTRO_9, tyrannus);
+ tyrannus->AI()->Talk(SAY_TYRANNUS_OUTRO_9);
_events.ScheduleEvent(EVENT_OUTRO_13, 2000);
break;
case EVENT_OUTRO_13:
if (Creature* jainaOrSylvanas = ObjectAccessor::GetCreature(*me, _outroNpcGUID))
{
if (_instanceScript->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE)
- DoScriptText(SAY_JAYNA_OUTRO_10, jainaOrSylvanas);
+ jainaOrSylvanas->AI()->Talk(SAY_JAYNA_OUTRO_10);
else
- DoScriptText(SAY_SYLVANAS_OUTRO_10, jainaOrSylvanas);
+ jainaOrSylvanas->AI()->Talk(SAY_SYLVANAS_OUTRO_10);
}
// End of OUTRO. for now...
_events.ScheduleEvent(EVENT_OUTRO_END, 3000);
@@ -632,19 +633,18 @@ class spell_krick_pursuit : public SpellScriptLoader
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
- if (GetCaster()->GetTypeId() != TYPEID_UNIT)
- return;
-
- Unit* caster = GetCaster();
- CreatureAI* ickAI = caster->ToCreature()->AI();
- if (Unit* target = ickAI->SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
- {
- DoScriptText(SAY_ICK_CHASE_1, caster, target);
- caster->AddAura(GetSpellInfo()->Id, target);
- CAST_AI(boss_ick::boss_ickAI, ickAI)->SetTempThreat(caster->getThreatManager().getThreat(target));
- caster->AddThreat(target, float(GetEffectValue()));
- target->AddThreat(caster, float(GetEffectValue()));
- }
+ if (GetCaster())
+ if (Creature* ick = GetCaster()->ToCreature())
+ {
+ if (Unit* target = ick->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
+ {
+ ick->AI()->Talk(SAY_ICK_CHASE_1, target->GetGUID());
+ ick->AddAura(GetSpellInfo()->Id, target);
+ CAST_AI(boss_ick::boss_ickAI, ick->AI())->SetTempThreat(ick->getThreatManager().getThreat(target));
+ ick->AddThreat(target, float(GetEffectValue()));
+ target->AddThreat(ick, float(GetEffectValue()));
+ }
+ }
}
void Register()
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 8d015adf4a4..51eca327810 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -15,38 +15,46 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "pit_of_saron.h"
#include "Vehicle.h"
+#include "Player.h"
enum Yells
{
- SAY_AMBUSH_1 = -1658050,
- SAY_AMBUSH_2 = -1658051,
- SAY_GAUNTLET_START = -1658052,
- SAY_TYRANNUS_INTRO_1 = -1658053,
- SAY_GORKUN_INTRO_2 = -1658054,
- SAY_TYRANNUS_INTRO_3 = -1658055,
-
- SAY_AGGRO = -1658056,
- SAY_SLAY_1 = -1658057,
- SAY_SLAY_2 = -1658058,
- SAY_DEATH = -1658059,
- SAY_MARK_RIMEFANG_1 = -1658060,
- SAY_MARK_RIMEFANG_2 = -1658061,
- SAY_DARK_MIGHT_1 = -1658062,
- SAY_DARK_MIGHT_2 = -1658063,
-
- SAY_GORKUN_OUTRO_1 = -1658064,
- SAY_GORKUN_OUTRO_2 = -1658065,
- SAY_JAYNA_OUTRO_3 = -1658066,
- SAY_SYLVANAS_OUTRO_3 = -1658067,
- SAY_JAYNA_OUTRO_4 = -1658068,
- SAY_SYLVANAS_OUTRO_4 = -1658069,
- SAY_JAYNA_OUTRO_5 = -1658070,
+ //Gorkun
+ SAY_GORKUN_INTRO_2 = 0,
+ SAY_GORKUN_OUTRO_1 = 1,
+ SAY_GORKUN_OUTRO_2 = 2,
+
+ //Tyrannus
+ SAY_AMBUSH_1 = 3,
+ SAY_AMBUSH_2 = 4,
+ SAY_GAUNTLET_START = 5,
+ SAY_TYRANNUS_INTRO_1 = 6,
+ SAY_TYRANNUS_INTRO_3 = 7,
+ SAY_AGGRO = 8,
+ SAY_SLAY = 9,
+ SAY_DEATH = 10,
+ SAY_MARK_RIMEFANG_1 = 11,
+ SAY_MARK_RIMEFANG_2 = 12,
+ SAY_DARK_MIGHT_1 = 13,
+ SAY_DARK_MIGHT_2 = 14,
+
+ //Jaina
+ SAY_JAYNA_OUTRO_3 = 3,
+ SAY_JAYNA_OUTRO_4 = 4,
+ SAY_JAYNA_OUTRO_5 = 5,
+
+ //Sylvanas
+ SAY_SYLVANAS_OUTRO_3 = 3,
+ SAY_SYLVANAS_OUTRO_4 = 4
};
-enum Spells
+enum Spelsl
{
SPELL_OVERLORD_BRAND = 69172,
SPELL_OVERLORD_BRAND_HEAL = 69190,
@@ -152,7 +160,7 @@ class boss_tyrannus : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void AttackStart(Unit* victim)
@@ -176,12 +184,12 @@ class boss_tyrannus : public CreatureScript
void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
instance->SetBossState(DATA_TYRANNUS, DONE);
// Prevent corpse despawning
@@ -197,7 +205,7 @@ class boss_tyrannus : public CreatureScript
{
if (actionId == ACTION_START_INTRO)
{
- DoScriptText(SAY_TYRANNUS_INTRO_1, me);
+ Talk(SAY_TYRANNUS_INTRO_1);
events.SetPhase(PHASE_INTRO);
events.ScheduleEvent(EVENT_INTRO_1, 14000, 0, PHASE_INTRO);
events.ScheduleEvent(EVENT_INTRO_2, 22000, 0, PHASE_INTRO);
@@ -219,10 +227,10 @@ class boss_tyrannus : public CreatureScript
switch (eventId)
{
case EVENT_INTRO_1:
- //DoScriptText(SAY_GORKUN_INTRO_2, pGorkunOrVictus);
+ //Talk(SAY_GORKUN_INTRO_2, pGorkunOrVictus);
break;
case EVENT_INTRO_2:
- DoScriptText(SAY_TYRANNUS_INTRO_3, me);
+ Talk(SAY_TYRANNUS_INTRO_3);
break;
case EVENT_INTRO_3:
me->ExitVehicle();
@@ -250,16 +258,16 @@ class boss_tyrannus : public CreatureScript
events.ScheduleEvent(EVENT_UNHOLY_POWER, 1000);
break;
case EVENT_UNHOLY_POWER:
- DoScriptText(SAY_DARK_MIGHT_1, me);
- DoScriptText(SAY_DARK_MIGHT_2, me);
+ Talk(SAY_DARK_MIGHT_1);
+ Talk(SAY_DARK_MIGHT_2);
DoCast(me, SPELL_UNHOLY_POWER);
events.ScheduleEvent(EVENT_FORCEFUL_SMASH, urand(40000, 48000));
break;
case EVENT_MARK_OF_RIMEFANG:
- DoScriptText(SAY_MARK_RIMEFANG_1, me);
+ Talk(SAY_MARK_RIMEFANG_1);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true))
{
- DoScriptText(SAY_MARK_RIMEFANG_2, me, target);
+ Talk(SAY_MARK_RIMEFANG_2, target->GetGUID());
DoCast(target, SPELL_MARK_OF_RIMEFANG);
}
events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, urand(24000, 26000));
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
index 1301acf4c99..df0829b3376 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "pit_of_saron.h"
+#include "Player.h"
// positions for Martin Victus (37591) and Gorkun Ironskull (37592)
Position const SlaveLeaderPos = {689.7158f, -104.8736f, 513.7360f, 0.0f};
@@ -222,7 +224,7 @@ class instance_pit_of_saron : public InstanceMapScript
return true;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -235,7 +237,7 @@ class instance_pit_of_saron : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
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 b6c821ef66a..eba19403517 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "pit_of_saron.h"
#include "Vehicle.h"
diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
index b66c3d795f3..3724aaf69e2 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp
@@ -19,8 +19,10 @@
* Comment: The event with the Living Mojos is not implemented, just is done that when one of the mojos around the boss take damage will make the boss enter in combat!
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
+#include "SpellInfo.h"
enum Spells
{
@@ -189,7 +191,7 @@ class boss_drakkari_colossus : public CreatureScript
}
}
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 data) const
{
if (data == DATA_COLOSSUS_PHASE)
return phase;
diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
index 3e803c24d61..b75c5cbc2a9 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
index be9b09a1263..a7933fed046 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
//Spells
@@ -37,16 +38,12 @@ enum Spells
//Yells
enum Yells
{
- SAY_AGGRO = -1604000,
- SAY_SLAY_1 = -1604001,
- SAY_SLAY_2 = -1604002,
- SAY_SLAY_3 = -1604003,
- SAY_DEATH = -1604004,
- SAY_SUMMON_RHINO_1 = -1604005,
- SAY_SUMMON_RHINO_2 = -1604006,
- SAY_SUMMON_RHINO_3 = -1604007,
- SAY_TRANSFORM_1 = -1604008, //Phase change
- SAY_TRANSFORM_2 = -1604009
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SUMMON_RHINO = 3,
+ SAY_TRANSFORM_1 = 4,
+ SAY_TRANSFORM_2 = 5
};
enum Displays
@@ -124,7 +121,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS);
@@ -145,7 +142,7 @@ public:
me->SetDisplayId(DISPLAY_RHINO);
Phase = RHINO;
uiPhaseCounter = 0;
- DoScriptText(SAY_TRANSFORM_1, me);
+ Talk(SAY_TRANSFORM_1);
uiTransformationTimer = 5*IN_MILLISECONDS;
bStartOfTransformation = true;
me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT);
@@ -168,7 +165,7 @@ public:
if (uiStampedeTimer <= diff)
{
DoCast(me, SPELL_STAMPEDE);
- DoScriptText(RAND(SAY_SUMMON_RHINO_1, SAY_SUMMON_RHINO_2, SAY_SUMMON_RHINO_3), me);
+ Talk(SAY_SUMMON_RHINO);
uiStampedeTimer = 15*IN_MILLISECONDS;
} else uiStampedeTimer -= diff;
@@ -188,7 +185,7 @@ public:
me->SetDisplayId(DISPLAY_TROLL);
Phase = TROLL;
uiPhaseCounter = 0;
- DoScriptText(SAY_TRANSFORM_2, me);
+ Talk(SAY_TRANSFORM_2);
uiTransformationTimer = 9*IN_MILLISECONDS;
bStartOfTransformation = true;
me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT);
@@ -257,7 +254,7 @@ public:
impaledList.push_back(guid);
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_SHARE_THE_LOVE)
return shareTheLove;
@@ -267,7 +264,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_GAL_DARAH_EVENT, DONE);
@@ -278,7 +275,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
index 1085e993322..d5e10aedd70 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gundrak.h"
enum eSpells
@@ -33,14 +34,12 @@ enum eSpells
enum eSays
{
- SAY_AGGRO = -1604010,
- //SAY_SLAY_1 = -1604011, // not in db
- SAY_SLAY_2 = -1604012,
- SAY_SLAY_3 = -1604013,
- SAY_DEATH = -1604014,
- SAY_TRANSFORM = -1604015,
- SAY_QUAKE = -1604016,
- EMOTE_TRANSFORM = -1604017
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_TRANSFORM = 3,
+ SAY_QUAKE = 4,
+ EMOTE_TRANSFORM = 5
};
#define DATA_LESS_RABI 1
@@ -85,7 +84,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_MOJO_FRENZY, true);
if (instance)
@@ -106,7 +105,7 @@ public:
if (uiGroundTremorTimer <= uiDiff)
{
- DoScriptText(SAY_QUAKE, me);
+ Talk(SAY_QUAKE);
if (bPhase)
DoCast(me->getVictim(), SPELL_QUAKE, true);
else
@@ -134,8 +133,8 @@ public:
if (!bPhase && uiTransformationTImer <= uiDiff)
{
- DoScriptText(EMOTE_TRANSFORM, me);
- DoScriptText(SAY_TRANSFORM, me);
+ Talk(EMOTE_TRANSFORM);
+ Talk(SAY_TRANSFORM);
DoCast(me, SPELL_TRANSFORMATION, false);
uiTransformationTImer = 10*IN_MILLISECONDS;
} else uiTransformationTImer -= uiDiff;
@@ -143,7 +142,7 @@ public:
DoMeleeAttackIfReady();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_LESS_RABI)
return bPhase ? 0 : 1;
@@ -153,7 +152,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MOORABI_EVENT, DONE);
@@ -164,7 +163,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
index b827f43dc99..cdbce68e337 100644
--- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
+++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "gundrak.h"
+#include "Player.h"
//Spells
enum Spells
@@ -32,13 +35,12 @@ enum Spells
//Yell
enum Yells
{
- SAY_AGGRO = -1604017,
- SAY_SLAY_1 = -1604018,
- SAY_SLAY_2 = -1604019,
- SAY_SLAY_3 = -1604020,
- SAY_DEATH = -1604021,
- SAY_SUMMON_SNAKES = -1604022,
- SAY_SUMMON_CONSTRICTORS = -1604023
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SUMMON_SNAKES = 3,
+ SAY_SUMMON_CONSTRICTORS = 4,
+ EMOTE_NOVA = 5
};
//Creatures
@@ -114,7 +116,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS);
@@ -129,6 +131,7 @@ public:
if (uiPoisonNovaTimer <= diff)
{
DoCast(me->getVictim(), SPELL_POISON_NOVA);
+ Talk(EMOTE_NOVA);
uiPoisonNovaTimer = 15*IN_MILLISECONDS;
} else uiPoisonNovaTimer -= diff;
@@ -160,13 +163,13 @@ public:
if (uiPhase == 0 && HealthBelowPct(30))
{
- DoScriptText(SAY_SUMMON_SNAKES, me);
+ Talk(SAY_SUMMON_SNAKES);
uiPhase = 1;
}
if (uiPhase == 1 && HealthBelowPct(25))
{
- DoScriptText(SAY_SUMMON_CONSTRICTORS, me);
+ Talk(SAY_SUMMON_CONSTRICTORS);
uiPhase = 2;
}
@@ -175,7 +178,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
lSummons.DespawnAll();
if (instance)
@@ -184,7 +187,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summoned)
@@ -322,4 +325,4 @@ void AddSC_boss_slad_ran()
new mob_slad_ran_constrictor();
new mob_slad_ran_viper();
new achievement_snakes_whyd_it_have_to_be_snakes();
-} \ No newline at end of file
+}
diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
index c22a0e17cd5..b8b9c2e9053 100644
--- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
+++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "gundrak.h"
+#include "Player.h"
+#include "TemporarySummon.h"
#define MAX_ENCOUNTER 5
@@ -316,7 +319,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -337,7 +340,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
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 367240cd2df..f28b94c858e 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -20,6 +20,7 @@
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "icecrown_citadel.h"
+#include "Player.h"
enum Texts
{
@@ -1336,6 +1337,7 @@ class npc_dark_nucleus : public CreatureScript
{
_targetAuraCheck = 1000;
if (Unit* victim = me->getVictim())
+ {
if (me->GetDistance(victim) < 15.0f &&
!victim->HasAura(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID()))
{
@@ -1344,6 +1346,7 @@ class npc_dark_nucleus : public CreatureScript
}
else
MoveInLineOfSight(me->getVictim());
+ }
}
else
_targetAuraCheck -= diff;
@@ -1583,7 +1586,7 @@ class spell_valanar_kinetic_bomb_absorb : public SpellScriptLoader
void OnAbsorb(AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount)
{
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), aurEff->GetAmount());
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), aurEff->GetAmount());
RoundToInterval<uint32>(absorbAmount, 0, dmgInfo.GetDamage());
dmgInfo.AbsorbDamage(absorbAmount);
}
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 0d092ec86b2..2b240bc93d8 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
@@ -37,6 +37,7 @@ enum Texts
SAY_WIPE = 9,
SAY_BERSERK = 10,
SAY_DEATH = 11,
+ EMOTE_BERSERK_RAID = 12
};
enum Spells
@@ -336,7 +337,7 @@ class boss_blood_queen_lana_thel : public CreatureScript
switch (eventId)
{
case EVENT_BERSERK:
- DoScriptText(EMOTE_GENERIC_BERSERK_RAID, me);
+ Talk(EMOTE_BERSERK_RAID);
Talk(SAY_BERSERK);
DoCast(me, SPELL_BERSERK);
break;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
index 5d3a6814eb2..9ee4bcea4d9 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp
@@ -21,6 +21,7 @@
#include "ScriptedGossip.h"
#include "SpellAuras.h"
#include "icecrown_citadel.h"
+#include "Player.h"
enum ScriptTexts
{
@@ -496,7 +497,7 @@ class boss_deathbringer_saurfang : public CreatureScript
DoMeleeAttackIfReady();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_MADE_A_MESS)
if (_fallenChampionCastCount < RAID_MODE<uint32>(3, 5, 3, 5))
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
index 58856f9fb44..9c0f2139b1b 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp
@@ -244,7 +244,7 @@ class boss_festergut : public CreatureScript
_maxInoculatedStack = data;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_INOCULATED_STACK)
return uint32(_maxInoculatedStack);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index e2f9faf6a97..8e7f891663e 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -22,6 +22,7 @@
#include "Group.h"
#include "icecrown_citadel.h"
#include "SpellInfo.h"
+#include "Player.h"
enum ScriptTexts
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 0c5cb0aba52..263d70c6a50 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -21,6 +21,7 @@
#include "SpellAuras.h"
#include "MapManager.h"
#include "icecrown_citadel.h"
+#include "Player.h"
enum ScriptTexts
{
@@ -246,7 +247,7 @@ class boss_lord_marrowgar : public CreatureScript
return &_coldflameLastPos;
}
- uint64 GetGUID(int32 type/* = 0 */)
+ uint64 GetGUID(int32 type/* = 0 */) const
{
if (type == DATA_COLDFLAME_GUID)
return _coldflameTarget;
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index a9ba0baa86f..4727504a4bd 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -23,6 +23,7 @@
#include "Spell.h"
#include "icecrown_citadel.h"
#include "Vehicle.h"
+#include "GridNotifiers.h"
enum ScriptTexts
{
@@ -185,12 +186,15 @@ class AbominationDespawner
if (Vehicle* veh = summon->GetVehicleKit())
veh->RemoveAllPassengers(); // also despawns the vehicle
+ // Found unit is Mutated Abomination, remove it
return true;
}
+ // Found unit is not Mutated Abomintaion, leave it
return false;
}
+ // No unit found, remove from SummonList
return true;
}
@@ -198,6 +202,19 @@ class AbominationDespawner
Unit* _owner;
};
+struct RotfaceHeightCheck
+{
+ RotfaceHeightCheck(Creature* rotface) : _rotface(rotface) { }
+
+ bool operator()(Creature* stalker) const
+ {
+ return stalker->GetPositionZ() < _rotface->GetPositionZ() + 5.0f;
+ }
+
+private:
+ Creature* _rotface;
+};
+
class boss_professor_putricide : public CreatureScript
{
public:
@@ -246,7 +263,7 @@ class boss_professor_putricide : public CreatureScript
events.Reset();
events.ScheduleEvent(EVENT_BERSERK, 600000);
events.ScheduleEvent(EVENT_SLIME_PUDDLE, 10000);
- events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(25000, 30000));
+ events.ScheduleEvent(EVENT_UNSTABLE_EXPERIMENT, urand(30000, 35000));
if (IsHeroic())
events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 20000);
@@ -295,18 +312,16 @@ class boss_professor_putricide : public CreatureScript
// no possible aura seen in sniff adding the aurastate
summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true);
- summon->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, summon, false);
summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
- return;
+ break;
case NPC_VOLATILE_OOZE:
// no possible aura seen in sniff adding the aurastate
summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true);
summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true);
- summon->CastSpell(summon, SPELL_VOLATILE_OOZE_ADHESIVE, false);
summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
- return;
+ break;
case NPC_CHOKING_GAS_BOMB:
summon->CastSpell(summon, SPELL_CHOKING_GAS_BOMB_PERIODIC, true);
summon->CastSpell(summon, SPELL_CHOKING_GAS_EXPLOSION_TRIGGER, true);
@@ -428,7 +443,8 @@ class boss_professor_putricide : public CreatureScript
if (Creature* rotface = Unit::GetCreature(*me, instance->GetData64(DATA_ROTFACE)))
{
std::list<Creature*> list;
- GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 36.0f);
+ GetCreatureListWithEntryInGrid(list, rotface, NPC_PUDDLE_STALKER, 50.0f);
+ list.remove_if(RotfaceHeightCheck(rotface));
if (list.size() > 4)
{
list.sort(Trinity::ObjectDistanceOrderPred(rotface));
@@ -510,7 +526,6 @@ class boss_professor_putricide : public CreatureScript
SetPhase(PHASE_COMBAT_3);
events.ScheduleEvent(EVENT_MUTATED_PLAGUE, 25000);
events.CancelEvent(EVENT_UNSTABLE_EXPERIMENT);
- summons.remove_if(AbominationDespawner(me));
break;
default:
break;
@@ -521,21 +536,15 @@ class boss_professor_putricide : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
case DATA_EXPERIMENT_STAGE:
- {
- // ALSO MODIFIES!
- uint32 ret = uint32(_experimentState);
- _experimentState ^= true;
- return ret;
- }
+ return _experimentState;
case DATA_PHASE:
return _phase;
case DATA_ABOMINATION:
- summons.RemoveNotExisting();
return uint32(summons.HasEntry(NPC_MUTATED_ABOMINATION_10) || summons.HasEntry(NPC_MUTATED_ABOMINATION_25));
default:
break;
@@ -544,6 +553,12 @@ class boss_professor_putricide : public CreatureScript
return 0;
}
+ void SetData(uint32 id, uint32 data)
+ {
+ if (id == DATA_EXPERIMENT_STAGE)
+ _experimentState = bool(data);
+ }
+
void UpdateAI(uint32 const diff)
{
if ((!(events.GetPhaseMask() & PHASE_MASK_NOT_SELF) && !UpdateVictim()) || !CheckInRoom())
@@ -643,7 +658,7 @@ class boss_professor_putricide : public CreatureScript
case EVENT_UNBOUND_PLAGUE:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)))
{
- me->CastCustomSpell(SPELL_UNBOUND_PLAGUE, SPELLVALUE_BASE_POINT0, 775, target);
+ DoCast(target, SPELL_UNBOUND_PLAGUE);
DoCast(target, SPELL_UNBOUND_PLAGUE_SEARCHER);
}
events.ScheduleEvent(EVENT_UNBOUND_PLAGUE, 90000);
@@ -668,6 +683,7 @@ class boss_professor_putricide : public CreatureScript
me->SetFacingToObject(face);
me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
Talk(SAY_TRANSFORM_2);
+ summons.remove_if(AbominationDespawner(me));
events.ScheduleEvent(EVENT_RESUME_ATTACK, 8500, 0, PHASE_COMBAT_3);
break;
default:
@@ -702,57 +718,78 @@ class boss_professor_putricide : public CreatureScript
}
};
-class npc_volatile_ooze : public CreatureScript
+class npc_putricide_oozeAI : public ScriptedAI
{
public:
- npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { }
+ npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature),
+ _hitTargetSpellId(hitTargetSpellId), _newTargetSelectTimer(0)
+ {
+ }
- struct npc_putricide_oozeAI : public ScriptedAI
+ void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
{
- npc_putricide_oozeAI(Creature* creature) : ScriptedAI(creature)
- {
- _newTargetSelectTimer = 0;
- }
+ if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(_hitTargetSpellId, me))
+ _newTargetSelectTimer = 1000;
+ }
- void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
- {
- if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_OOZE_ERUPTION, me))
- _newTargetSelectTimer = 1000;
- }
+ void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_TEAR_GAS_CREATURE)
+ _newTargetSelectTimer = 1000;
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim() && !_newTargetSelectTimer)
+ return;
- void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
+ if (!_newTargetSelectTimer && !me->IsNonMeleeSpellCasted(false, false, true, false, true))
+ _newTargetSelectTimer = 1000;
+
+ DoMeleeAttackIfReady();
+
+ if (!_newTargetSelectTimer)
+ return;
+
+ if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
+ return;
+
+ if (_newTargetSelectTimer <= diff)
{
- if (spell->Id == SPELL_TEAR_GAS_CREATURE)
- _newTargetSelectTimer = 1000;
+ _newTargetSelectTimer = 0;
+ CastMainSpell();
}
+ else
+ _newTargetSelectTimer -= diff;
+ }
- void UpdateAI(uint32 const diff)
- {
- if (!UpdateVictim() && !_newTargetSelectTimer)
- return;
+ virtual void CastMainSpell() = 0;
- if (!_newTargetSelectTimer)
- return;
+ private:
+ uint32 _hitTargetSpellId;
+ uint32 _newTargetSelectTimer;
+};
- if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
- return;
+class npc_volatile_ooze : public CreatureScript
+{
+ public:
+ npc_volatile_ooze() : CreatureScript("npc_volatile_ooze") { }
- if (_newTargetSelectTimer <= diff)
- {
- _newTargetSelectTimer = 0;
- me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false);
- }
- else
- _newTargetSelectTimer -= diff;
+ struct npc_volatile_oozeAI : public npc_putricide_oozeAI
+ {
+ npc_volatile_oozeAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_OOZE_ERUPTION)
+ {
}
- private:
- uint32 _newTargetSelectTimer;
+ void CastMainSpell()
+ {
+ me->CastSpell(me, SPELL_VOLATILE_OOZE_ADHESIVE, false);
+ }
};
CreatureAI* GetAI(Creature* creature) const
{
- return GetIcecrownCitadelAI<npc_putricide_oozeAI>(creature);
+ return GetIcecrownCitadelAI<npc_volatile_oozeAI>(creature);
}
};
@@ -761,45 +798,16 @@ class npc_gas_cloud : public CreatureScript
public:
npc_gas_cloud() : CreatureScript("npc_gas_cloud") { }
- struct npc_gas_cloudAI : public ScriptedAI
+ struct npc_gas_cloudAI : public npc_putricide_oozeAI
{
- npc_gas_cloudAI(Creature* creature) : ScriptedAI(creature)
+ npc_gas_cloudAI(Creature* creature) : npc_putricide_oozeAI(creature, SPELL_EXPUNGED_GAS)
{
_newTargetSelectTimer = 0;
}
- void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell)
- {
- if (!_newTargetSelectTimer && spell->Id == sSpellMgr->GetSpellIdForDifficulty(SPELL_EXPUNGED_GAS, me))
- _newTargetSelectTimer = 1000;
- }
-
- void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
- {
- if (spell->Id == SPELL_TEAR_GAS_CREATURE)
- _newTargetSelectTimer = 1000;
- }
-
- void UpdateAI(uint32 const diff)
+ void CastMainSpell()
{
- if (!UpdateVictim() && !_newTargetSelectTimer)
- return;
-
- DoMeleeAttackIfReady();
-
- if (!_newTargetSelectTimer)
- return;
-
- if (me->HasAura(SPELL_TEAR_GAS_CREATURE))
- return;
-
- if (_newTargetSelectTimer <= diff)
- {
- _newTargetSelectTimer = 0;
- me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false);
- }
- else
- _newTargetSelectTimer -= diff;
+ me->CastCustomSpell(SPELL_GASEOUS_BLOAT, SPELLVALUE_AURA_STACK, 10, me, false);
}
private:
@@ -900,23 +908,12 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff
}
- // temporary, until SelectTarget are not called on empty lists
- void CheckTarget()
- {
- if (_target)
- return;
-
- FinishCast(SPELL_FAILED_NO_VALID_TARGETS);
- GetCaster()->ToCreature()->DespawnOrUnsummon(1); // despawn next update
- }
-
void Register()
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_ooze_channel_SpellScript::SetTarget, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
AfterHit += SpellHitFn(spell_putricide_ooze_channel_SpellScript::StartAttack);
- OnCast += SpellCastFn(spell_putricide_ooze_channel_SpellScript::CheckTarget);
}
WorldObject* _target;
@@ -1013,7 +1010,11 @@ class spell_putricide_unstable_experiment : public SpellScriptLoader
if (GetCaster()->GetTypeId() != TYPEID_UNIT)
return;
- uint32 stage = GetCaster()->ToCreature()->AI()->GetData(DATA_EXPERIMENT_STAGE);
+ Creature* creature = GetCaster()->ToCreature();
+
+ uint32 stage = creature->AI()->GetData(DATA_EXPERIMENT_STAGE);
+ creature->AI()->SetData(DATA_EXPERIMENT_STAGE, stage ^ true);
+
Creature* target = NULL;
std::list<Creature*> creList;
GetCreatureListWithEntryInGrid(creList, GetCaster(), NPC_ABOMINATION_WING_MAD_SCIENTIST_STALKER, 200.0f);
@@ -1125,6 +1126,22 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
return true;
}
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (AuraEffect const* eff = GetCaster()->GetAuraEffect(SPELL_UNBOUND_PLAGUE_SEARCHER, EFFECT_0))
+ {
+ if (eff->GetTickNumber() < 2)
+ {
+ targets.clear();
+ return;
+ }
+ }
+
+
+ targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster())));
+ Trinity::Containers::RandomResizeList(targets, 1);
+ }
+
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (!GetHitUnit())
@@ -1159,6 +1176,7 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
void Register()
{
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_putricide_unbound_plague_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
OnEffectHitTarget += SpellEffectFn(spell_putricide_unbound_plague_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
index 5a0560293da..03427a4cfc2 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp
@@ -124,9 +124,9 @@ class boss_rotface : public CreatureScript
void JustDied(Unit* /*killer*/)
{
+ instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION);
_JustDied();
Talk(SAY_DEATH);
- instance->DoRemoveAurasDueToSpellOnPlayers(MUTATED_INFECTION);
if (Creature* professor = Unit::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
professor->AI()->DoAction(ACTION_ROTFACE_DEATH);
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
index e3c0f2260df..96cabfed918 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp
@@ -36,6 +36,7 @@ enum Texts
// A flaw of mortality...
SAY_BERSERK = 9, // Enough! I tire of these games!
SAY_DEATH = 10, // Free...at last...
+ EMOTE_BERSERK_RAID = 11
};
enum Spells
@@ -290,7 +291,7 @@ class boss_sindragosa : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_MYSTIC_BUFFET_STACK)
return _mysticBuffetStack;
@@ -440,7 +441,7 @@ class boss_sindragosa : public CreatureScript
switch (eventId)
{
case EVENT_BERSERK:
- DoScriptText(EMOTE_GENERIC_BERSERK_RAID, me);
+ Talk(EMOTE_BERSERK_RAID);
Talk(SAY_BERSERK);
DoCast(me, SPELL_BERSERK);
break;
@@ -978,7 +979,7 @@ class npc_sindragosa_trash : public CreatureScript
_isTaunted = data != 0;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_FROSTWYRM_OWNER)
return _frostwyrmId;
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 a8657925131..ec5172aeb83 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp
@@ -636,7 +636,7 @@ class boss_the_lich_king : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -2112,7 +2112,7 @@ class spell_the_lich_king_necrotic_plague : public SpellScriptLoader
CustomSpellValues values;
//values.AddSpellMod(SPELLVALUE_AURA_STACK, 2);
values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1);
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2204,7 +2204,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
}
@@ -2223,7 +2223,7 @@ class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader
CustomSpellValues values;
values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount());
values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1)
- GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID());
+ GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, TRIGGERED_FULL_MASK, NULL, NULL, GetCasterGUID());
if (Unit* caster = GetCaster())
caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true);
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
index 826c62a4390..cc40a076300 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp
@@ -460,7 +460,7 @@ class boss_valithria_dreamwalker : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == MISSED_PORTALS)
return _missedPortals;
@@ -1019,7 +1019,7 @@ class npc_dream_portal : public CreatureScript
me->DespawnOrUnsummon();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
return (type == MISSED_PORTALS && _used) ? 0 : 1;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
index 31639a698ef..4e117d9f3e3 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h
@@ -21,6 +21,7 @@
#include "SpellScript.h"
#include "Map.h"
#include "Creature.h"
+#include "SpellMgr.h"
#define ICCScriptName "instance_icecrown_citadel"
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
index af8aba57a6d..7ff995d4bcf 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp
@@ -20,6 +20,7 @@
#include "InstanceScript.h"
#include "icecrown_citadel.h"
#include "Spell.h"
+#include "Player.h"
#define GOSSIP_SENDER_ICC_PORT 631
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
index 650f426d29c..89d7b0f764d 100755..100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp
@@ -23,6 +23,9 @@
#include "PoolMgr.h"
#include "AccountMgr.h"
#include "icecrown_citadel.h"
+#include "Player.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
enum EventIds
{
@@ -589,7 +592,7 @@ class instance_icecrown_citadel : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -614,7 +617,7 @@ class instance_icecrown_citadel : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
index 1671eab0b32..61ce8817b17 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp
@@ -15,14 +15,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
-#define SAY_GREET RAND(-1533000, -1533004, -1533005, -1533006, -1533007)
-#define SAY_AGGRO RAND(-1533001, -1533002, -1533003)
-#define SAY_SLAY -1533008
+enum Anubrekhan
+{
+ SAY_AGGRO = 0,
+ SAY_GREET = 1,
+ SAY_SLAY = 2,
-#define MOB_CRYPT_GUARD 16573
+ MOB_CRYPT_GUARD = 16573
+};
const Position GuardSummonPos = {3333.72f, -3476.30f, 287.1f, 6.2801f};
@@ -96,7 +100,7 @@ public:
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, NULL, NULL, me->GetGUID());
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -110,7 +114,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_IMPALE, urand(10000, 20000));
events.ScheduleEvent(EVENT_LOCUST, 90000);
events.ScheduleEvent(EVENT_BERSERK, 600000);
@@ -123,7 +127,7 @@ public:
{
if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f) && who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(SAY_GREET, me);
+ Talk(SAY_GREET);
hasTaunted = true;
}
ScriptedAI::MoveInLineOfSight(who);
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
index 058c5b35e3a..58db1d9caea 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp
@@ -15,19 +15,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
+#include "SpellInfo.h"
enum Yells
{
- SAY_GREET = -1533009,
- SAY_AGGRO_1 = -1533010,
- SAY_AGGRO_2 = -1533011,
- SAY_AGGRO_3 = -1533012,
- SAY_AGGRO_4 = -1533013,
- SAY_SLAY_1 = -1533014,
- SAY_SLAY_2 = -1533015,
- SAY_DEATH = -1533016
+ SAY_GREET = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3
};
enum Spells
@@ -69,7 +67,7 @@ class boss_faerlina : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3, SAY_AGGRO_4), me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_POISON, urand(10000, 15000));
events.ScheduleEvent(EVENT_FIRE, urand(6000, 18000));
events.ScheduleEvent(EVENT_FRENZY, urand(60000, 80000));
@@ -86,7 +84,7 @@ class boss_faerlina : public CreatureScript
{
if (!_introDone && who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(SAY_GREET, me);
+ Talk(SAY_GREET);
_introDone = true;
}
@@ -96,13 +94,13 @@ class boss_faerlina : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
if (!urand(0, 2))
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void SpellHit(Unit* caster, SpellInfo const* spell)
@@ -116,7 +114,7 @@ class boss_faerlina : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_FRENZY_DISPELS)
return _frenzyDispels;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index f81ddbf6bf8..7785044e7d1 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -73,17 +73,14 @@ const uint32 SPELL_SECONDARY_H[]= {0, 57464, 0, 57465};
const uint32 SPELL_PUNISH[] = {0, 57381, 0, 57377};
#define SPELL_BERSERK 26662
-// used by 16063, 16064, 16065, 30549, but signed for 16063
-const int32 SAY_AGGRO[] = {-1533051, -1533044, -1533065, -1533058};
-const int32 SAY_TAUNT[3][4] ={ {-1533052, -1533045, -1533071, -1533059},
- {-1533053, -1533046, -1533072, -1533060},
- {-1533054, -1533047, -1533073, -1533061}, };
-const int32 SAY_SPECIAL[] = {-1533055, -1533048, -1533070, -1533062};
-const int32 SAY_SLAY[] = {-1533056, -1533049, -1533068, -1533063};
-const int32 SAY_DEATH[] = {-1533057, -1533050, -1533074, -1533064};
-
-#define SAY_BARON_AGGRO RAND(-1533065, -1533066, -1533067)
-#define SAY_BARON_SLAY RAND(-1533068, -1533069)
+enum FourHorsemen
+{
+ SAY_AGGRO = 0,
+ SAY_TAUNT = 1,
+ SAY_SPECIAL = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4
+};
class boss_four_horsemen : public CreatureScript
{
@@ -104,6 +101,7 @@ public:
if (me->GetEntry() == MOB_HORSEMEN[i])
id = Horsemen(i);
caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR);
+ encounterActionReset = false;
}
Horsemen id;
@@ -294,12 +292,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
if (!(rand()%5))
- {
- if (id == HORSEMEN_BARON)
- DoScriptText(SAY_BARON_SLAY, me);
- else
- DoScriptText(SAY_SLAY[id], me);
- }
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -320,17 +313,13 @@ public:
instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59450);
}
- DoScriptText(SAY_DEATH[id], me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
-
- if (id == HORSEMEN_BARON)
- DoScriptText(SAY_BARON_AGGRO, me);
- else
- DoScriptText(SAY_AGGRO[id], me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_MARK, 15000);
events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000);
@@ -359,13 +348,13 @@ public:
{
case EVENT_MARK:
if (!(rand()%5))
- DoScriptText(SAY_SPECIAL[id], me);
+ Talk(SAY_SPECIAL);
DoCastAOE(SPELL_MARK[id]);
events.ScheduleEvent(EVENT_MARK, 15000);
break;
case EVENT_CAST:
if (!(rand()%5))
- DoScriptText(SAY_TAUNT[rand()%3][id], me);
+ Talk(SAY_TAUNT);
if (caster)
{
@@ -378,7 +367,7 @@ public:
events.ScheduleEvent(EVENT_CAST, 15000);
break;
case EVENT_BERSERK:
- DoScriptText(SAY_SPECIAL[id], me);
+ Talk(SAY_SPECIAL);
DoCast(me, EVENT_BERSERK);
break;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index 47dfaa7f772..69443b2824e 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
#define SPELL_MORTAL_WOUND 25646
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index faaea9c4cae..14043f00939 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -24,10 +24,10 @@
enum Yells
{
- SAY_SPEECH = -1533040,
- SAY_KILL = -1533041,
- SAY_DEATH = -1533042,
- SAY_TELEPORT = -1533043
+ SAY_SPEECH = 0,
+ SAY_KILL = 1,
+ SAY_DEATH = 2,
+ SAY_TELEPORT = 3
};
//Gothik
@@ -200,7 +200,7 @@ class boss_gothik : public CreatureScript
if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
{
- sLog->outError("Script Gothik: cannot summon triggers!");
+ sLog->outError(LOG_FILTER_TSCR, "Script Gothik: cannot summon triggers!");
EnterEvadeMode();
return;
}
@@ -209,7 +209,7 @@ class boss_gothik : public CreatureScript
waveCount = 0;
events.ScheduleEvent(EVENT_SUMMON, 30000);
DoTeleportTo(PosPlatform);
- DoScriptText(SAY_SPEECH, me);
+ Talk(SAY_SPEECH);
if (instance)
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
}
@@ -239,7 +239,7 @@ class boss_gothik : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
if (!(rand()%5))
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
@@ -247,7 +247,7 @@ class boss_gothik : public CreatureScript
LiveTriggerGUID.clear();
DeadTriggerGUID.clear();
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
}
@@ -314,15 +314,14 @@ class boss_gothik : public CreatureScript
bool CheckGroupSplitted()
{
- bool checklife = false;
- bool checkdead = false;
-
Map* map = me->GetMap();
if (map && map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
{
+ bool checklife = false;
+ bool checkdead = false;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource() && i->getSource()->isAlive() &&
@@ -453,7 +452,7 @@ class boss_gothik : public CreatureScript
else
{
phaseTwo = true;
- DoScriptText(SAY_TELEPORT, me);
+ Talk(SAY_TELEPORT);
DoTeleportTo(PosGroundLiveSide);
me->SetReactState(REACT_AGGRESSIVE);
DummyEntryCheckPredicate pred;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
index 039b9b1e007..7ed9e950b53 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp
@@ -15,8 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
+#include "SpellInfo.h"
#define SPELL_BOMBARD_SLIME 28280
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
index 32741414579..8be4ac6b8b6 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp
@@ -15,17 +15,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
#include "naxxramas.h"
+#include "Player.h"
-#define SAY_AGGRO RAND(-1533109, -1533110, -1533111)
-#define SAY_SLAY -1533112
-#define SAY_TAUNT RAND(-1533113, -1533114, -1533115, -1533116, -1533117)
-#define SAY_DEATH -1533118
-
-#define SPELL_SPELL_DISRUPTION 29310
-#define SPELL_DECREPIT_FEVER RAID_MODE(29998, 55011)
-#define SPELL_PLAGUE_CLOUD 29350
+enum Heigan
+{
+ SPELL_DECREPIT_FEVER = 29998, // 25-man: 55011
+ SPELL_SPELL_DISRUPTION = 29310,
+ SPELL_PLAGUE_CLOUD = 29350,
+
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_TAUNT = 2,
+ SAY_DEATH = 3
+};
enum Events
{
@@ -67,7 +73,7 @@ public:
void KilledUnit(Unit* who)
{
if (!(rand()%5))
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
if (who->GetTypeId() == TYPEID_PLAYER)
safetyDance = false;
}
@@ -78,7 +84,7 @@ public:
safetyDance = data ? true : false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_SAFETY_DANCE)
return safetyDance ? 1 : 0;
@@ -89,13 +95,13 @@ public:
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
EnterPhase(PHASE_FIGHT);
safetyDance = true;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
index 38c22a93ac4..183fb40e5a0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp
@@ -23,40 +23,36 @@ SDComment: VERIFY SCRIPT
SDCategory: Naxxramas
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "naxxramas.h"
+#include "Player.h"
enum Yells
{
//when shappiron dies. dialog between kel and lich king (in this order)
- SAY_SAPP_DIALOG1 = -1533084, //not used
- SAY_SAPP_DIALOG2_LICH = -1533085, //not used
- SAY_SAPP_DIALOG3 = -1533086, //not used
- SAY_SAPP_DIALOG4_LICH = -1533087, //not used
- SAY_SAPP_DIALOG5 = -1533088, //not used
- SAY_CAT_DIED = -1533089, //when cat dies, not used
+ SAY_SAPP_DIALOG1 = 0, //not used
+ SAY_SAPP_DIALOG2_LICH = 1, //not used
+ SAY_SAPP_DIALOG3 = 2, //not used
+ SAY_SAPP_DIALOG4_LICH = 3, //not used
+ SAY_SAPP_DIALOG5 = 4, //not used
+ SAY_CAT_DIED = 5, //when cat dies, not used
//when each of the 4 wing bosses dies
- SAY_TAUNT1 = -1533090, //not used
- SAY_TAUNT2 = -1533091, //not used
- SAY_TAUNT3 = -1533092, //not used
- SAY_TAUNT4 = -1533093, //not used
- SAY_SUMMON_MINIONS = -1533105, //start of phase 1
- SAY_AGGRO_1 = -1533094, //start of phase 2
- SAY_AGGRO_2 = -1533095,
- SAY_AGGRO_3 = -1533096,
- SAY_SLAY_1 = -1533097,
- SAY_SLAY_2 = -1533098,
- SAY_DEATH = -1533099,
- SAY_CHAIN_1 = -1533100,
- SAY_CHAIN_2 = -1533101,
- SAY_FROST_BLAST = -1533102,
- SAY_SPECIAL_1 = -1533106,
- SAY_SPECIAL_2 = -1533107,
- SAY_SPECIAL_3 = -1533108,
- SAY_REQUEST_AID = -1533103, //start of phase 3
- SAY_ANSWER_REQUEST = -1533104 //lich king answer
+ SAY_TAUNT = 6,
+ SAY_AGGRO = 7,
+ SAY_SLAY = 8,
+ SAY_DEATH = 9,
+ SAY_CHAIN = 10,
+ SAY_FROST_BLAST = 11,
+ SAY_REQUEST_AID = 12, //start of phase 3
+ SAY_ANSWER_REQUEST = 13, //lich king answer
+ SAY_SUMMON_MINIONS = 14, //start of phase 1
+ SAY_SPECIAL = 15
};
-enum Event
+
+enum Events
{
EVENT_NONE,
EVENT_BOLT,
@@ -336,13 +332,13 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
std::map<uint64, float>::const_iterator itr;
for (itr = chained.begin(); itr != chained.end(); ++itr)
@@ -365,7 +361,7 @@ public:
pPortal->ResetDoorOrButton();
}
DoCast(me, SPELL_KELTHUZAD_CHANNEL, false);
- DoScriptText(SAY_SUMMON_MINIONS, me);
+ Talk(SAY_SUMMON_MINIONS);
Phase = 1;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE);
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 4);
@@ -430,7 +426,7 @@ public:
break;
case EVENT_PHASE:
events.Reset();
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
spawns.DespawnAll();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE);
me->CastStop();
@@ -459,10 +455,10 @@ public:
if (HealthBelowPct(45))
{
Phase = 3;
- DoScriptText(SAY_REQUEST_AID, me);
+ Talk(SAY_REQUEST_AID);
//here Lich King should respond to KelThuzad but I don't know which Creature to make talk
//so for now just make Kelthuzad says it.
- DoScriptText(SAY_ANSWER_REQUEST, me);
+ Talk(SAY_ANSWER_REQUEST);
for (uint8 i = 0; i <= 3; ++i)
{
@@ -518,7 +514,7 @@ public:
}
}
if (!chained.empty())
- DoScriptText(RAND(SAY_CHAIN_1, SAY_CHAIN_2), me);
+ Talk(SAY_CHAIN);
events.RepeatEvent(urand(100000, 180000));
break;
}
@@ -604,13 +600,17 @@ public:
case EVENT_DETONATE:
{
std::vector<Unit*> unitList;
- std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr)
+ ThreatContainer::StorageType const &threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
- if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER
- && (*itr)->getTarget()->getPowerType() == POWER_MANA
- && (*itr)->getTarget()->GetPower(POWER_MANA))
- unitList.push_back((*itr)->getTarget());
+ Unit * const target = (*itr)->getTarget();
+
+ if (target->GetTypeId() == TYPEID_PLAYER
+ && target->getPowerType() == POWER_MANA
+ && target->GetPower(POWER_MANA))
+ {
+ unitList.push_back(target);
+ }
}
if (!unitList.empty())
@@ -618,7 +618,7 @@ public:
std::vector<Unit*>::const_iterator itr = unitList.begin();
advance(itr, rand()%unitList.size());
DoCast(*itr, SPELL_MANA_DETONATION);
- DoScriptText(RAND(SAY_SPECIAL_1, SAY_SPECIAL_2, SAY_SPECIAL_3), me);
+ Talk(SAY_SPECIAL);
}
events.RepeatEvent(urand(20000, 50000));
@@ -633,7 +633,7 @@ public:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true))
DoCast(target, SPELL_FROST_BLAST);
if (rand()%2)
- DoScriptText(SAY_FROST_BLAST, me);
+ Talk(SAY_FROST_BLAST);
events.RepeatEvent(urand(30000, 90000));
break;
default:
@@ -651,7 +651,6 @@ public:
{
return new boss_kelthuzadAI (creature);
}
-
};
class at_kelthuzad_center : public AreaTriggerScript
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
index 58d3a4240b2..183d56a48c0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "naxxramas.h"
enum Spells
@@ -82,7 +85,7 @@ class boss_loatheb : public CreatureScript
_sporeLoserData = false;
}
- uint32 GetData(uint32 id)
+ uint32 GetData(uint32 id) const
{
if (id != DATA_ACHIEVEMENT_SPORE_LOSER)
return 0;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
index 3c258f08030..8ec9bac7e86 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#include "naxxramas.h"
enum Spells
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
index 75be596fd77..b670e36fa96 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp
@@ -15,24 +15,29 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
-#define SAY_AGGRO RAND(-1533075, -1533076, -1533077)
-#define SAY_SUMMON -1533078
-#define SAY_SLAY RAND(-1533079, -1533080)
-#define SAY_DEATH -1533081
+enum Noth
+{
+ SAY_AGGRO = 0,
+ SAY_SUMMON = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
-#define SOUND_DEATH 8848
+ SOUND_DEATH = 8848,
-#define SPELL_CURSE_PLAGUEBRINGER RAID_MODE(29213, 54835)
-#define SPELL_BLINK RAND(29208, 29209, 29210, 29211)
-#define SPELL_CRIPPLE RAID_MODE(29212, 54814)
-#define SPELL_TELEPORT 29216
+ SPELL_CURSE_PLAGUEBRINGER = 29213, // 25-man: 54835
+ SPELL_CRIPPLE = 29212, // 25-man: 54814
+ SPELL_TELEPORT = 29216,
-#define MOB_WARRIOR 16984
-#define MOB_CHAMPION 16983
-#define MOB_GUARDIAN 16981
+ MOB_WARRIOR = 16984,
+ MOB_CHAMPION = 16983,
+ MOB_GUARDIAN = 16981
+};
+
+#define SPELL_BLINK RAND(29208, 29209, 29210, 29211)
// Teleport position of Noth on his balcony
#define TELE_X 2631.370f
@@ -89,7 +94,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
balconyCount = 0;
EnterPhaseGround();
}
@@ -114,7 +119,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
if (!(rand()%5))
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summon)
@@ -127,7 +132,7 @@ public:
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void SummonUndead(uint32 entry, uint32 num)
@@ -156,7 +161,7 @@ public:
events.ScheduleEvent(EVENT_CURSE, urand(50000, 60000));
return;
case EVENT_WARRIOR:
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
SummonUndead(MOB_WARRIOR, RAID_MODE(2, 3));
events.ScheduleEvent(EVENT_WARRIOR, 30000);
return;
@@ -177,7 +182,7 @@ public:
waveCount = 0;
return;
case EVENT_WAVE:
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
switch (balconyCount)
{
case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2, 4)); break;
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
index b826a530719..d4b3f5ddce0 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
enum Spells
@@ -29,12 +30,11 @@ enum Spells
enum Yells
{
- SAY_AGGRO_1 = -1533017,
- SAY_AGGRO_2 = -1533018,
- SAY_SLAY = -1533019,
- SAY_DEATH = -1533020,
- EMOTE_BERSERK = -1533021,
- EMOTE_ENRAGE = -1533022,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ EMOTE_BERSERK = 3,
+ EMOTE_ENRAGE = 4
};
enum Events
@@ -77,20 +77,20 @@ public:
void KilledUnit(Unit* /*Victim*/)
{
if (!(rand()%5))
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Enraged = false;
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_HATEFUL, 1000);
events.ScheduleEvent(EVENT_BERSERK, 360000);
@@ -136,7 +136,7 @@ public:
}
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK, true);
- DoScriptText(EMOTE_BERSERK, me);
+ Talk(EMOTE_BERSERK);
events.ScheduleEvent(EVENT_SLIME, 2000);
break;
case EVENT_SLIME:
@@ -149,7 +149,7 @@ public:
if (!Enraged && HealthBelowPct(5))
{
DoCast(me, SPELL_FRENZY, true);
- DoScriptText(EMOTE_ENRAGE, me);
+ Talk(EMOTE_ENRAGE);
Enraged = true;
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
index e06aa6b03c5..d733cac001c 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "naxxramas.h"
//Razuvious - NO TEXT sound only
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
index 37fb5f3f4a9..aebd7fdc19c 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp
@@ -15,44 +15,47 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
+#include "SpellInfo.h"
#include "naxxramas.h"
-#define EMOTE_BREATH -1533082
-#define EMOTE_ENRAGE -1533083
-
-#define SPELL_FROST_AURA RAID_MODE(28531, 55799)
-#define SPELL_CLEAVE 19983
-#define SPELL_TAIL_SWEEP RAID_MODE(55697, 55696)
-#define SPELL_SUMMON_BLIZZARD 28560
-#define SPELL_LIFE_DRAIN RAID_MODE(28542, 55665)
-#define SPELL_ICEBOLT 28522
-#define SPELL_FROST_BREATH 29318
-#define SPELL_FROST_EXPLOSION 28524
-#define SPELL_FROST_MISSILE 30101
-#define SPELL_BERSERK 26662
-#define SPELL_DIES 29357
-
-#define SPELL_CHILL RAID_MODE(28547, 55699)
-
-#define MOB_BLIZZARD 16474
-#define GO_ICEBLOCK 181247
+enum Yells
+{
+ EMOTE_AIR_PHASE = 0,
+ EMOTE_GROUND_PHASE = 1,
+ EMOTE_BREATH = 2,
+ EMOTE_ENRAGE = 3
+};
-#define ACHIEVEMENT_THE_HUNDRED_CLUB RAID_MODE(2146, 2147)
-#define MAX_FROST_RESISTANCE 100
+enum Spells
+{
+ SPELL_FROST_AURA = 28531,
+ SPELL_CLEAVE = 19983,
+ SPELL_TAIL_SWEEP = 55697,
+ SPELL_SUMMON_BLIZZARD = 28560,
+ SPELL_LIFE_DRAIN = 28542,
+ SPELL_ICEBOLT = 28522,
+ SPELL_FROST_BREATH = 29318,
+ SPELL_FROST_EXPLOSION = 28524,
+ SPELL_FROST_MISSILE = 30101,
+ SPELL_BERSERK = 26662,
+ SPELL_DIES = 29357,
+ SPELL_CHILL = 28547,
+};
enum Phases
{
- PHASE_NULL = 0,
+ PHASE_NULL = 0,
PHASE_BIRTH,
PHASE_GROUND,
- PHASE_FLIGHT,
+ PHASE_FLIGHT
};
enum Events
{
- EVENT_NONE,
- EVENT_BERSERK,
+ EVENT_BERSERK = 1,
EVENT_CLEAVE,
EVENT_TAIL,
EVENT_DRAIN,
@@ -64,342 +67,362 @@ enum Events
EVENT_EXPLOSION,
EVENT_LAND,
EVENT_GROUND,
- EVENT_BIRTH,
+ EVENT_BIRTH
+};
+
+enum Misc
+{
+ NPC_BLIZZARD = 16474,
+ GO_ICEBLOCK = 181247,
+
+ // The Hundred Club
+ DATA_THE_HUNDRED_CLUB = 21462147,
+ MAX_FROST_RESISTANCE = 100
};
typedef std::map<uint64, uint64> IceBlockMap;
class boss_sapphiron : public CreatureScript
{
-public:
- boss_sapphiron() : CreatureScript("boss_sapphiron") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new boss_sapphironAI (creature);
- }
-
- struct boss_sapphironAI : public BossAI
- {
- boss_sapphironAI(Creature* creature) : BossAI(creature, BOSS_SAPPHIRON)
- , phase(PHASE_NULL)
+ public:
+ boss_sapphiron() : CreatureScript("boss_sapphiron") { }
+
+ struct boss_sapphironAI : public BossAI
{
- map = me->GetMap();
- }
+ boss_sapphironAI(Creature* creature) : BossAI(creature, BOSS_SAPPHIRON)
+ , _phase(PHASE_NULL)
+ {
+ _map = me->GetMap();
+ }
- Phases phase;
- uint32 iceboltCount;
- IceBlockMap iceblocks;
+ void InitializeAI()
+ {
+ float x, y, z;
+ me->GetPosition(x, y, z);
+ me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0);
+ me->SetVisible(false);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->SetReactState(REACT_PASSIVE);
+
+ BossAI::InitializeAI();
+ }
- bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147)
- uint32 CheckFrostResistTimer;
- Map* map;
+ void Reset()
+ {
+ _Reset();
- void InitializeAI()
- {
- float x, y, z;
- me->GetPosition(x, y, z);
- me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0);
- me->SetVisible(false);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->SetReactState(REACT_PASSIVE);
-
- ScriptedAI::InitializeAI();
- }
+ if (_phase == PHASE_FLIGHT)
+ ClearIceBlock();
- void Reset()
- {
- _Reset();
+ _phase = PHASE_NULL;
+
+ _canTheHundredClub = true;
+ _checkFrostResistTimer = 5 * IN_MILLISECONDS;
+ }
- if (phase == PHASE_FLIGHT)
- ClearIceBlock();
+ void EnterCombat(Unit* /*who*/)
+ {
+ _EnterCombat();
- phase = PHASE_NULL;
+ me->CastSpell(me, SPELL_FROST_AURA, true);
- CanTheHundredClub = true;
- CheckFrostResistTimer = 5000;
- }
+ events.ScheduleEvent(EVENT_BERSERK, 15 * MINUTE * IN_MILLISECONDS);
+ EnterPhaseGround();
- void EnterCombat(Unit* /*who*/)
- {
- _EnterCombat();
+ CheckPlayersFrostResist();
+ }
+
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_ICEBOLT)
+ {
+ IceBlockMap::iterator itr = _iceblocks.find(target->GetGUID());
+ if (itr != _iceblocks.end() && !itr->second)
+ {
+ if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25000))
+ itr->second = iceblock->GetGUID();
+ }
+ }
+ }
- me->CastSpell(me, SPELL_FROST_AURA, true);
+ void JustDied(Unit* /*killer*/)
+ {
+ _JustDied();
+ me->CastSpell(me, SPELL_DIES, true);
- events.ScheduleEvent(EVENT_BERSERK, 15*60000);
- EnterPhaseGround();
+ CheckPlayersFrostResist();
+ }
- CheckPlayersFrostResist();
- }
+ void MovementInform(uint32 /*type*/, uint32 id)
+ {
+ if (id == 1)
+ events.ScheduleEvent(EVENT_LIFTOFF, 0);
+ }
- void SpellHitTarget(Unit* target, const SpellInfo* spell)
- {
- if (spell->Id == SPELL_ICEBOLT)
+ void DoAction(int32 const param)
{
- IceBlockMap::iterator itr = iceblocks.find(target->GetGUID());
- if (itr != iceblocks.end() && !itr->second)
+ if (param == DATA_SAPPHIRON_BIRTH)
{
- if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25000))
- itr->second = iceblock->GetGUID();
+ _phase = PHASE_BIRTH;
+ events.ScheduleEvent(EVENT_BIRTH, 23 * IN_MILLISECONDS);
}
}
- }
- void JustDied(Unit* /*killer*/)
- {
- _JustDied();
- me->CastSpell(me, SPELL_DIES, true);
-
- CheckPlayersFrostResist();
- if (CanTheHundredClub)
+ void CheckPlayersFrostResist()
{
- AchievementEntry const* AchievTheHundredClub = sAchievementStore.LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB);
- if (AchievTheHundredClub)
+ if (_canTheHundredClub && _map && _map->IsRaid())
{
- if (map && map->IsDungeon())
+ Map::PlayerList const &players = _map->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
- Map::PlayerList const &players = map->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- itr->getSource()->CompletedAchievement(AchievTheHundredClub);
+ if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
+ {
+ _canTheHundredClub = false;
+ break;
+ }
}
}
}
- }
- void MovementInform(uint32, uint32 id)
- {
- if (id == 1)
- events.ScheduleEvent(EVENT_LIFTOFF, 0);
- }
-
- void DoAction(const int32 param)
- {
- if (param == DATA_SAPPHIRON_BIRTH)
+ void EnterPhaseGround()
{
- phase = PHASE_BIRTH;
- events.ScheduleEvent(EVENT_BIRTH, 23000);
+ _phase = PHASE_GROUND;
+ me->SetReactState(REACT_AGGRESSIVE);
+ events.SetPhase(PHASE_GROUND);
+ events.ScheduleEvent(EVENT_CLEAVE, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND);
+ events.ScheduleEvent(EVENT_TAIL, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND);
+ events.ScheduleEvent(EVENT_DRAIN, 24 * IN_MILLISECONDS, 0, PHASE_GROUND);
+ events.ScheduleEvent(EVENT_BLIZZARD, urand(5, 10) * IN_MILLISECONDS, 0, PHASE_GROUND);
+ events.ScheduleEvent(EVENT_FLIGHT, 45 * IN_MILLISECONDS);
}
- }
- void CheckPlayersFrostResist()
- {
- if (CanTheHundredClub && map && map->IsDungeon())
+ void ClearIceBlock()
{
- Map::PlayerList const &players = map->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ for (IceBlockMap::const_iterator itr = _iceblocks.begin(); itr != _iceblocks.end(); ++itr)
{
- if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE)
- {
- CanTheHundredClub = false;
- break;
- }
+ if (Player* player = ObjectAccessor::GetPlayer(*me, itr->first))
+ player->RemoveAura(SPELL_ICEBOLT);
+
+ if (GameObject* go = ObjectAccessor::GetGameObject(*me, itr->second))
+ go->Delete();
}
+ _iceblocks.clear();
}
- }
-
- void EnterPhaseGround()
- {
- phase = PHASE_GROUND;
- me->SetReactState(REACT_AGGRESSIVE);
- events.SetPhase(PHASE_GROUND);
- events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND);
- events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND);
- events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND);
- events.ScheduleEvent(EVENT_BLIZZARD, 5000+rand()%5000, 0, PHASE_GROUND);
- events.ScheduleEvent(EVENT_FLIGHT, 45000);
- }
- void ClearIceBlock()
- {
- for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr)
+ uint32 GetData(uint32 data) const
{
- if (Player* player = Unit::GetPlayer(*me, itr->first))
- player->RemoveAura(SPELL_ICEBOLT);
- if (GameObject* go = GameObject::GetGameObject(*me, itr->second))
- go->Delete();
+ if (data == DATA_THE_HUNDRED_CLUB)
+ return _canTheHundredClub;
+
+ return 0;
}
- iceblocks.clear();
- }
- void UpdateAI(const uint32 diff)
- {
- if (!phase)
- return;
+ void UpdateAI(uint32 const diff)
+ {
+ if (!_phase)
+ return;
- events.Update(diff);
+ events.Update(diff);
- if ((phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom())
- return;
+ if ((_phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom())
+ return;
- if (CanTheHundredClub)
- {
- if (CheckFrostResistTimer <= diff)
+ if (_canTheHundredClub)
{
- CheckPlayersFrostResist();
- CheckFrostResistTimer = (rand() % 5 + 5) * 1000;
- } else CheckFrostResistTimer -= diff;
- }
+ if (_checkFrostResistTimer <= diff)
+ {
+ CheckPlayersFrostResist();
+ _checkFrostResistTimer = 5 * IN_MILLISECONDS;
+ }
+ else
+ _checkFrostResistTimer -= diff;
+ }
- if (phase == PHASE_GROUND)
- {
- while (uint32 eventId = events.ExecuteEvent())
+ if (_phase == PHASE_GROUND)
{
- switch (eventId)
+ while (uint32 eventId = events.ExecuteEvent())
{
- case EVENT_BERSERK:
- DoScriptText(EMOTE_ENRAGE, me);
- DoCast(me, SPELL_BERSERK);
- return;
- case EVENT_CLEAVE:
- DoCast(me->getVictim(), SPELL_CLEAVE);
- events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND);
- return;
- case EVENT_TAIL:
- DoCastAOE(SPELL_TAIL_SWEEP);
- events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND);
- return;
- case EVENT_DRAIN:
- DoCastAOE(SPELL_LIFE_DRAIN);
- events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND);
- return;
- case EVENT_BLIZZARD:
+ switch (eventId)
{
- //DoCastAOE(SPELL_SUMMON_BLIZZARD);
- if (Creature* summon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000, 30000), TEMPSUMMON_TIMED_DESPAWN))
- summon->GetMotionMaster()->MoveRandom(40);
- events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000, 7000), 0, PHASE_GROUND);
- break;
- }
- case EVENT_FLIGHT:
- if (HealthAbovePct(10))
- {
- phase = PHASE_FLIGHT;
- events.SetPhase(PHASE_FLIGHT);
- me->SetReactState(REACT_PASSIVE);
- me->AttackStop();
- float x, y, z, o;
- me->GetHomePosition(x, y, z, o);
- me->GetMotionMaster()->MovePoint(1, x, y, z);
+ case EVENT_BERSERK:
+ Talk(EMOTE_ENRAGE);
+ DoCast(me, SPELL_BERSERK);
return;
+ case EVENT_CLEAVE:
+ DoCastVictim(SPELL_CLEAVE);
+ events.ScheduleEvent(EVENT_CLEAVE, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND);
+ return;
+ case EVENT_TAIL:
+ DoCastAOE(SPELL_TAIL_SWEEP);
+ events.ScheduleEvent(EVENT_TAIL, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND);
+ return;
+ case EVENT_DRAIN:
+ DoCastAOE(SPELL_LIFE_DRAIN);
+ events.ScheduleEvent(EVENT_DRAIN, 24 * IN_MILLISECONDS, 0, PHASE_GROUND);
+ return;
+ case EVENT_BLIZZARD:
+ {
+ //DoCastAOE(SPELL_SUMMON_BLIZZARD);
+ if (Creature* summon = DoSummon(NPC_BLIZZARD, me, 0.0f, urand(25, 30) * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN))
+ summon->GetMotionMaster()->MoveRandom(40);
+ events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20, 7) * IN_MILLISECONDS, 0, PHASE_GROUND);
+ break;
}
- break;
+ case EVENT_FLIGHT:
+ if (HealthAbovePct(10))
+ {
+ _phase = PHASE_FLIGHT;
+ events.SetPhase(PHASE_FLIGHT);
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
+ float x, y, z, o;
+ me->GetHomePosition(x, y, z, o);
+ me->GetMotionMaster()->MovePoint(1, x, y, z);
+ return;
+ }
+ break;
+ }
}
- }
- DoMeleeAttackIfReady();
- }
- else
- {
- if (uint32 eventId = events.ExecuteEvent())
+ DoMeleeAttackIfReady();
+ }
+ else
{
- switch (eventId)
+ if (uint32 eventId = events.ExecuteEvent())
{
- case EVENT_LIFTOFF:
- me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
- me->SetDisableGravity(true);
- me->SendMovementFlagUpdate();
- events.ScheduleEvent(EVENT_ICEBOLT, 1500);
- iceboltCount = RAID_MODE(2, 3);
- return;
- case EVENT_ICEBOLT:
+ switch (eventId)
{
- std::vector<Unit*> targets;
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (; i != me->getThreatManager().getThreatList().end(); ++i)
- if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT))
- targets.push_back((*i)->getTarget());
-
- if (targets.empty())
- iceboltCount = 0;
- else
+ case EVENT_LIFTOFF:
+ Talk(EMOTE_AIR_PHASE);
+ me->SetDisableGravity(true);
+ me->SendMovementFlagUpdate();
+ events.ScheduleEvent(EVENT_ICEBOLT, 1500);
+ _iceboltCount = RAID_MODE(2, 3);
+ return;
+ case EVENT_ICEBOLT:
{
- std::vector<Unit*>::const_iterator itr = targets.begin();
- advance(itr, rand()%targets.size());
- iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0));
- DoCast(*itr, SPELL_ICEBOLT);
- --iceboltCount;
+ std::vector<Unit*> targets;
+ std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
+ for (; i != me->getThreatManager().getThreatList().end(); ++i)
+ if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT))
+ targets.push_back((*i)->getTarget());
+
+ if (targets.empty())
+ _iceboltCount = 0;
+ else
+ {
+ std::vector<Unit*>::const_iterator itr = targets.begin();
+ advance(itr, rand()%targets.size());
+ _iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0));
+ DoCast(*itr, SPELL_ICEBOLT);
+ --_iceboltCount;
+ }
+
+ if (_iceboltCount)
+ events.ScheduleEvent(EVENT_ICEBOLT, 1 * IN_MILLISECONDS);
+ else
+ events.ScheduleEvent(EVENT_BREATH, 1 * IN_MILLISECONDS);
+ return;
}
-
- if (iceboltCount)
- events.ScheduleEvent(EVENT_ICEBOLT, 1000);
- else
- events.ScheduleEvent(EVENT_BREATH, 1000);
- return;
- }
- case EVENT_BREATH:
- {
- DoScriptText(EMOTE_BREATH, me);
- DoCastAOE(SPELL_FROST_MISSILE);
- events.ScheduleEvent(EVENT_EXPLOSION, 8000);
- return;
+ case EVENT_BREATH:
+ {
+ Talk(EMOTE_BREATH);
+ DoCastAOE(SPELL_FROST_MISSILE);
+ events.ScheduleEvent(EVENT_EXPLOSION, 8 * IN_MILLISECONDS);
+ return;
+ }
+ case EVENT_EXPLOSION:
+ CastExplosion();
+ ClearIceBlock();
+ events.ScheduleEvent(EVENT_LAND, 3 * IN_MILLISECONDS);
+ return;
+ case EVENT_LAND:
+ me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
+ Talk(EMOTE_GROUND_PHASE);
+ me->SetDisableGravity(false);
+ me->SendMovementFlagUpdate();
+ events.ScheduleEvent(EVENT_GROUND, 1500);
+ return;
+ case EVENT_GROUND:
+ EnterPhaseGround();
+ return;
+ case EVENT_BIRTH:
+ me->SetVisible(true);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->SetReactState(REACT_AGGRESSIVE);
+ return;
}
- case EVENT_EXPLOSION:
- CastExplosion();
- ClearIceBlock();
- events.ScheduleEvent(EVENT_LAND, 3000);
- return;
- case EVENT_LAND:
- me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
- me->SetDisableGravity(false);
- me->SendMovementFlagUpdate();
- events.ScheduleEvent(EVENT_GROUND, 1500);
- return;
- case EVENT_GROUND:
- EnterPhaseGround();
- return;
- case EVENT_BIRTH:
- me->SetVisible(true);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->SetReactState(REACT_AGGRESSIVE);
- return;
}
- }//if (uint32 eventId = events.ExecuteEvent())
- }//if (phase == PHASE_GROUND)
- }
+ }
+ }
- void CastExplosion()
- {
- DoZoneInCombat(); // make sure everyone is in threatlist
- std::vector<Unit*> targets;
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (; i != me->getThreatManager().getThreatList().end(); ++i)
+ void CastExplosion()
{
- Unit* target = (*i)->getTarget();
- if (target->GetTypeId() != TYPEID_PLAYER)
- continue;
-
- if (target->HasAura(SPELL_ICEBOLT))
+ DoZoneInCombat(); // make sure everyone is in threatlist
+ std::vector<Unit*> targets;
+ std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
+ for (; i != me->getThreatManager().getThreatList().end(); ++i)
{
- target->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true);
- targets.push_back(target);
- continue;
- }
+ Unit* target = (*i)->getTarget();
+ if (target->GetTypeId() != TYPEID_PLAYER)
+ continue;
- for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr)
- {
- if (GameObject* go = GameObject::GetGameObject(*me, itr->second))
+ if (target->HasAura(SPELL_ICEBOLT))
{
- if (go->IsInBetween(me, target, 2.0f)
- && me->GetExactDist2d(target->GetPositionX(), target->GetPositionY()) - me->GetExactDist2d(go->GetPositionX(), go->GetPositionY()) < 5.0f)
+ target->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true);
+ targets.push_back(target);
+ continue;
+ }
+
+ for (IceBlockMap::const_iterator itr = _iceblocks.begin(); itr != _iceblocks.end(); ++itr)
+ {
+ if (GameObject* go = GameObject::GetGameObject(*me, itr->second))
{
- target->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true);
- targets.push_back(target);
- break;
+ if (go->IsInBetween(me, target, 2.0f)
+ && me->GetExactDist2d(target->GetPositionX(), target->GetPositionY()) - me->GetExactDist2d(go->GetPositionX(), go->GetPositionY()) < 5.0f)
+ {
+ target->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true);
+ targets.push_back(target);
+ break;
+ }
}
}
}
+
+ me->CastSpell(me, SPELL_FROST_EXPLOSION, true);
+
+ for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
+ (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false);
}
- me->CastSpell(me, SPELL_FROST_EXPLOSION, true);
+ private:
+ Phases _phase;
+ uint32 _iceboltCount;
+ IceBlockMap _iceblocks;
+ bool _canTheHundredClub;
+ uint32 _checkFrostResistTimer;
+ Map* _map;
+ };
- for (std::vector<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
- (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false);
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_sapphironAI (creature);
}
- };
+};
+class achievement_the_hundred_club : public AchievementCriteriaScript
+{
+ public:
+ achievement_the_hundred_club() : AchievementCriteriaScript("achievement_the_hundred_club") { }
+
+ bool OnCheck(Player* /*source*/, Unit* target)
+ {
+ return target && target->GetAI()->GetData(DATA_THE_HUNDRED_CLUB);
+ }
};
void AddSC_boss_sapphiron()
{
new boss_sapphiron();
+ new achievement_the_hundred_club();
}
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
index e45700ebd72..c86cf1e9f28 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp
@@ -18,15 +18,15 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
-
+#include "Player.h"
#include "naxxramas.h"
//Stalagg
enum StalaggYells
{
- SAY_STAL_AGGRO = -1533023, //not used
- SAY_STAL_SLAY = -1533024, //not used
- SAY_STAL_DEATH = -1533025 //not used
+ SAY_STAL_AGGRO = 0,
+ SAY_STAL_SLAY = 1,
+ SAY_STAL_DEATH = 2
};
enum StalagSpells
@@ -40,9 +40,9 @@ enum StalagSpells
//Feugen
enum FeugenYells
{
- SAY_FEUG_AGGRO = -1533026, //not used
- SAY_FEUG_SLAY = -1533027, //not used
- SAY_FEUG_DEATH = -1533028 //not used
+ SAY_FEUG_AGGRO = 0,
+ SAY_FEUG_SLAY = 1,
+ SAY_FEUG_DEATH = 2
};
enum FeugenSpells
@@ -67,17 +67,12 @@ enum ThaddiusActions
//Thaddius
enum ThaddiusYells
{
- SAY_GREET = -1533029, //not used
- SAY_AGGRO_1 = -1533030,
- SAY_AGGRO_2 = -1533031,
- SAY_AGGRO_3 = -1533032,
- SAY_SLAY = -1533033,
- SAY_ELECT = -1533034, //not used
- SAY_DEATH = -1533035,
- SAY_SCREAM1 = -1533036, //not used
- SAY_SCREAM2 = -1533037, //not used
- SAY_SCREAM3 = -1533038, //not used
- SAY_SCREAM4 = -1533039 //not used
+ SAY_GREET = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_ELECT = 3,
+ SAY_DEATH = 4,
+ SAY_SCREAM = 5
};
enum ThaddiusSpells
@@ -155,13 +150,13 @@ public:
void KilledUnit(Unit* /*victim*/)
{
if (!(rand()%5))
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void DoAction(const int32 action)
@@ -198,7 +193,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SHIFT, 30000);
events.ScheduleEvent(EVENT_CHAIN, urand(10000, 20000));
events.ScheduleEvent(EVENT_BERSERK, 360000);
@@ -215,7 +210,7 @@ public:
polaritySwitch = data ? true : false;
}
- uint32 GetData(uint32 id)
+ uint32 GetData(uint32 id) const
{
if (id != DATA_POLARITY_SWITCH)
return 0;
@@ -315,13 +310,21 @@ public:
magneticPullTimer = 20000;
}
+ void KilledUnit(Unit* /*victim*/)
+ {
+ if (!(rand()%5))
+ Talk(SAY_STAL_SLAY);
+ }
+
void EnterCombat(Unit* /*who*/)
{
+ Talk(SAY_STAL_AGGRO);
DoCast(SPELL_STALAGG_TESLA);
}
void JustDied(Unit* /*killer*/)
{
+ Talk(SAY_STAL_DEATH);
if (instance)
if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
if (pThaddius->AI())
@@ -399,13 +402,21 @@ public:
staticFieldTimer = 5000;
}
+ void KilledUnit(Unit* /*victim*/)
+ {
+ if (!(rand()%5))
+ Talk(SAY_FEUG_SLAY);
+ }
+
void EnterCombat(Unit* /*who*/)
{
+ Talk(SAY_FEUG_AGGRO);
DoCast(SPELL_FEUGEN_TESLA);
}
void JustDied(Unit* /*killer*/)
{
+ Talk(SAY_FEUG_DEATH);
if (instance)
if (Creature* pThaddius = me->GetCreature(*me, instance->GetData64(DATA_THADDIUS)))
if (pThaddius->AI())
diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
index 50eb52cc4c2..b68d8d4a33c 100644
--- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "naxxramas.h"
const DoorData doorData[] =
@@ -314,7 +316,7 @@ public:
}
}
- uint32 GetData(uint32 id)
+ uint32 GetData(uint32 id) const
{
switch (id)
{
@@ -327,7 +329,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 id)
+ uint64 GetData64(uint32 id) const
{
switch (id)
{
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index ac5520b025a..5e7104fd83a 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -27,9 +27,14 @@ Script Data End */
// Remove hack that re-adds targets to the aggro list after they enter to a vehicle when it works as expected
// Improve whatever can be improved :)
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "PassiveAI.h"
#include "eye_of_eternity.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
enum Achievements
{
@@ -246,7 +251,7 @@ public:
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 data) const
{
if (data == DATA_SUMMON_DEATHS)
return _summonDeaths;
@@ -301,8 +306,8 @@ public:
summons.DespawnAll();
// players that used Hover Disk are no in the aggro list
me->SetInCombatWithZone();
- std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
+ ThreatContainer::StorageType const& m_threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
{
if (Unit* target = (*itr)->getTarget())
{
@@ -679,8 +684,8 @@ class spell_malygos_vortex_visual : public SpellScriptLoader
{
if (Unit* caster = GetCaster())
{
- std::list<HostileReference*> &m_threatlist = caster->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
+ ThreatContainer::StorageType const& m_threatlist = caster->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
{
if (Unit* target = (*itr)->getTarget())
{
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index fcb54985357..4ca28943be3 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "eye_of_eternity.h"
+#include "Player.h"
class instance_eye_of_eternity : public InstanceMapScript
{
@@ -223,7 +226,7 @@ public:
}
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index 7552ba4f389..2d89e5db0f0 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "nexus.h"
enum Spells
@@ -37,10 +38,10 @@ enum Adds
enum Yells
{
- SAY_AGGRO = -1576010,
- SAY_DEATH = -1576011,
- SAY_RIFT = -1576012,
- SAY_SHIELD = -1576013
+ SAY_AGGRO = 0,
+ SAY_DEATH = 1,
+ SAY_RIFT = 2,
+ SAY_SHIELD = 3
};
enum RiftSpells
@@ -95,7 +96,7 @@ class boss_anomalus : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS);
@@ -103,13 +104,13 @@ class boss_anomalus : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_ANOMALUS_EVENT, DONE);
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_CHAOS_THEORY)
return chaosTheory ? 1 : 0;
@@ -154,7 +155,7 @@ class boss_anomalus : public CreatureScript
if ((Phase == 0) && HealthBelowPct(50))
{
Phase = 1;
- DoScriptText(SAY_SHIELD, me);
+ Talk(SAY_SHIELD);
DoCast(me, SPELL_RIFT_SHIELD);
if (Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0, 5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
{
@@ -162,7 +163,7 @@ class boss_anomalus : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
Rift->AI()->AttackStart(target);
uiChaoticRiftGUID = Rift->GetGUID();
- DoScriptText(SAY_RIFT, me);
+ Talk(SAY_RIFT);
}
}
@@ -206,9 +207,7 @@ class mob_chaotic_rift : public CreatureScript
{
uiChaoticEnergyBurstTimer = 1000;
uiSummonCrazedManaWraithTimer = 5000;
- //me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different.
- //Model for ally (1126) does not show auras. Horde model works perfect.
- //Set model to horde number
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
DoCast(me, SPELL_ARCANEFORM, false);
}
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
index 5c1dee1d4e4..c110a4a3e85 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp
@@ -16,8 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "nexus.h"
+#include "Player.h"
enum Spells
{
@@ -36,11 +40,11 @@ enum Spells
enum Yells
{
//Yell
- SAY_AGGRO = -1576040,
- SAY_SLAY = -1576041,
- SAY_ENRAGE = -1576042,
- SAY_DEATH = -1576043,
- SAY_CRYSTAL_NOVA = -1576044
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_ENRAGE = 2,
+ SAY_DEATH = 3,
+ SAY_CRYSTAL_NOVA = 4
};
enum Misc
@@ -96,7 +100,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCastAOE(SPELL_INTENSE_COLD);
if (instance)
@@ -105,7 +109,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_KERISTRASZA_EVENT, DONE);
@@ -113,7 +117,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_SLAY, me);
+ Talk(SAY_SLAY);
}
bool CheckContainmentSpheres(bool remove_prison = false)
@@ -170,7 +174,7 @@ public:
if (!bEnrage && HealthBelowPct(25))
{
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
DoCast(me, SPELL_ENRAGE);
bEnrage = true;
}
@@ -189,7 +193,7 @@ public:
if (uiCrystalChainsCrystalizeTimer <= diff)
{
- DoScriptText(SAY_CRYSTAL_NOVA, me);
+ Talk(SAY_CRYSTAL_NOVA);
if (IsHeroic())
DoCast(me, SPELL_CRYSTALIZE);
else if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
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 ad188738c12..c8d3cc6416c 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "nexus.h"
enum Spells
@@ -42,12 +43,11 @@ enum Creatures
enum Yells
{
- SAY_AGGRO = -1576000,
- SAY_KILL = -1576001,
- SAY_DEATH = -1576002,
- SAY_MERGE = -1576003,
- SAY_SPLIT_1 = -1576004,
- SAY_SPLIT_2 = -1576005,
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_DEATH = 2,
+ SAY_MERGE = 3,
+ SAY_SPLIT = 4
};
#define ACTION_MAGUS_DEAD 1
@@ -121,7 +121,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_MAGUS_TELESTRA_EVENT, IN_PROGRESS);
@@ -129,7 +129,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE);
@@ -137,7 +137,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void DoAction(int32 const action)
@@ -154,7 +154,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_SPLIT_PERSONALITY)
return splitPersonality;
@@ -250,7 +250,7 @@ public:
uiArcaneMagusGUID = 0;
bIsWaitingToAppear = true;
uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS;
- DoScriptText(SAY_MERGE, me);
+ Talk(SAY_MERGE);
}
else
return;
@@ -269,7 +269,7 @@ public:
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
- DoScriptText(RAND(SAY_SPLIT_1, SAY_SPLIT_2), me);
+ Talk(SAY_SPLIT);
return;
}
@@ -286,7 +286,7 @@ public:
bFireMagusDead = false;
bFrostMagusDead = false;
bArcaneMagusDead = false;
- DoScriptText(RAND(SAY_SPLIT_1, SAY_SPLIT_2), me);
+ Talk(SAY_SPLIT);
return;
}
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
index c70db7d4ebc..11b1bce9ab7 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
@@ -16,98 +16,89 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "nexus.h"
+#include "SpellScript.h"
enum Spells
{
- SPELL_CRYSTAL_SPIKES = 47958, //Don't work, using walkaround
- H_SPELL_CRYSTAL_SPIKES = 57082, //Don't work, using walkaround
- SPELL_CRYSTALL_SPIKE_DAMAGE = 47944,
- H_SPELL_CRYSTALL_SPIKE_DAMAGE = 57067,
- SPELL_CRYSTAL_SPIKE_PREVISUAL = 50442,
- MOB_CRYSTAL_SPIKE = 27099,
- SPELL_SPELL_REFLECTION = 47981,
- SPELL_TRAMPLE = 48016,
- H_SPELL_TRAMPLE = 57066,
- SPELL_FRENZY = 48017,
- SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564, //summons npc 32665
- SPELL_ROOTS = 28858 //proper spell id is unknown
+ SPELL_SPELL_REFLECTION = 47981,
+ SPELL_TRAMPLE = 48016,
+ SPELL_FRENZY = 48017,
+ SPELL_SUMMON_CRYSTALLINE_TANGLER = 61564,
+ SPELL_CRYSTAL_SPIKES = 47958,
};
enum Yells
{
- SAY_AGGRO = -1576020,
- SAY_DEATH = -1576021,
- SAY_REFLECT = -1576022,
- SAY_CRYSTAL_SPIKES = -1576023,
- SAY_KILL = -1576024
+ SAY_AGGRO = 1,
+ SAY_DEATH = 2,
+ SAY_REFLECT = 3,
+ SAY_CRYSTAL_SPIKES = 4,
+ SAY_KILL = 5,
};
-enum Creatures
+
+enum Events
{
- MOB_CRYSTALLINE_TANGLER = 32665
+ EVENT_CRYSTAL_SPIKES = 1,
+ EVENT_TRAMPLE = 2,
+ EVENT_SPELL_REFLECTION = 3,
+ EVENT_CRYSTALLINE_TANGLER = 4,
};
-#define SPIKE_DISTANCE 5.0f
+class OrmorokTanglerPredicate
+{
+ public:
+ OrmorokTanglerPredicate(Unit* unit) : me(unit) {}
+
+ bool operator() (WorldObject* object) const
+ {
+ return object->GetDistance2d(me) >= 5.0f;
+ }
+
+ private:
+ Unit* me;
+};
class boss_ormorok : public CreatureScript
{
public:
boss_ormorok() : CreatureScript("boss_ormorok") { }
- CreatureAI* GetAI(Creature* creature) const
+ struct boss_ormorokAI : public BossAI
{
- return new boss_ormorokAI (creature);
- }
+ boss_ormorokAI(Creature* creature) : BossAI(creature, DATA_ORMOROK_EVENT) {}
- struct boss_ormorokAI : public ScriptedAI
- {
- boss_ormorokAI(Creature* creature) : ScriptedAI(creature)
+ void EnterCombat(Unit* /*who*/)
{
- instance = creature->GetInstanceScript();
- }
+ _EnterCombat();
- InstanceScript* instance;
-
- bool bFrenzy;
- bool bCrystalSpikes;
- uint8 uiCrystalSpikesCount;
- float fBaseX;
- float fBaseY;
- float fBaseZ;
- float fBaseO;
- float fSpikeXY[4][2];
-
- uint32 uiCrystalSpikesTimer;
- uint32 uiCrystalSpikesTimer2;
- uint32 uiTrampleTimer;
- uint32 uiFrenzyTimer;
- uint32 uiSpellReflectionTimer;
- uint32 uiSummonCrystallineTanglerTimer;
-
- void Reset()
- {
- uiCrystalSpikesTimer = 12*IN_MILLISECONDS;
- uiTrampleTimer = 10*IN_MILLISECONDS;
- uiSpellReflectionTimer = 30*IN_MILLISECONDS;
- uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS;
- bFrenzy = false;
- bCrystalSpikes = false;
+ events.ScheduleEvent(EVENT_CRYSTAL_SPIKES, 12000);
+ events.ScheduleEvent(EVENT_TRAMPLE, 10000);
+ events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000);
+ if (IsHeroic())
+ events.ScheduleEvent(EVENT_CRYSTALLINE_TANGLER, 17000);
+
+ Talk(SAY_AGGRO);
if (instance)
- instance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED);
+ instance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS);
}
- void EnterCombat(Unit* /*who*/)
+ void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/)
{
- DoScriptText(SAY_AGGRO, me);
-
- if (instance)
- instance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS);
+ if (!frenzy && HealthBelowPct(25))
+ {
+ DoCast(me, SPELL_FRENZY);
+ frenzy = true;
+ }
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ _JustDied();
+
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_ORMOROK_EVENT, DONE);
@@ -115,195 +106,181 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
- {
return;
- }
- if (bCrystalSpikes)
- {
- if (uiCrystalSpikesTimer2 <= diff)
- {
- fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO));
- fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO));
- fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO));
- fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO));
- fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2)));
- fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2)));
- fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2)));
- fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2)));
- for (uint8 i = 0; i < 4; ++i)
- me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS);
- if (++uiCrystalSpikesCount >= 13)
- bCrystalSpikes = false;
- uiCrystalSpikesTimer2 = 200;
- } else uiCrystalSpikesTimer2 -= diff;
- }
- if (!bFrenzy && HealthBelowPct(25))
- {
- DoCast(me, SPELL_FRENZY);
- bFrenzy = true;
- }
+ events.Update(diff);
- if (uiTrampleTimer <= diff)
- {
- DoCast(me, SPELL_TRAMPLE);
- uiTrampleTimer = 10*IN_MILLISECONDS;
- } else uiTrampleTimer -= diff;
-
- if (uiSpellReflectionTimer <= diff)
- {
- DoScriptText(SAY_REFLECT, me);
- DoCast(me, SPELL_SPELL_REFLECTION);
- uiSpellReflectionTimer = 30*IN_MILLISECONDS;
- } else uiSpellReflectionTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (uiCrystalSpikesTimer <= diff)
- {
- DoScriptText(SAY_CRYSTAL_SPIKES, me);
- bCrystalSpikes = true;
- uiCrystalSpikesCount = 1;
- uiCrystalSpikesTimer2 = 0;
- fBaseX = me->GetPositionX();
- fBaseY = me->GetPositionY();
- fBaseZ = me->GetPositionZ();
- fBaseO = me->GetOrientation();
- uiCrystalSpikesTimer = 20*IN_MILLISECONDS;
- } else uiCrystalSpikesTimer -= diff;
-
- if (IsHeroic() && (uiSummonCrystallineTanglerTimer <= diff))
+ while (uint32 eventId = events.ExecuteEvent())
{
- Creature* Crystalline_Tangler = me->SummonCreature(MOB_CRYSTALLINE_TANGLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
- if (Crystalline_Tangler)
+ switch (eventId)
{
- Unit* target = NULL;
- uint8 Healer = 0;
- for (uint8 j = 1; j <= 4; j++)
- {
- switch (j)
- {
- case 1: Healer = CLASS_PRIEST; break;
- case 2: Healer = CLASS_PALADIN; break;
- case 3: Healer = CLASS_DRUID; break;
- case 4: Healer = CLASS_SHAMAN; break;
- }
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
- for (; i != me->getThreatManager().getThreatList().end(); ++i)
- {
- Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid());
- if (temp && temp->GetTypeId() == TYPEID_PLAYER && temp->getClass() == Healer)
- {
- target = temp;
- break;
- }
- }
- if (target)
- break;
- }
- if (!target)
- target = SelectTarget(SELECT_TARGET_RANDOM, 0);
- if (target)
- {
- Crystalline_Tangler->AI()->AttackStart(target);
- Crystalline_Tangler->getThreatManager().addThreat(target, 1000000000.0f);
- }
+ case EVENT_TRAMPLE:
+ DoCast(me, SPELL_TRAMPLE);
+ events.ScheduleEvent(EVENT_TRAMPLE, 10000);
+ break;
+ case EVENT_SPELL_REFLECTION:
+ Talk(SAY_REFLECT);
+ DoCast(me, SPELL_SPELL_REFLECTION);
+ events.ScheduleEvent(EVENT_SPELL_REFLECTION, 30000);
+ break;
+ case EVENT_CRYSTAL_SPIKES:
+ Talk(SAY_CRYSTAL_SPIKES);
+ DoCast(SPELL_CRYSTAL_SPIKES);
+ events.ScheduleEvent(EVENT_CRYSTAL_SPIKES, 12000);
+ break;
+ case EVENT_CRYSTALLINE_TANGLER:
+ if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, OrmorokTanglerPredicate(me)))
+ DoCast(target, SPELL_SUMMON_CRYSTALLINE_TANGLER);
+ events.ScheduleEvent(EVENT_CRYSTALLINE_TANGLER, 17000);
+ break;
+ default:
+ break;
}
- uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS;
- } else uiSummonCrystallineTanglerTimer -= diff;
+ }
DoMeleeAttackIfReady();
}
+
+ private:
+ bool frenzy;
+
};
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new boss_ormorokAI (creature);
+ }
+};
+
+enum CrystalSpikes
+{
+ NPC_CRYSTAL_SPIKE_INITIAL = 27101,
+ NPC_CRYSTAL_SPIKE_TRIGGER = 27079,
+
+ DATA_COUNT = 1,
+ MAX_COUNT = 5,
+
+ SPELL_CRYSTAL_SPIKE_DAMAGE = 47944,
+
+ GO_CRYSTAL_SPIKE_TRAP = 188537,
+};
+
+uint32 const crystalSpikeSummon[3] =
+{
+ 47936,
+ 47942,
+ 47943
};
-class mob_crystal_spike : public CreatureScript
+class npc_crystal_spike_trigger : public CreatureScript
{
public:
- mob_crystal_spike() : CreatureScript("mob_crystal_spike") { }
+ npc_crystal_spike_trigger() : CreatureScript("npc_crystal_spike_trigger") { }
- CreatureAI* GetAI(Creature* creature) const
+ struct npc_crystal_spike_triggerAI : public ScriptedAI
{
- return new mob_crystal_spikeAI (creature);
- }
+ npc_crystal_spike_triggerAI(Creature* creature) : ScriptedAI(creature) {}
- struct mob_crystal_spikeAI : public Scripted_NoMovementAI
- {
- mob_crystal_spikeAI(Creature* creature) : Scripted_NoMovementAI(creature)
+ void IsSummonedBy(Unit* owner)
{
- }
+ switch (me->GetEntry())
+ {
+ case NPC_CRYSTAL_SPIKE_INITIAL:
+ _count = 0;
+ me->SetFacingToObject(owner);
+ break;
+ case NPC_CRYSTAL_SPIKE_TRIGGER:
+ if (Creature* trigger = owner->ToCreature())
+ _count = trigger->AI()->GetData(DATA_COUNT) + 1;
+ break;
+ default:
+ _count = MAX_COUNT;
+ break;
+ }
- uint32 SpellCrystalSpikeDamageTimer;
- uint32 SpellCrystalSpikePrevisualTimer;
+ if (me->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
+ if (GameObject* trap = me->FindNearestGameObject(GO_CRYSTAL_SPIKE_TRAP, 1.0f))
+ trap->Use(me);
- void Reset()
+ _despawntimer = 2000;
+ }
+
+ uint32 GetData(uint32 type) const
{
- SpellCrystalSpikeDamageTimer = 3700;
- SpellCrystalSpikePrevisualTimer = 1*IN_MILLISECONDS;
+ return type == DATA_COUNT ? _count : 0;
}
void UpdateAI(const uint32 diff)
{
- if (SpellCrystalSpikePrevisualTimer <= diff)
+ if (_despawntimer <= diff)
{
- DoCast(me, SPELL_CRYSTAL_SPIKE_PREVISUAL);
- SpellCrystalSpikePrevisualTimer = 10*IN_MILLISECONDS;
- } else SpellCrystalSpikePrevisualTimer -= diff;
+ if (me->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
+ if (GameObject* trap = me->FindNearestGameObject(GO_CRYSTAL_SPIKE_TRAP, 1.0f))
+ trap->Delete();
- if (SpellCrystalSpikeDamageTimer <= diff)
- {
- DoCast(me, SPELL_CRYSTALL_SPIKE_DAMAGE);
- SpellCrystalSpikeDamageTimer = 10*IN_MILLISECONDS;
- } else SpellCrystalSpikeDamageTimer -= diff;
+ me->DespawnOrUnsummon();
+ }
+ else
+ _despawntimer -= diff;
}
- };
-};
+ private:
+ uint32 _count;
+ uint32 _despawntimer;
-class mob_crystalline_tangler : public CreatureScript
-{
-public:
- mob_crystalline_tangler() : CreatureScript("mob_crystalline_tangler") { }
+ };
CreatureAI* GetAI(Creature* creature) const
{
- return new mob_crystalline_tanglerAI (creature);
+ return new npc_crystal_spike_triggerAI(creature);
}
+};
- struct mob_crystalline_tanglerAI : public ScriptedAI
- {
- mob_crystalline_tanglerAI(Creature* creature) : ScriptedAI(creature) {}
-
- uint32 uiRootsTimer;
+class spell_crystal_spike : public SpellScriptLoader
+{
+ public:
+ spell_crystal_spike() : SpellScriptLoader("spell_crystal_spike") { }
- void Reset()
+ class spell_crystal_spike_AuraScript : public AuraScript
{
- uiRootsTimer = 1*IN_MILLISECONDS;
- }
+ PrepareAuraScript(spell_crystal_spike_AuraScript);
- void UpdateAI(const uint32 diff)
- {
- if (uiRootsTimer <= diff)
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
- if (me->IsWithinDist(me->getVictim(), 5.0f, false))
- {
- DoCast(me->getVictim(), SPELL_ROOTS);
- uiRootsTimer = 15*IN_MILLISECONDS;
- }
- } else uiRootsTimer -= diff;
- }
- };
+ Unit* target = GetTarget();
+ if (target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL || target->GetEntry() == NPC_CRYSTAL_SPIKE_TRIGGER)
+ if (Creature* trigger = target->ToCreature())
+ {
+ uint32 spell = target->GetEntry() == NPC_CRYSTAL_SPIKE_INITIAL ? crystalSpikeSummon[0] : crystalSpikeSummon[urand(0, 2)];
+ if (trigger->AI()->GetData(DATA_COUNT) < MAX_COUNT)
+ trigger->CastSpell(trigger, spell, true);
+ }
+ }
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_crystal_spike_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_crystal_spike_AuraScript();
+ }
};
void AddSC_boss_ormorok()
{
new boss_ormorok();
- new mob_crystal_spike();
- new mob_crystalline_tangler();
+ new npc_crystal_spike_trigger();
+ new spell_crystal_spike();
}
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp
index 5ea3eb32c1d..5463f6c9045 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp
@@ -23,7 +23,8 @@ SDComment: Only Alliance Heroic
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_BATTLE_SHOUT 31403
#define SPELL_CHARGE 60067
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp
index da4b49740c1..1af1edcdf71 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp
@@ -23,19 +23,18 @@ SDComment: Only Horde Heroic
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SPELL_BATTLE_SHOUT 31403
-#define SPELL_CHARGE 60067
-#define SPELL_FRIGHTENING_SHOUT 19134
-#define SPELL_WHIRLWIND_1 38619
-#define SPELL_WHIRLWIND_2 38618
+enum CommanderStoutbeard
+{
+ SPELL_BATTLE_SHOUT = 31403,
+ SPELL_CHARGE = 60067,
+ SPELL_FRIGHTENING_SHOUT = 19134,
+ SPELL_WHIRLWIND_1 = 38619,
+ SPELL_WHIRLWIND_2 = 38618
+};
-//not used
-//Yell
-#define SAY_AGGRO -1576021
-#define SAY_KILL -1576022
-#define SAY_DEATH -1576023
class boss_commander_stoutbeard : public CreatureScript
{
@@ -52,10 +51,6 @@ public:
boss_commander_stoutbeardAI(Creature* creature) : ScriptedAI(creature) {}
void Reset() {}
- void EnterCombat(Unit* /*who*/)
- {
- DoScriptText(SAY_AGGRO, me);
- }
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
void UpdateAI(const uint32 /*diff*/)
@@ -66,10 +61,6 @@ public:
DoMeleeAttackIfReady();
}
- void JustDied(Unit* /*killer*/)
- {
- DoScriptText(SAY_DEATH, me);
- }
};
};
diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
index 5af982bb694..f06800cd201 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp
@@ -16,8 +16,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "nexus.h"
+#include "Player.h"
#define NUMBER_OF_ENCOUNTERS 4
@@ -57,6 +59,9 @@ public:
Anomalus = 0;
Keristrasza = 0;
+ AnomalusContainmentSphere = 0;
+ OrmoroksContainmentSphere = 0;
+ TelestrasContainmentSphere = 0;
}
void OnCreatureCreate(Creature* creature)
@@ -149,7 +154,7 @@ public:
}
}
- uint32 GetData(uint32 identifier)
+ uint32 GetData(uint32 identifier) const
{
switch (identifier)
{
@@ -216,7 +221,7 @@ public:
}
}
- uint64 GetData64(uint32 uiIdentifier)
+ uint64 GetData64(uint32 uiIdentifier) const
{
switch (uiIdentifier)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
index bb75b789fff..60f9a3ddc9a 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "oculus.h"
enum Spells
@@ -30,18 +31,11 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1578005,
- SAY_KILL_1 = -1578006,
- SAY_KILL_2 = -1578007,
- SAY_KILL_3 = -1578008,
- SAY_DEATH = -1578009,
- SAY_PULL_1 = -1578010,
- SAY_PULL_2 = -1578011,
- SAY_PULL_3 = -1578012,
- SAY_PULL_4 = -1578013,
- SAY_STOMP_1 = -1578014,
- SAY_STOMP_2 = -1578015,
- SAY_STOMP_3 = -1578016
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_DEATH = 2,
+ SAY_PULL = 3,
+ SAY_STOMP = 4
};
enum DrakosAchievement
@@ -84,7 +78,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
@@ -121,7 +115,7 @@ public:
events.ScheduleEvent(EVENT_MAGIC_PULL, 15000);
break;
case EVENT_STOMP:
- DoScriptText(RAND(SAY_STOMP_1, SAY_STOMP_2, SAY_STOMP_3), me);
+ Talk(SAY_STOMP);
DoCast(SPELL_THUNDERING_STOMP);
events.ScheduleEvent(EVENT_STOMP, 17000);
break;
@@ -135,7 +129,7 @@ public:
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
// start achievement timer (kill Eregos within 20 min)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
@@ -143,7 +137,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2, SAY_KILL_3), me);
+ Talk(SAY_KILL);
}
private:
bool postPull;
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index ab814a2ca22..b17c471c81b 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "oculus.h"
//Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer)
@@ -31,9 +34,12 @@ enum Events
enum Says
{
- SAY_AGGRO = 0,
- SAY_ENRAGE = 1,
- SAY_DEATH = 2
+ SAY_SPAWN = 0,
+ SAY_AGGRO = 1,
+ SAY_ENRAGE = 2,
+ SAY_KILL = 3,
+ SAY_DEATH = 4,
+ SAY_SHIELD = 5,
};
enum Spells
@@ -65,49 +71,11 @@ enum Actions
ACTION_SET_NORMAL_EVENTS = 1
};
-/*Ruby Drake,
-(npc 27756) (item 37860)
-(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756)
-*/
-enum RubyDrake
+enum EregosData
{
- NPC_RUBY_DRAKE_VEHICLE = 27756,
- SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464
- SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy
- SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets
- SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells.
- SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted.
- //you do not have acces to until you kill Mage-Lord Urom
- SPELL_RUBY_MARTYR = 50253 //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec.
-};
-/*Amber Drake,
-(npc 27755) (item 37859)
-(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755)
-*/
-enum AmberDrake
-{
- NPC_AMBER_DRAKE_VEHICLE = 27755,
- SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460
- SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy
- SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated.
-// SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target.
- //you do not have access to until you kill the Mage-Lord Urom.
- SPELL_AMBER_TEMPORAL_RIFT = 49592 //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated.
-};
-
-/*Emerald Drake,
-(npc 27692) (item 37815),
- (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692)
-*/
-enum EmeraldDrake
-{
- NPC_EMERALD_DRAKE_VEHICLE = 27692,
- SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346
- SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy
- SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times.
- SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec.
- // you do not have access to until you kill the Mage-Lord Urom
- SPELL_EMERALD_DREAM_FUNNEL = 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels.
+ DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044
+ DATA_EMERALD_VOID = 1, // http://www.wowhead.com/achievement=2045
+ DATA_AMBER_VOID = 2 // http://www.wowhead.com/achievement=2046
};
class boss_eregos : public CreatureScript
@@ -127,17 +95,50 @@ public:
void Reset()
{
_Reset();
+ _phase = PHASE_NORMAL;
- phase = PHASE_NORMAL;
+ _rubyVoid = true;
+ _emeraldVoid = true;
+ _amberVoid = true;
DoAction(ACTION_SET_NORMAL_EVENTS);
}
+ void KilledUnit(Unit* /*victim*/)
+ {
+ Talk(SAY_KILL);
+ }
+
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
Talk(SAY_AGGRO);
+ /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found
+ The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/
+ Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */
+ if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true))
+ _rubyVoid = false;
+ if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true))
+ _emeraldVoid = false;
+ if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true))
+ _amberVoid = false;
+ }
+
+ uint32 GetData(uint32 type) const
+ {
+ switch (type)
+ {
+ case DATA_RUBY_VOID:
+ return _rubyVoid;
+ case DATA_EMERALD_VOID:
+ return _emeraldVoid;
+ case DATA_AMBER_VOID:
+ return _amberVoid;
+ default:
+ break;
+ }
+ return 0;
}
void DoAction(const int32 action)
@@ -177,12 +178,13 @@ public:
if (!me->GetMap()->IsHeroic())
return;
- if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && phase < PHASE_FIRST_PLANAR)
- || (me->GetHealthPct() < 20.0f && phase < PHASE_SECOND_PLANAR) )
+ if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR)
+ || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) )
{
events.Reset();
- phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR;
+ _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR;
+ Talk(SAY_SHIELD);
DoCast(SPELL_PLANAR_SHIFT);
// not sure about the amount, and if we should despawn previous spawns (dragon trashs)
@@ -238,8 +240,11 @@ public:
_JustDied();
}
- private:
- uint8 phase;
+ private:
+ uint8 _phase;
+ bool _rubyVoid;
+ bool _emeraldVoid;
+ bool _amberVoid;
};
};
@@ -271,8 +276,25 @@ class spell_eregos_planar_shift : public SpellScriptLoader
}
};
-void AddSC_boss_eregos()
+class achievement_gen_eregos_void : public AchievementCriteriaScript
{
+ public:
+ achievement_gen_eregos_void(char const* name, uint32 data) : AchievementCriteriaScript(name), _data(data) { }
+
+ bool OnCheck(Player* /*player*/, Unit* target)
+ {
+ return target && target->GetAI()->GetData(_data);
+ }
+
+ private:
+ uint32 _data;
+};
+
+ void AddSC_boss_eregos()
+ {
new boss_eregos();
new spell_eregos_planar_shift();
-}
+ new achievement_gen_eregos_void("achievement_ruby_void", DATA_RUBY_VOID);
+ new achievement_gen_eregos_void("achievement_emerald_void", DATA_EMERALD_VOID);
+ new achievement_gen_eregos_void("achievement_amber_void", DATA_AMBER_VOID);
+ }
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index b96d7c4aa84..ffd5e53e787 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -22,8 +22,10 @@ SDComment: Is not working SPELL_ARCANE_SHIELD. SPELL_FROSTBOMB has some issues,
SDCategory: Instance Script
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "oculus.h"
+#include "SpellInfo.h"
enum Spells
{
@@ -37,16 +39,20 @@ enum Spells
SPELL_SUMMON_MENAGERIE_3 = 50496,
SPELL_TELEPORT = 51112, //Teleports to the center of Oculus
SPELL_TIME_BOMB = 51121, //Deals arcane damage to a random player, and after 6 seconds, deals zone damage to nearby equal to the health missing of the target afflicted by the debuff.
- SPELL_TIME_BOMB_2 = 59376
+ SPELL_TIME_BOMB_2 = 59376,
+ SPELL_EVOCATE = 51602 // He always cast it on reset or after teleportation
};
enum Yells
{
- SAY_AGGRO_1 = -1578000,
- SAY_AGGRO_2 = -1578001,
- SAY_AGGRO_3 = -1578002,
- SAY_AGGRO_4 = -1578003,
- SAY_TELEPORT = -1578004,
+ SAY_SUMMON_1 = 0,
+ SAY_SUMMON_2 = 1,
+ SAY_SUMMON_3 = 2,
+ SAY_AGGRO = 3,
+ EMOTE_ARCANE_EXPLOSION = 4,
+ SAY_ARCANE_EXPLOSION = 5,
+ SAY_DEATH = 6,
+ SAY_PLAYER_KILL = 7
};
enum eCreature
@@ -81,11 +87,6 @@ static uint32 TeleportSpells[]=
SPELL_SUMMON_MENAGERIE, SPELL_SUMMON_MENAGERIE_2, SPELL_SUMMON_MENAGERIE_3
};
-static int32 SayAggro[]=
-{
- SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3, SAY_AGGRO_4
-};
-
class boss_urom : public CreatureScript
{
public:
@@ -102,8 +103,7 @@ public:
void Reset()
{
- if (instance->GetBossState(DATA_VAROS_EVENT) != DONE)
- DoCast(SPELL_ARCANE_SHIELD);
+ me->CastSpell(me, SPELL_EVOCATE);
_Reset();
@@ -151,7 +151,7 @@ public:
{
if (me->Attack(who, true))
{
- DoScriptText(SayAggro[3], me);
+ Talk(SAY_AGGRO);
me->SetInCombatWith(who);
who->SetInCombatWith(me);
@@ -207,6 +207,22 @@ public:
{
SetPosition(i);
me->SummonCreature(Group[group[instance->GetData(DATA_UROM_PLATAFORM)]].entry[i], x, y, me->GetPositionZ(), me->GetOrientation());
+
+ // teleport to next platform and spawn adds
+ switch (instance->GetData(DATA_UROM_PLATAFORM))
+ {
+ case 1:
+ Talk(SAY_SUMMON_1);
+ break;
+ case 2:
+ Talk(SAY_SUMMON_2);
+ break;
+ case 3:
+ Talk(SAY_SUMMON_3);
+ break;
+ default:
+ break;
+ }
}
}
@@ -215,13 +231,17 @@ public:
if (!instance || instance->GetData(DATA_UROM_PLATAFORM) > 2)
return;
- DoScriptText(SayAggro[instance->GetData(DATA_UROM_PLATAFORM)], me);
+ Talk(instance->GetData(DATA_UROM_PLATAFORM) < 5 ? instance->GetData(DATA_UROM_PLATAFORM) : 0);
DoCast(TeleportSpells[instance->GetData(DATA_UROM_PLATAFORM)]);
}
+ void KilledUnit(Unit* /*victim*/)
+ {
+ Talk(SAY_PLAYER_KILL);
+ }
+
void UpdateAI(const uint32 uiDiff)
{
- //Return since we have no target
if (!UpdateVictim())
return;
@@ -231,7 +251,6 @@ public:
if (teleportTimer <= uiDiff)
{
me->InterruptNonMeleeSpells(false);
- DoScriptText(SAY_TELEPORT, me);
me->GetMotionMaster()->MoveIdle();
DoCast(SPELL_TELEPORT);
teleportTimer = urand(30000, 35000);
@@ -260,6 +279,9 @@ public:
me->GetMotionMaster()->MoveChase(me->getVictim(), 0, 0);
me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);
+ Talk(EMOTE_ARCANE_EXPLOSION);
+ Talk(SAY_ARCANE_EXPLOSION);
+
canCast = false;
canGoBack = false;
arcaneExplosionTimer = 9000;
@@ -289,6 +311,7 @@ public:
void JustDied(Unit* /*killer*/)
{
_JustDied();
+ Talk(SAY_DEATH);
DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur
}
@@ -306,14 +329,17 @@ public:
case SPELL_SUMMON_MENAGERIE:
me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f);
LeaveCombat();
+ me->CastSpell(me, SPELL_EVOCATE);
break;
case SPELL_SUMMON_MENAGERIE_2:
me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f);
LeaveCombat();
+ me->CastSpell(me, SPELL_EVOCATE);
break;
case SPELL_SUMMON_MENAGERIE_3:
me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f);
LeaveCombat();
+ me->CastSpell(me, SPELL_EVOCATE);
break;
case SPELL_TELEPORT:
//! Unconfirmed, previous below
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
index d200e8bf4bf..6d9450daf21 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "oculus.h"
#include "MapManager.h"
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index 46498a69c6f..7035e0534aa 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "oculus.h"
+#include "Player.h"
#define MAX_ENCOUNTER 4
@@ -54,9 +57,13 @@ public:
eregosCacheGUID = 0;
- azureDragonsList.clear();
+ gwhelpList.clear();
gameObjectList.clear();
- }
+
+ belgaristraszGUID = 0;
+ eternosGUID = 0;
+ verdisaGUID = 0;
+}
void OnUnitDeath(Unit* unit)
{
@@ -110,17 +117,49 @@ public:
break;
case NPC_VAROS:
varosGUID = creature->GetGUID();
+ if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
+ creature->SetPhaseMask(1, true);
break;
case NPC_UROM:
uromGUID = creature->GetGUID();
+ if (GetBossState(DATA_VAROS_EVENT) == DONE)
+ creature->SetPhaseMask(1, true);
break;
case NPC_EREGOS:
eregosGUID = creature->GetGUID();
+ if (GetBossState(DATA_UROM_EVENT) == DONE)
+ creature->SetPhaseMask(1, true);
break;
case NPC_CENTRIFUGE_CONSTRUCT:
if (creature->isAlive())
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, ++centrifugueConstructCounter);
break;
+ case NPC_BELGARISTRASZ:
+ belgaristraszGUID = creature->GetGUID();
+ if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
+ creature->SetWalk(true),
+ creature->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f),
+ creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ break;
+ case NPC_ETERNOS:
+ eternosGUID = creature->GetGUID();
+ if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
+ creature->SetWalk(true),
+ creature->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f),
+ creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ break;
+ case NPC_VERDISA:
+ verdisaGUID = creature->GetGUID();
+ if (GetBossState(DATA_DRAKOS_EVENT) == DONE)
+ creature->SetWalk(true),
+ creature->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f),
+ creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ break;
+ case NPC_GREATER_WHELP:
+ if (GetBossState(DATA_UROM_EVENT) == DONE)
+ creature->SetPhaseMask(1, true);
+ gwhelpList.push_back(creature->GetGUID());
+ break;
}
}
@@ -157,11 +196,22 @@ public:
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1);
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, centrifugueConstructCounter);
OpenCageDoors();
+ FreeDragons();
+ if (Creature* varos = instance->GetCreature(varosGUID))
+ varos->SetPhaseMask(1, true);
}
break;
case DATA_VAROS_EVENT:
if (state == DONE)
DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0);
+ if (Creature* urom = instance->GetCreature(uromGUID))
+ urom->SetPhaseMask(1, true);
+ break;
+ case DATA_UROM_EVENT:
+ if (state == DONE)
+ if (Creature* eregos = instance->GetCreature(eregosGUID))
+ eregos->SetPhaseMask(1, true);
+ GreaterWhelps();
break;
case DATA_EREGOS_EVENT:
if (state == DONE)
@@ -182,7 +232,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -194,7 +244,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -219,6 +269,31 @@ public:
}
}
+ void FreeDragons()
+ {
+ if (Creature* belgaristrasz = instance->GetCreature(belgaristraszGUID))
+ belgaristrasz->SetWalk(true),
+ belgaristrasz->GetMotionMaster()->MovePoint(0, 941.453f, 1044.1f, 359.967f);
+ if (Creature* eternos = instance->GetCreature(eternosGUID))
+ eternos->SetWalk(true),
+ eternos->GetMotionMaster()->MovePoint(0, 943.202f, 1059.35f, 359.967f);
+ if (Creature* verdisa = instance->GetCreature(verdisaGUID))
+ verdisa->SetWalk(true),
+ verdisa->GetMotionMaster()->MovePoint(0, 949.188f, 1032.91f, 359.967f);
+ }
+
+ void GreaterWhelps()
+ {
+ if (gwhelpList.empty())
+ return;
+
+ for (std::list<uint64>::const_iterator itr = gwhelpList.begin(); itr != gwhelpList.end(); ++itr)
+ {
+ if (Creature* gwhelp = instance->GetCreature(*itr))
+ gwhelp->SetPhaseMask(1, true);
+ }
+ }
+
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
@@ -267,6 +342,10 @@ public:
uint64 uromGUID;
uint64 eregosGUID;
+ uint64 belgaristraszGUID;
+ uint64 eternosGUID;
+ uint64 verdisaGUID;
+
uint8 platformUrom;
uint8 centrifugueConstructCounter;
@@ -275,9 +354,8 @@ public:
std::string str_data;
std::list<uint64> gameObjectList;
- std::list<uint64> azureDragonsList;
+ std::list<uint64> gwhelpList;
};
-
};
void AddSC_instance_oculus()
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
index 0eafd7a7fea..0e73e929aef 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
@@ -15,8 +15,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "Vehicle.h"
+#include "CombatAI.h"
#include "oculus.h"
+#include "Player.h"
#define GOSSIP_ITEM_DRAKES "So where do we go from here?"
#define GOSSIP_ITEM_BELGARISTRASZ1 "I want to fly on the wings of the Red Flight"
@@ -26,9 +33,9 @@
#define GOSSIP_ITEM_ETERNOS1 "I want to fly on the wings of the Bronze Flight"
#define GOSSIP_ITEM_ETERNOS2 "What abilities do Amber Drakes have?"
-#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE, 1) || (a)->HasItemCount(ITEM_AMBER_ESSENCE, 1) || (a)->HasItemCount(ITEM_RUBY_ESSENCE, 1))
+#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE) || (a)->HasItemCount(ITEM_AMBER_ESSENCE) || (a)->HasItemCount(ITEM_RUBY_ESSENCE))
-enum Drakes
+enum GossipNPCs
{
GOSSIP_TEXTID_DRAKES = 13267,
GOSSIP_TEXTID_BELGARISTRASZ1 = 12916,
@@ -45,23 +52,65 @@ enum Drakes
ITEM_AMBER_ESSENCE = 37859,
ITEM_RUBY_ESSENCE = 37860,
- NPC_VERDISA = 27657,
- NPC_BELGARISTRASZ = 27658,
- NPC_ETERNOS = 27659,
+ SPELL_SHOCK_CHARGE = 49836
+};
+
+enum Drakes
+{
+/*Ruby Drake,
+(npc 27756) (item 37860)
+(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756)
+*/
+ SPELL_RIDE_RUBY_DRAKE_QUE = 49463, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464
+ SPELL_RUBY_DRAKE_SADDLE = 49464, //Allows you to ride on the back of an Amber Drake. ---> Dummy
+ SPELL_RUBY_SEARING_WRATH = 50232, //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets
+ SPELL_RUBY_EVASIVE_AURA = 50248, //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells.
+ SPELL_RUBY_EVASIVE_MANEUVERS = 50240, //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted.
+ //you do not have acces to until you kill Mage-Lord Urom
+ SPELL_RUBY_MARTYR = 50253, //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec.
+
+/*Amber Drake,
+(npc 27755) (item 37859)
+(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755)
+*/
- SPELL_SHOCK_CHARGE = 49836,
+ SPELL_RIDE_AMBER_DRAKE_QUE = 49459, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460
+ SPELL_AMBER_DRAKE_SADDLE = 49460, //Allows you to ride on the back of an Amber Drake. ---> Dummy
+ SPELL_AMBER_SHOCK_LANCE = 49840, //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated.
+ // SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target.
+ //you do not have access to until you kill the Mage-Lord Urom.
+ SPELL_AMBER_TEMPORAL_RIFT = 49592, //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15, 000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated.
+
+/*Emerald Drake,
+(npc 27692) (item 37815),
+ (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692)
+*/
+ SPELL_RIDE_EMERALD_DRAKE_QUE = 49427, //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346
+ SPELL_EMERALD_DRAKE_SADDLE = 49346, //Allows you to ride on the back of an Amber Drake. ---> Dummy
+ SPELL_EMERALD_LEECHING_POISON = 50328, //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times.
+ SPELL_EMERALD_TOUCH_THE_NIGHTMARE = 50341, //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25, 000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec.
+ // you do not have access to until you kill the Mage-Lord Urom
+ SPELL_EMERALD_DREAM_FUNNEL = 50344, //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels.
};
enum Says
{
- SAY_VAROS = 0,
- SAY_UROM = 1
+ SAY_VAROS = 0,
+ SAY_UROM = 1,
+ SAY_BELGARISTRASZ = 0,
+ SAY_DRAKES_TAKEOFF = 0,
+ WHISPER_DRAKES_WELCOME = 1,
+ WHISPER_DRAKES_ABILITIES = 2,
+ WHISPER_DRAKES_SPECIAL = 3,
+ WHISPER_DRAKES_LOWHEALTH = 4
};
-class npc_oculus_drake : public CreatureScript
+class npc_verdisa_beglaristrasz_eternos : public CreatureScript
{
public:
- npc_oculus_drake() : CreatureScript("npc_oculus_drake") { }
+ npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { }
+
+ InstanceScript* instance;
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
@@ -180,6 +229,28 @@ public:
return true;
}
+ struct npc_verdisa_beglaristrasz_eternosAI : public ScriptedAI
+ {
+ npc_verdisa_beglaristrasz_eternosAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void MovementInform(uint32 /*type*/, uint32 id)
+ {
+ // When Belgaristraz finish his moving say grateful text
+ if (me->GetEntry() == NPC_BELGARISTRASZ)
+ if (id == 0)
+ {
+ Talk(SAY_BELGARISTRASZ);
+ }
+ // The gossip flag should activate when Drakos die and not from DB
+ if (id == 0)
+ me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_verdisa_beglaristrasz_eternosAI(creature);
+ }
};
class npc_image_belgaristrasz : public CreatureScript
@@ -189,7 +260,7 @@ public:
struct npc_image_belgaristraszAI : public ScriptedAI
{
- npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) {}
+ npc_image_belgaristraszAI(Creature* creature) : ScriptedAI(creature) { }
void IsSummonedBy(Unit* summoner)
{
@@ -212,6 +283,176 @@ public:
}
};
+class npc_ruby_emerald_amber_drake : public CreatureScript
+{
+public:
+ npc_ruby_emerald_amber_drake() : CreatureScript("npc_ruby_emerald_amber_drake") { }
+
+ struct npc_ruby_emerald_amber_drakeAI : public VehicleAI
+ {
+ npc_ruby_emerald_amber_drakeAI(Creature* creature) : VehicleAI(creature)
+ {
+ instance = creature->GetInstanceScript();
+ }
+
+ InstanceScript* instance;
+
+ uint64 summonerGUID;
+ uint32 WelcomeTimer;
+ uint32 WelcomeSequelTimer;
+ uint32 SpecialTimer;
+ uint32 WarningTimer;
+ uint32 TakeOffTimer;
+
+ bool WelcomeOff;
+ bool WelcomeSequelOff;
+ bool SpecialOff;
+ bool HealthWarningOff;
+ bool DisableTakeOff;
+
+ void Reset()
+ {
+ summonerGUID = 0;
+ WelcomeTimer = 4500;
+ WelcomeSequelTimer = 4500;
+ SpecialTimer = 10000;
+ WarningTimer = 25000;
+ TakeOffTimer = 3500;
+
+ WelcomeOff = false;
+ WelcomeSequelOff = false;
+ SpecialOff = false;
+ HealthWarningOff = false;
+ DisableTakeOff = false;
+ }
+
+ void IsSummonedBy(Unit* summoner)
+ {
+ if (instance->GetBossState(DATA_EREGOS_EVENT) == IN_PROGRESS)
+ if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true))
+ {
+ eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos
+ }
+ summonerGUID = summoner->GetGUID();
+ me->SetFacingToObject(summoner);
+ // TO DO: Drake Ques should be casted from vehicle to player, however the way core handle triggered spells from auras break it no matter the conditions. So this change the caster and give the same result until someone fix triggered spells from auras that involve implicit targets or make exception for this case.
+ if (me->GetEntry() == NPC_RUBY_DRAKE_VEHICLE)
+ summoner->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE);
+ if (me->GetEntry() == NPC_EMERALD_DRAKE_VEHICLE)
+ summoner->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE);
+ if (me->GetEntry() == NPC_AMBER_DRAKE_VEHICLE)
+ summoner->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE);
+ Position pos;
+ summoner->GetPosition(&pos);
+ me->GetMotionMaster()->MovePoint(0, pos);
+ }
+
+ void MovementInform(uint32 type, uint32 id)
+ {
+ if (type == POINT_MOTION_TYPE && id == 0)
+ {
+ me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move.
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!(instance->GetBossState(DATA_VAROS_EVENT) == DONE))
+ {
+ if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
+ {
+ if (!(WelcomeOff))
+ {
+ if (WelcomeTimer <= diff)
+ {
+ Talk(WHISPER_DRAKES_WELCOME, me->GetCreatorGUID());
+ WelcomeOff = true;
+ WelcomeSequelOff = true;
+ }
+ else WelcomeTimer -= diff;
+ }
+ }
+ }
+ if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
+ {
+ if (WelcomeSequelOff)
+ {
+ if (WelcomeSequelTimer <= diff)
+ {
+ Talk(WHISPER_DRAKES_ABILITIES, me->GetCreatorGUID());
+ WelcomeSequelOff = false;
+ }
+ else WelcomeSequelTimer -= diff;
+ }
+ }
+ if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
+ {
+ if (instance->GetBossState(DATA_UROM_EVENT) == DONE)
+ {
+ if (!(SpecialOff))
+ {
+ if (SpecialTimer <= diff)
+ {
+ Talk(WHISPER_DRAKES_SPECIAL, me->GetCreatorGUID());
+ SpecialOff = true;
+ }
+ else SpecialTimer -= diff;
+ }
+ }
+ }
+ if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
+ {
+ if (!(HealthWarningOff))
+ {
+ if (me->GetHealthPct() <= 40.0f)
+ {
+ Talk(WHISPER_DRAKES_LOWHEALTH, me->GetCreatorGUID());
+ HealthWarningOff = true;
+ }
+ }
+ }
+ if (me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE))
+ {
+ if (HealthWarningOff)
+ {
+ if (WarningTimer <= diff)
+ {
+ HealthWarningOff = false;
+ WarningTimer = 25000;
+ }
+ else WarningTimer -= diff;
+ }
+ }
+ if (!(me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)))
+ {
+ if (!(DisableTakeOff))
+ {
+ if (TakeOffTimer <= diff)
+ {
+ me->DespawnOrUnsummon(2050);
+ me->SetOrientation(2.5f);
+ me->SetSpeed(MOVE_FLIGHT, 1.0f, true);
+ Talk(SAY_DRAKES_TAKEOFF);
+ Position pos;
+ me->GetPosition(&pos);
+ pos.m_positionX += 10.0f;
+ pos.m_positionY += 10.0f;
+ pos.m_positionZ += 12.0f;
+ me->GetMotionMaster()->MovePoint(1, pos);
+ DisableTakeOff = true;
+ }
+ else TakeOffTimer -= diff;
+ }
+ }
+ };
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_ruby_emerald_amber_drakeAI(creature);
+ }
+};
+
class spell_gen_stop_time : public SpellScriptLoader
{
public:
@@ -243,9 +484,50 @@ public:
}
};
+class spell_call_ruby_emerald_amber_drake : public SpellScriptLoader
+{
+public:
+ spell_call_ruby_emerald_amber_drake() : SpellScriptLoader("spell_call_ruby_emerald_amber_drake") { }
+
+ class spell_call_ruby_emerald_amber_drake_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_call_ruby_emerald_amber_drake_SpellScript);
+
+ void ChangeSummonPos(SpellEffIndex /*effIndex*/)
+ {
+ // Adjust effect summon position
+ WorldLocation summonPos = *GetExplTargetDest();
+ Position offset = {0.0f, 0.0f, 12.0f, 0.0f};
+ summonPos.RelocateOffset(offset);
+ SetExplTargetDest(summonPos);
+ GetHitDest()->RelocateOffset(offset);
+ }
+
+ void ModDestHeight(SpellEffIndex /*effIndex*/)
+ {
+ // Used to cast visual effect at proper position
+ Position offset = {0.0f, 0.0f, 12.0f, 0.0f};
+ const_cast<WorldLocation*>(GetExplTargetDest())->RelocateOffset(offset);
+ }
+
+ void Register()
+ {
+ OnEffectHit += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ChangeSummonPos, EFFECT_0, SPELL_EFFECT_SUMMON);
+ OnEffectLaunch += SpellEffectFn(spell_call_ruby_emerald_amber_drake_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_call_ruby_emerald_amber_drake_SpellScript();
+ }
+};
+
void AddSC_oculus()
{
- new npc_oculus_drake();
+ new npc_verdisa_beglaristrasz_eternos();
new npc_image_belgaristrasz();
+ new npc_ruby_emerald_amber_drake();
new spell_gen_stop_time();
+ new spell_call_ruby_emerald_amber_drake();
}
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h
index 81d1e9f9ea8..c536b43f905 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h
@@ -35,15 +35,22 @@ enum Data64
DATA_EREGOS
};
-enum Bosses
+enum Bosses_NPCs
{
NPC_DRAKOS = 27654,
NPC_VAROS = 27447,
NPC_UROM = 27655,
NPC_EREGOS = 27656,
- NPC_AZURE_RING_GUARDIAN = 28236,
- NPC_CENTRIFUGE_CONSTRUCT = 27641,
+ NPC_AZURE_RING_GUARDIAN = 28236,
+ NPC_CENTRIFUGE_CONSTRUCT = 27641,
+ NPC_RUBY_DRAKE_VEHICLE = 27756,
+ NPC_EMERALD_DRAKE_VEHICLE = 27692,
+ NPC_AMBER_DRAKE_VEHICLE = 27755,
+ NPC_VERDISA = 27657,
+ NPC_BELGARISTRASZ = 27658,
+ NPC_ETERNOS = 27659,
+ NPC_GREATER_WHELP = 28276
};
enum GameObjects
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
index 9f39cecbb23..72ab5259693 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp
@@ -23,7 +23,8 @@ SDComment: Waypoint needed, we expect boss to always have 2x Stormforged Lieuten
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
enum eEnums
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
index abdf5ecb1e1..6f54ce50a94 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp
@@ -20,8 +20,10 @@
* Comment: Timer check pending
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
+#include "SpellInfo.h"
enum Spells
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
index 5c7bf0d1c1e..a7dae9aba78 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp
@@ -23,10 +23,13 @@ SDComment: Event should be pretty close minus a few visual flaws
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_lightning.h"
+#include "Player.h"
+#include "SpellInfo.h"
-enum eEnums
+enum Enums
{
SAY_AGGRO = 0,
SAY_FORGE = 1,
@@ -59,7 +62,7 @@ enum eEnums
MAX_GOLEM = 2,
- ACHIEVEMENT_SHATTER_RESISTANT = 2042
+ DATA_SHATTER_RESISTANT = 2042
};
/*######
@@ -149,21 +152,6 @@ public:
if (instance)
instance->SetData(TYPE_VOLKHAN, DONE);
-
- if (IsHeroic() && GolemsShattered < 5)
- {
- AchievementEntry const* AchievShatterResistant = sAchievementStore.LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT);
- if (AchievShatterResistant)
- {
- Map* map = me->GetMap();
- if (map && map->IsDungeon())
- {
- Map::PlayerList const &players = map->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- itr->getSource()->CompletedAchievement(AchievShatterResistant);
- }
- }
- }
}
void KilledUnit(Unit* /*victim*/)
@@ -230,6 +218,14 @@ public:
}
}
+ uint32 GetData(uint32 data) const
+ {
+ if (data == DATA_SHATTER_RESISTANT)
+ return GolemsShattered;
+
+ return 0;
+ }
+
void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
@@ -458,8 +454,20 @@ public:
};
};
+class achievement_shatter_resistant : public AchievementCriteriaScript
+{
+ public:
+ achievement_shatter_resistant() : AchievementCriteriaScript("achievement_shatter_resistant") { }
+
+ bool OnCheck(Player* /*source*/, Unit* target)
+ {
+ return target && target->GetAI()->GetData(DATA_SHATTER_RESISTANT) < 5;
+ }
+};
+
void AddSC_boss_volkhan()
{
new boss_volkhan();
new mob_molten_golem();
+ new achievement_shatter_resistant();
}
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
index f25be6dae0d..e399c5548e3 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp
@@ -23,7 +23,8 @@ SDComment: All ready.
SDCategory: Halls of Lightning
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "halls_of_lightning.h"
/* Halls of Lightning encounters:
@@ -173,7 +174,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 uiType)
+ uint32 GetData(uint32 uiType) const
{
switch (uiType)
{
@@ -189,7 +190,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 uiData)
+ uint64 GetData64(uint32 uiData) const
{
switch (uiData)
{
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
index 93bea92503c..747bd699c81 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp
@@ -45,10 +45,10 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1599007,
- SAY_KILL = -1599008,
- SAY_DEATH = -1599009,
- SAY_SHATTER = -1599010
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_DEATH = 2,
+ SAY_SHATTER = 3
};
class boss_krystallus : public CreatureScript
@@ -93,7 +93,7 @@ public:
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS);
@@ -146,7 +146,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_KRYSTALLUS_EVENT, DONE);
@@ -156,7 +156,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(SAY_KILL, me);
+ Talk(SAY_KILL);
}
void SpellHitTarget(Unit* /*target*/, const SpellInfo* pSpell)
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 65711643827..4511b8b0f1e 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
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_stone.h"
enum Spells
@@ -39,13 +40,10 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1599000,
- SAY_SLAY_1 = -1599001,
- SAY_SLAY_2 = -1599002,
- SAY_SLAY_3 = -1599003,
- SAY_SLAY_4 = -1599004,
- SAY_DEATH = -1599005,
- SAY_STUN = -1599006
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_STUN = 3
};
enum Achievements
@@ -93,7 +91,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
{
@@ -137,7 +135,7 @@ public:
if (ShockOfSorrowTimer <= diff)
{
DoResetThreat();
- DoScriptText(SAY_STUN, me);
+ Talk(SAY_STUN);
DoCast(me, SPELL_SHOCK_OF_SORROW_N);
ShockOfSorrowTimer = urand(20000, 30000);
} else ShockOfSorrowTimer -= diff;
@@ -159,7 +157,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE);
@@ -170,7 +168,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3, SAY_SLAY_4), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
index c2a8e905950..326779661cc 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "halls_of_stone.h"
enum Spells
@@ -43,11 +44,9 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1599011,
- SAY_SLAY_1 = -1599012,
- SAY_SLAY_2 = -1599013,
- SAY_SLAY_3 = -1599014,
- SAY_DEATH = -1599015
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2
};
#define EMOTE_GENERIC_FRENZY -1000002
@@ -131,7 +130,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
uiEncounterTimer = 0;
@@ -216,7 +215,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
lSummons.DespawnAll();
if (instance)
@@ -226,7 +225,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
void DoAction(int32 const action)
@@ -235,7 +234,7 @@ public:
++abuseTheOoze;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_ABUSE_THE_OOZE)
return abuseTheOoze;
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 a608de5fcf3..6b51d923517 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp
@@ -15,74 +15,71 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "halls_of_stone.h"
+#include "Player.h"
enum Texts
{
- SAY_KILL_1 = -1599016,
- SAY_KILL_2 = -1599017,
- SAY_KILL_3 = -1599018,
- SAY_LOW_HEALTH = -1599019,
- SAY_DEATH = -1599020,
- SAY_PLAYER_DEATH_1 = -1599021,
- SAY_PLAYER_DEATH_2 = -1599022,
- SAY_PLAYER_DEATH_3 = -1599023,
- SAY_ESCORT_START = -1599024,
-
- SAY_SPAWN_DWARF = -1599025,
- SAY_SPAWN_TROGG = -1599026,
- SAY_SPAWN_OOZE = -1599027,
- SAY_SPAWN_EARTHEN = -1599028,
-
- SAY_EVENT_INTRO_1 = -1599029,
- SAY_EVENT_INTRO_2 = -1599030,
- SAY_EVENT_INTRO_3_ABED = -1599031,
-
- SAY_EVENT_A_1 = -1599032,
- SAY_EVENT_A_2_KADD = -1599033,
- SAY_EVENT_A_3 = -1599034,
-
- SAY_EVENT_B_1 = -1599035,
- SAY_EVENT_B_2_MARN = -1599036,
- SAY_EVENT_B_3 = -1599037,
-
- SAY_EVENT_C_1 = -1599038,
- SAY_EVENT_C_2_ABED = -1599039,
- SAY_EVENT_C_3 = -1599040,
-
- SAY_EVENT_D_1 = -1599041,
- SAY_EVENT_D_2_ABED = -1599042,
- SAY_EVENT_D_3 = -1599043,
- SAY_EVENT_D_4_ABED = -1599044,
-
- SAY_EVENT_END_01 = -1599045,
- SAY_EVENT_END_02 = -1599046,
- SAY_EVENT_END_03_ABED = -1599047,
- SAY_EVENT_END_04 = -1599048,
- SAY_EVENT_END_05_ABED = -1599049,
- SAY_EVENT_END_06 = -1599050,
- SAY_EVENT_END_07_ABED = -1599051,
- SAY_EVENT_END_08 = -1599052,
- SAY_EVENT_END_09_KADD = -1599053,
- SAY_EVENT_END_10 = -1599054,
- SAY_EVENT_END_11_KADD = -1599055,
- SAY_EVENT_END_12 = -1599056,
- SAY_EVENT_END_13_KADD = -1599057,
- SAY_EVENT_END_14 = -1599058,
- SAY_EVENT_END_15_MARN = -1599059,
- SAY_EVENT_END_16 = -1599060,
- SAY_EVENT_END_17_MARN = -1599061,
- SAY_EVENT_END_18 = -1599062,
- SAY_EVENT_END_19_MARN = -1599063,
- SAY_EVENT_END_20 = -1599064,
- SAY_EVENT_END_21_ABED = -1599065,
-
- SAY_VICTORY_SJONNIR_1 = -1599066,
- SAY_VICTORY_SJONNIR_2 = -1599067,
-
- SAY_ENTRANCE_MEET = -1599068,
+ SAY_KILL = 0,
+ SAY_LOW_HEALTH = 1,
+ SAY_DEATH = 2,
+ SAY_PLAYER_DEATH = 3,
+ SAY_ESCORT_START = 4,
+
+ SAY_SPAWN_DWARF = 5,
+ SAY_SPAWN_TROGG = 6,
+ SAY_SPAWN_OOZE = 7,
+ SAY_SPAWN_EARTHEN = 8,
+
+ SAY_EVENT_INTRO_1 = 9,
+ SAY_EVENT_INTRO_2 = 10,
+ SAY_EVENT_A_1 = 11,
+ SAY_EVENT_A_3 = 12,
+ SAY_EVENT_B_1 = 13,
+ SAY_EVENT_B_3 = 14,
+ SAY_EVENT_C_1 = 15,
+ SAY_EVENT_C_3 = 16,
+ SAY_EVENT_D_1 = 17,
+ SAY_EVENT_D_3 = 18,
+
+ SAY_EVENT_END_01 = 19,
+ SAY_EVENT_END_02 = 20,
+ SAY_EVENT_END_04 = 21,
+ SAY_EVENT_END_06 = 22,
+ SAY_EVENT_END_08 = 23,
+ SAY_EVENT_END_10 = 24,
+ SAY_EVENT_END_12 = 25,
+ SAY_EVENT_END_14 = 26,
+ SAY_EVENT_END_16 = 27,
+ SAY_EVENT_END_18 = 28,
+ SAY_EVENT_END_20 = 29,
+
+ SAY_VICTORY_SJONNIR_1 = 30,
+ SAY_VICTORY_SJONNIR_2 = 31,
+ SAY_ENTRANCE_MEET = 32,
+
+ SAY_EVENT_INTRO_3_ABED = 0,
+ SAY_EVENT_C_2_ABED = 1,
+ SAY_EVENT_D_2_ABED = 2,
+ SAY_EVENT_D_4_ABED = 3,
+ SAY_EVENT_END_03_ABED = 4,
+ SAY_EVENT_END_05_ABED = 5,
+ SAY_EVENT_END_07_ABED = 6,
+ SAY_EVENT_END_21_ABED = 7,
+
+ SAY_EVENT_A_2_KADD = 0,
+ SAY_EVENT_END_09_KADD = 1,
+ SAY_EVENT_END_11_KADD = 2,
+ SAY_EVENT_END_13_KADD = 3,
+
+ SAY_EVENT_B_2_MARN = 0,
+ SAY_EVENT_END_15_MARN = 1,
+ SAY_EVENT_END_17_MARN = 2,
+ SAY_EVENT_END_19_MARN = 3,
TEXT_ID_START = 13100,
TEXT_ID_PROGRESS = 13101
@@ -360,12 +357,12 @@ public:
}
break;
case 13:
- DoScriptText(SAY_EVENT_INTRO_1, me);
+ Talk(SAY_EVENT_INTRO_1);
SetEscortPaused(true);
JumpToNextStep(20000);
break;
case 17:
- DoScriptText(SAY_EVENT_INTRO_2, me);
+ Talk(SAY_EVENT_INTRO_2);
if (instance)
instance->HandleGameObject(instance->GetData64(DATA_GO_TRIBUNAL_CONSOLE), true);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
@@ -427,7 +424,7 @@ public:
brannSparklinNews = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_BRANN_SPARKLIN_NEWS)
return brannSparklinNews ? 1 : 0;
@@ -449,7 +446,7 @@ public:
instance->SetData(DATA_BRANN_EVENT, IN_PROGRESS);
}
bIsBattle = false;
- DoScriptText(SAY_ESCORT_START, me);
+ Talk(SAY_ESCORT_START);
SetRun(true);
JumpToNextStep(0);
break;
@@ -460,21 +457,21 @@ public:
case 5:
if (instance)
if (Creature* temp = (Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM))))
- DoScriptText(SAY_EVENT_INTRO_3_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_INTRO_3_ABED);
JumpToNextStep(8500);
break;
case 6:
- DoScriptText(SAY_EVENT_A_1, me);
+ Talk(SAY_EVENT_A_1);
JumpToNextStep(6500);
break;
case 7:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
- DoScriptText(SAY_EVENT_A_2_KADD, temp);
+ temp->AI()->Talk(SAY_EVENT_A_2_KADD);
JumpToNextStep(12500);
break;
case 8:
- DoScriptText(SAY_EVENT_A_3, me);
+ Talk(SAY_EVENT_A_3);
if (instance)
instance->HandleGameObject(instance->GetData64(DATA_GO_KADDRAK), true);
if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
@@ -487,18 +484,18 @@ public:
JumpToNextStep(20000);
break;
case 10:
- DoScriptText(SAY_EVENT_B_1, me);
+ Talk(SAY_EVENT_B_1);
JumpToNextStep(6000);
break;
case 11:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
- DoScriptText(SAY_EVENT_B_2_MARN, temp);
+ temp->AI()->Talk(SAY_EVENT_B_2_MARN);
SpawnDwarf(1);
JumpToNextStep(20000);
break;
case 12:
- DoScriptText(SAY_EVENT_B_3, me);
+ Talk(SAY_EVENT_B_3);
if (instance)
instance->HandleGameObject(instance->GetData64(DATA_GO_MARNAK), true);
if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
@@ -514,7 +511,7 @@ public:
JumpToNextStep(20000);
break;
case 15:
- DoScriptText(SAY_EVENT_C_1, me);
+ Talk(SAY_EVENT_C_1);
SpawnDwarf(1);
JumpToNextStep(10000);
break;
@@ -525,12 +522,12 @@ public:
case 17:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_C_2_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_C_2_ABED);
SpawnDwarf(1);
JumpToNextStep(20000);
break;
case 18:
- DoScriptText(SAY_EVENT_C_3, me);
+ Talk(SAY_EVENT_C_3);
if (instance)
instance->HandleGameObject(instance->GetData64(DATA_GO_ABEDNEUM), true);
if (Creature* temp = Unit::GetCreature(*me, uiControllerGUID))
@@ -546,14 +543,14 @@ public:
JumpToNextStep(15000);
break;
case 21:
- DoScriptText(SAY_EVENT_D_1, me);
+ Talk(SAY_EVENT_D_1);
SpawnDwarf(3);
JumpToNextStep(20000);
break;
case 22:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_D_2_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_D_2_ABED);
SpawnDwarf(1);
JumpToNextStep(5000);
break;
@@ -562,7 +559,7 @@ public:
JumpToNextStep(15000);
break;
case 24:
- DoScriptText(SAY_EVENT_D_3, me);
+ Talk(SAY_EVENT_D_3);
SpawnDwarf(3);
JumpToNextStep(5000);
break;
@@ -577,13 +574,13 @@ public:
case 27:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_D_4_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_D_4_ABED);
SpawnDwarf(1);
JumpToNextStep(10000);
break;
case 28:
me->SetReactState(REACT_DEFENSIVE);
- DoScriptText(SAY_EVENT_END_01, me);
+ Talk(SAY_EVENT_END_01);
me->SetStandState(UNIT_STAND_STATE_STAND);
if (instance)
instance->HandleGameObject(instance->GetData64(DATA_GO_SKY_FLOOR), true);
@@ -594,7 +591,7 @@ public:
JumpToNextStep(6500);
break;
case 29:
- DoScriptText(SAY_EVENT_END_02, me);
+ Talk(SAY_EVENT_END_02);
if (instance)
instance->SetData(DATA_BRANN_EVENT, DONE);
me->CastSpell(me, SPELL_REWARD_ACHIEVEMENT, true);
@@ -603,97 +600,97 @@ public:
case 30:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_END_03_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_END_03_ABED);
JumpToNextStep(8500);
break;
case 31:
- DoScriptText(SAY_EVENT_END_04, me);
+ Talk(SAY_EVENT_END_04);
JumpToNextStep(11500);
break;
case 32:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_END_05_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_END_05_ABED);
JumpToNextStep(11500);
break;
case 33:
- DoScriptText(SAY_EVENT_END_06, me);
+ Talk(SAY_EVENT_END_06);
JumpToNextStep(4500);
break;
case 34:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_END_07_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_END_07_ABED);
JumpToNextStep(22500);
break;
case 35:
- DoScriptText(SAY_EVENT_END_08, me);
+ Talk(SAY_EVENT_END_08);
JumpToNextStep(7500);
break;
case 36:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
- DoScriptText(SAY_EVENT_END_09_KADD, temp);
+ temp->AI()->Talk(SAY_EVENT_END_09_KADD);
JumpToNextStep(18500);
break;
case 37:
- DoScriptText(SAY_EVENT_END_10, me);
+ Talk(SAY_EVENT_END_10);
JumpToNextStep(5500);
break;
case 38:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
- DoScriptText(SAY_EVENT_END_11_KADD, temp);
+ temp->AI()->Talk(SAY_EVENT_END_11_KADD);
JumpToNextStep(20500);
break;
case 39:
- DoScriptText(SAY_EVENT_END_12, me);
+ Talk(SAY_EVENT_END_12);
JumpToNextStep(2500);
break;
case 40:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_KADDRAK)))
- DoScriptText(SAY_EVENT_END_13_KADD, temp);
+ temp->AI()->Talk(SAY_EVENT_END_13_KADD);
JumpToNextStep(19500);
break;
case 41:
- DoScriptText(SAY_EVENT_END_14, me);
+ Talk(SAY_EVENT_END_14);
JumpToNextStep(10500);
break;
case 42:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
- DoScriptText(SAY_EVENT_END_15_MARN, temp);
+ temp->AI()->Talk(SAY_EVENT_END_15_MARN);
JumpToNextStep(6500);
break;
case 43:
- DoScriptText(SAY_EVENT_END_16, me);
+ Talk(SAY_EVENT_END_16);
JumpToNextStep(6500);
break;
case 44:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
- DoScriptText(SAY_EVENT_END_17_MARN, temp);
+ temp->AI()->Talk(SAY_EVENT_END_17_MARN);
JumpToNextStep(25500);
break;
case 45:
- DoScriptText(SAY_EVENT_END_18, me);
+ Talk(SAY_EVENT_END_18);
JumpToNextStep(23500);
break;
case 46:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_MARNAK)))
- DoScriptText(SAY_EVENT_END_19_MARN, temp);
+ temp->AI()->Talk(SAY_EVENT_END_19_MARN);
JumpToNextStep(3500);
break;
case 47:
- DoScriptText(SAY_EVENT_END_20, me);
+ Talk(SAY_EVENT_END_20);
JumpToNextStep(8500);
break;
case 48:
if (instance)
if (Creature* temp = Unit::GetCreature(*me, instance->GetData64(DATA_ABEDNEUM)))
- DoScriptText(SAY_EVENT_END_21_ABED, temp);
+ temp->AI()->Talk(SAY_EVENT_END_21_ABED);
JumpToNextStep(5500);
break;
case 49:
@@ -720,7 +717,7 @@ public:
if (!bIsLowHP && HealthBelowPct(30))
{
- DoScriptText(SAY_LOW_HEALTH, me);
+ Talk(SAY_LOW_HEALTH);
bIsLowHP = true;
}
else if (bIsLowHP && !HealthBelowPct(30))
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
index ee5cb87dd85..7a2b579dca9 100644
--- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
+++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "halls_of_stone.h"
#define MAX_ENCOUNTER 4
@@ -185,7 +186,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -198,7 +199,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
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 7ee67060f97..e52f1efcd73 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
@@ -24,6 +24,7 @@
#include "MapManager.h"
#include "MoveSplineInit.h"
#include "ulduar.h"
+#include "Player.h"
enum Texts
{
@@ -373,11 +374,11 @@ class boss_algalon_the_observer : public CreatureScript
case ACTION_INIT_ALGALON:
_firstPull = false;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
- break;;
+ break;
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
return type == DATA_HAS_FED_ON_TEARS ? _fedOnTears : 1;
}
@@ -521,7 +522,7 @@ class boss_algalon_the_observer : public CreatureScript
if (Creature* wormHole = DoSummon(NPC_WORM_HOLE, CollapsingStarPos[i], TEMPSUMMON_MANUAL_DESPAWN))
wormHole->m_Events.AddEvent(new SummonUnleashedDarkMatter(wormHole), wormHole->m_Events.CalculateTime(i >= 2 ? 8000 : 6000));
}
- else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePctF<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
+ else if ((int32(me->GetHealth()) - int32(damage)) < CalculatePct<int32>(int32(me->GetMaxHealth()), 2.5f) && !_fightWon)
{
_fightWon = true;
damage = 0;
@@ -727,7 +728,7 @@ class npc_living_constellation : public CreatureScript
_isActive = false;
}
- uint32 GetData(uint32 /*type*/)
+ uint32 GetData(uint32 /*type*/) const
{
return _isActive ? 1 : 0;
}
@@ -978,7 +979,7 @@ class go_celestial_planetarium_access : public GameObjectScript
if (!lock->Index[i])
continue;
- if (player->HasItemCount(lock->Index[i], 1))
+ if (player->HasItemCount(lock->Index[i]))
{
hasKey = true;
break;
@@ -1328,7 +1329,7 @@ class spell_algalon_supermassive_fail : public SpellScriptLoader
if (!GetHitPlayer())
return;
- GetHitPlayer()->GetAchievementMgr().ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true);
+ GetHitPlayer()->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_CONDITION_NO_SPELL_HIT, GetSpellInfo()->Id, true);
}
void Register()
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 0967c38c2e7..db8c7f38ef7 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
@@ -18,7 +18,7 @@
/* ScriptData
SDName: Assembly of Iron encounter
SD%Complete: 60%
-SDComment: Runes need DB support, chain lightning won't cast, supercharge won't cast (target error?) - it worked before during debugging.
+SDComment: chain lightning won't cast, supercharge don't work (auras don't stack from different casters)
SDCategory: Ulduar - Ulduar
EndScriptData */
@@ -33,6 +33,7 @@ enum AssemblySpells
// General
SPELL_SUPERCHARGE = 61920,
SPELL_BERSERK = 47008, // Hard enrage, don't know the correct ID.
+ SPELL_KILL_CREDIT = 65195, // spell_dbc
// Steelbreaker
SPELL_HIGH_VOLTAGE = 61890,
@@ -45,12 +46,9 @@ enum AssemblySpells
SPELL_SHIELD_OF_RUNES = 62274,
SPELL_SHIELD_OF_RUNES_BUFF = 62277,
SPELL_SUMMON_RUNE_OF_POWER = 63513,
- SPELL_RUNE_OF_POWER = 61974,
SPELL_RUNE_OF_DEATH = 62269,
SPELL_RUNE_OF_SUMMONING = 62273, // This is the spell that summons the rune
- SPELL_RUNE_OF_SUMMONING_VIS = 62019, // Visual
SPELL_RUNE_OF_SUMMONING_SUMMON = 62020, // Spell that summons
- SPELL_LIGHTNING_ELEMENTAL_PASSIVE = 62052,
// Stormcaller Brundir
SPELL_CHAIN_LIGHTNING = 61879,
@@ -59,7 +57,7 @@ enum AssemblySpells
SPELL_LIGHTNING_TENDRILS_10M = 61887,
SPELL_LIGHTNING_TENDRILS_25M = 63486,
SPELL_LIGHTNING_TENDRILS_VISUAL = 61883,
- SPELL_STORMSHIELD = 64187,
+ SPELL_STORMSHIELD = 64187
};
enum AssemblyEvents
@@ -88,115 +86,50 @@ enum AssemblyEvents
EVENT_ENDFLIGHT = 15,
EVENT_GROUND = 16,
EVENT_LAND = 17,
- EVENT_MOVE_POSITION = 18,
+ EVENT_MOVE_POSITION = 18
};
enum AssemblyActions
{
- ACTION_STEELBREAKER = 0,
- ACTION_MOLGEIM = 1,
- ACTION_BRUNDIR = 2,
- ACTION_ADD_CHARGE = 3,
+ ACTION_SUPERCHARGE = 1,
+ ACTION_ADD_CHARGE = 2
};
enum AssemblyYells
{
- SAY_STEELBREAKER_AGGRO = -1603020,
- SAY_STEELBREAKER_SLAY_1 = -1603021,
- SAY_STEELBREAKER_SLAY_2 = -1603022,
- SAY_STEELBREAKER_POWER = -1603023,
- SAY_STEELBREAKER_DEATH_1 = -1603024,
- SAY_STEELBREAKER_DEATH_2 = -1603025,
- SAY_STEELBREAKER_BERSERK = -1603026,
-
- SAY_MOLGEIM_AGGRO = -1603030,
- SAY_MOLGEIM_SLAY_1 = -1603031,
- SAY_MOLGEIM_SLAY_2 = -1603032,
- SAY_MOLGEIM_RUNE_DEATH = -1603033,
- SAY_MOLGEIM_SUMMON = -1603034,
- SAY_MOLGEIM_DEATH_1 = -1603035,
- SAY_MOLGEIM_DEATH_2 = -1603036,
- SAY_MOLGEIM_BERSERK = -1603037,
-
- SAY_BRUNDIR_AGGRO = -1603040,
- SAY_BRUNDIR_SLAY_1 = -1603041,
- SAY_BRUNDIR_SLAY_2 = -1603042,
- SAY_BRUNDIR_SPECIAL = -1603043,
- SAY_BRUNDIR_FLIGHT = -1603044,
- SAY_BRUNDIR_DEATH_1 = -1603045,
- SAY_BRUNDIR_DEATH_2 = -1603046,
- SAY_BRUNDIR_BERSERK = -1603047,
+ SAY_STEELBREAKER_AGGRO = 0,
+ SAY_STEELBREAKER_SLAY = 1,
+ SAY_STEELBREAKER_POWER = 2,
+ SAY_STEELBREAKER_DEATH = 3,
+ SAY_STEELBREAKER_ENCOUNTER_DEFEATED = 4,
+ SAY_STEELBREAKER_BERSERK = 5,
+
+ SAY_MOLGEIM_AGGRO = 0,
+ SAY_MOLGEIM_SLAY = 1,
+ SAY_MOLGEIM_RUNE_DEATH = 2,
+ SAY_MOLGEIM_SUMMON = 3,
+ SAY_MOLGEIM_DEATH = 4,
+ SAY_MOLGEIM_ENCOUNTER_DEFEATED = 5,
+ SAY_MOLGEIM_BERSERK = 6,
+
+ SAY_BRUNDIR_AGGRO = 0,
+ SAY_BRUNDIR_SLAY = 1,
+ SAY_BRUNDIR_SPECIAL = 2,
+ SAY_BRUNDIR_FLIGHT = 3,
+ SAY_BRUNDIR_DEATH = 4,
+ SAY_BRUNDIR_ENCOUNTER_DEFEATED = 5,
+ SAY_BRUNDIR_BERSERK = 6,
+ EMOTE_BRUNDIR_OVERLOAD = 7
};
enum AssemblyNPCs
{
- NPC_WORLD_TRIGGER = 22515,
+ NPC_WORLD_TRIGGER = 22515
};
-#define EMOTE_OVERLOAD "Stormcaller Brundir begins to Overload!" // Move it to DB
#define FLOOR_Z 427.28f
#define FINAL_FLIGHT_Z 435.0f
-bool IsEncounterComplete(InstanceScript* instance, Creature* me)
-{
- if (!instance || !me)
- return false;
-
- for (uint8 i = 0; i < 3; ++i)
- {
- uint64 guid = instance->GetData64(BOSS_STEELBREAKER + i);
- if (!guid)
- return false;
-
- if (Creature* boss = ObjectAccessor::GetCreature(*me, guid))
- {
- if (boss->isAlive())
- return false;
- }
- else
- return false;
- }
-
- return true;
-}
-
-void RespawnEncounter(InstanceScript* instance, Creature* me)
-{
- for (uint8 i = 0; i < 3; ++i)
- {
- uint64 guid = instance->GetData64(BOSS_STEELBREAKER + i);
- if (!guid)
- continue;
-
- if (Creature* boss = ObjectAccessor::GetCreature(*me, guid))
- {
- if (!boss->isAlive())
- {
- boss->Respawn();
- boss->GetMotionMaster()->MoveTargetedHome();
- }
- }
- }
-}
-
-void StartEncounter(InstanceScript* instance, Creature* me, Unit* /*target*/)
-{
- if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == IN_PROGRESS)
- return; // Prevent recursive calls
-
- instance->SetBossState(BOSS_ASSEMBLY_OF_IRON, IN_PROGRESS);
-
- for (uint8 i = 0; i < 3; ++i)
- {
- uint64 guid = instance->GetData64(BOSS_STEELBREAKER + i);
- if (!guid)
- continue;
-
- if (Creature* boss = ObjectAccessor::GetCreature(*me, guid))
- boss->SetInCombatWithZone();
- }
-}
-
class boss_steelbreaker : public CreatureScript
{
public:
@@ -204,12 +137,8 @@ class boss_steelbreaker : public CreatureScript
struct boss_steelbreakerAI : public BossAI
{
- boss_steelbreakerAI(Creature* creature) : BossAI(creature, BOSS_ASSEMBLY_OF_IRON)
- {
- instance = me->GetInstanceScript();
- }
+ boss_steelbreakerAI(Creature* creature) : BossAI(creature, BOSS_ASSEMBLY_OF_IRON) { }
- InstanceScript* instance;
uint32 phase;
void Reset()
@@ -217,14 +146,12 @@ class boss_steelbreaker : public CreatureScript
_Reset();
phase = 0;
me->RemoveAllAuras();
- RespawnEncounter(instance, me);
}
- void EnterCombat(Unit* who)
+ void EnterCombat(Unit* /*who*/)
{
- StartEncounter(instance, me, who);
- DoScriptText(SAY_STEELBREAKER_AGGRO, me);
- DoZoneInCombat();
+ _EnterCombat();
+ Talk(SAY_STEELBREAKER_AGGRO);
DoCast(me, SPELL_HIGH_VOLTAGE);
events.SetPhase(++phase);
events.ScheduleEvent(EVENT_BERSERK, 900000);
@@ -235,8 +162,8 @@ class boss_steelbreaker : public CreatureScript
{
switch (action)
{
- case ACTION_STEELBREAKER:
- me->SetHealth(me->GetMaxHealth());
+ case ACTION_SUPERCHARGE:
+ me->SetFullHealth();
me->AddAura(SPELL_SUPERCHARGE, me);
events.SetPhase(++phase);
events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000);
@@ -253,24 +180,33 @@ class boss_steelbreaker : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(RAND(SAY_STEELBREAKER_DEATH_1, SAY_STEELBREAKER_DEATH_2), me);
- if (IsEncounterComplete(instance, me))
- instance->SetData(BOSS_ASSEMBLY_OF_IRON, DONE);
+ _JustDied();
+
+ if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == DONE)
+ {
+ DoCastAOE(SPELL_KILL_CREDIT);
+ Talk(SAY_STEELBREAKER_ENCOUNTER_DEFEATED);
+ }
else
+ {
me->SetLootRecipient(NULL);
+ Talk(SAY_STEELBREAKER_DEATH);
+ //DoCastAOE(SPELL_SUPERCHARGE, true);
- if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRUNDIR)))
- if (Brundir->isAlive())
- Brundir->AI()->DoAction(ACTION_BRUNDIR);
+ if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRUNDIR)))
+ if (Brundir->isAlive())
+ Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
- if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MOLGEIM)))
- if (Molgeim->isAlive())
- Molgeim->AI()->DoAction(ACTION_MOLGEIM);
+ if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOLGEIM)))
+ if (Molgeim->isAlive())
+ Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
+ }
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_STEELBREAKER_SLAY_1, SAY_STEELBREAKER_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_STEELBREAKER_SLAY);
if (phase == 3)
DoCast(me, SPELL_ELECTRICAL_CHARGE);
@@ -291,7 +227,7 @@ class boss_steelbreaker : public CreatureScript
switch (eventId)
{
case EVENT_BERSERK:
- DoScriptText(SAY_STEELBREAKER_BERSERK, me);
+ Talk(SAY_STEELBREAKER_BERSERK);
DoCast(SPELL_BERSERK);
events.CancelEvent(EVENT_BERSERK);
break;
@@ -306,7 +242,7 @@ class boss_steelbreaker : public CreatureScript
events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(20000, 40000));
break;
case EVENT_OVERWHELMING_POWER:
- DoScriptText(SAY_STEELBREAKER_POWER, me);
+ Talk(SAY_STEELBREAKER_POWER);
DoCastVictim(SPELL_OVERWHELMING_POWER);
events.ScheduleEvent(EVENT_OVERWHELMING_POWER, RAID_MODE(60000, 35000));
break;
@@ -330,12 +266,8 @@ class boss_runemaster_molgeim : public CreatureScript
struct boss_runemaster_molgeimAI : public BossAI
{
- boss_runemaster_molgeimAI(Creature* creature) : BossAI(creature, BOSS_ASSEMBLY_OF_IRON)
- {
- instance = me->GetInstanceScript();
- }
+ boss_runemaster_molgeimAI(Creature* creature) : BossAI(creature, BOSS_ASSEMBLY_OF_IRON) { }
- InstanceScript* instance;
uint32 phase;
void Reset()
@@ -343,14 +275,12 @@ class boss_runemaster_molgeim : public CreatureScript
_Reset();
phase = 0;
me->RemoveAllAuras();
- RespawnEncounter(instance, me);
}
- void EnterCombat(Unit* who)
+ void EnterCombat(Unit* /*who*/)
{
- StartEncounter(instance, me, who);
- DoScriptText(SAY_MOLGEIM_AGGRO, me);
- DoZoneInCombat();
+ _EnterCombat();
+ Talk(SAY_MOLGEIM_AGGRO);
events.SetPhase(++phase);
events.ScheduleEvent(EVENT_BERSERK, 900000);
events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, 30000);
@@ -361,8 +291,9 @@ class boss_runemaster_molgeim : public CreatureScript
{
switch (action)
{
- case ACTION_MOLGEIM:
- me->SetHealth(me->GetMaxHealth());
+ case ACTION_SUPERCHARGE:
+ {
+ me->SetFullHealth();
me->AddAura(SPELL_SUPERCHARGE, me);
events.SetPhase(++phase);
events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000);
@@ -371,30 +302,40 @@ class boss_runemaster_molgeim : public CreatureScript
events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000);
if (phase >= 3)
events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000, 30000));
- break;
+ break;
+ }
}
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(RAND(SAY_MOLGEIM_DEATH_1, SAY_MOLGEIM_DEATH_2), me);
- if (IsEncounterComplete(instance, me))
- instance->SetData(BOSS_ASSEMBLY_OF_IRON, DONE);
+ _JustDied();
+
+ if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == DONE)
+ {
+ DoCastAOE(SPELL_KILL_CREDIT);
+ Talk(SAY_MOLGEIM_ENCOUNTER_DEFEATED);
+ }
else
+ {
me->SetLootRecipient(NULL);
+ Talk(SAY_MOLGEIM_DEATH);
+ //DoCastAOE(SPELL_SUPERCHARGE, true);
- if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRUNDIR)))
- if (Brundir->isAlive())
- Brundir->AI()->DoAction(ACTION_BRUNDIR);
+ if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_BRUNDIR)))
+ if (Brundir->isAlive())
+ Brundir->AI()->DoAction(ACTION_SUPERCHARGE);
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STEELBREAKER)))
- if (Steelbreaker->isAlive())
- Steelbreaker->AI()->DoAction(ACTION_STEELBREAKER);
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
+ if (Steelbreaker->isAlive())
+ Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
+ }
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_MOLGEIM_SLAY_1, SAY_MOLGEIM_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_MOLGEIM_SLAY);
}
void UpdateAI(uint32 const diff)
@@ -412,28 +353,27 @@ class boss_runemaster_molgeim : public CreatureScript
switch (eventId)
{
case EVENT_BERSERK:
- DoScriptText(SAY_MOLGEIM_BERSERK, me);
+ Talk(SAY_MOLGEIM_BERSERK);
DoCast(SPELL_BERSERK);
events.CancelEvent(EVENT_BERSERK);
break;
case EVENT_RUNE_OF_POWER:
{
- Unit* target = NULL;
+ Unit* target = me;
switch (urand(0, 2))
{
- case 0:
- target = me;
- break;
case 1:
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STEELBREAKER)))
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
if (Steelbreaker->isAlive())
target = Steelbreaker;
break;
case 2:
- if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STEELBREAKER)))
+ if (Creature* Brundir = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
if (Brundir->isAlive())
target = Brundir;
break;
+ default:
+ break;
}
DoCast(target, SPELL_SUMMON_RUNE_OF_POWER);
events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000);
@@ -444,13 +384,13 @@ class boss_runemaster_molgeim : public CreatureScript
events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000, 34000));
break;
case EVENT_RUNE_OF_DEATH:
- DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me);
+ Talk(SAY_MOLGEIM_RUNE_DEATH);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_RUNE_OF_DEATH);
events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000, 40000));
break;
case EVENT_RUNE_OF_SUMMONING:
- DoScriptText(SAY_MOLGEIM_SUMMON, me);
+ Talk(SAY_MOLGEIM_SUMMON);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_RUNE_OF_SUMMONING);
events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(30000, 45000));
@@ -468,93 +408,6 @@ class boss_runemaster_molgeim : public CreatureScript
}
};
-class mob_rune_of_power : public CreatureScript
-{
- public:
- mob_rune_of_power() : CreatureScript("mob_rune_of_power") { }
-
- struct mob_rune_of_powerAI : public ScriptedAI
- {
- mob_rune_of_powerAI(Creature* creature) : ScriptedAI(creature)
- {
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- me->setFaction(16); // Same faction as bosses
- DoCast(SPELL_RUNE_OF_POWER);
-
- me->DespawnOrUnsummon(60000);
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_rune_of_powerAI(creature);
- }
-};
-
-class mob_lightning_elemental : public CreatureScript
-{
- public:
- mob_lightning_elemental() : CreatureScript("mob_lightning_elemental") { }
-
- struct mob_lightning_elementalAI : public ScriptedAI
- {
- mob_lightning_elementalAI(Creature* creature) : ScriptedAI(creature)
- {
- me->SetInCombatWithZone();
- me->AddAura(SPELL_LIGHTNING_ELEMENTAL_PASSIVE, me);
- }
-
- // Nothing to do here, just let the creature chase players and procflags == 2 on the applied aura will trigger explosion
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_lightning_elementalAI(creature);
- }
-};
-
-class mob_rune_of_summoning : public CreatureScript
-{
- public:
- mob_rune_of_summoning() : CreatureScript("mob_rune_of_summoning") { }
-
- struct mob_rune_of_summoningAI : public ScriptedAI
- {
- mob_rune_of_summoningAI(Creature* creature) : ScriptedAI(creature)
- {
- me->AddAura(SPELL_RUNE_OF_SUMMONING_VIS, me);
- summonCount = 0;
- summonTimer = 2000;
- }
-
- uint32 summonCount;
- uint32 summonTimer;
-
- void UpdateAI(uint32 const diff)
- {
- if (summonTimer <= diff)
- SummonLightningElemental();
- else
- summonTimer -= diff;
- }
-
- void SummonLightningElemental()
- {
- me->CastSpell(me, SPELL_RUNE_OF_SUMMONING_SUMMON, false);
- if (++summonCount == 10) // TODO: Find out if this amount is right
- me->DespawnOrUnsummon();
- else
- summonTimer = 2000; // TODO: Find out of timer is right
- }
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new mob_rune_of_summoningAI(creature);
- }
-};
-
class boss_stormcaller_brundir : public CreatureScript
{
public:
@@ -562,12 +415,8 @@ class boss_stormcaller_brundir : public CreatureScript
struct boss_stormcaller_brundirAI : public BossAI
{
- boss_stormcaller_brundirAI(Creature* creature) : BossAI(creature, BOSS_ASSEMBLY_OF_IRON)
- {
- instance = me->GetInstanceScript();
- }
+ boss_stormcaller_brundirAI(Creature* creature) : BossAI(creature, BOSS_ASSEMBLY_OF_IRON) { }
- InstanceScript* instance;
uint32 phase;
void Reset()
@@ -577,15 +426,13 @@ class boss_stormcaller_brundir : public CreatureScript
me->RemoveAllAuras();
me->SetDisableGravity(false);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false); // Should be interruptable unless overridden by spell (Overload)
- me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
- RespawnEncounter(instance, me);
+ me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, false); // Reset immumity, Brundir should be stunnable by default
}
- void EnterCombat(Unit* who)
+ void EnterCombat(Unit* /*who*/)
{
- StartEncounter(instance, me, who);
- DoScriptText(SAY_BRUNDIR_AGGRO, me);
- DoZoneInCombat();
+ _EnterCombat();
+ Talk(SAY_BRUNDIR_AGGRO);
events.SetPhase(++phase);
events.ScheduleEvent(EVENT_MOVE_POSITION, 1000);
events.ScheduleEvent(EVENT_BERSERK, 900000);
@@ -597,8 +444,9 @@ class boss_stormcaller_brundir : public CreatureScript
{
switch (action)
{
- case ACTION_BRUNDIR:
- me->SetHealth(me->GetMaxHealth());
+ case ACTION_SUPERCHARGE:
+ {
+ me->SetFullHealth();
me->AddAura(SPELL_SUPERCHARGE, me);
events.SetPhase(++phase);
events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(7000, 12000));
@@ -609,37 +457,46 @@ class boss_stormcaller_brundir : public CreatureScript
{
DoCast(me, SPELL_STORMSHIELD);
events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(50000, 60000));
- me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); // Apply immumity to stuns
+ me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); // Apply immumity to stuns
}
- break;
-
+ break;
+ }
}
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(RAND(SAY_BRUNDIR_DEATH_1, SAY_BRUNDIR_DEATH_2), me);
- if (IsEncounterComplete(instance, me))
- instance->SetData(BOSS_ASSEMBLY_OF_IRON, DONE);
+ _JustDied();
+
+ if (instance->GetBossState(BOSS_ASSEMBLY_OF_IRON) == DONE)
+ {
+ DoCastAOE(SPELL_KILL_CREDIT);
+ Talk(SAY_BRUNDIR_ENCOUNTER_DEFEATED);
+ }
else
+ {
me->SetLootRecipient(NULL);
+ Talk(SAY_BRUNDIR_DEATH);
+ //DoCastAOE(SPELL_SUPERCHARGE, true);
- if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_MOLGEIM)))
- if (Molgeim->isAlive())
- Molgeim->AI()->DoAction(ACTION_MOLGEIM);
+ if (Creature* Molgeim = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_MOLGEIM)))
+ if (Molgeim->isAlive())
+ Molgeim->AI()->DoAction(ACTION_SUPERCHARGE);
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_STEELBREAKER)))
- if (Steelbreaker->isAlive())
- Steelbreaker->AI()->DoAction(ACTION_STEELBREAKER);
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_STEELBREAKER)))
+ if (Steelbreaker->isAlive())
+ Steelbreaker->AI()->DoAction(ACTION_SUPERCHARGE);
+ }
// Prevent to have Brundir somewhere in the air when he die in Air phase
if (me->GetPositionZ() > FLOOR_Z)
me->GetMotionMaster()->MoveFall();
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_BRUNDIR_SLAY_1, SAY_BRUNDIR_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_BRUNDIR_SLAY);
}
void UpdateAI(uint32 const diff)
@@ -657,7 +514,7 @@ class boss_stormcaller_brundir : public CreatureScript
switch (eventId)
{
case EVENT_BERSERK:
- DoScriptText(SAY_BRUNDIR_BERSERK, me);
+ Talk(SAY_BRUNDIR_BERSERK);
DoCast(SPELL_BERSERK);
events.CancelEvent(EVENT_BERSERK);
break;
@@ -667,8 +524,8 @@ class boss_stormcaller_brundir : public CreatureScript
events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(7000, 10000));
break;
case EVENT_OVERLOAD:
- me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true);
- DoScriptText(SAY_BRUNDIR_SPECIAL, me);
+ Talk(EMOTE_BRUNDIR_OVERLOAD);
+ Talk(SAY_BRUNDIR_SPECIAL);
DoCast(SPELL_OVERLOAD);
events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 120000));
break;
@@ -677,7 +534,7 @@ class boss_stormcaller_brundir : public CreatureScript
events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(15000, 20000));
break;
case EVENT_LIGHTNING_TENDRILS:
- DoScriptText(SAY_BRUNDIR_FLIGHT, me);
+ Talk(SAY_BRUNDIR_FLIGHT);
DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M));
DoCast(SPELL_LIGHTNING_TENDRILS_VISUAL);
me->AttackStop();
@@ -783,7 +640,7 @@ class spell_assembly_meltdown : public SpellScriptLoader
void HandleInstaKill(SpellEffIndex /*effIndex*/)
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
- if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(BOSS_STEELBREAKER)))
+ if (Creature* Steelbreaker = ObjectAccessor::GetCreature(*GetCaster(), instance->GetData64(DATA_STEELBREAKER)))
Steelbreaker->AI()->DoAction(ACTION_ADD_CHARGE);
}
@@ -799,14 +656,53 @@ class spell_assembly_meltdown : public SpellScriptLoader
}
};
+class spell_assembly_rune_of_summoning : public SpellScriptLoader
+{
+ public:
+ spell_assembly_rune_of_summoning() : SpellScriptLoader("spell_assembly_rune_of_summoning") { }
+
+ class spell_assembly_rune_of_summoning_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_assembly_rune_of_summoning_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_RUNE_OF_SUMMONING_SUMMON))
+ return false;
+ return true;
+ }
+
+ void HandlePeriodic(AuraEffect const* aurEff)
+ {
+ PreventDefaultAction();
+ GetTarget()->CastSpell(GetTarget(), SPELL_RUNE_OF_SUMMONING_SUMMON, true, NULL, aurEff, GetTarget()->isSummon() ? GetTarget()->ToTempSummon()->GetSummonerGUID() : 0);
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (TempSummon* summ = GetTarget()->ToTempSummon())
+ summ->DespawnOrUnsummon(1);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_assembly_rune_of_summoning_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ OnEffectRemove += AuraEffectRemoveFn(spell_assembly_rune_of_summoning_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_assembly_rune_of_summoning_AuraScript();
+ }
+};
+
void AddSC_boss_assembly_of_iron()
{
new boss_steelbreaker();
new boss_runemaster_molgeim();
new boss_stormcaller_brundir();
- new mob_lightning_elemental();
- new mob_rune_of_summoning();
- new mob_rune_of_power();
new spell_shield_of_runes();
new spell_assembly_meltdown();
+ new spell_assembly_rune_of_summoning();
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
index ec3125f7c0a..bd063877d39 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp
@@ -76,16 +76,12 @@ enum AuriayaEvents
enum AuriayaYells
{
- // Yells
- SAY_AGGRO = -1603050,
- SAY_SLAY_1 = -1603051,
- SAY_SLAY_2 = -1603052,
- SAY_DEATH = -1603053,
- SAY_BERSERK = -1603054,
-
- // Emotes
- EMOTE_FEAR = -1603055,
- EMOTE_DEFENDER = -1603056,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_BERSERK = 3,
+ EMOTE_FEAR = 4,
+ EMOTE_DEFENDER = 5
};
enum AuriayaActions
@@ -121,7 +117,7 @@ class boss_auriaya : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_SCREECH, urand(45000, 65000));
events.ScheduleEvent(EVENT_BLAST, urand(20000, 25000));
@@ -131,9 +127,10 @@ class boss_auriaya : public CreatureScript
events.ScheduleEvent(EVENT_BERSERK, 600000);
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summoned)
@@ -178,7 +175,7 @@ class boss_auriaya : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -206,8 +203,8 @@ class boss_auriaya : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
_JustDied();
+ Talk(SAY_DEATH);
}
void UpdateAI(uint32 const diff)
@@ -229,7 +226,7 @@ class boss_auriaya : public CreatureScript
events.ScheduleEvent(EVENT_SCREECH, urand(40000, 60000));
break;
case EVENT_TERRIFYING:
- DoScriptText(EMOTE_FEAR, me);
+ Talk(EMOTE_FEAR);
DoCast(SPELL_TERRIFYING_SCREECH);
events.ScheduleEvent(EVENT_TERRIFYING, urand(20000, 30000));
break;
@@ -238,7 +235,7 @@ class boss_auriaya : public CreatureScript
events.ScheduleEvent(EVENT_BLAST, urand(25000, 35000));
break;
case EVENT_DEFENDER:
- DoScriptText(EMOTE_DEFENDER, me);
+ Talk(EMOTE_DEFENDER);
DoCast(SPELL_DEFENDER_TRIGGER);
if (Creature* trigger = me->FindNearestCreature(NPC_FERAL_DEFENDER_TRIGGER, 15.0f, true))
DoCast(trigger, SPELL_ACTIVATE_DEFENDER, true);
@@ -262,7 +259,7 @@ class boss_auriaya : public CreatureScript
break;
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK, true);
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
events.CancelEvent(EVENT_BERSERK);
break;
}
@@ -296,17 +293,17 @@ class npc_auriaya_seeping_trigger : public CreatureScript
instance = me->GetInstanceScript();
}
- void Reset()
- {
- me->DespawnOrUnsummon(600000);
- DoCast(me, SPELL_SEEPING_ESSENCE);
- }
+ void Reset()
+ {
+ me->DespawnOrUnsummon(600000);
+ DoCast(me, SPELL_SEEPING_ESSENCE);
+ }
- void UpdateAI(uint32 const /*diff*/)
- {
- if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS)
- me->DespawnOrUnsummon();
- }
+ void UpdateAI(uint32 const /*diff*/)
+ {
+ if (instance->GetBossState(BOSS_AURIAYA) != IN_PROGRESS)
+ me->DespawnOrUnsummon();
+ }
private:
InstanceScript* instance;
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 9d5adf39817..921d67d6d65 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -141,9 +141,6 @@ enum Vehicles
VEHICLE_DEMOLISHER = 33109,
};
-#define EMOTE_PURSUE "Flame Leviathan pursues $N."
-#define EMOTE_OVERLOAD "Flame Leviathan's circuits overloaded."
-#define EMOTE_REPAIR "Automatic repair sequence initiated."
#define DATA_SHUTOUT 29112912 // 2911, 2912 are achievement IDs
#define DATA_ORBIT_ACHIEVEMENTS 1
#define VEHICLE_SPAWNS 5
@@ -151,22 +148,21 @@ enum Vehicles
enum Yells
{
- SAY_AGGRO = -1603060,
- SAY_SLAY = -1603061,
- SAY_DEATH = -1603062,
- SAY_TARGET_1 = -1603063,
- SAY_TARGET_2 = -1603064,
- SAY_TARGET_3 = -1603065,
- SAY_HARDMODE = -1603066,
- SAY_TOWER_NONE = -1603067,
- SAY_TOWER_FROST = -1603068,
- SAY_TOWER_FLAME = -1603069,
- SAY_TOWER_NATURE = -1603070,
- SAY_TOWER_STORM = -1603071,
- SAY_PLAYER_RIDING = -1603072,
- SAY_OVERLOAD_1 = -1603073,
- SAY_OVERLOAD_2 = -1603074,
- SAY_OVERLOAD_3 = -1603075,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_TARGET = 3,
+ SAY_HARDMODE = 4,
+ SAY_TOWER_NONE = 5,
+ SAY_TOWER_FROST = 6,
+ SAY_TOWER_FLAME = 7,
+ SAY_TOWER_NATURE = 8,
+ SAY_TOWER_STORM = 9,
+ SAY_PLAYER_RIDING = 10,
+ SAY_OVERLOAD = 11,
+ EMOTE_PURSUE = 12,
+ EMOTE_OVERLOAD = 13,
+ EMOTE_REPAIR = 14
};
enum MiscellanousData
@@ -179,15 +175,8 @@ enum MiscellanousData
FOUR_SEATS = 4,
};
-Position const Center[]=
-{
- {354.8771f, -12.90240f, 409.803650f, 0.0f},
-};
-
-Position const InfernoStart[]=
-{
- {390.93f, -13.91f, 409.81f, 0.0f},
-};
+Position const Center = { 354.8771f, -12.90240f, 409.803650f, 0.0f };
+Position const InfernoStart = { 390.93f, -13.91f, 409.81f, 0.0f };
Position const PosSiege[VEHICLE_SPAWNS] =
{
@@ -320,12 +309,12 @@ class boss_flame_leviathan : public CreatureScript
}
if (!towerOfLife && !towerOfFrost && !towerOfFlames && !towerOfStorms)
- DoScriptText(SAY_TOWER_NONE, me);
+ Talk(SAY_TOWER_NONE);
else
- DoScriptText(SAY_HARDMODE, me);
+ Talk(SAY_HARDMODE);
}
else
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
@@ -334,7 +323,7 @@ class boss_flame_leviathan : public CreatureScript
// Set Field Flags 67108928 = 64 | 67108864 = UNIT_FLAG_UNK_6 | UNIT_FLAG_SKINNABLE
// Set DynFlags 12
// Set NPCFlags 0
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
@@ -349,7 +338,7 @@ class boss_flame_leviathan : public CreatureScript
++Shutdown;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -397,7 +386,7 @@ class boss_flame_leviathan : public CreatureScript
switch (eventId)
{
case EVENT_PURSUE:
- DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me);
+ Talk(SAY_TARGET);
DoCast(SPELL_PURSUED); // Will select target in spellscript
events.ScheduleEvent(EVENT_PURSUE, 35*IN_MILLISECONDS);
break;
@@ -420,8 +409,8 @@ class boss_flame_leviathan : public CreatureScript
events.ScheduleEvent(EVENT_SUMMON, 2*IN_MILLISECONDS);
break;
case EVENT_SHUTDOWN:
- DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me);
- me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true);
+ Talk(SAY_OVERLOAD);
+ Talk(EMOTE_OVERLOAD);
me->CastSpell(me, SPELL_SYSTEMS_SHUTDOWN, true);
if (Shutout)
Shutout = false;
@@ -429,7 +418,7 @@ class boss_flame_leviathan : public CreatureScript
events.DelayEvents(20 * IN_MILLISECONDS, 0);
break;
case EVENT_REPAIR:
- me->MonsterTextEmote(EMOTE_REPAIR, 0, true);
+ Talk(EMOTE_REPAIR);
me->ClearUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT);
events.ScheduleEvent(EVENT_SHUTDOWN, 150*IN_MILLISECONDS);
events.CancelEvent(EVENT_REPAIR);
@@ -440,12 +429,12 @@ class boss_flame_leviathan : public CreatureScript
if (Creature* thorim = DoSummon(NPC_THORIM_BEACON, me, float(urand(20, 60)), 20000, TEMPSUMMON_TIMED_DESPAWN))
thorim->GetMotionMaster()->MoveRandom(100);
}
- DoScriptText(SAY_TOWER_STORM, me);
+ Talk(SAY_TOWER_STORM);
events.CancelEvent(EVENT_THORIM_S_HAMMER);
break;
case EVENT_MIMIRON_S_INFERNO: // Tower of Flames
- me->SummonCreature(NPC_MIMIRON_BEACON, InfernoStart->GetPositionX(), InfernoStart->GetPositionY(), InfernoStart->GetPositionZ());
- DoScriptText(SAY_TOWER_FLAME, me);
+ me->SummonCreature(NPC_MIMIRON_BEACON, InfernoStart);
+ Talk(SAY_TOWER_FLAME);
events.CancelEvent(EVENT_MIMIRON_S_INFERNO);
break;
case EVENT_HODIR_S_FURY: // Tower of Frost
@@ -454,11 +443,11 @@ class boss_flame_leviathan : public CreatureScript
if (Creature* hodir = DoSummon(NPC_HODIR_BEACON, me, 50, 0))
hodir->GetMotionMaster()->MoveRandom(100);
}
- DoScriptText(SAY_TOWER_FROST, me);
+ Talk(SAY_TOWER_FROST);
events.CancelEvent(EVENT_HODIR_S_FURY);
break;
case EVENT_FREYA_S_WARD: // Tower of Nature
- DoScriptText(SAY_TOWER_NATURE, me);
+ Talk(SAY_TOWER_NATURE);
for (int32 i = 0; i < 4; ++i)
me->SummonCreature(NPC_FREYA_BEACON, FreyaBeacons[i]);
@@ -529,8 +518,8 @@ class boss_flame_leviathan : public CreatureScript
case ACTION_MOVE_TO_CENTER_POSITION: // Triggered by 2 Collossus near door
if (!me->isDead())
{
- me->SetHomePosition(Center->GetPositionX(), Center->GetPositionY(), Center->GetPositionZ(), 0);
- me->GetMotionMaster()->MoveCharge(Center->GetPositionX(), Center->GetPositionY(), Center->GetPositionZ()); //position center
+ me->SetHomePosition(Center);
+ me->GetMotionMaster()->MoveCharge(Center.GetPositionX(), Center.GetPositionY(), Center.GetPositionZ()); // position center
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
return;
@@ -593,8 +582,8 @@ class boss_flame_leviathan_seat : public CreatureScript
{
if (!apply)
return;
- else
- DoScriptText(SAY_PLAYER_RIDING, me);
+ else if (Creature* leviathan = me->GetVehicleCreatureBase())
+ leviathan->AI()->Talk(SAY_PLAYER_RIDING);
if (Creature* turret = me->GetVehicleKit()->GetPassenger(SEAT_TURRET)->ToCreature())
{
@@ -887,7 +876,7 @@ class npc_colossus : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- if (me->GetHomePosition().IsInDist(Center, 50.f))
+ if (me->GetHomePosition().IsInDist(&Center, 50.f))
instance->SetData(DATA_COLOSSUS, instance->GetData(DATA_COLOSSUS)+1);
}
@@ -1187,7 +1176,7 @@ class npc_lorekeeper : public CreatureScript
if (Creature* Branz = creature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true))
{
Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ());
- //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz
+ //TODO Delorah->AI()->Talk(xxxx, Branz->GetGUID()); when reached at branz
}
}
}
@@ -1700,7 +1689,7 @@ class spell_pursue : public SpellScriptLoader
{
if (IS_PLAYER_GUID(itr->second.Passenger))
{
- caster->MonsterTextEmote(EMOTE_PURSUE, itr->second.Passenger, true);
+ caster->AI()->Talk(EMOTE_PURSUE, itr->second.Passenger);
return;
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index a3c9cb847e5..b894706e0bf 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -27,34 +27,23 @@
enum FreyaYells
{
// Freya
- SAY_AGGRO = -1603180,
- SAY_AGGRO_WITH_ELDER = -1603181,
- SAY_SLAY_1 = -1603182,
- SAY_SLAY_2 = -1603183,
- SAY_DEATH = -1603184,
- SAY_BERSERK = -1603185,
- SAY_SUMMON_CONSERVATOR = -1603186,
- SAY_SUMMON_TRIO = -1603187,
- SAY_SUMMON_LASHERS = -1603188,
- SAY_YS_HELP = -1603189,
-
- // Elder Brightleaf
- SAY_BRIGHTLEAF_AGGRO = -1603190,
- SAY_BRIGHTLEAF_SLAY_1 = -1603191,
- SAY_BRIGHTLEAF_SLAY_2 = -1603192,
- SAY_BRIGHTLEAF_DEATH = -1603193,
-
- // Elder Ironbranch
- SAY_IRONBRANCH_AGGRO = -1603194,
- SAY_IRONBRANCH_SLAY_1 = -1603195,
- SAY_IRONBRANCH_SLAY_2 = -1603196,
- SAY_IRONBRANCH_DEATH = -1603197,
-
- // Elder Stonebark
- SAY_STONEBARK_AGGRO = -1603198,
- SAY_STONEBARK_SLAY_1 = -1603199,
- SAY_STONEBARK_SLAY_2 = -1603200,
- SAY_STONEBARK_DEATH = -1603201,
+ SAY_AGGRO = 0,
+ SAY_AGGRO_WITH_ELDER = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
+ SAY_BERSERK = 4,
+ SAY_SUMMON_CONSERVATOR = 5,
+ SAY_SUMMON_TRIO = 6,
+ SAY_SUMMON_LASHERS = 7,
+ EMOTE_LIFEBINDERS_GIFT = 8,
+ EMOTE_ALLIES_OF_NATURE = 9,
+ EMOTE_GROUND_TREMOR = 10,
+ EMOTE_IRON_ROOTS = 11,
+
+ // Elder Brightleaf / Elder Ironbranch / Elder Stonebark
+ SAY_ELDER_AGGRO = 0,
+ SAY_ELDER_SLAY = 1,
+ SAY_ELDER_DEATH = 2
};
enum FreyaSpells
@@ -143,7 +132,7 @@ enum FreyaSpells
// Nature Bomb
SPELL_NATURE_BOMB = 64587,
SPELL_OBJECT_BOMB = 64600,
- SPELL_SUMMON_NATURE_BOMB = 64606,
+ SPELL_SUMMON_NATURE_BOMB = 64604,
// Unstable Sun Beam
SPELL_UNSTABLE_SUN_BEAM = 62211,
@@ -159,7 +148,7 @@ enum FreyaSpells
// Attuned To Nature spells
SPELL_ATTUNED_TO_NATURE_2_DOSE_REDUCTION = 62524,
SPELL_ATTUNED_TO_NATURE_10_DOSE_REDUCTION = 62525,
- SPELL_ATTUNED_TO_NATURE_25_DOSE_REDUCTION = 62521,
+ SPELL_ATTUNED_TO_NATURE_25_DOSE_REDUCTION = 62521
};
enum FreyaNpcs
@@ -177,13 +166,13 @@ enum FreyaNpcs
NPC_IRON_ROOTS = 33088,
NPC_STRENGTHENED_IRON_ROOTS = 33168,
- OBJECT_NATURE_BOMB = 194902,
+ OBJECT_NATURE_BOMB = 194902
};
enum FreyaActions
{
ACTION_ELDER_DEATH = 1,
- ACTION_ELDER_FREYA_KILLED = 2,
+ ACTION_ELDER_FREYA_KILLED = 2
};
enum FreyaEvents
@@ -211,13 +200,16 @@ enum FreyaEvents
// Elder Brightleaf
EVENT_SOLAR_FLARE = 15,
EVENT_UNSTABLE_SUN_BEAM = 16,
- EVENT_FLUX = 17,
+ EVENT_FLUX = 17
};
-#define WAVE_TIME 60000 // Normal wave is one minute
-#define TIME_DIFFERENCE 10000 // If difference between waveTime and WAVE_TIME is bigger then TIME_DIFFERENCE, schedule EVENT_WAVE in 10 seconds
-#define DATA_GETTING_BACK_TO_NATURE 1
-#define DATA_KNOCK_ON_WOOD 2
+enum Misc
+{
+ WAVE_TIME = 60000, // Normal wave is one minute
+ TIME_DIFFERENCE = 10000, // If difference between waveTime and WAVE_TIME is bigger then TIME_DIFFERENCE, schedule EVENT_WAVE in 10 seconds
+ DATA_GETTING_BACK_TO_NATURE = 1,
+ DATA_KNOCK_ON_WOOD = 2
+};
class npc_iron_roots : public CreatureScript
{
@@ -273,9 +265,7 @@ class boss_freya : public CreatureScript
struct boss_freyaAI : public BossAI
{
- boss_freyaAI(Creature* creature) : BossAI(creature, BOSS_FREYA)
- {
- }
+ boss_freyaAI(Creature* creature) : BossAI(creature, BOSS_FREYA) { }
uint64 ElementalGUID[3][2];
@@ -316,9 +306,10 @@ class boss_freya : public CreatureScript
random[n] = false;
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void DamageTaken(Unit* who, uint32& damage)
@@ -369,9 +360,9 @@ class boss_freya : public CreatureScript
}
if (elderCount == 0)
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
else
- DoScriptText(SAY_AGGRO_WITH_ELDER, me);
+ Talk(SAY_AGGRO_WITH_ELDER);
me->CastCustomSpell(SPELL_ATTUNED_TO_NATURE, SPELLVALUE_AURA_STACK, 150, me, true);
@@ -381,7 +372,7 @@ class boss_freya : public CreatureScript
events.ScheduleEvent(EVENT_SUNBEAM, urand(5000, 15000));
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -409,7 +400,7 @@ class boss_freya : public CreatureScript
switch (eventId)
{
case EVENT_ENRAGE:
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
DoCast(me, SPELL_ENRAGE);
break;
case EVENT_SUNBEAM:
@@ -418,17 +409,9 @@ class boss_freya : public CreatureScript
events.ScheduleEvent(EVENT_SUNBEAM, urand(10000, 15000));
break;
case EVENT_NATURE_BOMB:
- {
- // On every player
- std::list<Player*> PlayerList;
- Trinity::AnyPlayerInObjectRangeCheck checker(me, 50.0f);
- Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(me, PlayerList, checker);
- me->VisitNearbyWorldObject(50.0f, searcher);
- for (std::list<Player*>::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
- (*itr)->CastSpell(*itr, SPELL_SUMMON_NATURE_BOMB, true);
+ DoCastAOE(SPELL_SUMMON_NATURE_BOMB, true);
events.ScheduleEvent(EVENT_NATURE_BOMB, urand(10000, 12000));
break;
- }
case EVENT_UNSTABLE_ENERGY:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
DoCast(target, SPELL_FREYA_UNSTABLE_SUNBEAM, true);
@@ -442,15 +425,18 @@ class boss_freya : public CreatureScript
events.ScheduleEvent(EVENT_NATURE_BOMB, urand(10000, 20000));
break;
case EVENT_EONAR_GIFT:
+ Talk(EMOTE_LIFEBINDERS_GIFT);
DoCast(me, SPELL_SUMMON_EONAR_GIFT);
events.ScheduleEvent(EVENT_EONAR_GIFT, urand(40000, 50000));
break;
case EVENT_STRENGTHENED_IRON_ROOTS:
+ Talk(EMOTE_IRON_ROOTS);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, -SPELL_ROOTS_FREYA))
target->CastSpell(target, SPELL_ROOTS_FREYA, true); // This must be casted by Target self
events.ScheduleEvent(EVENT_STRENGTHENED_IRON_ROOTS, urand(12000, 20000));
break;
case EVENT_GROUND_TREMOR:
+ Talk(EMOTE_GROUND_TREMOR);
DoCastAOE(SPELL_FREYA_GROUND_TREMOR);
events.ScheduleEvent(EVENT_GROUND_TREMOR, urand(25000, 28000));
break;
@@ -573,20 +559,21 @@ class boss_freya : public CreatureScript
switch (GetWaveId())
{
case 0:
- DoScriptText(SAY_SUMMON_LASHERS, me);
+ Talk(SAY_SUMMON_LASHERS);
for (uint8 n = 0; n < 10; ++n)
DoCast(SPELL_SUMMON_LASHERS);
break;
case 1:
- DoScriptText(SAY_SUMMON_TRIO, me);
+ Talk(SAY_SUMMON_TRIO);
DoCast(SPELL_SUMMON_TRIO);
trioWaveCount++;
break;
case 2:
- DoScriptText(SAY_SUMMON_CONSERVATOR, me);
+ Talk(SAY_SUMMON_CONSERVATOR);
DoCast(SPELL_SUMMON_ANCIENT_CONSERVATOR);
break;
}
+ Talk(EMOTE_ALLIES_OF_NATURE);
waveCount++;
}
@@ -602,7 +589,7 @@ class boss_freya : public CreatureScript
me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficulty()][elderCount], true);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
me->SetReactState(REACT_PASSIVE);
_JustDied();
me->RemoveAllAuras();
@@ -705,17 +692,18 @@ class boss_elder_brightleaf : public CreatureScript
lumberjack = false;
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_BRIGHTLEAF_SLAY_1, SAY_BRIGHTLEAF_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_ELDER_SLAY);
}
void JustDied(Unit* killer)
{
_JustDied();
- DoScriptText(SAY_BRIGHTLEAF_DEATH, me);
+ Talk(SAY_ELDER_DEATH);
- if (killer && killer->GetTypeId() == TYPEID_PLAYER)
+ if (killer->GetTypeId() == TYPEID_PLAYER)
{
if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH)))
Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH);
@@ -729,7 +717,7 @@ class boss_elder_brightleaf : public CreatureScript
{
_EnterCombat();
if (!me->HasAura(SPELL_DRAINED_OF_POWER))
- DoScriptText(SAY_BRIGHTLEAF_AGGRO, me);
+ Talk(SAY_ELDER_AGGRO);
}
void UpdateAI(uint32 const diff)
@@ -825,17 +813,18 @@ class boss_elder_stonebark : public CreatureScript
lumberjack = false;
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_STONEBARK_SLAY_1, SAY_STONEBARK_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_ELDER_SLAY);
}
void JustDied(Unit* killer)
{
_JustDied();
- DoScriptText(SAY_STONEBARK_DEATH, me);
+ Talk(SAY_ELDER_DEATH);
- if (killer && killer->GetTypeId() == TYPEID_PLAYER)
+ if (killer->GetTypeId() == TYPEID_PLAYER)
{
if (Creature* Ironbranch = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_IRONBRANCH)))
Ironbranch->AI()->DoAction(ACTION_ELDER_DEATH);
@@ -849,7 +838,7 @@ class boss_elder_stonebark : public CreatureScript
{
_EnterCombat();
if (!me->HasAura(SPELL_DRAINED_OF_POWER))
- DoScriptText(SAY_STONEBARK_AGGRO, me);
+ Talk(SAY_ELDER_AGGRO);
}
void DamageTaken(Unit* who, uint32& damage)
@@ -951,17 +940,18 @@ class boss_elder_ironbranch : public CreatureScript
lumberjack = false;
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_IRONBRANCH_SLAY_1, SAY_IRONBRANCH_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_ELDER_SLAY);
}
void JustDied(Unit* killer)
{
_JustDied();
- DoScriptText(SAY_IRONBRANCH_DEATH, me);
+ Talk(SAY_ELDER_DEATH);
- if (killer && killer->GetTypeId() == TYPEID_PLAYER)
+ if (killer->GetTypeId() == TYPEID_PLAYER)
{
if (Creature* Brightleaf = ObjectAccessor::GetCreature(*me, instance->GetData64(BOSS_BRIGHTLEAF)))
Brightleaf->AI()->DoAction(ACTION_ELDER_DEATH);
@@ -975,7 +965,7 @@ class boss_elder_ironbranch : public CreatureScript
{
_EnterCombat();
if (!me->HasAura(SPELL_DRAINED_OF_POWER))
- DoScriptText(SAY_IRONBRANCH_AGGRO, me);
+ Talk(SAY_ELDER_AGGRO);
}
void UpdateAI(uint32 const diff)
@@ -1530,19 +1520,17 @@ class npc_unstable_sun_beam : public CreatureScript
class spell_freya_attuned_to_nature_dose_reduction : public SpellScriptLoader
{
public:
- spell_freya_attuned_to_nature_dose_reduction() : SpellScriptLoader("spell_freya_attuned_to_nature_dose_reduction")
- {
- }
+ spell_freya_attuned_to_nature_dose_reduction() : SpellScriptLoader("spell_freya_attuned_to_nature_dose_reduction") { }
class spell_freya_attuned_to_nature_dose_reduction_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_freya_attuned_to_nature_dose_reduction_SpellScript)
+ PrepareSpellScript(spell_freya_attuned_to_nature_dose_reduction_SpellScript);
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* target = GetHitUnit();
- SpellInfo const* spellInfo = GetSpellInfo();
- switch (spellInfo->Id)
+
+ switch (GetSpellInfo()->Id)
{
case SPELL_ATTUNED_TO_NATURE_2_DOSE_REDUCTION:
if (target->HasAura(GetEffectValue()))
@@ -1579,9 +1567,7 @@ class spell_freya_attuned_to_nature_dose_reduction : public SpellScriptLoader
class spell_freya_iron_roots : public SpellScriptLoader
{
public:
- spell_freya_iron_roots() : SpellScriptLoader("spell_freya_iron_roots")
- {
- }
+ spell_freya_iron_roots() : SpellScriptLoader("spell_freya_iron_roots") { }
class spell_freya_iron_roots_SpellScript : public SpellScript
{
@@ -1614,80 +1600,44 @@ class spell_freya_iron_roots : public SpellScriptLoader
class achievement_getting_back_to_nature : public AchievementCriteriaScript
{
public:
- achievement_getting_back_to_nature() : AchievementCriteriaScript("achievement_getting_back_to_nature")
- {
- }
+ achievement_getting_back_to_nature() : AchievementCriteriaScript("achievement_getting_back_to_nature") { }
bool OnCheck(Player* /*player*/, Unit* target)
{
- if (!target)
- return false;
-
- if (Creature* Freya = target->ToCreature())
- if (Freya->AI()->GetData(DATA_GETTING_BACK_TO_NATURE) >= 25)
- return true;
-
- return false;
+ return target && target->GetAI()->GetData(DATA_GETTING_BACK_TO_NATURE) >= 25;
}
};
class achievement_knock_on_wood : public AchievementCriteriaScript
{
public:
- achievement_knock_on_wood() : AchievementCriteriaScript("achievement_knock_on_wood")
- {
- }
+ achievement_knock_on_wood() : AchievementCriteriaScript("achievement_knock_on_wood") { }
bool OnCheck(Player* /*player*/, Unit* target)
{
- if (!target)
- return false;
-
- if (Creature* Freya = target->ToCreature())
- if (Freya->AI()->GetData(DATA_KNOCK_ON_WOOD) >= 1)
- return true;
-
- return false;
+ return target && target->GetAI()->GetData(DATA_KNOCK_ON_WOOD) >= 1;
}
};
class achievement_knock_knock_on_wood : public AchievementCriteriaScript
{
public:
- achievement_knock_knock_on_wood() : AchievementCriteriaScript("achievement_knock_knock_on_wood")
- {
- }
+ achievement_knock_knock_on_wood() : AchievementCriteriaScript("achievement_knock_knock_on_wood") { }
bool OnCheck(Player* /*player*/, Unit* target)
{
- if (!target)
- return false;
-
- if (Creature* Freya = target->ToCreature())
- if (Freya->AI()->GetData(DATA_KNOCK_ON_WOOD) >= 2)
- return true;
-
- return false;
+ return target && target->GetAI()->GetData(DATA_KNOCK_ON_WOOD) >= 2;
}
};
class achievement_knock_knock_knock_on_wood : public AchievementCriteriaScript
{
public:
- achievement_knock_knock_knock_on_wood() : AchievementCriteriaScript("achievement_knock_knock_knock_on_wood")
- {
- }
+ achievement_knock_knock_knock_on_wood() : AchievementCriteriaScript("achievement_knock_knock_knock_on_wood") { }
bool OnCheck(Player* /*player*/, Unit* target)
{
- if (!target)
- return false;
-
- if (Creature* Freya = target->ToCreature())
- if (Freya->AI()->GetData(DATA_KNOCK_ON_WOOD) == 3)
- return true;
-
- return false;
+ return target && target->GetAI()->GetData(DATA_KNOCK_ON_WOOD) == 3;
}
};
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
index 8090b9e8a3e..43d203daedf 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp
@@ -20,24 +20,26 @@
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "ulduar.h"
+#include "Player.h"
enum VezaxYells
{
- SAY_AGGRO = -1603290,
- SAY_SLAY_1 = -1603291,
- SAY_SLAY_2 = -1603292,
- SAY_SURGE_OF_DARKNESS = -1603293,
- SAY_DEATH = -1603294,
- SAY_BERSERK = -1603295,
- SAY_HARDMODE = -1603296,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_SURGE_OF_DARKNESS = 2,
+ SAY_DEATH = 3,
+ SAY_BERSERK = 4,
+ SAY_HARDMODE = 5,
};
enum VezaxEmotes
{
- EMOTE_VAPORS = -1603289,
- EMOTE_ANIMUS = -1603297,
- EMOTE_BARRIER = -1603298,
- EMOTE_SURGE_OF_DARKNESS = -1603299,
+ EMOTE_ANIMUS = 6,
+ EMOTE_BARRIER = 7,
+ EMOTE_SURGE_OF_DARKNESS = 8,
+
+ // Saronite Vapor
+ EMOTE_VAPORS = 9
};
enum VezaxSpells
@@ -121,7 +123,7 @@ class boss_general_vezax : public CreatureScript
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_AURA_OF_DESPAIR);
CheckShamanisticRage();
@@ -172,8 +174,8 @@ class boss_general_vezax : public CreatureScript
break;
}
case EVENT_SURGE_OF_DARKNESS:
- DoScriptText(EMOTE_SURGE_OF_DARKNESS, me);
- DoScriptText(SAY_SURGE_OF_DARKNESS, me);
+ Talk(EMOTE_SURGE_OF_DARKNESS);
+ Talk(SAY_SURGE_OF_DARKNESS);
DoCast(me, SPELL_SURGE_OF_DARKNESS);
events.ScheduleEvent(EVENT_SURGE_OF_DARKNESS, urand(50000, 70000));
break;
@@ -182,8 +184,8 @@ class boss_general_vezax : public CreatureScript
events.ScheduleEvent(EVENT_SARONITE_VAPORS, urand(30000, 35000));
if (++vaporCount == 6 && smellSaronite)
{
- DoScriptText(SAY_HARDMODE, me);
- DoScriptText(EMOTE_BARRIER, me);
+ Talk(SAY_HARDMODE);
+ Talk(EMOTE_BARRIER);
summons.DespawnAll();
DoCast(me, SPELL_SARONITE_BARRIER);
DoCast(SPELL_SUMMON_SARONITE_ANIMUS);
@@ -193,7 +195,7 @@ class boss_general_vezax : public CreatureScript
}
break;
case EVENT_BERSERK:
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
DoCast(me, SPELL_BERSERK);
break;
}
@@ -208,15 +210,16 @@ class boss_general_vezax : public CreatureScript
shadowDodger = false;
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_AURA_OF_DESPAIR);
}
@@ -234,7 +237,7 @@ class boss_general_vezax : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -315,7 +318,6 @@ class boss_saronite_animus : public CreatureScript
boss_saronite_animusAI(Creature* creature) : ScriptedAI(creature)
{
instance = me->GetInstanceScript();
- DoScriptText(EMOTE_BARRIER, me);
}
void Reset()
@@ -377,7 +379,7 @@ class npc_saronite_vapors : public CreatureScript
{
npc_saronite_vaporsAI(Creature* creature) : ScriptedAI(creature)
{
- DoScriptText(EMOTE_VAPORS, me);
+ Talk(EMOTE_VAPORS);
instance = me->GetInstanceScript();
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip jump effect
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
index c9fe1c5b707..8247236016c 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp
@@ -32,18 +32,15 @@
enum HodirYells
{
- SAY_AGGRO = -1603210,
- SAY_SLAY_1 = -1603211,
- SAY_SLAY_2 = -1603212,
- SAY_FLASH_FREEZE = -1603213,
- SAY_STALACTITE = -1603214,
- SAY_DEATH = -1603215,
- SAY_BERSERK = -1603216,
- SAY_YS_HELP = -1603217,
- SAY_HARD_MODE_FAILED = -1603218,
-
- EMOTE_FREEZE = -1603209,
- EMOTE_BLOWS = -1603219,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_FLASH_FREEZE = 2,
+ SAY_STALACTITE = 3,
+ SAY_DEATH = 4,
+ SAY_BERSERK = 5,
+ SAY_HARD_MODE_FAILED = 6,
+ EMOTE_FREEZE = 7,
+ EMOTE_BLOWS = 8
};
enum HodirSpells
@@ -70,6 +67,8 @@ enum HodirSpells
SPELL_ICE_SHARD = 62457,
SPELL_ICE_SHARD_HIT = 65370,
+ SPELL_KILL_CREDIT = 64899,
+
// Druids
SPELL_WRATH = 62793,
SPELL_STARLIGHT = 62807,
@@ -329,7 +328,7 @@ class boss_hodir : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_BITING_COLD, true);
gettingColdInHereTimer = 1000;
@@ -346,10 +345,10 @@ class boss_hodir : public CreatureScript
events.ScheduleEvent(EVENT_BERSERK, 480000);
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- if (!urand(0, 3))
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void DamageTaken(Unit* /*who*/, uint32& damage)
@@ -357,7 +356,7 @@ class boss_hodir : public CreatureScript
if (damage >= me->GetHealth())
{
damage = 0;
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (iCouldSayThatThisCacheWasRare)
instance->SetData(DATA_HODIR_RARE_CACHE, 1);
@@ -376,6 +375,8 @@ class boss_hodir : public CreatureScript
me->setFaction(35);
me->DespawnOrUnsummon(10000);
+ DoCastAOE(SPELL_KILL_CREDIT);
+
_JustDied();
}
}
@@ -404,8 +405,8 @@ class boss_hodir : public CreatureScript
events.ScheduleEvent(EVENT_ICICLE, RAID_MODE(5500, 3500));
break;
case EVENT_FLASH_FREEZE:
- DoScriptText(SAY_FLASH_FREEZE, me);
- DoScriptText(EMOTE_FREEZE, me);
+ Talk(SAY_FLASH_FREEZE);
+ Talk(EMOTE_FREEZE);
for (uint8 n = 0; n < RAID_MODE(2, 3); ++n)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
target->CastSpell(target, SPELL_ICICLE_SNOWDRIFT, true);
@@ -424,19 +425,19 @@ class boss_hodir : public CreatureScript
break;
}
case EVENT_BLOWS:
- DoScriptText(SAY_STALACTITE, me);
- DoScriptText(EMOTE_BLOWS, me);
+ Talk(SAY_STALACTITE);
+ Talk(EMOTE_BLOWS);
DoCast(me, SPELL_FROZEN_BLOWS);
events.ScheduleEvent(EVENT_BLOWS, urand(60000, 65000));
break;
case EVENT_RARE_CACHE:
- DoScriptText(SAY_HARD_MODE_FAILED, me);
+ Talk(SAY_HARD_MODE_FAILED);
iCouldSayThatThisCacheWasRare = false;
instance->SetData(DATA_HODIR_RARE_CACHE, 0);
events.CancelEvent(EVENT_RARE_CACHE);
break;
case EVENT_BERSERK:
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
DoCast(me, SPELL_BERSERK, true);
events.CancelEvent(EVENT_BERSERK);
break;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
index 540876f421b..8f68542d462 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp
@@ -24,16 +24,14 @@
enum Yells
{
- SAY_AGGRO = -1603220,
- SAY_SLAY_1 = -1603221,
- SAY_SLAY_2 = -1603222,
- SAY_DEATH = -1603223,
- SAY_SUMMON = -1603224,
- SAY_SLAG_POT = -1603225,
- SAY_SCORCH_1 = -1603226,
- SAY_SCORCH_2 = -1603227,
- SAY_BERSERK = -1603228,
- EMOTE_JETS = -1603229,
+ SAY_AGGRO = 0,
+ SAY_SUMMON = 1,
+ SAY_SLAG_POT = 2,
+ SAY_SCORCH = 3,
+ SAY_SLAY = 4,
+ SAY_BERSERK = 5,
+ SAY_DEATH = 6,
+ EMOTE_JETS = 7
};
enum Spells
@@ -135,7 +133,7 @@ class boss_ignis : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
_EnterCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_JET, 30000);
events.ScheduleEvent(EVENT_SCORCH, 25000);
events.ScheduleEvent(EVENT_SLAG_POT, 35000);
@@ -151,10 +149,10 @@ class boss_ignis : public CreatureScript
void JustDied(Unit* /*killer*/)
{
_JustDied();
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_SHATTERED)
return _shattered ? 1 : 0;
@@ -162,10 +160,10 @@ class boss_ignis : public CreatureScript
return 0;
}
- void KilledUnit(Unit* /*victim*/)
+ void KilledUnit(Unit* who)
{
- if (!urand(0, 4))
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summon)
@@ -217,7 +215,7 @@ class boss_ignis : public CreatureScript
case EVENT_SLAG_POT:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
- DoScriptText(SAY_SLAG_POT, me);
+ Talk(SAY_SLAG_POT);
_slagPotGUID = target->GetGUID();
DoCast(target, SPELL_GRAB);
events.DelayEvents(3000);
@@ -252,14 +250,14 @@ class boss_ignis : public CreatureScript
}
break;
case EVENT_SCORCH:
- DoScriptText(RAND(SAY_SCORCH_1, SAY_SCORCH_2), me);
+ Talk(SAY_SCORCH);
if (Unit* target = me->getVictim())
me->SummonCreature(NPC_GROUND_SCORCH, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 45000);
DoCast(SPELL_SCORCH);
events.ScheduleEvent(EVENT_SCORCH, 25000);
break;
case EVENT_CONSTRUCT:
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
DoSummon(NPC_IRON_CONSTRUCT, ConstructSpawnPosition[urand(0, CONSTRUCT_SPAWN_POINTS - 1)], 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
DoCast(SPELL_STRENGHT);
DoCast(me, SPELL_ACTIVATE_CONSTRUCT);
@@ -267,7 +265,7 @@ class boss_ignis : public CreatureScript
break;
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK, true);
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
break;
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
index 24a9171e29f..c1fc0a81989 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp
@@ -21,6 +21,7 @@
#include "SpellAuraEffects.h"
#include "ulduar.h"
#include "Vehicle.h"
+#include "Player.h"
/* ScriptData
SDName: boss_kologarn
@@ -29,34 +30,40 @@ SDComment: TODO: Achievements
SDCategory: Ulduar
EndScriptData */
-#define SPELL_ARM_DEAD_DAMAGE RAID_MODE(63629, 63979)
-#define SPELL_TWO_ARM_SMASH RAID_MODE(63356, 64003)
-#define SPELL_ONE_ARM_SMASH RAID_MODE(63573, 64006)
-#define SPELL_ARM_SWEEP RAID_MODE(63766, 63983)
-#define SPELL_STONE_SHOUT RAID_MODE(63716, 64005)
-#define SPELL_PETRIFY_BREATH RAID_MODE(62030, 63980)
-#define SPELL_STONE_GRIP RAID_MODE(62166, 63981)
-#define SPELL_STONE_GRIP_CANCEL 65594
-#define SPELL_SUMMON_RUBBLE 63633
-#define SPELL_FALLING_RUBBLE 63821
-#define SPELL_ARM_ENTER_VEHICLE 65343
-#define SPELL_ARM_ENTER_VISUAL 64753
-
-#define SPELL_SUMMON_FOCUSED_EYEBEAM 63342
-#define SPELL_FOCUSED_EYEBEAM_PERIODIC RAID_MODE(63347, 63977)
-#define SPELL_FOCUSED_EYEBEAM_VISUAL 63369
-#define SPELL_FOCUSED_EYEBEAM_VISUAL_LEFT 63676
-#define SPELL_FOCUSED_EYEBEAM_VISUAL_RIGHT 63702
-
-// Passive
-#define SPELL_KOLOGARN_REDUCE_PARRY 64651
-#define SPELL_KOLOGARN_PACIFY 63726
-#define SPELL_KOLOGARN_UNK_0 65219 // Not found in DBC
-
-#define SPELL_BERSERK 47008 // guess
-
-#define NPC_RUBBLE_STALKER 33809
-#define NPC_ARM_SWEEP_STALKER 33661
+enum Spells
+{
+ SPELL_ARM_DEAD_DAMAGE = 63629,
+ SPELL_TWO_ARM_SMASH = 63356,
+ SPELL_ONE_ARM_SMASH = 63573,
+ SPELL_ARM_SWEEP = 63766,
+ SPELL_STONE_SHOUT = 63716,
+ SPELL_PETRIFY_BREATH = 62030,
+ SPELL_STONE_GRIP = 62166,
+ SPELL_STONE_GRIP_CANCEL = 65594,
+ SPELL_SUMMON_RUBBLE = 63633,
+ SPELL_FALLING_RUBBLE = 63821,
+ SPELL_ARM_ENTER_VEHICLE = 65343,
+ SPELL_ARM_ENTER_VISUAL = 64753,
+
+ SPELL_SUMMON_FOCUSED_EYEBEAM = 63342,
+ SPELL_FOCUSED_EYEBEAM_PERIODIC = 63347,
+ SPELL_FOCUSED_EYEBEAM_VISUAL = 63369,
+ SPELL_FOCUSED_EYEBEAM_VISUAL_LEFT = 63676,
+ SPELL_FOCUSED_EYEBEAM_VISUAL_RIGHT = 63702,
+
+ // Passive
+ SPELL_KOLOGARN_REDUCE_PARRY = 64651,
+ SPELL_KOLOGARN_PACIFY = 63726,
+ SPELL_KOLOGARN_UNK_0 = 65219, // Not found in DBC
+
+ SPELL_BERSERK = 47008 // guess
+};
+
+enum NPCs
+{
+ NPC_RUBBLE_STALKER = 33809,
+ NPC_ARM_SWEEP_STALKER = 33661
+};
enum Events
{
@@ -75,15 +82,15 @@ enum Events
enum Yells
{
- SAY_AGGRO = -1603230,
- SAY_SLAY_1 = -1603231,
- SAY_SLAY_2 = -1603232,
- SAY_LEFT_ARM_GONE = -1603233,
- SAY_RIGHT_ARM_GONE = -1603234,
- SAY_SHOCKWAVE = -1603235,
- SAY_GRAB_PLAYER = -1603236,
- SAY_DEATH = -1603237,
- SAY_BERSERK = -1603238,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_LEFT_ARM_GONE = 2,
+ SAY_RIGHT_ARM_GONE = 3,
+ SAY_SHOCKWAVE = 4,
+ SAY_GRAB_PLAYER = 5,
+ SAY_DEATH = 6,
+ SAY_BERSERK = 7,
+ EMOTE_STONE_GRIP = 8
};
class boss_kologarn : public CreatureScript
@@ -112,7 +119,7 @@ class boss_kologarn : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
events.ScheduleEvent(EVENT_MELEE_CHECK, 6000);
events.ScheduleEvent(EVENT_SMASH, 5000);
@@ -137,7 +144,7 @@ class boss_kologarn : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
DoCast(SPELL_KOLOGARN_PACIFY);
me->GetMotionMaster()->MoveTargetedHome();
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -145,9 +152,10 @@ class boss_kologarn : public CreatureScript
_JustDied();
}
- void KilledUnit(Unit* /*who*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply)
@@ -159,7 +167,7 @@ class boss_kologarn : public CreatureScript
if (!apply && isEncounterInProgress)
{
who->ToCreature()->DisappearAndDie();
- DoScriptText(SAY_LEFT_ARM_GONE, me);
+ Talk(SAY_LEFT_ARM_GONE);
events.ScheduleEvent(EVENT_RESPAWN_LEFT_ARM, 40000);
}
}
@@ -170,7 +178,7 @@ class boss_kologarn : public CreatureScript
if (!apply && isEncounterInProgress)
{
who->ToCreature()->DisappearAndDie();
- DoScriptText(SAY_RIGHT_ARM_GONE, me);
+ Talk(SAY_RIGHT_ARM_GONE);
events.ScheduleEvent(EVENT_RESPAWN_RIGHT_ARM, 40000);
}
}
@@ -271,7 +279,7 @@ class boss_kologarn : public CreatureScript
break;
case EVENT_ENRAGE:
DoCast(SPELL_BERSERK);
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
break;
case EVENT_RESPAWN_LEFT_ARM:
case EVENT_RESPAWN_RIGHT_ARM:
@@ -289,11 +297,12 @@ class boss_kologarn : public CreatureScript
if (right)
{
DoCast(SPELL_STONE_GRIP);
- DoScriptText(SAY_GRAB_PLAYER, me);
+ Talk(SAY_GRAB_PLAYER);
+ Talk(EMOTE_STONE_GRIP);
}
events.ScheduleEvent(EVENT_STONE_GRIP, 25 * IN_MILLISECONDS);
+ break;
}
- break;
case EVENT_FOCUSED_EYEBEAM:
if (Unit* eyebeamTargetUnit = SelectTarget(SELECT_TARGET_FARTHEST, 0, 0, true))
{
@@ -403,12 +412,12 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
}
// For subsequent effects
- m_unitList = unitList;
+ _unitList = unitList;
}
void FillTargetsSubsequential(std::list<WorldObject*>& unitList)
{
- unitList = m_unitList;
+ unitList = _unitList;
}
void Register()
@@ -418,8 +427,9 @@ class spell_ulduar_stone_grip_cast_target : public SpellScriptLoader
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_ulduar_stone_grip_cast_target_SpellScript::FillTargetsSubsequential, EFFECT_2, TARGET_UNIT_SRC_AREA_ENEMY);
}
+ private:
// Shared between effects
- std::list<WorldObject*> m_unitList;
+ std::list<WorldObject*> _unitList;
};
SpellScript* GetSpellScript() const
@@ -488,7 +498,7 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader
pos.m_positionX = 1756.25f + irand(-3, 3);
pos.m_positionY = -8.3f + irand(-3, 3);
pos.m_positionZ = 448.8f;
- pos.m_orientation = M_PI;
+ pos.SetOrientation(M_PI);
GetHitPlayer()->DestroyForNearbyPlayers();
GetHitPlayer()->ExitVehicle(&pos);
GetHitPlayer()->UpdateObjectVisibility(false);
@@ -624,10 +634,10 @@ class spell_kologarn_summon_focused_eyebeam : public SpellScriptLoader
{
PrepareSpellScript(spell_kologarn_summon_focused_eyebeam_SpellScript);
- void HandleForceCast(SpellEffIndex eff)
+ void HandleForceCast(SpellEffIndex effIndex)
{
- PreventHitDefaultEffect(eff);
- GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->Effects[eff].TriggerSpell, true);
+ PreventHitDefaultEffect(effIndex);
+ GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true);
}
void Register()
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index 98b3a6b658b..b5c907af7f0 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -21,97 +21,92 @@
enum Yells
{
- SAY_AGGRO = -1603240,
- SAY_HARDMODE_ON = -1603241,
- SAY_MKII_ACTIVATE = -1603242,
- SAY_MKII_SLAY_1 = -1603243,
- SAY_MKII_SLAY_2 = -1603244,
- SAY_MKII_DEATH = -1603245,
- SAY_VX001_ACTIVATE = -1603246,
- SAY_VX001_SLAY_1 = -1603247,
- SAY_VX001_SLAY_2 = -1603248,
- SAY_VX001_DEATH = -1603249,
- SAY_AERIAL_ACTIVATE = -1603250,
- SAY_AERIAL_SLAY_1 = -1603251,
- SAY_AERIAL_SLAY_2 = -1603252,
- SAY_AERIAL_DEATH = -1603253,
- SAY_V07TRON_ACTIVATE = -1603254,
- SAY_V07TRON_SLAY_1 = -1603255,
- SAY_V07TRON_SLAY_2 = -1603256,
- SAY_V07TRON_DEATH = -1603257,
- SAY_BERSERK = -1603258,
- SAY_YS_HELP = -1603259,
+ SAY_AGGRO = 0,
+ SAY_HARDMODE_ON = 1,
+ SAY_MKII_ACTIVATE = 2,
+ SAY_MKII_SLAY = 3,
+ SAY_MKII_DEATH = 4,
+ SAY_VX001_ACTIVATE = 5,
+ SAY_VX001_SLAY = 6,
+ SAY_VX001_DEATH = 7,
+ SAY_AERIAL_ACTIVATE = 8,
+ SAY_AERIAL_SLAY = 9,
+ SAY_AERIAL_DEATH = 10,
+ SAY_V07TRON_ACTIVATE = 11,
+ SAY_V07TRON_SLAY = 12,
+ SAY_V07TRON_DEATH = 13,
+ SAY_BERSERK = 14
};
enum Spells
{
- SPELL_JETPACK = 63341,
- SPELL_EMERGENCY_MODE = 64582,
- SPELL_SELF_REPAIR = 64383,
- SPELL_MAGNETIC_CORE = 64444,
- // Leviathan MK II
- SPELL_FLAME_SUPPRESSANT_MK = 64570,
- SPELL_NAPALM_SHELL = 63666,
- SPELL_PLASMA_BLAST = 62977,
- SPELL_PROXIMITY_MINES = 63027,
- SPELL_SHOCK_BLAST = 63631,
- // VX 001
- SPELL_FLAME_SUPPRESSANT_VX = 65192,
- SPELL_FROSTBOMB = 64623,
- SPELL_HAND_PULSE = 64348,
- SPELL_SPINNING_UP = 63414,
- SPELL_RAPID_BURST = 63387,
- SPELL_P3WX2_LASER_BARRAGE = 63293,
- SPELL_ROCKET_STRIKE = 63041,
- SPELL_HEAT_WAVE = 63677,
- // Aerial Command Unit
- SPELL_PLASMA_BALL = 63689,
- // Additonal spells
- SPELL_MAGNETIC_FIELD = 64668,
- SPELL_DEAFENING_SIREN = 64616,
- SPELL_WATER_SPRAY = 64619,
- SPELL_FROST_BOMB_HARD_MODE = 64627,
- SPELL_EXPLOSION = 66351,
- SPELL_DISARM = 1842,
- SPELL_RIDE_VEHICLE = 46598,
- SPELL_TRIGGER_MISSILE = 65347,
+ SPELL_JETPACK = 63341,
+ SPELL_EMERGENCY_MODE = 64582,
+ SPELL_SELF_REPAIR = 64383,
+ SPELL_MAGNETIC_CORE = 64444,
+ // Leviathan MK II
+ SPELL_FLAME_SUPPRESSANT_MK = 64570,
+ SPELL_NAPALM_SHELL = 63666,
+ SPELL_PLASMA_BLAST = 62977,
+ SPELL_PROXIMITY_MINES = 63027,
+ SPELL_SHOCK_BLAST = 63631,
+ // VX 001
+ SPELL_FLAME_SUPPRESSANT_VX = 65192,
+ SPELL_FROSTBOMB = 64623,
+ SPELL_HAND_PULSE = 64348,
+ SPELL_SPINNING_UP = 63414,
+ SPELL_RAPID_BURST = 63387,
+ SPELL_P3WX2_LASER_BARRAGE = 63293,
+ SPELL_ROCKET_STRIKE = 63041,
+ SPELL_HEAT_WAVE = 63677,
+ // Aerial Command Unit
+ SPELL_PLASMA_BALL = 63689,
+ // Additonal spells
+ SPELL_MAGNETIC_FIELD = 64668,
+ SPELL_DEAFENING_SIREN = 64616,
+ SPELL_WATER_SPRAY = 64619,
+ SPELL_FROST_BOMB_HARD_MODE = 64627,
+ SPELL_EXPLOSION = 66351,
+ SPELL_DISARM = 1842,
+ SPELL_RIDE_VEHICLE = 46598,
+ SPELL_TRIGGER_MISSILE = 65347,
};
enum Npc
{
- NPC_ASSAULT_BOT = 34057,
- NPC_BOMB_BOT = 33836,
- NPC_JUNK_BOT = 33855,
- NPC_EMERGENCE_FIRE_BOT = 34147,
- NPC_FROST_BOMB = 34149,
+ NPC_ASSAULT_BOT = 34057,
+ NPC_BOMB_BOT = 33836,
+ NPC_JUNK_BOT = 33855,
+ NPC_EMERGENCE_FIRE_BOT = 34147,
+ NPC_FROST_BOMB = 34149,
};
class spell_ulduar_proximity_mines : public SpellScriptLoader
{
- public:
- spell_ulduar_proximity_mines() : SpellScriptLoader("spell_ulduar_proximity_mines") { }
+ public:
+ spell_ulduar_proximity_mines() : SpellScriptLoader("spell_ulduar_proximity_mines") { }
- class spell_ulduar_proximity_minesSpellScript : public SpellScript
- {
- PrepareSpellScript(spell_ulduar_proximity_minesSpellScript)
+ class spell_ulduar_proximity_minesSpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_ulduar_proximity_minesSpellScript)
- void HandleScript(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
- for (uint8 i = 0; i < 10; ++i)
- GetCaster()->CastSpell(GetCaster(), SPELL_TRIGGER_MISSILE, true);
- }
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ for (uint8 i = 0; i < 10; ++i)
+ GetCaster()->CastSpell(GetCaster(), SPELL_TRIGGER_MISSILE, true);
+ }
- void Register()
- {
- OnEffectHitTarget += SpellEffectFn(spell_ulduar_proximity_minesSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_ulduar_proximity_minesSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
- SpellScript* GetSpellScript() const
- {
- return new spell_ulduar_proximity_minesSpellScript();
- }
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_ulduar_proximity_minesSpellScript();
+ }
};
void AddSC_boss_mimiron()
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
index e8e938dc06b..9643b2ec9ab 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -23,18 +23,26 @@
#include "SpellScript.h"
#include "ulduar.h"
#include "SpellInfo.h"
+#include "Player.h"
enum Says
{
- SAY_GREET = -1603260,
- SAY_GROUND_PHASE = -1603261,
- SAY_AGGRO_1 = -1603262,
- SAY_AGGRO_2 = -1603263,
- SAY_AGGRO_3 = -1603264,
- SAY_TURRETS = -1603265,
- EMOTE_HARPOON = -1603266,
- EMOTE_BREATH = -1603267,
- EMOTE_PERMA = -1603268,
+ // Expedition Commander
+ SAY_INTRO = 0,
+ SAY_GROUND_PHASE = 1,
+ SAY_AGGRO_2 = 2,
+
+ // Expedition Engineer
+ SAY_AGGRO_1 = 0,
+ SAY_AGGRO_3 = 1,
+ SAY_TURRETS = 2, // unused
+
+ // Razorscale Controller
+ EMOTE_HARPOON = 0,
+
+ // Razorscale
+ EMOTE_PERMA = 0,
+ EMOTE_BREATH = 1
};
enum Spells
@@ -244,7 +252,7 @@ class boss_razorscale_controller : public CreatureScript
switch (eventId)
{
case EVENT_BUILD_HARPOON_1:
- DoScriptText(EMOTE_HARPOON, me);
+ Talk(EMOTE_HARPOON);
if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_1, PosHarpoon[0].GetPositionX(), PosHarpoon[0].GetPositionY(), PosHarpoon[0].GetPositionZ(), 4.790f, 0.0f, 0.0f, 0.0f, 0.0f, uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f)) //only nearest broken harpoon
@@ -254,7 +262,7 @@ class boss_razorscale_controller : public CreatureScript
}
return;
case EVENT_BUILD_HARPOON_2:
- DoScriptText(EMOTE_HARPOON, me);
+ Talk(EMOTE_HARPOON);
if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_2, PosHarpoon[1].GetPositionX(), PosHarpoon[1].GetPositionY(), PosHarpoon[1].GetPositionZ(), 4.659f, 0, 0, 0, 0, uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f))
@@ -263,7 +271,7 @@ class boss_razorscale_controller : public CreatureScript
}
return;
case EVENT_BUILD_HARPOON_3:
- DoScriptText(EMOTE_HARPOON, me);
+ Talk(EMOTE_HARPOON);
if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_3, PosHarpoon[2].GetPositionX(), PosHarpoon[2].GetPositionY(), PosHarpoon[2].GetPositionZ(), 5.382f, 0, 0, 0, 0, uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f))
@@ -273,7 +281,7 @@ class boss_razorscale_controller : public CreatureScript
}
return;
case EVENT_BUILD_HARPOON_4:
- DoScriptText(EMOTE_HARPOON, me);
+ Talk(EMOTE_HARPOON);
if (GameObject* Harpoon = me->SummonGameObject(GO_RAZOR_HARPOON_4, PosHarpoon[3].GetPositionX(), PosHarpoon[3].GetPositionY(), PosHarpoon[3].GetPositionZ(), 4.266f, 0, 0, 0, 0, uint32(me->GetRespawnTime())))
{
if (GameObject* BrokenHarpoon = Harpoon->FindNearestGameObject(GO_RAZOR_BROKEN_HARPOON, 5.0f))
@@ -369,7 +377,7 @@ class boss_razorscale : public CreatureScript
void MovementInform(uint32 type, uint32 id)
{
- if (type == POINT_MOTION_TYPE && id == 1)
+ if (type == EFFECT_MOTION_TYPE && id == 1)
{
phase = PHASE_GROUND;
events.SetPhase(PHASE_GROUND);
@@ -377,7 +385,7 @@ class boss_razorscale : public CreatureScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_QUICK_SHAVE)
if (FlyCount <= 2)
@@ -407,7 +415,7 @@ class boss_razorscale : public CreatureScript
if (HarpoonCounter == RAID_MODE(2, 4))
{
HarpoonCounter = 0;
- me->GetMotionMaster()->MovePoint(1, RazorGround);
+ me->GetMotionMaster()->MoveLand(1, RazorGround);
}
if (phase == PHASE_GROUND)
@@ -423,7 +431,7 @@ class boss_razorscale : public CreatureScript
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
me->AttackStop();
- me->GetMotionMaster()->MovePoint(0, RazorFlight);
+ me->GetMotionMaster()->MoveTakeoff(0, RazorFlight);
events.ScheduleEvent(EVENT_FIREBALL, 7000, 0, PHASE_FLIGHT);
events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT);
events.ScheduleEvent(EVENT_SUMMON, 5000, 0, PHASE_FLIGHT);
@@ -443,7 +451,7 @@ class boss_razorscale : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
me->RemoveAllAuras();
me->SetReactState(REACT_AGGRESSIVE);
- DoScriptText(EMOTE_BREATH, me, 0);
+ Talk(EMOTE_BREATH);
DoCastAOE(SPELL_FLAMEBREATH);
events.CancelEvent(EVENT_BREATH);
return;
@@ -467,7 +475,7 @@ class boss_razorscale : public CreatureScript
events.ScheduleEvent(EVENT_FLAME, 10000, 0, PHASE_PERMAGROUND);
return;
case EVENT_BREATH:
- me->MonsterTextEmote(EMOTE_BREATH, 0, true);
+ Talk(EMOTE_BREATH);
DoCastVictim(SPELL_FLAMEBREATH);
events.ScheduleEvent(EVENT_BREATH, 20000, 0, PHASE_PERMAGROUND);
return;
@@ -521,11 +529,11 @@ class boss_razorscale : public CreatureScript
void EnterPermaGround()
{
- me->MonsterTextEmote(EMOTE_PERMA, 0, true);
+ Talk(EMOTE_PERMA);
phase = PHASE_PERMAGROUND;
events.SetPhase(PHASE_PERMAGROUND);
me->SetCanFly(false);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED | UNIT_FLAG_PACIFIED);
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveAurasDueToSpell(SPELL_HARPOON_TRIGGER);
me->SetSpeed(MOVE_FLIGHT, 1.0f, true);
@@ -607,7 +615,7 @@ class npc_expedition_commander : public CreatureScript
{
if (!Greet && me->IsWithinDistInMap(who, 10.0f) && who->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(SAY_GREET, me);
+ Talk(SAY_INTRO);
Greet = true;
}
}
@@ -622,7 +630,7 @@ class npc_expedition_commander : public CreatureScript
switch (action)
{
case ACTION_GROUND_PHASE:
- DoScriptText(SAY_GROUND_PHASE, me);
+ Talk(SAY_GROUND_PHASE);
break;
case ACTION_COMMANDER_RESET:
summons.clear();
@@ -652,7 +660,7 @@ class npc_expedition_commander : public CreatureScript
Engineer[n]->SetHomePosition(PosEngRepair[n]);
Engineer[n]->GetMotionMaster()->MoveTargetedHome();
}
- Engineer[0]->MonsterYell(SAY_AGGRO_3, LANG_UNIVERSAL, 0);
+ Engineer[0]->AI()->Talk(SAY_AGGRO_3);
Phase = 3;
AttackStartTimer = 14000;
break;
@@ -671,7 +679,7 @@ class npc_expedition_commander : public CreatureScript
Engineer[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING);
for (uint8 n = 0; n < 4; ++n)
Defender[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);
- me->MonsterYell(SAY_AGGRO_2, LANG_UNIVERSAL, 0);
+ Talk(SAY_AGGRO_2);
AttackStartTimer = 16000;
Phase = 5;
break;
@@ -681,7 +689,7 @@ class npc_expedition_commander : public CreatureScript
Razorscale->AI()->DoAction(ACTION_EVENT_START);
me->SetInCombatWith(Razorscale);
}
- Engineer[0]->MonsterYell(SAY_AGGRO_1, LANG_UNIVERSAL, 0);
+ Engineer[0]->AI()->Talk(SAY_AGGRO_1);
Phase = 6;
break;
}
@@ -895,7 +903,7 @@ class npc_darkrune_guardian : public CreatureScript
killedByBreath = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
return type == DATA_IRON_DWARF_MEDIUM_RARE ? killedByBreath : 0;
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
index 084cd3e0f86..82845d10b8c 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp
@@ -21,83 +21,80 @@
enum Yells
{
- SAY_AGGRO_1 = -1603270,
- SAY_AGGRO_2 = -1603271,
- SAY_SPECIAL_1 = -1603272,
- SAY_SPECIAL_2 = -1603273,
- SAY_SPECIAL_3 = -1603274,
- SAY_JUMPDOWN = -1603275,
- SAY_SLAY_1 = -1603276,
- SAY_SLAY_2 = -1603277,
- SAY_BERSERK = -1603278,
- SAY_WIPE = -1603279,
- SAY_DEATH = -1603280,
- SAY_END_NORMAL_1 = -1603281,
- SAY_END_NORMAL_2 = -1603282,
- SAY_END_NORMAL_3 = -1603283,
- SAY_END_HARD_1 = -1603284,
- SAY_END_HARD_2 = -1603285,
- SAY_END_HARD_3 = -1603286,
- SAY_YS_HELP = -1603287,
+ SAY_AGGRO = 0,
+ SAY_SPECIAL_1 = 1,
+ SAY_SPECIAL_2 = 2,
+ SAY_SPECIAL_3 = 3,
+ SAY_JUMPDOWN = 4,
+ SAY_SLAY = 5,
+ SAY_BERSERK = 6,
+ SAY_WIPE = 7,
+ SAY_DEATH = 8,
+ SAY_END_NORMAL_1 = 9,
+ SAY_END_NORMAL_2 = 10,
+ SAY_END_NORMAL_3 = 11,
+ SAY_END_HARD_1 = 12,
+ SAY_END_HARD_2 = 13,
+ SAY_END_HARD_3 = 14
};
class boss_thorim : public CreatureScript
{
-public:
- boss_thorim() : CreatureScript("boss_thorim") { }
+ public:
+ boss_thorim() : CreatureScript("boss_thorim") { }
- CreatureAI* GetAI(Creature* creature) const
- {
- return GetUlduarAI<boss_thorimAI>(creature);
- }
-
- struct boss_thorimAI : public BossAI
- {
- boss_thorimAI(Creature* creature) : BossAI(creature, BOSS_THORIM)
+ struct boss_thorimAI : public BossAI
{
- }
+ boss_thorimAI(Creature* creature) : BossAI(creature, BOSS_THORIM)
+ {
+ }
- void Reset()
- {
- _Reset();
- }
+ void Reset()
+ {
+ _Reset();
+ }
- void EnterEvadeMode()
- {
- DoScriptText(SAY_WIPE, me);
- _EnterEvadeMode();
- }
+ void EnterEvadeMode()
+ {
+ Talk(SAY_WIPE);
+ _EnterEvadeMode();
+ }
- void KilledUnit(Unit* /*victim*/)
- {
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
- }
+ void KilledUnit(Unit* who)
+ {
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
+ }
- void JustDied(Unit* /*killer*/)
- {
- DoScriptText(SAY_DEATH, me);
- _JustDied();
- }
+ void JustDied(Unit* /*killer*/)
+ {
+ Talk(SAY_DEATH);
+ _JustDied();
+ }
- void EnterCombat(Unit* /*who*/)
- {
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2), me);
- _EnterCombat();
- }
+ void EnterCombat(Unit* /*who*/)
+ {
+ Talk(SAY_AGGRO);
+ _EnterCombat();
+ }
- void UpdateAI(const uint32 diff)
- {
- if (!UpdateVictim())
- return;
- //SPELLS TODO:
+ void UpdateAI(uint32 const diff)
+ {
+ if (!UpdateVictim())
+ return;
+ //SPELLS TODO:
- //
- DoMeleeAttackIfReady();
+ //
+ DoMeleeAttackIfReady();
- EnterEvadeIfOutOfCombatArea(diff);
- }
- };
+ EnterEvadeIfOutOfCombatArea(diff);
+ }
+ };
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return GetUlduarAI<boss_thorimAI>(creature);
+ }
};
void AddSC_boss_thorim()
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
index 7ada42144a8..09ab35d6589 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp
@@ -29,6 +29,9 @@
#include "SpellAuraEffects.h"
#include "ulduar.h"
#include "Vehicle.h"
+#include "Player.h"
+#include "WorldPacket.h"
+#include "Opcodes.h"
enum Spells
{
@@ -154,15 +157,18 @@ enum XT002Data
enum Yells
{
- SAY_AGGRO = -1603300,
- SAY_HEART_OPENED = -1603301,
- SAY_HEART_CLOSED = -1603302,
- SAY_TYMPANIC_TANTRUM = -1603303,
- SAY_SLAY_1 = -1603304,
- SAY_SLAY_2 = -1603305,
- SAY_BERSERK = -1603306,
- SAY_DEATH = -1603307,
- SAY_SUMMON = -1603308,
+ SAY_AGGRO = 0,
+ SAY_HEART_OPENED = 1,
+ SAY_HEART_CLOSED = 2,
+ SAY_TYMPANIC_TANTRUM = 3,
+ SAY_SLAY = 4,
+ SAY_BERSERK = 5,
+ SAY_DEATH = 6,
+ SAY_SUMMON = 7,
+ EMOTE_HEART_OPENED = 8,
+ EMOTE_HEART_CLOSED = 9,
+ EMOTE_TYMPANIC_TANTRUM = 10,
+ EMOTE_SCRAPBOT = 11
};
enum AchievementCredits
@@ -220,7 +226,7 @@ class boss_xt002 : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
_EnterCombat();
events.ScheduleEvent(EVENT_ENRAGE, TIMER_ENRAGE);
@@ -245,14 +251,15 @@ class boss_xt002 : public CreatureScript
}
}
- void KilledUnit(Unit* /*victim*/)
+ void KilledUnit(Unit* who)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
_JustDied();
}
@@ -289,7 +296,8 @@ class boss_xt002 : public CreatureScript
events.ScheduleEvent(EVENT_GRAVITY_BOMB, TIMER_GRAVITY_BOMB);
break;
case EVENT_TYMPANIC_TANTRUM:
- DoScriptText(SAY_TYMPANIC_TANTRUM, me);
+ Talk(SAY_TYMPANIC_TANTRUM);
+ Talk(EMOTE_TYMPANIC_TANTRUM);
DoCast(SPELL_TYMPANIC_TANTRUM);
events.ScheduleEvent(EVENT_TYMPANIC_TANTRUM, urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX));
break;
@@ -297,7 +305,7 @@ class boss_xt002 : public CreatureScript
SetPhaseOne();
break;
case EVENT_ENRAGE:
- DoScriptText(SAY_BERSERK, me);
+ Talk(SAY_BERSERK);
DoCast(me, SPELL_ENRAGE);
break;
case EVENT_ENTER_HARD_MODE:
@@ -322,11 +330,12 @@ class boss_xt002 : public CreatureScript
if (me->GetHealthPct() > (25 * (4 - _heartExposed)))
++_heartExposed;
+ Talk(EMOTE_SCRAPBOT);
_healthRecovered = true;
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -356,7 +365,8 @@ class boss_xt002 : public CreatureScript
void ExposeHeart()
{
- DoScriptText(SAY_HEART_OPENED, me);
+ Talk(SAY_HEART_OPENED);
+ Talk(EMOTE_HEART_OPENED);
DoCast(me, SPELL_SUBMERGE); // WIll make creature untargetable
me->AttackStop();
@@ -388,7 +398,8 @@ class boss_xt002 : public CreatureScript
void SetPhaseOne()
{
- DoScriptText(SAY_HEART_CLOSED, me);
+ Talk(SAY_HEART_CLOSED);
+ Talk(EMOTE_HEART_CLOSED);
DoCast(me, SPELL_STAND);
me->SetReactState(REACT_AGGRESSIVE);
@@ -925,7 +936,8 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader
}
}
- DoScriptText(SAY_SUMMON, caster->GetVehicleBase());
+ if (Creature* base = caster->GetVehicleCreatureBase())
+ base->AI()->Talk(SAY_SUMMON);
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
index 58ba125b994..20d6a7a40da 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yoggsaron.cpp
@@ -43,18 +43,6 @@ enum Sara
enum YoggSaron_Yells
{
- SAY_PHASE2_1 = -1603330,
- SAY_PHASE2_2 = -1603331,
- SAY_PHASE2_3 = -1603332,
- SAY_PHASE2_4 = -1603333,
- SAY_PHASE2_5 = -1603334,
- SAY_PHASE3 = -1603335,
- SAY_VISION = -1603336,
- SAY_SLAY_1 = -1603337,
- SAY_SLAY_2 = -1603338,
- WHISP_INSANITY_1 = -1603339,
- WHISP_INSANITY_2 = -1603340,
- SAY_DEATH = -1603341,
};
enum
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index 654d763ddbc..b334b8dcbed 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -19,6 +19,8 @@
#include "ScriptedCreature.h"
#include "InstanceScript.h"
#include "ulduar.h"
+#include "Player.h"
+#include "WorldPacket.h"
static DoorData const doorData[] =
{
@@ -32,6 +34,14 @@ static DoorData const doorData[] =
{0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE },
};
+MinionData const minionData[] =
+{
+ { NPC_STEELBREAKER, BOSS_ASSEMBLY_OF_IRON },
+ { NPC_MOLGEIM, BOSS_ASSEMBLY_OF_IRON },
+ { NPC_BRUNDIR, BOSS_ASSEMBLY_OF_IRON },
+ { 0, 0, }
+};
+
class instance_ulduar : public InstanceMapScript
{
public:
@@ -41,8 +51,6 @@ class instance_ulduar : public InstanceMapScript
{
instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { }
- std::string m_strInstData;
-
// Creatures
uint64 LeviathanGUID;
uint64 IgnisGUID;
@@ -97,6 +105,7 @@ class instance_ulduar : public InstanceMapScript
{
SetBossNumber(MAX_ENCOUNTER);
LoadDoorData(doorData);
+ LoadMinionData(minionData);
IgnisGUID = 0;
RazorscaleGUID = 0;
RazorscaleController = 0;
@@ -134,6 +143,7 @@ class instance_ulduar : public InstanceMapScript
elderCount = 0;
conSpeedAtory = false;
Unbroken = true;
+ _algalonSummoned = false;
_summonAlgalon = false;
memset(AlgalonSigilDoorGUID, 0, sizeof(AlgalonSigilDoorGUID));
@@ -199,18 +209,24 @@ class instance_ulduar : public InstanceMapScript
case NPC_XT_TOY_PILE:
for (uint8 i = 0; i < 4; ++i)
if (!XTToyPileGUIDs[i])
+ {
XTToyPileGUIDs[i] = creature->GetGUID();
+ break;
+ }
break;
// Assembly of Iron
case NPC_STEELBREAKER:
AssemblyGUIDs[0] = creature->GetGUID();
+ AddMinion(creature, true);
break;
case NPC_MOLGEIM:
AssemblyGUIDs[1] = creature->GetGUID();
+ AddMinion(creature, true);
break;
case NPC_BRUNDIR:
AssemblyGUIDs[2] = creature->GetGUID();
+ AddMinion(creature, true);
break;
// Freya's Keeper
@@ -311,10 +327,25 @@ class instance_ulduar : public InstanceMapScript
{
switch (creature->GetEntry())
{
+ case NPC_XT_TOY_PILE:
+ for (uint8 i = 0; i < 4; ++i)
+ if (XTToyPileGUIDs[i] == creature->GetGUID())
+ {
+ XTToyPileGUIDs[i] = 0;
+ break;
+ }
+ break;
+ case NPC_STEELBREAKER:
+ case NPC_MOLGEIM:
+ case NPC_BRUNDIR:
+ AddMinion(creature, false);
+ break;
case NPC_BRANN_BRONZBEARD_ALG:
if (BrannBronzebeardAlgGUID == creature->GetGUID())
BrannBronzebeardAlgGUID = 0;
break;
+ default:
+ break;
}
}
@@ -653,7 +684,7 @@ class instance_ulduar : public InstanceMapScript
{
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
@@ -704,11 +735,11 @@ class instance_ulduar : public InstanceMapScript
return RazorHarpoonGUIDs[3];
// Assembly of Iron
- case BOSS_STEELBREAKER:
+ case DATA_STEELBREAKER:
return AssemblyGUIDs[0];
- case BOSS_MOLGEIM:
+ case DATA_MOLGEIM:
return AssemblyGUIDs[1];
- case BOSS_BRUNDIR:
+ case DATA_BRUNDIR:
return AssemblyGUIDs[2];
// Freya's Keepers
@@ -739,7 +770,7 @@ class instance_ulduar : public InstanceMapScript
return 0;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index 858a82bbe57..4dff89f7b2c 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -25,28 +25,25 @@ extern Position const AlgalonLandPos;
enum UlduarBosses
{
- MAX_ENCOUNTER = 20,
+ MAX_ENCOUNTER = 17,
BOSS_LEVIATHAN = 0,
BOSS_IGNIS = 1,
BOSS_RAZORSCALE = 2,
BOSS_XT002 = 3,
BOSS_ASSEMBLY_OF_IRON = 4,
- BOSS_STEELBREAKER = 5,
- BOSS_MOLGEIM = 6,
- BOSS_BRUNDIR = 7,
- BOSS_KOLOGARN = 8,
- BOSS_AURIAYA = 9,
- BOSS_MIMIRON = 10,
- BOSS_HODIR = 11,
- BOSS_THORIM = 12,
- BOSS_FREYA = 13,
- BOSS_BRIGHTLEAF = 14,
- BOSS_IRONBRANCH = 15,
- BOSS_STONEBARK = 16,
- BOSS_VEZAX = 17,
- BOSS_YOGGSARON = 18,
- BOSS_ALGALON = 19,
+ BOSS_KOLOGARN = 5,
+ BOSS_AURIAYA = 6,
+ BOSS_MIMIRON = 7,
+ BOSS_HODIR = 8,
+ BOSS_THORIM = 9,
+ BOSS_FREYA = 10,
+ BOSS_BRIGHTLEAF = 11,
+ BOSS_IRONBRANCH = 12,
+ BOSS_STONEBARK = 13,
+ BOSS_VEZAX = 14,
+ BOSS_YOGGSARON = 15,
+ BOSS_ALGALON = 16,
};
enum UlduarNPCs
@@ -207,6 +204,11 @@ enum UlduarData
DATA_TOY_PILE_2,
DATA_TOY_PILE_3,
+ // Assembly of Iron
+ DATA_STEELBREAKER,
+ DATA_MOLGEIM,
+ DATA_BRUNDIR,
+
// Hodir
DATA_HODIR_RARE_CACHE,
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
index 29eb5ad3367..ab2f778ba9d 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar_teleporter.cpp
@@ -20,6 +20,7 @@
#include "ScriptedGossip.h"
#include "ulduar.h"
#include "InstanceScript.h"
+#include "Player.h"
/*
The teleporter appears to be active and stable.
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 a7853a07e22..4fe56b346b2 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
@@ -22,20 +22,21 @@ SDComment: Some Problems with Annhylde Movement, Blizzlike Timers (just shadow a
SDCategory: Udgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_keep.h"
enum Yells
{
//Yells Ingvar
- YELL_AGGRO_1 = -1574005,
- YELL_AGGRO_2 = -1574006,
+ YELL_AGGRO_1 = 0,
+ YELL_AGGRO_2 = 1,
- YELL_DEAD_1 = -1574007,
- YELL_DEAD_2 = -1574008,
+ YELL_DEAD_1 = 2,
+ YELL_DEAD_2 = 3,
- YELL_KILL_1 = -1574009,
- YELL_KILL_2 = -1574010,
+ YELL_KILL_1 = 4,
+ YELL_KILL_2 = 5,
};
enum Creatures
@@ -55,13 +56,16 @@ enum Events
EVENT_DARK_SMASH,
EVENT_DREADFUL_ROAR,
EVENT_WOE_STRIKE,
- EVENT_SHADOW_AXE
+ EVENT_SHADOW_AXE,
+ EVENT_JUST_TRANSFORMED,
+ EVENT_SUMMON_BANSHEE
};
enum Phases
{
PHASE_HUMAN = 1,
PHASE_UNDEAD,
+ PHASE_EVENT
};
enum Spells
@@ -82,7 +86,7 @@ enum Spells
SPELL_WOE_STRIKE = 42730,
ENTRY_THROW_TARGET = 23996,
- SPELL_SHADOW_AXE_SUMMON = 42749
+ SPELL_SHADOW_AXE_SUMMON = 42748
};
class boss_ingvar_the_plunderer : public CreatureScript
@@ -100,14 +104,12 @@ public:
boss_ingvar_the_plundererAI(Creature* creature) : ScriptedAI(creature)
{
instance = creature->GetInstanceScript();
+ bIsUndead = false;
}
InstanceScript* instance;
bool bIsUndead;
- bool bEventInProgress;
-
- uint32 uiSpawnResTimer;
void Reset()
{
@@ -115,7 +117,6 @@ public:
me->UpdateEntry(MOB_INGVAR_HUMAN);
bIsUndead = false;
- bEventInProgress = false;
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -128,13 +129,6 @@ public:
events.ScheduleEvent(EVENT_ENRAGE, urand(7,14)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_SMASH, urand(12,17)*IN_MILLISECONDS, 0, PHASE_HUMAN);
- events.ScheduleEvent(EVENT_DARK_SMASH, urand(14,22)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
- events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18,21)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
- events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10,14)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
- events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD);
-
- uiSpawnResTimer = 3000;
-
if (instance)
instance->SetData(DATA_INGVAR_EVENT, NOT_STARTED);
}
@@ -154,42 +148,39 @@ public:
me->SetStandState(UNIT_STAND_STATE_DEAD);
// visuel hack end
- bEventInProgress = true;
- bIsUndead = true;
- events.SetPhase(PHASE_UNDEAD);
+ events.SetPhase(PHASE_EVENT);
+ events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT);
- DoScriptText(YELL_DEAD_1, me);
+ Talk(YELL_DEAD_1);
}
- if (bEventInProgress)
- {
+ if (events.GetPhaseMask() & (1 << PHASE_EVENT))
damage = 0;
- }
}
void StartZombiePhase()
{
bIsUndead = true;
- bEventInProgress = false;
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->UpdateEntry(MOB_INGVAR_UNDEAD);
- me->SetInCombatWith(me->getVictim());
- me->GetMotionMaster()->MoveChase(me->getVictim());
+ events.ScheduleEvent(EVENT_JUST_TRANSFORMED, 2 * IN_MILLISECONDS, 0, PHASE_EVENT);
- DoScriptText(YELL_AGGRO_2, me);
+ Talk(YELL_AGGRO_2);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(YELL_AGGRO_1, me);
+ if (!bIsUndead)
+ Talk(YELL_AGGRO_1);
if (instance)
instance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS);
+
+ me->SetInCombatWithZone();
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(YELL_DEAD_2, me);
+ Talk(YELL_DEAD_2);
if (instance)
{
@@ -199,33 +190,24 @@ public:
}
}
+ void ScheduleSecondPhase()
+ {
+ events.SetPhase(PHASE_UNDEAD);
+ events.ScheduleEvent(EVENT_DARK_SMASH, urand(14,18)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
+ events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18,22)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
+ events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10,14)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
+ events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD);
+ }
+
void KilledUnit(Unit* /*victim*/)
{
- if (bIsUndead)
- DoScriptText(YELL_KILL_1, me);
- else
- DoScriptText(YELL_KILL_2, me);
+ Talk(bIsUndead ? YELL_KILL_1 : YELL_KILL_2);
}
void UpdateAI(const uint32 diff)
{
- if (!UpdateVictim())
- return;
-
- if (bEventInProgress)
- {
- if (uiSpawnResTimer)
- {
- if (uiSpawnResTimer <= diff)
- {
- DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position
- // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ?
- uiSpawnResTimer = 0;
- } else uiSpawnResTimer -= diff;
- }
-
+ if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_EVENT)))
return;
- }
events.Update(diff);
@@ -243,24 +225,33 @@ public:
break;
case EVENT_STAGGERING_ROAR:
DoCast(me, SPELL_STAGGERING_ROAR);
- events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18,21)*IN_MILLISECONDS, 0, PHASE_HUMAN);
+ events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18,22)*IN_MILLISECONDS, 0, PHASE_HUMAN);
break;
case EVENT_ENRAGE:
DoCast(me, SPELL_ENRAGE);
events.ScheduleEvent(EVENT_ENRAGE, urand(7,14)*IN_MILLISECONDS, 0, PHASE_HUMAN);
break;
case EVENT_SMASH:
- DoCastVictim(SPELL_SMASH);
- events.ScheduleEvent(EVENT_SMASH, urand(12,17)*IN_MILLISECONDS, 0, PHASE_HUMAN);
+ DoCastAOE(SPELL_SMASH);
+ events.ScheduleEvent(EVENT_SMASH, urand(12,16)*IN_MILLISECONDS, 0, PHASE_HUMAN);
break;
+ case EVENT_JUST_TRANSFORMED:
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ me->SetInCombatWithZone();
+ me->GetMotionMaster()->MoveChase(me->getVictim());
+ ScheduleSecondPhase();
+ return;
+ case EVENT_SUMMON_BANSHEE:
+ DoCast(me, SPELL_SUMMON_BANSHEE);
+ return;
// PHASE TWO
case EVENT_DARK_SMASH:
DoCastVictim(SPELL_DARK_SMASH);
- events.ScheduleEvent(EVENT_DARK_SMASH, urand(14,22)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
+ events.ScheduleEvent(EVENT_DARK_SMASH, urand(12,16)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
break;
case EVENT_DREADFUL_ROAR:
DoCast(me, SPELL_DREADFUL_ROAR);
- events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18,21)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
+ events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18,22)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
break;
case EVENT_WOE_STRIKE:
DoCastVictim(SPELL_WOE_STRIKE);
@@ -269,8 +260,7 @@ public:
case EVENT_SHADOW_AXE:
if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1))
{
- me->SummonCreature(ENTRY_THROW_TARGET, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2000);
- DoCast(me, SPELL_SHADOW_AXE_SUMMON);
+ DoCast(target, SPELL_SHADOW_AXE_SUMMON);
}
events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD);
break;
@@ -336,7 +326,7 @@ public:
{
me->GetMotionMaster()->MovePoint(1, x, y, z+15);
- // DoScriptText(YELL_RESSURECT, me);
+ // Talk(YELL_RESSURECT);
}
}
@@ -409,7 +399,8 @@ public:
enum eShadowAxe
{
SPELL_SHADOW_AXE_DAMAGE = 42750,
- H_SPELL_SHADOW_AXE_DAMAGE = 59719
+ H_SPELL_SHADOW_AXE_DAMAGE = 59719,
+ POINT_TARGET = 28
};
class mob_ingvar_throw_dummy : public CreatureScript
@@ -428,32 +419,34 @@ public:
{
}
- uint32 uiDespawnTimer;
-
void Reset()
{
- Unit* target = me->FindNearestCreature(ENTRY_THROW_TARGET, 50);
- if (target)
+ if (Creature* target = me->FindNearestCreature(ENTRY_THROW_TARGET, 50.0f))
{
- DoCast(me, SPELL_SHADOW_AXE_DAMAGE);
float x, y, z;
target->GetPosition(x, y, z);
- me->GetMotionMaster()->MovePoint(0, x, y, z);
+ me->GetMotionMaster()->MoveCharge(x, y, z, 42.0f, POINT_TARGET);
+ target->DisappearAndDie();
+ }
+ else
+ {
+ me->DisappearAndDie();
}
- uiDespawnTimer = 7000;
}
- void AttackStart(Unit* /*who*/) {}
- void MoveInLineOfSight(Unit* /*who*/) {}
- void EnterCombat(Unit* /*who*/) {}
- void UpdateAI(const uint32 diff)
+ void MovementInform(uint32 type, uint32 id)
{
- if (uiDespawnTimer <= diff)
+ if (type == EFFECT_MOTION_TYPE && id == POINT_TARGET)
{
- me->DealDamage(me, me->GetHealth());
- me->RemoveCorpse();
- uiDespawnTimer = 0;
- } else uiDespawnTimer -= diff;
+ DoCast(me, SPELL_SHADOW_AXE_DAMAGE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
+ if (TempSummon* summon = me->ToTempSummon())
+ {
+ summon->UnSummon(10000);
+ }
+ else
+ me->DisappearAndDie();
+ }
}
};
};
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
index 93cc94923db..9a50e1cbfa3 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -22,7 +22,10 @@ SDComment:
SDCategory: Utgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "utgarde_keep.h"
enum KelsethEncounter
@@ -40,6 +43,9 @@ enum KelsethEncounter
NPC_FROSTTOMB = 23965,
NPC_SKELETON = 23970,
+ NPC_RUNEMAGE = 23960,
+ NPC_STRATEGIST = 23956,
+
SAY_START_COMBAT = 1,
SAY_SUMMON_SKELETONS,
SAY_FROST_TOMB,
@@ -115,14 +121,12 @@ public:
struct boss_kelesethAI : public BossAI
{
- boss_kelesethAI(Creature* creature) : BossAI(creature, DATA_PRINCEKELESETH_EVENT)
- {
- creature->SetReactState(REACT_DEFENSIVE);
- }
+ boss_kelesethAI(Creature* creature) : BossAI(creature, DATA_PRINCEKELESETH_EVENT){}
void Reset()
{
- instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED);
+ if (instance)
+ instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED);
events.Reset();
events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2,3)*IN_MILLISECONDS);
@@ -134,16 +138,43 @@ public:
onTheRocks = true;
}
- void EnterCombat(Unit* /*who*/)
+ void EnterCombat(Unit* who)
{
me->SetInCombatWithZone();
- instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS);
+ if (instance)
+ instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS);
Talk(SAY_START_COMBAT);
+
+ if (!who)
+ return;
+
+ std::list<Creature*> runemages;
+ me->GetCreatureListWithEntryInGrid(runemages, NPC_RUNEMAGE, 60.0f);
+ if (!runemages.empty())
+ {
+ for (std::list<Creature*>::iterator itr = runemages.begin(); itr != runemages.end(); ++itr)
+ {
+ if ((*itr)->isAlive() && (*itr)->IsWithinLOSInMap(me))
+ (*itr)->AI()->AttackStart(who);
+ }
+ }
+
+ std::list<Creature*> strategists;
+ me->GetCreatureListWithEntryInGrid(strategists, NPC_STRATEGIST, 60.0f);
+ if (!strategists.empty())
+ {
+ for (std::list<Creature*>::iterator itr = strategists.begin(); itr != strategists.end(); ++itr)
+ {
+ if ((*itr)->isAlive() && (*itr)->IsWithinLOSInMap(me))
+ (*itr)->AI()->AttackStart(who);
+ }
+ }
}
void JustDied(Unit* /*killer*/)
{
- instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE);
+ if (instance)
+ instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE);
summons.DespawnAll();
Talk(SAY_DEATH);
}
@@ -154,7 +185,7 @@ public:
onTheRocks = value;
}
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 data) const
{
if (data == DATA_ON_THE_ROCKS)
return onTheRocks;
@@ -162,10 +193,20 @@ public:
return 0;
}
- void ExecuteEvent(uint32 const eventId)
+ void UpdateAI(uint32 const diff)
{
- switch (eventId)
+ if (!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventId = events.ExecuteEvent())
{
+ switch (eventId)
+ {
case EVENT_SUMMON_SKELETONS:
Talk(SAY_SUMMON_SKELETONS);
SummonSkeletons();
@@ -186,7 +227,10 @@ public:
}
events.ScheduleEvent(EVENT_FROST_TOMB, urand(14,19)*IN_MILLISECONDS);
break;
+ }
}
+
+ DoMeleeAttackIfReady();
}
void SummonSkeletons()
@@ -219,7 +263,6 @@ public:
events.Reset();
events.ScheduleEvent(EVENT_DECREPIFY, urand(4,6)*IN_MILLISECONDS);
- DoCast(SPELL_BONE_ARMOR);
}
void DamageTaken(Unit* /*done_by*/, uint32 &damage)
@@ -272,6 +315,13 @@ public:
break;
case EVENT_SHADOW_FISSURE:
DoCast(me, SPELL_SHADOW_FISSURE, true);
+ if (TempSummon* temp = me->ToTempSummon())
+ {
+ if (Unit* summoner = temp->GetSummoner())
+ {
+ DoCast(summoner, SPELL_BONE_ARMOR);
+ }
+ }
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD);
me->GetMotionMaster()->MoveChase(me->getVictim());
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 915d1c71bb2..aad4c9989c1 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -22,30 +22,32 @@ SDComment: Needs adjustments to blizzlike timers, Yell Text + Sound to DB
SDCategory: Utgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_keep.h"
enum eEnums
{
//signed for 24200, but used by 24200, 27390
- YELL_SKARVALD_AGGRO = -1574011,
- YELL_SKARVALD_DAL_DIED = -1574012,
- YELL_SKARVALD_SKA_DIEDFIRST = -1574013,
- YELL_SKARVALD_KILL = -1574014,
- YELL_SKARVALD_DAL_DIEDFIRST = -1574015,
+ YELL_SKARVALD_AGGRO = 0,
+ YELL_SKARVALD_DAL_DIED = 1,
+ YELL_SKARVALD_SKA_DIEDFIRST = 2,
+ YELL_SKARVALD_KILL = 3,
+ YELL_SKARVALD_DAL_DIEDFIRST = 4,
//signed for 24201, but used by 24201, 27389
- YELL_DALRONN_AGGRO = -1574016,
- YELL_DALRONN_SKA_DIED = -1574017,
- YELL_DALRONN_DAL_DIEDFIRST = -1574018,
- YELL_DALRONN_KILL = -1574019,
- YELL_DALRONN_SKA_DIEDFIRST = -1574020,
+ YELL_DALRONN_AGGRO = 0,
+ YELL_DALRONN_SKA_DIED = 1,
+ YELL_DALRONN_DAL_DIEDFIRST = 2,
+ YELL_DALRONN_KILL = 3,
+ YELL_DALRONN_SKA_DIEDFIRST = 4,
//Spells of Skarvald and his Ghost
MOB_SKARVALD_THE_CONSTRUCTOR = 24200,
SPELL_CHARGE = 43651,
SPELL_STONE_STRIKE = 48583,
SPELL_SUMMON_SKARVALD_GHOST = 48613,
+ SPELL_ENRAGE = 48193,
MOB_SKARVALD_GHOST = 27390,
//Spells of Dalronn and his Ghost
MOB_DALRONN_THE_CONTROLLER = 24201,
@@ -57,6 +59,20 @@ enum eEnums
MOB_DALRONN_GHOST = 27389
};
+class SkarvaldChargePredicate
+{
+ public:
+ SkarvaldChargePredicate(Unit* unit) : me(unit) {}
+
+ bool operator() (WorldObject* object) const
+ {
+ return object->GetDistance2d(me) >= 5.0f && object->GetDistance2d(me) <= 30.0f;
+ }
+
+ private:
+ Unit* me;
+};
+
class boss_skarvald_the_constructor : public CreatureScript
{
public:
@@ -82,6 +98,7 @@ public:
uint32 Response_Timer;
uint32 Check_Timer;
bool Dalronn_isDead;
+ bool Enraged;
void Reset()
{
@@ -89,6 +106,7 @@ public:
StoneStrike_Timer = 10000;
Dalronn_isDead = false;
Check_Timer = 5000;
+ Enraged = false;
ghost = (me->GetEntry() == MOB_SKARVALD_GHOST);
if (!ghost && instance)
@@ -105,7 +123,7 @@ public:
{
if (!ghost && instance)
{
- DoScriptText(YELL_SKARVALD_AGGRO, me);
+ Talk(YELL_SKARVALD_AGGRO);
Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN));
if (dalronn && dalronn->isAlive() && !dalronn->getVictim())
@@ -115,6 +133,15 @@ public:
}
}
+ void DamageTaken(Unit* /*attacker*/, uint32& damage)
+ {
+ if (!Enraged && !ghost && me->HealthBelowPctDamaged(15, damage))
+ {
+ Enraged = true;
+ DoCast(me, SPELL_ENRAGE);
+ }
+ }
+
void JustDied(Unit* killer)
{
if (!ghost && instance)
@@ -124,13 +151,13 @@ public:
{
if (dalronn->isDead())
{
- DoScriptText(YELL_SKARVALD_DAL_DIED, me);
+ Talk(YELL_SKARVALD_DAL_DIED);
instance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE);
}
else
{
- DoScriptText(YELL_SKARVALD_SKA_DIEDFIRST, me);
+ Talk(YELL_SKARVALD_SKA_DIEDFIRST);
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
//DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true);
@@ -149,7 +176,7 @@ public:
{
if (!ghost)
{
- DoScriptText(YELL_SKARVALD_KILL, me);
+ Talk(YELL_SKARVALD_KILL);
}
}
@@ -184,7 +211,7 @@ public:
{
if (Response_Timer <= diff)
{
- DoScriptText(YELL_SKARVALD_DAL_DIEDFIRST, me);
+ Talk(YELL_SKARVALD_DAL_DIEDFIRST);
Response_Timer = 0;
} else Response_Timer -= diff;
@@ -193,7 +220,7 @@ public:
if (Charge_Timer <= diff)
{
- DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1), SPELL_CHARGE);
+ DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, SkarvaldChargePredicate(me)), SPELL_CHARGE);
Charge_Timer = 5000+rand()%5000;
} else Charge_Timer -= diff;
@@ -203,7 +230,8 @@ public:
StoneStrike_Timer = 5000+rand()%5000;
} else StoneStrike_Timer -= diff;
- DoMeleeAttackIfReady();
+ if (!me->HasUnitState(UNIT_STATE_CASTING))
+ DoMeleeAttackIfReady();
}
};
@@ -282,14 +310,14 @@ public:
{
if (skarvald->isDead())
{
- DoScriptText(YELL_DALRONN_SKA_DIED, me);
+ Talk(YELL_DALRONN_SKA_DIED);
if (instance)
instance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE);
}
else
{
- DoScriptText(YELL_DALRONN_DAL_DIEDFIRST, me);
+ Talk(YELL_DALRONN_DAL_DIEDFIRST);
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
//DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true);
@@ -308,7 +336,7 @@ public:
{
if (!ghost)
{
- DoScriptText(YELL_DALRONN_KILL, me);
+ Talk(YELL_DALRONN_KILL);
}
}
@@ -327,7 +355,7 @@ public:
{
if (AggroYell_Timer <= diff)
{
- DoScriptText(YELL_DALRONN_AGGRO, me);
+ Talk(YELL_DALRONN_AGGRO);
AggroYell_Timer = 0;
} else AggroYell_Timer -= diff;
@@ -354,7 +382,7 @@ public:
{
if (Response_Timer <= diff)
{
- DoScriptText(YELL_DALRONN_SKA_DIEDFIRST, me);
+ Talk(YELL_DALRONN_SKA_DIEDFIRST);
Response_Timer = 0;
} else Response_Timer -= diff;
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
index fda4767e16b..c236b36312d 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp
@@ -22,8 +22,10 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Utgarde Keep
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "utgarde_keep.h"
+#include "Player.h"
#define MAX_ENCOUNTER 3
@@ -119,7 +121,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -164,7 +166,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -245,7 +247,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index 95d2cb1709e..e587a864fd6 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_keep.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
uint32 entry_search[3] =
{
@@ -140,30 +143,204 @@ public:
}
}
}
+ return near_f > 0 && near_f < 4 ? near_f : 0;
+ }
+
+ void UpdateAI(uint32 const /* diff */)
+ {
+ if (fm_Type == 0)
+ fm_Type = GetForgeMasterType();
+
+ if (!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ };
+};
- switch (near_f)
+enum TickingTimeBomb
+{
+ SPELL_TICKING_TIME_BOMB_EXPLODE = 59687
+};
+class spell_ticking_time_bomb : public SpellScriptLoader
+{
+ public:
+ spell_ticking_time_bomb() : SpellScriptLoader("spell_ticking_time_bomb") { }
+
+ class spell_ticking_time_bomb_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_ticking_time_bomb_AuraScript);
+
+ bool Validate(SpellInfo const* /*spellEntry*/)
{
- case 1: return 1;
- case 2: return 2;
- case 3: return 3;
- default: return 0;
+ return (bool) sSpellMgr->GetSpellInfo(SPELL_TICKING_TIME_BOMB_EXPLODE);
}
+
+ void HandleOnEffectRemove(AuraEffect const* /* aurEff */, AuraEffectHandleModes /* mode */)
+ {
+ if (GetCaster() == GetTarget())
+ {
+ GetTarget()->CastSpell(GetTarget(), SPELL_TICKING_TIME_BOMB_EXPLODE, true);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_ticking_time_bomb_AuraScript::HandleOnEffectRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_ticking_time_bomb_AuraScript();
}
+};
+
+enum Fixate
+{
+ SPELL_FIXATE_TRIGGER = 40415
+};
+class spell_fixate : public SpellScriptLoader
+{
+ public:
+ spell_fixate() : SpellScriptLoader("spell_fixate") { }
- void UpdateAI(const uint32 /*diff*/)
+ class spell_fixate_SpellScript : public SpellScript
{
- if (fm_Type == 0)
- fm_Type = GetForgeMasterType();
+ PrepareSpellScript(spell_fixate_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellEntry*/)
+ {
+ return (bool) sSpellMgr->GetSpellInfo(SPELL_FIXATE_TRIGGER);
+ }
+
+ void HandleScriptEffect(SpellEffIndex /*effIndex*/)
+ {
+ // The unit has to cast the taunt on hisself, but we need the original caster for SPELL_AURA_MOD_TAUNT
+ GetCaster()->CastSpell(GetCaster(), SPELL_FIXATE_TRIGGER, true, 0, 0, GetHitUnit()->GetGUID());
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_fixate_SpellScript::HandleScriptEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_fixate_SpellScript();
+ }
+};
+enum EnslavedProtoDrake
+{
+ TYPE_PROTODRAKE_AT = 28,
+ DATA_PROTODRAKE_MOVE = 6,
+
+ PATH_PROTODRAKE = 125946,
+
+ EVENT_REND = 1,
+ EVENT_FLAME_BREATH = 2,
+ EVENT_KNOCKAWAY = 3,
+
+ SPELL_REND = 43931,
+ SPELL_FLAME_BREATH = 50653,
+ SPELL_KNOCK_AWAY = 49722,
+
+ POINT_LAST = 5,
+};
+
+const Position protodrakeCheckPos = {206.24f, -190.28f, 200.11f, 0.f};
+
+class npc_enslaved_proto_drake : public CreatureScript
+{
+public:
+ npc_enslaved_proto_drake() : CreatureScript("npc_enslaved_proto_drake") { }
+
+ struct npc_enslaved_proto_drakeAI : public ScriptedAI
+ {
+ npc_enslaved_proto_drakeAI(Creature* creature) : ScriptedAI(creature)
+ {
+ _setData = false;
+ }
+
+ void Reset()
+ {
+ _events.Reset();
+ _events.ScheduleEvent(EVENT_REND, urand(2000, 3000));
+ _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(5500, 7000));
+ _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(3500, 6000));
+ }
+
+ void MovementInform(uint32 type, uint32 id)
+ {
+ if (type == WAYPOINT_MOTION_TYPE && id == POINT_LAST)
+ {
+ me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
+ }
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ if (type == TYPE_PROTODRAKE_AT && data == DATA_PROTODRAKE_MOVE && !_setData && me->GetDistance(protodrakeCheckPos) < 5.0f)
+ {
+ _setData = true;
+ me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER);
+ me->GetMotionMaster()->MovePath(PATH_PROTODRAKE, false);
+ }
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
if (!UpdateVictim())
return;
+ _events.Update(diff);
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
+
+ while (uint32 eventid = _events.ExecuteEvent())
+ {
+ switch (eventid)
+ {
+ case EVENT_REND:
+ DoCast(SPELL_REND);
+ _events.ScheduleEvent(EVENT_REND, urand(15000, 20000));
+ break;
+ case EVENT_FLAME_BREATH:
+ DoCast(SPELL_FLAME_BREATH);
+ _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(11000, 12000));
+ break;
+ case EVENT_KNOCKAWAY:
+ DoCast(SPELL_KNOCK_AWAY);
+ _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(7000, 8500));
+ break;
+ default:
+ break;
+ }
+ }
+
DoMeleeAttackIfReady();
}
+
+ private:
+ bool _setData;
+ EventMap _events;
+
};
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_enslaved_proto_drakeAI(creature);
+ }
};
void AddSC_utgarde_keep()
{
new npc_dragonflayer_forge_master();
+ new npc_enslaved_proto_drake();
+ new spell_ticking_time_bomb();
+ new spell_fixate();
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
index e2943f491f6..d2772514edf 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_pinnacle.h"
enum Spells
@@ -46,10 +47,9 @@ enum OrbSpells
//not in db
enum Yells
{
- SAY_AGGRO = -1575000,
- SAY_SLAY_1 = -1575001,
- SAY_SLAY_2 = -1575002,
- SAY_DEATH = -1575003
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1
+ //SAY_DEATH = 2 Missing in database
};
enum Creatures
@@ -154,7 +154,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void AttackStart(Unit* who)
@@ -211,7 +211,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ //Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE);
Creature* temp = Unit::GetCreature((*me), instance ? instance->GetData64(DATA_MOB_ORB) : 0);
@@ -221,7 +221,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void NextPhase()
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
index 5132dd0f046..45bab11c46a 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp
@@ -25,22 +25,22 @@ SDComment: <Known Bugs>
SDCategory: Utgarde Pinnacle
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_pinnacle.h"
+#include "Player.h"
+#include "SpellInfo.h"
//Yell
enum eYells
{
- SAY_AGGRO = -1575004,
- SAY_KILL_1 = -1575005,
- SAY_KILL_2 = -1575006,
- EMOTE_RANGE = -1575007, //Skadi
- SAY_DEATH = -1575008,
- SAY_DRAKE_DEATH = -1575009,
- EMOTE_BREATH = -1575010, //Grauf
- SAY_DRAKE_BREATH_1 = -1575011,
- SAY_DRAKE_BREATH_2 = -1575012,
- SAY_DRAKE_BREATH_3 = -1575013,
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ EMOTE_RANGE = 2,
+ SAY_DEATH = 3,
+ SAY_DRAKE_DEATH = 4,
+ EMOTE_BREATH = 5,
+ SAY_DRAKE_BREATH = 6
};
static Position SpawnLoc = {468.931f, -513.555f, 104.723f, 0};
@@ -171,6 +171,7 @@ public:
boss_skadiAI(Creature* creature) : ScriptedAI(creature), Summons(me)
{
instance = creature->GetInstanceScript();
+ m_uiGraufGUID = 0;
}
InstanceScript* instance;
@@ -206,7 +207,7 @@ public:
Summons.DespawnAll();
me->SetSpeed(MOVE_FLIGHT, 3.0f);
- if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted())
+ if ((Unit::GetCreature(*me, m_uiGraufGUID) == NULL) && !me->IsMounted())
me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
if (instance)
{
@@ -220,13 +221,13 @@ public:
me->SetCanFly(false);
me->Dismount();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
- if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL)
+ if (!Unit::GetCreature(*me, m_uiGraufGUID))
me->SummonCreature(CREATURE_GRAUF, Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 3.0f);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
@@ -293,7 +294,7 @@ public:
}
me->GetMotionMaster()->MoveJump(Location[4].GetPositionX(), Location[4].GetPositionY(), Location[4].GetPositionZ(), 5.0f, 10.0f);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
- DoScriptText(SAY_DRAKE_DEATH, me);
+ Talk(SAY_DRAKE_DEATH);
m_uiCrushTimer = 8000;
m_uiPoisonedSpearTimer = 10000;
m_uiWhirlwindTimer = 20000;
@@ -315,7 +316,7 @@ public:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
if (!m_bSaidEmote)
{
- DoScriptText(EMOTE_RANGE, me);
+ Talk(EMOTE_RANGE);
m_bSaidEmote = true;
}
}
@@ -356,8 +357,8 @@ public:
break;
case 3:
me->GetMotionMaster()->MovePoint(0, Location[69].GetPositionX(), Location[69].GetPositionY(), Location[69].GetPositionZ());
- DoScriptText(RAND(SAY_DRAKE_BREATH_1, SAY_DRAKE_BREATH_2), me);
- DoScriptText(EMOTE_BREATH, me);
+ Talk(SAY_DRAKE_BREATH);
+ Talk(EMOTE_BREATH);
m_uiMovementTimer = 2500;
break;
case 4:
@@ -409,7 +410,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
Summons.DespawnAll();
if (instance)
instance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE);
@@ -417,7 +418,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void SpawnMobs()
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
index 7969accc28c..fc82ad1b526 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp
@@ -15,7 +15,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "utgarde_pinnacle.h"
enum Spells
@@ -585,7 +588,7 @@ class npc_scourge_hulk : public CreatureScript
killedByRitualStrike = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
return type == DATA_INCREDIBLE_HULK ? killedByRitualStrike : 0;
}
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
index f9251c637ba..96cfee7c2b8 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp
@@ -23,8 +23,10 @@ SDComment:
SDCategory:
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "utgarde_pinnacle.h"
+#include "SpellInfo.h"
enum Spells
{
@@ -53,16 +55,13 @@ enum Spells
//not in db
enum Yells
{
- SAY_AGGRO = -1575028,
- SAY_SLAY_1 = -1575029,
- SAY_SLAY_2 = -1575030,
- SAY_SLAY_3 = -1575031,
- SAY_SLAY_4 = -1575032,
- SAY_DEATH = -1575033,
- SAY_SUMMON_BJORN = -1575034,
- SAY_SUMMON_HALDOR = -1575035,
- SAY_SUMMON_RANULF = -1575036,
- SAY_SUMMON_TORGYN = -1575037
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SUMMON_BJORN = 3,
+ SAY_SUMMON_HALDOR = 4,
+ SAY_SUMMON_RANULF = 5,
+ SAY_SUMMON_TORGYN = 6
};
enum Creatures
@@ -120,6 +119,9 @@ public:
m_uiActiveOrder[i] = m_uiActiveOrder[r];
m_uiActiveOrder[r] = temp;
}
+
+ m_uiActivedCreatureGUID = 0;
+ m_uiOrbGUID = 0;
}
bool m_bIsWalking;
@@ -185,7 +187,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS);
@@ -197,7 +199,7 @@ public:
kingsBane = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_KINGS_BANE)
return kingsBane ? 1 : 0;
@@ -211,7 +213,7 @@ public:
{
if (m_uiPause_Timer <= diff)
{
- DoScriptText(ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].say, me);
+ Talk(ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].say);
DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit
if (Creature* temp = me->SummonCreature(ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBoat[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0))
{
@@ -365,7 +367,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
DespawnBoatGhosts(m_uiActivedCreatureGUID);
DespawnBoatGhosts(m_uiOrbGUID);
@@ -376,7 +378,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3, SAY_SLAY_4), me);
+ Talk(SAY_SLAY);
}
void DespawnBoatGhosts(uint64 m_uiCreatureGUID)
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp
index 26fbbf4d717..a76c5a61109 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "utgarde_pinnacle.h"
#define MAX_ENCOUNTER 4
@@ -179,7 +180,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -191,7 +192,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
index bffc6af2a3a..8a5e25e4487 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp
@@ -15,10 +15,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
-#define EMOTE_BERSERK -1590002
+enum
+{
+ EMOTE_BERSERK = 0
+};
//Spells Archavon
#define SPELL_ROCK_SHARDS 58678
@@ -108,7 +112,7 @@ class boss_archavon : public CreatureScript
break;
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK);
- DoScriptText(EMOTE_BERSERK, me);
+ Talk(EMOTE_BERSERK);
break;
default:
break;
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
index 4980ed36ec3..b61bb20389d 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp
@@ -15,7 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "vault_of_archavon.h"
//Emalon spells
@@ -35,9 +37,9 @@ enum Spells
enum BossEmotes
{
- EMOTE_OVERCHARGE = -1590000,
- EMOTE_MINION_RESPAWN = -1590001,
- EMOTE_BERSERK = -1590002,
+ EMOTE_OVERCHARGE = 0,
+ EMOTE_MINION_RESPAWN = 1,
+ EMOTE_BERSERK = 2
};
enum Events
@@ -144,14 +146,14 @@ class boss_emalon : public CreatureScript
{
minion->CastSpell(me, SPELL_OVERCHARGED, true);
minion->SetFullHealth();
- DoScriptText(EMOTE_OVERCHARGE, me);
+ Talk(EMOTE_OVERCHARGE);
events.ScheduleEvent(EVENT_OVERCHARGE, 45000);
}
}
break;
case EVENT_BERSERK:
DoCast(me, SPELL_BERSERK);
- DoScriptText(EMOTE_BERSERK, me);
+ Talk(EMOTE_BERSERK);
break;
default:
break;
@@ -196,7 +198,7 @@ class mob_tempest_minion : public CreatureScript
if (emalon->isAlive())
{
emalon->SummonCreature(MOB_TEMPEST_MINION, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
- DoScriptText(EMOTE_MINION_RESPAWN, me);
+ Talk(EMOTE_MINION_RESPAWN);
}
}
}
@@ -242,7 +244,7 @@ class mob_tempest_minion : public CreatureScript
{
DoCast(me, SPELL_OVERCHARGED_BLAST);
me->DespawnOrUnsummon();
- DoScriptText(EMOTE_MINION_RESPAWN, me);
+ Talk(EMOTE_MINION_RESPAWN);
}
}
}
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
index dd9db1c0a99..31003addf1f 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
enum Events
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
index 100f1fccac8..9c60673522c 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "vault_of_archavon.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
index ec0de41ed6d..de557e10e7f 100644
--- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
+++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "vault_of_archavon.h"
/* Vault of Archavon encounters:
@@ -61,7 +62,7 @@ class instance_archavon : public InstanceMapScript
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
index 37ef8bf2788..7b1b9e96baf 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
@@ -33,16 +34,13 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1608000,
- SAY_SLAY_1 = -1608001,
- SAY_SLAY_2 = -1608002,
- SAY_SLAY_3 = -1608003,
- SAY_DEATH = -1608004,
- SAY_SPAWN = -1608005,
- SAY_DISRUPTION = -1608006,
- SAY_BREATH_ATTACK = -1608007,
- SAY_SPECIAL_ATTACK_1 = -1608008,
- SAY_SPECIAL_ATTACK_2 = -1608009
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SPAWN = 3,
+ SAY_DISRUPTION = 4,
+ SAY_BREATH_ATTACK = 5,
+ SAY_SPECIAL_ATTACK = 6
};
class boss_cyanigosa : public CreatureScript
@@ -83,7 +81,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS);
@@ -143,7 +141,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_CYANIGOSA_EVENT, DONE);
@@ -153,7 +151,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 31902acfc46..15cd12140cf 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
@@ -33,14 +34,12 @@ enum Spells
enum Yells
{
- SAY_AGGRO = -1608010,
- SAY_SLAY_1 = -1608011,
- SAY_SLAY_2 = -1608012,
- SAY_SLAY_3 = -1608013,
- SAY_DEATH = -1608014,
- SAY_SPAWN = -1608015,
- SAY_ADD_KILLED = -1608016,
- SAY_BOTH_ADDS_KILLED = -1608017
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SPAWN = 3,
+ SAY_ADD_KILLED = 4,
+ SAY_BOTH_ADDS_KILLED = 5
};
class boss_erekem : public CreatureScript
@@ -124,7 +123,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_EARTH_SHIELD);
if (instance)
@@ -208,7 +207,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
@@ -229,7 +228,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
uint64 GetChainHealTargetGUID()
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index a191d9349f2..fba7efe43ab 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
@@ -39,15 +40,13 @@ enum IchoronCreatures
enum Yells
{
- SAY_AGGRO = -1608018,
- SAY_SLAY_1 = -1608019,
- SAY_SLAY_2 = -1608020,
- SAY_SLAY_3 = -1608021,
- SAY_DEATH = -1608022,
- SAY_SPAWN = -1608023,
- SAY_ENRAGE = -1608024,
- SAY_SHATTER = -1608025,
- SAY_BUBBLE = -1608026
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SPAWN = 3,
+ SAY_ENRAGE = 4,
+ SAY_SHATTER = 5,
+ SAY_BUBBLE = 6
};
enum Actions
@@ -119,7 +118,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(me, SPELL_PROTECTIVE_BUBBLE);
@@ -188,7 +187,7 @@ public:
if (!HealthBelowPct(25))
{
- DoScriptText(SAY_BUBBLE, me);
+ Talk(SAY_BUBBLE);
DoCast(me, SPELL_PROTECTIVE_BUBBLE, true);
}
@@ -196,7 +195,7 @@ public:
me->GetMotionMaster()->MoveChase(me->getVictim());
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_DEHYDRATION)
return dehydration ? 1 : 0;
@@ -213,7 +212,7 @@ public:
if (!bIsFrenzy && HealthBelowPct(25) && !bIsExploded)
{
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
DoCast(me, SPELL_FRENZY, true);
bIsFrenzy = true;
}
@@ -226,7 +225,7 @@ public:
{
if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0))
{
- DoScriptText(SAY_SHATTER, me);
+ Talk(SAY_SHATTER);
DoCast(me, SPELL_WATER_BLAST);
DoCast(me, SPELL_DRAINED);
bIsExploded = true;
@@ -276,7 +275,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (bIsExploded)
{
@@ -325,7 +324,7 @@ public:
{
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
index 7a8254ad2b6..510e9874dd7 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index 1a70846e1b6..f368b07077a 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
//Spells
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index ac165ac39ef..429b2ac32ea 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -15,46 +15,45 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
+#include "Player.h"
enum Spells
{
- SPELL_ARCANE_BARRAGE_VOLLEY = 54202,
- SPELL_ARCANE_BARRAGE_VOLLEY_H = 59483,
- SPELL_ARCANE_BUFFET = 54226,
- SPELL_ARCANE_BUFFET_H = 59485,
- SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102,
- SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137,
- SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138,
+ SPELL_ARCANE_BARRAGE_VOLLEY = 54202,
+ SPELL_ARCANE_BARRAGE_VOLLEY_H = 59483,
+ SPELL_ARCANE_BUFFET = 54226,
+ SPELL_ARCANE_BUFFET_H = 59485,
+ SPELL_SUMMON_ETHEREAL_SPHERE_1 = 54102,
+ SPELL_SUMMON_ETHEREAL_SPHERE_2 = 54137,
+ SPELL_SUMMON_ETHEREAL_SPHERE_3 = 54138,
};
enum NPCs
{
- NPC_ETHEREAL_SPHERE = 29271,
- //NPC_ETHEREAL_SPHERE2 = 32582, // heroic only?
+ NPC_ETHEREAL_SPHERE = 29271,
+ //NPC_ETHEREAL_SPHERE2 = 32582, // heroic only?
};
enum CreatureSpells
{
- SPELL_ARCANE_POWER = 54160,
- H_SPELL_ARCANE_POWER = 59474,
- SPELL_SUMMON_PLAYERS = 54164,
- SPELL_POWER_BALL_VISUAL = 54141,
+ SPELL_ARCANE_POWER = 54160,
+ H_SPELL_ARCANE_POWER = 59474,
+ SPELL_SUMMON_PLAYERS = 54164,
+ SPELL_POWER_BALL_VISUAL = 54141,
};
enum Yells
{
- SAY_AGGRO = -1608027,
- SAY_SLAY_1 = -1608028,
- SAY_SLAY_2 = -1608029,
- SAY_SLAY_3 = -1608030,
- SAY_DEATH = -1608031,
- SAY_SPAWN = -1608032,
- SAY_CHARGED = -1608033,
- SAY_REPEAT_SUMMON_1 = -1608034,
- SAY_REPEAT_SUMMON_2 = -1608035,
- SAY_SUMMON_ENERGY = -1608036
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SPAWN = 3,
+ SAY_CHARGED = 4,
+ SAY_REPEAT_SUMMON = 5,
+ SAY_SUMMON_ENERGY = 6
};
class boss_xevozz : public CreatureScript
@@ -137,7 +136,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
{
if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_XEVOZZ_CELL)))
@@ -180,7 +179,7 @@ public:
if (uiSummonEtherealSphere_Timer < uiDiff)
{
- DoScriptText(SAY_SPAWN, me);
+ Talk(SAY_SPAWN);
DoCast(me, SPELL_SUMMON_ETHEREAL_SPHERE_1);
if (IsHeroic()) // extra one for heroic
me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000);
@@ -195,7 +194,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
DespawnSphere();
@@ -218,7 +217,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
};
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index 4569741e459..5216ae9f08d 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -15,7 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "violet_hold.h"
enum Spells
@@ -37,14 +38,12 @@ enum ZuramatCreatures
enum Yells
{
- SAY_AGGRO = -1608037,
- SAY_SLAY_1 = -1608038,
- SAY_SLAY_2 = -1608039,
- SAY_SLAY_3 = -1608040,
- SAY_DEATH = -1608041,
- SAY_SPAWN = -1608042,
- SAY_SHIELD = -1608043,
- SAY_WHISPER = -1608044
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_SPAWN = 3,
+ SAY_SHIELD = 4,
+ SAY_WHISPER = 5
};
#define DATA_VOID_DANCE 2153
@@ -105,7 +104,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
{
if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_ZURAMAT_CELL)))
@@ -157,7 +156,7 @@ public:
voidDance = false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_VOID_DANCE)
return voidDance ? 1 : 0;
@@ -167,7 +166,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
@@ -189,7 +188,7 @@ public:
if (victim == me)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summon)
diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
index 37a13388b5f..c1c93c789de 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -15,8 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "violet_hold.h"
+#include "Player.h"
+#include "TemporarySummon.h"
#define MAX_ENCOUNTER 3
@@ -91,7 +95,7 @@ const Position MiddleRoomPortalSaboLocation = {1896.622925f, 804.854126f, 38.504
//Cyanigosa's prefight event data
enum Yells
{
- CYANIGOSA_SAY_SPAWN = -1608005
+ CYANIGOSA_SAY_SPAWN = 0
};
enum Spells
@@ -416,7 +420,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -437,7 +441,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -739,7 +743,7 @@ public:
{
case 1:
pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false);
- DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa);
+ pCyanigosa->AI()->Talk(CYANIGOSA_SAY_SPAWN);
uiCyanigosaEventTimer = 7*IN_MILLISECONDS;
++uiCyanigosaEventPhase;
break;
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
index e9d2c85e13e..5e326af9891 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp
@@ -15,9 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "violet_hold.h"
+#include "Player.h"
#define GOSSIP_START_EVENT "Get your people to safety, we'll keep the Blue Dragonflight's forces at bay."
#define GOSSIP_ITEM_1 "Activate the crystals when we get in trouble, right"
@@ -122,7 +125,7 @@ enum Spells
enum eSinclari
{
- SAY_SINCLARI_1 = -1608045
+ SAY_SINCLARI_1 = 0
};
float FirstPortalWPs [6][3] =
@@ -350,7 +353,7 @@ public:
switch (uiPhase)
{
case 1:
- DoScriptText(SAY_SINCLARI_1, me);
+ Talk(SAY_SINCLARI_1);
uiTimer = 4000;
uiPhase = 2;
break;
@@ -780,10 +783,13 @@ struct violet_hold_trashAI : public npc_escortAI
void JustDied(Unit* /*killer*/)
{
- if (Creature* portal = Unit::GetCreature((*me), instance->GetData64(DATA_TELEPORTATION_PORTAL)))
- CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI, portal->AI())->SummonedMobDied(me);
if (instance)
+ {
+ if (Creature* portal = Unit::GetCreature((*me), instance->GetData64(DATA_TELEPORTATION_PORTAL)))
+ CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI, portal->AI())->SummonedMobDied(me);
+
instance->SetData(DATA_NPC_PRESENCE_AT_DOOR_REMOVE, 1);
+ }
}
void CreatureStartAttackDoor()
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp
index 8b51618eedd..3f20a3d32bc 100644
--- a/src/server/scripts/Northrend/borean_tundra.cpp
+++ b/src/server/scripts/Northrend/borean_tundra.cpp
@@ -29,7 +29,6 @@ npc_corastrasza
npc_jenny
npc_sinkhole_kill_credit
npc_khunok_the_behemoth
-npc_scourge_prisoner
mob_nerubar_victim
npc_keristrasza
npc_nesingwary_trapper
@@ -37,9 +36,14 @@ npc_lurgglbr
npc_nexus_drake_hatchling
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ScriptedFollowerAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "WorldSession.h"
/*######
## npc_sinkhole_kill_credit
@@ -62,26 +66,26 @@ public:
{
npc_sinkhole_kill_creditAI(Creature* creature) : ScriptedAI(creature){}
- uint32 uiPhaseTimer;
- uint8 Phase;
+ uint32 phaseTimer;
+ uint8 phase;
uint64 casterGuid;
void Reset()
{
- uiPhaseTimer = 500;
- Phase = 0;
+ phaseTimer = 500;
+ phase = 0;
casterGuid = 0;
}
void SpellHit(Unit* caster, const SpellInfo* spell)
{
- if (Phase)
+ if (phase)
return;
if (spell->Id == SPELL_SET_CART && caster->GetTypeId() == TYPEID_PLAYER
&& CAST_PLR(caster)->GetQuestStatus(11897) == QUEST_STATUS_INCOMPLETE)
{
- Phase = 1;
+ phase = 1;
casterGuid = caster->GetGUID();
}
}
@@ -90,32 +94,32 @@ public:
void UpdateAI(const uint32 diff)
{
- if (!Phase)
+ if (!phase)
return;
- if (uiPhaseTimer <= diff)
+ if (phaseTimer <= diff)
{
- switch (Phase)
+ switch (phase)
{
case 1:
DoCast(me, SPELL_EXPLODE_CART, true);
DoCast(me, SPELL_SUMMON_CART, true);
if (GameObject* cart = me->FindNearestGameObject(188160, 3))
cart->SetUInt32Value(GAMEOBJECT_FACTION, 14);
- uiPhaseTimer = 3000;
- Phase = 2;
+ phaseTimer = 3000;
+ phase = 2;
break;
case 2:
if (GameObject* cart = me->FindNearestGameObject(188160, 3))
cart->UseDoorOrButton();
DoCast(me, SPELL_EXPLODE_CART, true);
- uiPhaseTimer = 3000;
- Phase = 3;
+ phaseTimer = 3000;
+ phase = 3;
break;
case 3:
DoCast(me, SPELL_EXPLODE_CART, true);
- uiPhaseTimer = 2000;
- Phase = 4;
+ phaseTimer = 2000;
+ phase = 4;
case 5:
DoCast(me, SPELL_SUMMON_WORM, true);
if (Unit* worm = me->FindNearestCreature(26250, 3))
@@ -123,8 +127,8 @@ public:
worm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
worm->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
}
- uiPhaseTimer = 1000;
- Phase = 6;
+ phaseTimer = 1000;
+ phase = 6;
break;
case 6:
DoCast(me, SPELL_EXPLODE_CART, true);
@@ -133,21 +137,21 @@ public:
me->Kill(worm);
worm->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
- uiPhaseTimer = 2000;
- Phase = 7;
+ phaseTimer = 2000;
+ phase = 7;
break;
case 7:
DoCast(me, SPELL_EXPLODE_CART, true);
if (Player* caster = Unit::GetPlayer(*me, casterGuid))
caster->KilledMonster(me->GetCreatureTemplate(), me->GetGUID());
- uiPhaseTimer = 5000;
- Phase = 8;
+ phaseTimer = 5000;
+ phase = 8;
break;
case 8:
EnterEvadeMode();
break;
}
- } else uiPhaseTimer -= diff;
+ } else phaseTimer -= diff;
}
@@ -382,41 +386,6 @@ public:
};
/*######
-## npc_scourge_prisoner
-######*/
-
-enum eScourgePrisoner
-{
- GO_SCOURGE_CAGE = 187867
-};
-
-class npc_scourge_prisoner : public CreatureScript
-{
-public:
- npc_scourge_prisoner() : CreatureScript("npc_scourge_prisoner") { }
-
- struct npc_scourge_prisonerAI : public ScriptedAI
- {
- npc_scourge_prisonerAI(Creature* creature) : ScriptedAI (creature){}
-
- void Reset()
- {
- me->SetReactState(REACT_PASSIVE);
-
- if (GameObject* go = me->FindNearestGameObject(GO_SCOURGE_CAGE, 5.0f))
- if (go->GetGoState() == GO_STATE_ACTIVE)
- go->SetGoState(GO_STATE_READY);
- }
-
- };
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_scourge_prisonerAI(creature);
- }
-};
-
-/*######
## npc_jenny
######*/
@@ -578,14 +547,14 @@ public:
npc_nesingwary_trapperAI(Creature* creature) : ScriptedAI(creature) { creature->SetVisible(false); }
uint64 go_caribouGUID;
- uint8 Phase;
- uint32 uiPhaseTimer;
+ uint8 phase;
+ uint32 phaseTimer;
void Reset()
{
me->SetVisible(false);
- uiPhaseTimer = 2500;
- Phase = 1;
+ phaseTimer = 2500;
+ phase = 1;
go_caribouGUID = 0;
}
@@ -609,41 +578,41 @@ public:
void UpdateAI(const uint32 diff)
{
- if (uiPhaseTimer <= diff)
+ if (phaseTimer <= diff)
{
- switch (Phase)
+ switch (phase)
{
case 1:
me->SetVisible(true);
- uiPhaseTimer = 2000;
- Phase = 2;
+ phaseTimer = 2000;
+ phase = 2;
break;
case 2:
if (GameObject* go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f))
me->GetMotionMaster()->MovePoint(0, go_fur->GetPositionX(), go_fur->GetPositionY(), go_fur->GetPositionZ());
- uiPhaseTimer = 1500;
- Phase = 3;
+ phaseTimer = 1500;
+ phase = 3;
break;
case 3:
- //DoScriptText(SAY_NESINGWARY_1, me);
- uiPhaseTimer = 2000;
- Phase = 4;
+ //Talk(SAY_NESINGWARY_1);
+ phaseTimer = 2000;
+ phase = 4;
break;
case 4:
me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT);
- uiPhaseTimer = 1000;
- Phase = 5;
+ phaseTimer = 1000;
+ phase = 5;
break;
case 5:
me->HandleEmoteCommand(EMOTE_ONESHOT_NONE);
- uiPhaseTimer = 500;
- Phase = 6;
+ phaseTimer = 500;
+ phase = 6;
break;
case 6:
if (GameObject* go_fur = me->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 11.0f))
go_fur->Delete();
- uiPhaseTimer = 500;
- Phase = 7;
+ phaseTimer = 500;
+ phase = 7;
break;
case 7:
{
@@ -658,16 +627,16 @@ public:
break;
}
}
- Phase = 8;
- uiPhaseTimer = 1000;
+ phase = 8;
+ phaseTimer = 1000;
}
break;
case 8:
DoCast(me, SPELL_TRAPPED, true);
- Phase = 0;
+ phase = 0;
break;
}
- } else uiPhaseTimer -= diff;
+ } else phaseTimer -= diff;
}
};
@@ -689,12 +658,12 @@ enum eLurgglbr
FACTION_ESCORTEE_A = 774,
FACTION_ESCORTEE_H = 775,
-};
-/*#define SAY_WP_1_LUR_START -1571004
-#define SAY_WP_1_LUR_END -1571005
-#define SAY_WP_41_LUR_START -1571006
-#define SAY_WP_41_LUR_END -1571007*/
+ SAY_START_1 = 0,
+ SAY_START_2 = 1,
+ SAY_END_1 = 2,
+ SAY_END_2 = 3
+};
class npc_lurgglbr : public CreatureScript
{
@@ -741,12 +710,12 @@ public:
switch (IntroPhase)
{
case 1:
- //DoScriptText(SAY_WP_1_LUR_START, me);
+ Talk(SAY_START_1);
IntroPhase = 2;
IntroTimer = 7500;
break;
case 2:
- //DoScriptText(SAY_WP_1_LUR_END, me);
+ Talk(SAY_END_1);
IntroPhase = 3;
IntroTimer = 7500;
break;
@@ -756,12 +725,12 @@ public:
IntroTimer = 0;
break;
case 4:
- //DoScriptText(SAY_WP_41_LUR_START, me);
+ Talk(SAY_START_2);
IntroPhase = 5;
IntroTimer = 8000;
break;
case 5:
- //DoScriptText(SAY_WP_41_LUR_END, me);
+ Talk(SAY_END_2);
IntroPhase = 6;
IntroTimer = 2500;
break;
@@ -946,26 +915,30 @@ enum eThassarian
NPC_GENERAL_ARLOS = 25250,
NPC_LERYSSA = 25251,
- SAY_TALBOT_1 = -1571004,
- SAY_LICH_1 = -1571005,
- SAY_TALBOT_2 = -1571006,
- SAY_THASSARIAN_1 = -1571007,
- SAY_THASSARIAN_2 = -1571008,
- SAY_LICH_2 = -1571009,
- SAY_THASSARIAN_3 = -1571010,
- SAY_TALBOT_3 = -1571011,
- SAY_LICH_3 = -1571012,
- SAY_TALBOT_4 = -1571013,
- SAY_ARLOS_1 = -1571014,
- SAY_ARLOS_2 = -1571015,
- SAY_LERYSSA_1 = -1571016,
- SAY_THASSARIAN_4 = -1571017,
- SAY_LERYSSA_2 = -1571018,
- SAY_THASSARIAN_5 = -1571019,
- SAY_LERYSSA_3 = -1571020,
- SAY_THASSARIAN_6 = -1571021,
- SAY_LERYSSA_4 = -1571022,
- SAY_THASSARIAN_7 = -1571023,
+ SAY_THASSARIAN_1 = 0,
+ SAY_THASSARIAN_2 = 1,
+ SAY_THASSARIAN_3 = 2,
+ SAY_THASSARIAN_4 = 3,
+ SAY_THASSARIAN_5 = 4,
+ SAY_THASSARIAN_6 = 5,
+ SAY_THASSARIAN_7 = 6,
+
+ SAY_TALBOT_1 = 0,
+ SAY_TALBOT_2 = 1,
+ SAY_TALBOT_3 = 2,
+ SAY_TALBOT_4 = 3,
+
+ SAY_LICH_1 = 0,
+ SAY_LICH_2 = 1,
+ SAY_LICH_3 = 2,
+
+ SAY_ARLOS_1 = 0,
+ SAY_ARLOS_2 = 1,
+
+ SAY_LERYSSA_1 = 0,
+ SAY_LERYSSA_2 = 1,
+ SAY_LERYSSA_3 = 2,
+ SAY_LERYSSA_4 = 3
};
#define GOSSIP_ITEM_T "Let's do this, Thassarian. It's now or never."
@@ -977,40 +950,38 @@ public:
struct npc_thassarianAI : public npc_escortAI
{
- npc_thassarianAI(Creature* creature) : npc_escortAI(creature)
- {
- }
+ npc_thassarianAI(Creature* creature) : npc_escortAI(creature) {}
- uint64 uiArthas;
- uint64 uiTalbot;
- uint64 uiLeryssa;
- uint64 uiArlos;
+ uint64 arthasGUID;
+ uint64 talbotGUID;
+ uint64 leryssaGUID;
+ uint64 arlosGUID;
- bool bArthasInPosition;
- bool bArlosInPosition;
- bool bLeryssaInPosition;
- bool bTalbotInPosition;
+ bool arthasInPosition;
+ bool arlosInPosition;
+ bool leryssaInPosition;
+ bool talbotInPosition;
- uint32 uiPhase;
- uint32 uiPhaseTimer;
+ uint32 phase;
+ uint32 phaseTimer;
void Reset()
{
me->RestoreFaction();
me->RemoveStandFlags(UNIT_STAND_STATE_SIT);
- uiArthas = 0;
- uiTalbot = 0;
- uiLeryssa = 0;
- uiArlos = 0;
+ arthasGUID = 0;
+ talbotGUID = 0;
+ leryssaGUID = 0;
+ arlosGUID = 0;
- bArthasInPosition = false;
- bArlosInPosition = false;
- bLeryssaInPosition = false;
- bTalbotInPosition = false;
+ arthasInPosition = false;
+ arlosInPosition = false;
+ leryssaInPosition = false;
+ talbotInPosition = false;
- uiPhase = 0;
- uiPhaseTimer = 0;
+ phase = 0;
+ phaseTimer = 0;
}
void WaypointReached(uint32 waypointId)
@@ -1023,25 +994,25 @@ public:
{
case 3:
SetEscortPaused(true);
- if (Creature* pArthas = me->SummonCreature(NPC_IMAGE_LICH_KING, 3730.313f, 3518.689f, 473.324f, 1.562f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
+ if (Creature* arthas = me->SummonCreature(NPC_IMAGE_LICH_KING, 3730.313f, 3518.689f, 473.324f, 1.562f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
{
- uiArthas = pArthas->GetGUID();
- pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- pArthas->SetReactState(REACT_PASSIVE);
- pArthas->SetWalk(true);
- pArthas->GetMotionMaster()->MovePoint(0, 3737.374756f, 3564.841309f, 477.433014f);
+ arthasGUID = arthas->GetGUID();
+ arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ arthas->SetReactState(REACT_PASSIVE);
+ arthas->SetWalk(true);
+ arthas->GetMotionMaster()->MovePoint(0, 3737.374756f, 3564.841309f, 477.433014f);
}
- if (Creature* pTalbot = me->SummonCreature(NPC_COUNSELOR_TALBOT, 3747.23f, 3614.936f, 473.321f, 4.462012f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
+ if (Creature* talbot = me->SummonCreature(NPC_COUNSELOR_TALBOT, 3747.23f, 3614.936f, 473.321f, 4.462012f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
{
- uiTalbot = pTalbot->GetGUID();
- pTalbot->SetWalk(true);
- pTalbot->GetMotionMaster()->MovePoint(0, 3738.000977f, 3568.882080f, 477.433014f);
+ talbotGUID = talbot->GetGUID();
+ talbot->SetWalk(true);
+ talbot->GetMotionMaster()->MovePoint(0, 3738.000977f, 3568.882080f, 477.433014f);
}
me->SetWalk(false);
break;
case 4:
SetEscortPaused(true);
- uiPhase = 7;
+ phase = 7;
break;
}
}
@@ -1050,173 +1021,173 @@ public:
{
npc_escortAI::UpdateAI(uiDiff);
- if (bArthasInPosition && bTalbotInPosition)
+ if (arthasInPosition && talbotInPosition)
{
- uiPhase = 1;
- bArthasInPosition = false;
- bTalbotInPosition = false;
+ phase = 1;
+ arthasInPosition = false;
+ talbotInPosition = false;
}
- if (bArlosInPosition && bLeryssaInPosition)
+ if (arlosInPosition && leryssaInPosition)
{
- bArlosInPosition = false;
- bLeryssaInPosition = false;
- DoScriptText(SAY_THASSARIAN_1, me);
+ arlosInPosition = false;
+ leryssaInPosition = false;
+ Talk(SAY_THASSARIAN_1);
SetEscortPaused(false);
}
- if (uiPhaseTimer <= uiDiff)
+ if (phaseTimer <= uiDiff)
{
- Creature* pTalbot = me->GetCreature(*me, uiTalbot);
- Creature* pArthas = me->GetCreature(*me, uiArthas);
- switch (uiPhase)
+ Creature* talbot = me->GetCreature(*me, talbotGUID);
+ Creature* arthas = me->GetCreature(*me, arthasGUID);
+ switch (phase)
{
case 1:
- if (pTalbot)
- pTalbot->SetStandState(UNIT_STAND_STATE_KNEEL);
- uiPhaseTimer = 3000;
- ++uiPhase;
+ if (talbot)
+ talbot->SetStandState(UNIT_STAND_STATE_KNEEL);
+ phaseTimer = 3000;
+ ++phase;
break;
case 2:
- if (pTalbot)
+ if (talbot)
{
- pTalbot->UpdateEntry(NPC_PRINCE_VALANAR, ALLIANCE);
- pTalbot->setFaction(14);
- pTalbot->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- pTalbot->SetReactState(REACT_PASSIVE);
+ talbot->UpdateEntry(NPC_PRINCE_VALANAR, ALLIANCE);
+ talbot->setFaction(14);
+ talbot->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ talbot->SetReactState(REACT_PASSIVE);
}
- uiPhaseTimer = 5000;
- ++uiPhase;
+ phaseTimer = 5000;
+ ++phase;
break;
case 3:
- if (pTalbot)
- DoScriptText(SAY_TALBOT_1, pTalbot);
- uiPhaseTimer = 5000;
- ++uiPhase;
+ if (talbot)
+ talbot->AI()->Talk(SAY_TALBOT_1);
+ phaseTimer = 5000;
+ ++phase;
break;
case 4:
- if (pArthas)
- DoScriptText(SAY_LICH_1, pArthas);
- uiPhaseTimer = 5000;
- ++uiPhase;
+ if (arthas)
+ arthas->AI()->Talk(SAY_LICH_1);
+ phaseTimer = 5000;
+ ++phase;
break;
case 5:
- if (pTalbot)
- DoScriptText(SAY_TALBOT_2, pTalbot);
- uiPhaseTimer = 5000;
- ++uiPhase;
+ if (talbot)
+ talbot->AI()->Talk(SAY_TALBOT_2);
+ phaseTimer = 5000;
+ ++phase;
break;
case 6:
- if (Creature* pArlos = me->SummonCreature(NPC_GENERAL_ARLOS, 3745.527100f, 3615.655029f, 473.321533f, 4.447805f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
+ if (Creature* arlos = me->SummonCreature(NPC_GENERAL_ARLOS, 3745.527100f, 3615.655029f, 473.321533f, 4.447805f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
{
- uiArlos = pArlos->GetGUID();
- pArlos->SetWalk(true);
- pArlos->GetMotionMaster()->MovePoint(0, 3735.570068f, 3572.419922f, 477.441010f);
+ arlosGUID = arlos->GetGUID();
+ arlos->SetWalk(true);
+ arlos->GetMotionMaster()->MovePoint(0, 3735.570068f, 3572.419922f, 477.441010f);
}
- if (Creature* pLeryssa = me->SummonCreature(NPC_LERYSSA, 3749.654541f, 3614.959717f, 473.323486f, 4.524959f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
+ if (Creature* leryssa = me->SummonCreature(NPC_LERYSSA, 3749.654541f, 3614.959717f, 473.323486f, 4.524959f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000))
{
- uiLeryssa = pLeryssa->GetGUID();
- pLeryssa->SetWalk(false);
- pLeryssa->SetReactState(REACT_PASSIVE);
- pLeryssa->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- pLeryssa->GetMotionMaster()->MovePoint(0, 3741.969971f, 3571.439941f, 477.441010f);
+ leryssaGUID = leryssa->GetGUID();
+ leryssa->SetWalk(false);
+ leryssa->SetReactState(REACT_PASSIVE);
+ leryssa->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ leryssa->GetMotionMaster()->MovePoint(0, 3741.969971f, 3571.439941f, 477.441010f);
}
- uiPhaseTimer = 2000;
- uiPhase = 0;
+ phaseTimer = 2000;
+ phase = 0;
break;
case 7:
- DoScriptText(SAY_THASSARIAN_2, me);
- uiPhaseTimer = 5000;
- ++uiPhase;
+ Talk(SAY_THASSARIAN_2);
+ phaseTimer = 5000;
+ ++phase;
break;
case 8:
- if (pArthas && pTalbot)
+ if (arthas && talbot)
{
- pArthas->SetInFront(me); //The client doesen't update with the new orientation :l
- pTalbot->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_LICH_2, pArthas);
+ arthas->SetInFront(me); //The client doesen't update with the new orientation :l
+ talbot->SetStandState(UNIT_STAND_STATE_STAND);
+ arthas->AI()->Talk(SAY_LICH_2);
}
- uiPhaseTimer = 5000;
- uiPhase = 9;
+ phaseTimer = 5000;
+ phase = 9;
break;
case 9:
- DoScriptText(SAY_THASSARIAN_3, me);
- uiPhaseTimer = 5000;
- uiPhase = 10;
+ Talk(SAY_THASSARIAN_3);
+ phaseTimer = 5000;
+ phase = 10;
break;
case 10:
- if (pTalbot)
- DoScriptText(SAY_TALBOT_3, pTalbot);
- uiPhaseTimer = 5000;
- uiPhase = 11;
+ if (talbot)
+ talbot->AI()->Talk(SAY_TALBOT_3);
+ phaseTimer = 5000;
+ phase = 11;
break;
case 11:
- if (pArthas)
- DoScriptText(SAY_LICH_3, pArthas);
- uiPhaseTimer = 5000;
- uiPhase = 12;
+ if (arthas)
+ arthas->AI()->Talk(SAY_LICH_3);
+ phaseTimer = 5000;
+ phase = 12;
break;
case 12:
- if (pTalbot)
- DoScriptText(SAY_TALBOT_4, pTalbot);
- uiPhaseTimer = 2000;
- uiPhase = 13;
+ if (talbot)
+ talbot->AI()->Talk(SAY_TALBOT_4);
+ phaseTimer = 2000;
+ phase = 13;
break;
case 13:
- if (pArthas)
- pArthas->RemoveFromWorld();
- ++uiPhase;
+ if (arthas)
+ arthas->RemoveFromWorld();
+ ++phase;
break;
case 14:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- if (pTalbot)
+ if (talbot)
{
- pTalbot->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- pTalbot->SetReactState(REACT_AGGRESSIVE);
- pTalbot->CastSpell(me, SPELL_SHADOW_BOLT, false);
+ talbot->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ talbot->SetReactState(REACT_AGGRESSIVE);
+ talbot->CastSpell(me, SPELL_SHADOW_BOLT, false);
}
- uiPhaseTimer = 1500;
- ++uiPhase;
+ phaseTimer = 1500;
+ ++phase;
break;
case 15:
me->SetReactState(REACT_AGGRESSIVE);
- AttackStart(pTalbot);
- uiPhase = 0;
+ AttackStart(talbot);
+ phase = 0;
break;
case 16:
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
- uiPhaseTimer = 20000;
- ++uiPhase;
+ phaseTimer = 20000;
+ ++phase;
break;
case 17:
- if (Creature* pLeryssa = me->GetCreature(*me, uiLeryssa))
- pLeryssa->RemoveFromWorld();
- if (Creature* pArlos= me->GetCreature(*me, uiArlos))
- pArlos->RemoveFromWorld();
- if (pTalbot)
- pTalbot->RemoveFromWorld();
+ if (Creature* leryssa = me->GetCreature(*me, leryssaGUID))
+ leryssa->RemoveFromWorld();
+ if (Creature* arlos= me->GetCreature(*me, arlosGUID))
+ arlos->RemoveFromWorld();
+ if (talbot)
+ talbot->RemoveFromWorld();
me->RemoveStandFlags(UNIT_STAND_STATE_SIT);
SetEscortPaused(false);
- uiPhaseTimer = 0;
- uiPhase = 0;
+ phaseTimer = 0;
+ phase = 0;
}
- } else uiPhaseTimer -= uiDiff;
+ } else phaseTimer -= uiDiff;
if (!UpdateVictim())
return;
@@ -1226,17 +1197,17 @@ public:
void JustDied(Unit* /*killer*/)
{
- if (Creature* pTalbot = me->GetCreature(*me, uiTalbot))
- pTalbot->RemoveFromWorld();
+ if (Creature* talbot = me->GetCreature(*me, talbotGUID))
+ talbot->RemoveFromWorld();
- if (Creature* pLeryssa = me->GetCreature(*me, uiLeryssa))
- pLeryssa->RemoveFromWorld();
+ if (Creature* leryssa = me->GetCreature(*me, leryssaGUID))
+ leryssa->RemoveFromWorld();
- if (Creature* pArlos = me->GetCreature(*me, uiArlos))
- pArlos->RemoveFromWorld();
+ if (Creature* arlos = me->GetCreature(*me, arlosGUID))
+ arlos->RemoveFromWorld();
- if (Creature* pArthas = me->GetCreature(*me, uiArthas))
- pArthas->RemoveFromWorld();
+ if (Creature* arthas = me->GetCreature(*me, arthasGUID))
+ arthas->RemoveFromWorld();
}
};
@@ -1297,7 +1268,7 @@ public:
if (me->isSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
- CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->bArthasInPosition = true;
+ CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->arthasInPosition = true;
}
};
@@ -1329,7 +1300,7 @@ public:
me->CastSpell(me, SPELL_STUN, true);
if (me->isSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
- CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->bArlosInPosition = true;
+ CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->arlosInPosition = true;
}
};
@@ -1361,23 +1332,23 @@ public:
creature->RestoreFaction();
}
- uint64 LeryssaGUID;
- uint64 ArlosGUID;
+ uint64 leryssaGUID;
+ uint64 arlosGUID;
bool bCheck;
- uint32 uiShadowBoltTimer;
- uint32 uiDeflectionTimer;
- uint32 uiSoulBlastTimer;
+ uint32 shadowBoltTimer;
+ uint32 deflectionTimer;
+ uint32 soulBlastTimer;
void Reset()
{
- LeryssaGUID = 0;
- ArlosGUID = 0;
+ leryssaGUID = 0;
+ arlosGUID = 0;
bCheck = false;
- uiShadowBoltTimer = urand(5000, 12000);
- uiDeflectionTimer = urand(20000, 25000);
- uiSoulBlastTimer = urand (12000, 18000);
+ shadowBoltTimer = urand(5000, 12000);
+ deflectionTimer = urand(20000, 25000);
+ soulBlastTimer = urand (12000, 18000);
}
void MovementInform(uint32 uiType, uint32 /*uiId*/)
{
@@ -1386,17 +1357,17 @@ public:
if (me->isSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
- CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->bTalbotInPosition = true;
+ CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(summoner)->AI())->talbotInPosition = true;
}
void UpdateAI(const uint32 uiDiff)
{
if (bCheck)
{
- if (Creature* pLeryssa = me->FindNearestCreature(NPC_LERYSSA, 50.0f, true))
- LeryssaGUID = pLeryssa->GetGUID();
- if (Creature* pArlos = me->FindNearestCreature(NPC_GENERAL_ARLOS, 50.0f, true))
- ArlosGUID = pArlos->GetGUID();
+ if (Creature* leryssa = me->FindNearestCreature(NPC_LERYSSA, 50.0f, true))
+ leryssaGUID = leryssa->GetGUID();
+ if (Creature* arlos = me->FindNearestCreature(NPC_GENERAL_ARLOS, 50.0f, true))
+ arlosGUID = arlos->GetGUID();
bCheck = false;
}
@@ -1405,23 +1376,23 @@ public:
if (me->GetAreaId() == 4125)
{
- if (uiShadowBoltTimer <= uiDiff)
+ if (shadowBoltTimer <= uiDiff)
{
DoCast(me->getVictim(), SPELL_SHADOW_BOLT);
- uiShadowBoltTimer = urand(5000, 12000);
- } else uiShadowBoltTimer -= uiDiff;
+ shadowBoltTimer = urand(5000, 12000);
+ } else shadowBoltTimer -= uiDiff;
- if (uiDeflectionTimer <= uiDiff)
+ if (deflectionTimer <= uiDiff)
{
DoCast(me->getVictim(), SPELL_DEFLECTION);
- uiDeflectionTimer = urand(20000, 25000);
- } else uiDeflectionTimer -= uiDiff;
+ deflectionTimer = urand(20000, 25000);
+ } else deflectionTimer -= uiDiff;
- if (uiSoulBlastTimer <= uiDiff)
+ if (soulBlastTimer <= uiDiff)
{
DoCast(me->getVictim(), SPELL_SOUL_BLAST);
- uiSoulBlastTimer = urand (12000, 18000);
- } else uiSoulBlastTimer -= uiDiff;
+ soulBlastTimer = urand (12000, 18000);
+ } else soulBlastTimer -= uiDiff;
}
DoMeleeAttackIfReady();
@@ -1429,22 +1400,22 @@ public:
void JustDied(Unit* killer)
{
- if (!LeryssaGUID || !ArlosGUID)
+ if (!leryssaGUID || !arlosGUID)
return;
- Creature* pLeryssa = Unit::GetCreature(*me, LeryssaGUID);
- Creature* pArlos = Unit::GetCreature(*me, ArlosGUID);
- if (!pLeryssa || !pArlos)
+ Creature* leryssa = Unit::GetCreature(*me, leryssaGUID);
+ Creature* arlos = Unit::GetCreature(*me, arlosGUID);
+ if (!leryssa || !arlos)
return;
- DoScriptText(SAY_ARLOS_1, pArlos);
- DoScriptText(SAY_ARLOS_2, pArlos);
- DoScriptText(SAY_LERYSSA_1, pLeryssa);
- pArlos->Kill(pArlos, false);
- pLeryssa->RemoveAura(SPELL_STUN);
- pLeryssa->ClearUnitState(UNIT_STATE_STUNNED);
- pLeryssa->SetWalk(false);
- pLeryssa->GetMotionMaster()->MovePoint(0, 3722.114502f, 3564.201660f, 477.441437f);
+ arlos->AI()->Talk(SAY_ARLOS_1);
+ arlos->AI()->Talk(SAY_ARLOS_2);
+ leryssa->AI()->Talk(SAY_LERYSSA_1);
+ arlos->Kill(arlos, false);
+ leryssa->RemoveAura(SPELL_STUN);
+ leryssa->ClearUnitState(UNIT_STATE_STUNNED);
+ leryssa->SetWalk(false);
+ leryssa->GetMotionMaster()->MovePoint(0, 3722.114502f, 3564.201660f, 477.441437f);
if (Player* player = killer->ToPlayer())
player->RewardPlayerAndGroupAtEvent(NPC_PRINCE_VALANAR, 0);
@@ -1471,33 +1442,33 @@ public:
npc_leryssaAI(Creature* creature) : ScriptedAI(creature)
{
bDone = false;
- Phase = 0;
- uiPhaseTimer = 0;
+ phase = 0;
+ phaseTimer = 0;
creature->RemoveStandFlags(UNIT_STAND_STATE_SIT);
}
bool bDone;
- uint32 Phase;
- uint32 uiPhaseTimer;
+ uint32 phase;
+ uint32 phaseTimer;
- void MovementInform(uint32 uiType, uint32 /*uiId*/)
+ void MovementInform(uint32 type, uint32 /*uiId*/)
{
- if (uiType != POINT_MOTION_TYPE)
+ if (type != POINT_MOTION_TYPE)
return;
if (!bDone)
{
- if (Creature* pTalbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true))
- CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, pTalbot->GetAI())->bCheck = true;
+ if (Creature* talbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true))
+ CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, talbot->GetAI())->bCheck = true;
me->AddUnitState(UNIT_STATE_STUNNED);
me->CastSpell(me, SPELL_STUN, true);
if (me->isSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
- CAST_AI(npc_thassarian::npc_thassarianAI, summoner->GetAI())->bLeryssaInPosition = true;
+ CAST_AI(npc_thassarian::npc_thassarianAI, summoner->GetAI())->leryssaInPosition = true;
bDone = true;
}
else
@@ -1506,8 +1477,8 @@ public:
if (me->isSummon())
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
summoner->SetStandState(UNIT_STAND_STATE_SIT);
- uiPhaseTimer = 1500;
- Phase = 1;
+ phaseTimer = 1500;
+ phase = 1;
}
}
@@ -1515,59 +1486,63 @@ public:
{
ScriptedAI::UpdateAI(uiDiff);
- if (uiPhaseTimer <= uiDiff)
+ if (phaseTimer <= uiDiff)
{
- switch (Phase)
+ switch (phase)
{
case 1:
if (me->isSummon())
- if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
- DoScriptText(SAY_THASSARIAN_4, pThassarian);
- uiPhaseTimer = 5000;
- ++Phase;
+ if (Unit* summoner = me->ToTempSummon()->GetSummoner())
+ if (Creature* thassarian = summoner->ToCreature())
+ thassarian->AI()->Talk(SAY_THASSARIAN_4);
+ phaseTimer = 5000;
+ ++phase;
break;
case 2:
- DoScriptText(SAY_LERYSSA_2, me);
- uiPhaseTimer = 5000;
- ++Phase;
+ Talk(SAY_LERYSSA_2);
+ phaseTimer = 5000;
+ ++phase;
break;
case 3:
if (me->isSummon())
- if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
- DoScriptText(SAY_THASSARIAN_5, pThassarian);
- uiPhaseTimer = 5000;
- ++Phase;
+ if (Unit* summoner = me->ToTempSummon()->GetSummoner())
+ if (Creature* thassarian = summoner->ToCreature())
+ thassarian->AI()->Talk(SAY_THASSARIAN_5);
+ phaseTimer = 5000;
+ ++phase;
break;
case 4:
- DoScriptText(SAY_LERYSSA_3, me);
- uiPhaseTimer = 5000;
- ++Phase;
+ Talk(SAY_LERYSSA_3);
+ phaseTimer = 5000;
+ ++phase;
break;
case 5:
if (me->isSummon())
- if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
- DoScriptText(SAY_THASSARIAN_6, pThassarian);
- uiPhaseTimer = 5000;
- ++Phase;
+ if (Unit* summoner = me->ToTempSummon()->GetSummoner())
+ if (Creature* thassarian = summoner->ToCreature())
+ thassarian->AI()->Talk(SAY_THASSARIAN_6);
+ phaseTimer = 5000;
+ ++phase;
break;
case 6:
- DoScriptText(SAY_LERYSSA_4, me);
- uiPhaseTimer = 5000;
- ++Phase;
+ Talk(SAY_LERYSSA_4);
+ phaseTimer = 5000;
+ ++phase;
break;
case 7:
if (me->isSummon())
- if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
- {
- DoScriptText(SAY_THASSARIAN_7, pThassarian);
- CAST_AI(npc_thassarian::npc_thassarianAI, pThassarian->GetAI())->uiPhase = 16;
- }
- uiPhaseTimer = 5000;
- Phase = 0;
+ if (Unit* summoner = me->ToTempSummon()->GetSummoner())
+ if (Creature* thassarian = summoner->ToCreature())
+ {
+ thassarian->AI()->Talk(SAY_THASSARIAN_7);
+ CAST_AI(npc_thassarian::npc_thassarianAI, thassarian->GetAI())->phase = 16;
+ }
+ phaseTimer = 5000;
+ phase = 0;
break;
}
- } else uiPhaseTimer -= uiDiff;
+ } else phaseTimer -= uiDiff;
if (!UpdateVictim())
return;
@@ -1665,20 +1640,19 @@ public:
/*######
## npc_imprisoned_beryl_sorcerer
######*/
-
enum eImprisionedBerylSorcerer
{
SPELL_NEURAL_NEEDLE = 45634,
NPC_IMPRISONED_BERYL_SORCERER = 25478,
- SAY_IMPRISIONED_BERYL_1 = -1571024,
- SAY_IMPRISIONED_BERYL_2 = -1571025,
- SAY_IMPRISIONED_BERYL_3 = -1571026,
- SAY_IMPRISIONED_BERYL_4 = -1571027,
- SAY_IMPRISIONED_BERYL_5 = -1571028,
- SAY_IMPRISIONED_BERYL_6 = -1571029,
- SAY_IMPRISIONED_BERYL_7 = -1571030,
+ SAY_IMPRISIONED_BERYL_1 = 0,
+ SAY_IMPRISIONED_BERYL_2 = 1,
+ SAY_IMPRISIONED_BERYL_3 = 2,
+ SAY_IMPRISIONED_BERYL_4 = 3,
+ SAY_IMPRISIONED_BERYL_5 = 4,
+ SAY_IMPRISIONED_BERYL_6 = 5,
+ SAY_IMPRISIONED_BERYL_7 = 6
};
class npc_imprisoned_beryl_sorcerer : public CreatureScript
@@ -1690,103 +1664,79 @@ public:
{
npc_imprisoned_beryl_sorcererAI(Creature* creature) : ScriptedAI(creature) {}
- uint64 CasterGUID;
-
- uint32 uiStep;
- uint32 uiPhase;
+ uint32 rebuff;
void Reset()
{
- uiStep = 1;
- uiPhase = 0;
- CasterGUID = 0;
+ if (me->GetReactState() != REACT_PASSIVE)
+ me->SetReactState(REACT_PASSIVE);
+
+ rebuff = 0;
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ UpdateVictim();
+
+ if (rebuff <= diff)
+ {
+ if (!me->HasAura(SPELL_COSMETIC_ENSLAVE_CHAINS_SELF))
+ {
+ DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF);
+ }
+ rebuff = 180000;
+ }
+ else
+ rebuff -= diff;
+
+ DoMeleeAttackIfReady();
}
void EnterCombat(Unit* /*who*/)
{
}
- void SpellHit(Unit* unit, const SpellInfo* pSpell)
+ void SpellHit(Unit* unit, const SpellInfo* spell)
{
- if (pSpell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER)
+ if (spell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER)
{
- ++uiPhase;
- CasterGUID = unit->GetGUID();
+ if (Player* player = unit->ToPlayer())
+ {
+ GotStinged(player->GetGUID());
+ }
}
}
- void UpdateAI(const uint32 uiDiff)
+ void GotStinged(uint64 casterGUID)
{
- ScriptedAI::UpdateAI(uiDiff);
-
- if (!me->HasAura(SPELL_COSMETIC_ENSLAVE_CHAINS_SELF))
- DoCast(me, SPELL_COSMETIC_ENSLAVE_CHAINS_SELF);
-
- if (me->GetReactState() != REACT_PASSIVE)
- me->SetReactState(REACT_PASSIVE);
-
- switch (uiPhase)
+ if (Player* caster = Player::GetPlayer(*me, casterGUID))
{
- case 1:
- if (uiStep == 1)
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_1, me);
- uiStep = 2;
- }
- break;
-
- case 2:
- if (uiStep == 2)
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_2, me);
- uiStep = 3;
- }
- break;
-
- case 3:
- if (uiStep == 3)
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_3, me);
- uiStep = 4;
- }
- break;
-
- case 4:
- if (uiStep == 4)
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_4, me);
- uiStep = 5;
- }
- break;
-
- case 5:
- if (uiStep == 5)
- {
- if (Player* pCaster = Unit::GetPlayer(*me, CasterGUID))
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_5, me);
- pCaster->KilledMonsterCredit(25478, 0);
- uiStep = 6;
- }
- }
- break;
-
- case 6:
- if (uiStep == 6)
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_6, me);
- uiStep = 7;
- }
- break;
-
- case 7:
- if (uiStep == 7)
- {
- DoScriptText(SAY_IMPRISIONED_BERYL_7, me);
- uiStep = 1;
- uiPhase = 0;
- }
- break;
+ uint32 step = caster->GetAuraCount(SPELL_NEURAL_NEEDLE) + 1;
+ switch (step)
+ {
+ case 1:
+ Talk(SAY_IMPRISIONED_BERYL_1);
+ break;
+ case 2:
+ Talk(SAY_IMPRISIONED_BERYL_2, caster->GetGUID());
+ break;
+ case 3:
+ Talk(SAY_IMPRISIONED_BERYL_3);
+ break;
+ case 4:
+ Talk(SAY_IMPRISIONED_BERYL_4);
+ break;
+ case 5:
+ Talk(SAY_IMPRISIONED_BERYL_5);
+ break;
+ case 6:
+ Talk(SAY_IMPRISIONED_BERYL_6, caster->GetGUID());
+ break;
+ case 7:
+ Talk(SAY_IMPRISIONED_BERYL_7);
+ caster->KilledMonsterCredit(NPC_IMPRISONED_BERYL_SORCERER, 0);
+ break;
+ }
}
}
};
@@ -1800,18 +1750,16 @@ public:
/*######
## npc_mootoo_the_younger
######*/
-enum Script_Texts_Mootoo_the_Younger
-{
- SAY_1 =-1750040,
- SAY_2 =-1750041,
- SAY_3 =-1750042,
- SAY_4 =-1750043,
- SAY_5 =-1750044
-};
-enum Mootoo_the_Younger_Entries
+enum MootooTheYounger
{
- NPC_MOOTOO_THE_YOUNGER =25504,
- QUEST_ESCAPING_THE_MIST =11664
+ SAY_1 = 0,
+ SAY_2 = 1,
+ SAY_3 = 2,
+ SAY_4 = 3,
+ SAY_5 = 4,
+
+ NPC_MOOTOO_THE_YOUNGER = 25504,
+ QUEST_ESCAPING_THE_MIST = 11664
};
class npc_mootoo_the_younger : public CreatureScript
@@ -1833,7 +1781,7 @@ public:
break;
}
creature->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_1, creature);
+ creature->AI()->Talk(SAY_1);
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
}
return true;
@@ -1864,19 +1812,19 @@ public:
{
case 10:
me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
- DoScriptText(SAY_2, me);
+ Talk(SAY_2);
break;
case 12:
- DoScriptText(SAY_3, me);
+ Talk(SAY_3);
me->HandleEmoteCommand(EMOTE_ONESHOT_LOOT);
break;
case 16:
- DoScriptText(SAY_4, me);
+ Talk(SAY_4);
me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
break;
case 20:
me->SetPhaseMask(1, true);
- DoScriptText(SAY_5, me);
+ Talk(SAY_5);
me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
player->GroupEventHappens(QUEST_ESCAPING_THE_MIST, me);
SetRun(true);
@@ -1895,15 +1843,13 @@ public:
## npc_bonker_togglevolt
######*/
-enum Bonker_Togglevolt_Entries
+enum BonkerTogglevolt
{
- NPC_BONKER_TOGGLEVOLT = 25589,
- QUEST_GET_ME_OUTA_HERE = 11673
-};
-enum Script_Texts_Bonker_Togglevolt
-{
- SAY_bonker_1 = -1700002,
- SAY_bonker_2 = -1700003
+ NPC_BONKER_TOGGLEVOLT = 25589,
+ QUEST_GET_ME_OUTA_HERE = 11673,
+
+ SAY_BONKER_1 = 0,
+ SAY_BONKER_2 = 1
};
class npc_bonker_togglevolt : public CreatureScript
@@ -1916,7 +1862,7 @@ public:
if (quest->GetQuestId() == QUEST_GET_ME_OUTA_HERE)
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_bonker_2, creature, player);
+ creature->AI()->Talk(SAY_BONKER_2, player->GetGUID());
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, player->GetGUID());
}
return true;
@@ -1945,7 +1891,7 @@ public:
{
if (Bonker_agro == 0)
{
- DoScriptText(SAY_bonker_1, me);
+ Talk(SAY_BONKER_1);
Bonker_agro++;
}
DoMeleeAttackIfReady();
@@ -2363,10 +2309,10 @@ enum eHiddenCultist
NPC_SALTY_JOHN_THORPE = 25248,
NPC_GUARD_MITCHELLS = 25828,
- SAY_HIDDEN_CULTIST_1 = -1571044,
- SAY_HIDDEN_CULTIST_2 = -1571045,
- SAY_HIDDEN_CULTIST_3 = -1571046,
- SAY_HIDDEN_CULTIST_4 = -1571047
+ SAY_HIDDEN_CULTIST_1 = 0,
+ SAY_HIDDEN_CULTIST_2 = 1,
+ SAY_HIDDEN_CULTIST_3 = 2,
+ SAY_HIDDEN_CULTIST_4 = 3
};
const char* GOSSIP_ITEM_TOM_HEGGER = "What do you know about the Cult of the Damned?";
@@ -2448,17 +2394,17 @@ public:
{
case NPC_SALTY_JOHN_THORPE:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
- DoScriptText(SAY_HIDDEN_CULTIST_1, me);
+ Talk(SAY_HIDDEN_CULTIST_1);
uiEventTimer = 5000;
uiEventPhase = 2;
break;
case NPC_GUARD_MITCHELLS:
- DoScriptText(SAY_HIDDEN_CULTIST_2, me);
+ Talk(SAY_HIDDEN_CULTIST_2);
uiEventTimer = 5000;
uiEventPhase = 2;
break;
case NPC_TOM_HEGGER:
- DoScriptText(SAY_HIDDEN_CULTIST_3, me);
+ Talk(SAY_HIDDEN_CULTIST_3);
uiEventTimer = 5000;
uiEventPhase = 2;
break;
@@ -2468,7 +2414,7 @@ public:
switch (me->GetEntry())
{
case NPC_SALTY_JOHN_THORPE:
- DoScriptText(SAY_HIDDEN_CULTIST_4, me);
+ Talk(SAY_HIDDEN_CULTIST_4);
if (Player* player = me->GetPlayer(*me, uiPlayerGUID))
{
me->SetInFront(player);
@@ -2568,7 +2514,6 @@ void AddSC_borean_tundra()
new npc_corastrasza();
new npc_iruk();
new mob_nerubar_victim();
- new npc_scourge_prisoner();
new npc_jenny();
new npc_fezzix_geartwist();
new npc_nesingwary_trapper();
diff --git a/src/server/scripts/Northrend/crystalsong_forest.cpp b/src/server/scripts/Northrend/crystalsong_forest.cpp
index d48903696ec..09df0acc467 100644
--- a/src/server/scripts/Northrend/crystalsong_forest.cpp
+++ b/src/server/scripts/Northrend/crystalsong_forest.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory: CrystalsongForest
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
/*******************************************************
* npc_warmage_violetstand
@@ -107,4 +109,4 @@ public:
void AddSC_crystalsong_forest()
{
new npc_warmage_violetstand;
-} \ No newline at end of file
+}
diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp
index e7b92732066..b662442ef93 100644
--- a/src/server/scripts/Northrend/dalaran.cpp
+++ b/src/server/scripts/Northrend/dalaran.cpp
@@ -23,7 +23,11 @@ SDComment: For what is 63990+63991? Same function but don't work correct...
SDCategory: Dalaran
Script Data End */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
+#include "WorldSession.h"
/*******************************************************
* npc_mageguard_dalaran
diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp
index 1b339b24549..13a8370690e 100644
--- a/src/server/scripts/Northrend/dragonblight.cpp
+++ b/src/server/scripts/Northrend/dragonblight.cpp
@@ -27,8 +27,13 @@ EndScriptData */
npc_alexstrasza_wr_gate
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
enum eEnums
{
@@ -75,16 +80,16 @@ public:
enum StrengthenAncientsMisc
{
- SAY_WALKER_FRIENDLY = 0,
- SAY_WALKER_ENEMY = 1,
- SAY_LOTHALOR = 0,
+ SAY_WALKER_FRIENDLY = 0,
+ SAY_WALKER_ENEMY = 1,
+ SAY_LOTHALOR = 0,
- SPELL_CREATE_ITEM_BARK = 47550,
- SPELL_CONFUSED = 47044,
+ SPELL_CREATE_ITEM_BARK = 47550,
+ SPELL_CONFUSED = 47044,
- NPC_LOTHALOR = 26321,
+ NPC_LOTHALOR = 26321,
- FACTION_WALKER_ENEMY = 14,
+ FACTION_WALKER_ENEMY = 14,
};
class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
@@ -166,9 +171,56 @@ public:
}
};
+/*######
+## wyrmrest_defender
+######*/
+
+enum WyrmDefenderEnum
+{
+ QUEST_DEFENDING_WYRMREST_TEMPLE = 12372,
+ GOSSIP_TEXTID_DEF1 = 12899,
+ GOSSIP_TEXTID_DEF2 = 12900,
+ SPELL_CHARACTER_SCRIPT = 49213
+};
+
+#define GOSSIP_ITEM_1 "We need to get into the fight. Are you ready?"
+
+class npc_wyrmrest_defender : public CreatureScript
+{
+ public:
+ npc_wyrmrest_defender() : CreatureScript("npc_wyrmrest_defender") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (player->GetQuestStatus(QUEST_DEFENDING_WYRMREST_TEMPLE) == QUEST_STATUS_INCOMPLETE)
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DEF1, creature->GetGUID());
+ }
+ else
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ {
+ player->PlayerTalkClass->ClearMenus();
+ if (action == GOSSIP_ACTION_INFO_DEF+1)
+ {
+ player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DEF2, creature->GetGUID());
+ // Makes player cast trigger spell for 49207 on self
+ player->CastSpell(player, SPELL_CHARACTER_SCRIPT, true);
+ }
+
+ return true;
+ }
+};
+
void AddSC_dragonblight()
{
new npc_alexstrasza_wr_gate;
new spell_q12096_q12092_dummy;
new spell_q12096_q12092_bark;
+ new npc_wyrmrest_defender;
}
diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp
index 2da84dd3fdb..8bcc255b343 100644
--- a/src/server/scripts/Northrend/grizzly_hills.cpp
+++ b/src/server/scripts/Northrend/grizzly_hills.cpp
@@ -16,8 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "CreatureTextMgr.h"
/*######
## Quest 12027: Mr. Floppy's Perilous Adventure
@@ -34,19 +38,19 @@ enum eFloppy
SPELL_MRFLOPPY = 47184, //vehicle aura
- SAY_WORGHAGGRO1 = -1800001, //Um... I think one of those wolves is back...
- SAY_WORGHAGGRO2 = -1800002, //He's going for Mr. Floppy!
- SAY_WORGRAGGRO3 = -1800003, //Oh, no! Look, it's another wolf, and it's a biiiiiig one!
- SAY_WORGRAGGRO4 = -1800004, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
- SAY_RANDOMAGGRO = -1800005, //There's a big meanie attacking Mr. Floppy! Help!
- SAY_VICTORY1 = -1800006, //Let's get out of here before more wolves find us!
- SAY_VICTORY2 = -1800007, //Don't go toward the light, Mr. Floppy!
- SAY_VICTORY3 = -1800008, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
- SAY_VICTORY4 = -1800009, //I think I see the camp! We're almost home, Mr. Floppy! Let's go!
- TEXT_EMOTE_WP1 = -1800010, //Mr. Floppy revives
- TEXT_EMOTE_AGGRO = -1800011, //The Ravenous Worg chomps down on Mr. Floppy
- SAY_QUEST_ACCEPT = -1800012, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
- SAY_QUEST_COMPLETE = -1800013 //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
+ SAY_WORGHAGGRO1 = 0, //Um... I think one of those wolves is back...
+ SAY_WORGHAGGRO2 = 1, //He's going for Mr. Floppy!
+ SAY_WORGRAGGRO3 = 2, //Oh, no! Look, it's another wolf, and it's a biiiiiig one!
+ SAY_WORGRAGGRO4 = 3, //He's gonna eat Mr. Floppy! You gotta help Mr. Floppy! You just gotta!
+ SAY_RANDOMAGGRO = 4, //There's a big meanie attacking Mr. Floppy! Help!
+ SAY_VICTORY1 = 5, //Let's get out of here before more wolves find us!
+ SAY_VICTORY2 = 6, //Don't go toward the light, Mr. Floppy!
+ SAY_VICTORY3 = 7, //Mr. Floppy, you're ok! Thank you so much for saving Mr. Floppy!
+ SAY_VICTORY4 = 8, //I think I see the camp! We're almost home, Mr. Floppy! Let's go!
+ TEXT_EMOTE_WP1 = 9, //Mr. Floppy revives
+ TEXT_EMOTE_AGGRO = 10, //The Ravenous Worg chomps down on Mr. Floppy
+ SAY_QUEST_ACCEPT = 11, //Are you ready, Mr. Floppy? Stay close to me and watch out for those wolves!
+ SAY_QUEST_COMPLETE = 12 //Thank you for helping me get back to the camp. Go tell Walter that I'm safe now!
};
//emily
@@ -89,7 +93,7 @@ public:
case 10:
if (Unit::GetCreature(*me, MrfloppyGUID))
{
- DoScriptText(SAY_WORGHAGGRO1, me);
+ Talk(SAY_WORGHAGGRO1);
me->SummonCreature(NPC_HUNGRY_WORG, me->GetPositionX()+5, me->GetPositionY()+2, me->GetPositionZ()+1, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
}
break;
@@ -100,7 +104,7 @@ public:
case 17:
if (Creature* Mrfloppy = Unit::GetCreature(*me, MrfloppyGUID))
Mrfloppy->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
- DoScriptText(SAY_WORGRAGGRO3, me);
+ Talk(SAY_WORGRAGGRO3);
if (Creature* RWORG = me->SummonCreature(NPC_RAVENOUS_WORG, me->GetPositionX()+10, me->GetPositionY()+8, me->GetPositionZ()+2, 3.229f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000))
{
RWORG->setFaction(35);
@@ -138,7 +142,7 @@ public:
Mrfloppy->ExitVehicle();
RWORG->setFaction(14);
RWORG->GetMotionMaster()->MovePoint(0, RWORG->GetPositionX()+10, RWORG->GetPositionY()+80, RWORG->GetPositionZ());
- DoScriptText(SAY_VICTORY2, me);
+ Talk(SAY_VICTORY2);
}
}
break;
@@ -152,7 +156,7 @@ public:
me->GetMotionMaster()->MovePoint(0, Mrfloppy->GetPositionX(), Mrfloppy->GetPositionY(), Mrfloppy->GetPositionZ());
Mrfloppy->setDeathState(ALIVE);
Mrfloppy->GetMotionMaster()->MoveFollow(me, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
- DoScriptText(SAY_VICTORY3, me);
+ Talk(SAY_VICTORY3);
}
}
break;
@@ -161,12 +165,12 @@ public:
{
Completed = true;
player->GroupEventHappens(QUEST_PERILOUS_ADVENTURE, me);
- DoScriptText(SAY_QUEST_COMPLETE, me, player);
+ Talk(SAY_QUEST_COMPLETE, player->GetGUID());
}
me->SetWalk(false);
break;
case 25:
- DoScriptText(SAY_VICTORY4, me);
+ Talk(SAY_VICTORY4);
break;
case 27:
me->DisappearAndDie();
@@ -178,7 +182,7 @@ public:
void EnterCombat(Unit* /*Who*/)
{
- DoScriptText(SAY_RANDOMAGGRO, me);
+ Talk(SAY_RANDOMAGGRO);
}
void Reset()
@@ -206,7 +210,7 @@ public:
{
if (quest->GetQuestId() == QUEST_PERILOUS_ADVENTURE)
{
- DoScriptText(SAY_QUEST_ACCEPT, creature);
+ creature->AI()->Talk(SAY_QUEST_ACCEPT);
if (Creature* Mrfloppy = GetClosestCreatureWithEntry(creature, NPC_MRFLOPPY, 180.0f))
Mrfloppy->GetMotionMaster()->MoveFollow(creature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
@@ -245,13 +249,13 @@ public:
switch (Who->GetEntry())
{
case NPC_HUNGRY_WORG:
- DoScriptText(SAY_WORGHAGGRO2, Emily);
+ Emily->AI()->Talk(SAY_WORGHAGGRO2);
break;
case NPC_RAVENOUS_WORG:
- DoScriptText(SAY_WORGRAGGRO4, Emily);
+ Emily->AI()->Talk(SAY_WORGRAGGRO4);
break;
default:
- DoScriptText(SAY_RANDOMAGGRO, Emily);
+ Emily->AI()->Talk(SAY_RANDOMAGGRO);
}
}
}
@@ -458,12 +462,10 @@ public:
enum eSkirmisher
{
- SPELL_RENEW_SKIRMISHER = 48812,
- CREDIT_NPC = 27466,
+ SPELL_RENEW_SKIRMISHER = 48812,
+ CREDIT_NPC = 27466,
- RANDOM_SAY_1 = -1800044, //Ahh..better..
- RANDOM_SAY_2 = -1800045, //Whoa.. i nearly died there. Thank you, $Race!
- RANDOM_SAY_3 = -1800046 //Thank you. $Class!
+ RANDOM_SAY = 0,
};
class npc_wounded_skirmisher : public CreatureScript
@@ -497,7 +499,7 @@ public:
&& caster->ToPlayer()->GetQuestStatus(12288) == QUEST_STATUS_INCOMPLETE)
{
caster->ToPlayer()->KilledMonsterCredit(CREDIT_NPC, 0);
- DoScriptText(RAND(RANDOM_SAY_1, RANDOM_SAY_2, RANDOM_SAY_3), caster);
+ sCreatureTextMgr->SendChat(me, RANDOM_SAY, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, caster->ToPlayer());
if (me->IsStandState())
me->GetMotionMaster()->MovePoint(1, me->GetPositionX()+7, me->GetPositionY()+7, me->GetPositionZ());
else
@@ -590,109 +592,104 @@ public:
/*Venture co. Straggler - when you cast Smoke Bomb, he will yell and run away*/
enum eSmokeEmOut
{
- SAY_SEO1 = -1603535,
- SAY_SEO2 = -1603536,
- SAY_SEO3 = -1603537,
- SAY_SEO4 = -1603538,
- SAY_SEO5 = -1603539,
- QUEST_SMOKE_EM_OUT_A = 12323,
- QUEST_SMOKE_EM_OUT_H = 12324,
- SPELL_SMOKE_BOMB = 49075,
- SPELL_CHOP = 43410,
- NPC_VENTURE_CO_STABLES_KC = 27568,
+ SAY_SEO = 0,
+ QUEST_SMOKE_EM_OUT_A = 12323,
+ QUEST_SMOKE_EM_OUT_H = 12324,
+ SPELL_SMOKE_BOMB = 49075,
+ SPELL_CHOP = 43410,
+ SPELL_VENTURE_STRAGGLER_CREDIT = 49093,
};
class npc_venture_co_straggler : public CreatureScript
{
-public:
- npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_venture_co_stragglerAI(creature);
- }
+ public:
+ npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { }
- struct npc_venture_co_stragglerAI : public ScriptedAI
- {
- npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
+ struct npc_venture_co_stragglerAI : public ScriptedAI
+ {
+ npc_venture_co_stragglerAI(Creature* creature) : ScriptedAI(creature) { }
- uint64 uiPlayerGUID;
- uint32 uiRunAwayTimer;
- uint32 uiTimer;
- uint32 uiChopTimer;
+ uint64 uiPlayerGUID;
+ uint32 uiRunAwayTimer;
+ uint32 uiTimer;
+ uint32 uiChopTimer;
- void Reset()
- {
- uiPlayerGUID = 0;
- uiTimer = 0;
- uiChopTimer = urand(10000, 12500);
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_AGGRESSIVE);
- }
+ void Reset()
+ {
+ uiPlayerGUID = 0;
+ uiTimer = 0;
+ uiRunAwayTimer = 0;
+ uiChopTimer = urand(10000, 12500);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_AGGRESSIVE);
+ }
- void UpdateAI(const uint32 uiDiff)
- {
- if (uiRunAwayTimer <= uiDiff)
+ void UpdateAI(const uint32 uiDiff)
{
- if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
+ if (uiPlayerGUID && uiRunAwayTimer <= uiDiff)
{
- switch (uiTimer)
+ if (Player* player = Unit::GetPlayer(*me, uiPlayerGUID))
{
- case 0:
- if (player->GetQuestStatus(QUEST_SMOKE_EM_OUT_A) == QUEST_STATUS_INCOMPLETE ||
- player->GetQuestStatus(QUEST_SMOKE_EM_OUT_H) == QUEST_STATUS_INCOMPLETE)
- player->KilledMonsterCredit(NPC_VENTURE_CO_STABLES_KC, 0);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 1:
- DoScriptText(RAND(SAY_SEO1, SAY_SEO2, SAY_SEO3, SAY_SEO4, SAY_SEO5), me);
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 2:
- me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
- uiRunAwayTimer = 2500;
- ++uiTimer;
- break;
- case 3:
- me->DisappearAndDie();
- uiTimer = 0;
- break;
+ switch (uiTimer)
+ {
+ case 0:
+ DoCast(player, SPELL_VENTURE_STRAGGLER_CREDIT);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()+7, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 1:
+ Talk(SAY_SEO);
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-7, me->GetPositionY()-5, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 2:
+ me->GetMotionMaster()->MovePoint(0, me->GetPositionX()-5, me->GetPositionY()-5, me->GetPositionZ());
+ uiRunAwayTimer = 2500;
+ ++uiTimer;
+ break;
+ case 3:
+ me->DisappearAndDie();
+ uiTimer = 0;
+ break;
+ }
}
}
- }
- else
- uiRunAwayTimer -= uiDiff;
+ else if (uiRunAwayTimer)
+ uiRunAwayTimer -= uiDiff;
- if (!UpdateVictim())
- return;
+ if (!UpdateVictim())
+ return;
- if (uiChopTimer <= uiDiff)
- {
- DoCast(me->getVictim(), SPELL_CHOP);
- uiChopTimer = urand(10000, 12000);
- }
- else
- uiChopTimer -= uiDiff;
+ if (uiChopTimer <= uiDiff)
+ {
+ DoCast(me->getVictim(), SPELL_CHOP);
+ uiChopTimer = urand(10000, 12000);
+ }
+ else
+ uiChopTimer -= uiDiff;
- DoMeleeAttackIfReady();
- }
+ DoMeleeAttackIfReady();
+ }
- void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
- {
- if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
- me->SetReactState(REACT_PASSIVE);
- me->CombatStop(false);
- uiPlayerGUID = pCaster->GetGUID();
- uiRunAwayTimer = 3500;
+ if (spell->Id == SPELL_SMOKE_BOMB && caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC);
+ me->SetReactState(REACT_PASSIVE);
+ me->CombatStop(false);
+ uiPlayerGUID = caster->GetGUID();
+ uiRunAwayTimer = 3500;
+ }
}
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_venture_co_stragglerAI(creature);
}
- };
};
void AddSC_grizzly_hills()
diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp
index 88cc297868b..e04531954ea 100644
--- a/src/server/scripts/Northrend/howling_fjord.cpp
+++ b/src/server/scripts/Northrend/howling_fjord.cpp
@@ -27,8 +27,11 @@ npc_plaguehound_tracker
npc_apothecary_hanes
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_apothecary_hanes
diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp
index fb2e0f6c389..e08a9173715 100644
--- a/src/server/scripts/Northrend/icecrown.cpp
+++ b/src/server/scripts/Northrend/icecrown.cpp
@@ -27,7 +27,11 @@ EndScriptData */
npc_arete
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellAuras.h"
+#include "Player.h"
/*######
## npc_arete
@@ -169,8 +173,7 @@ enum eArgentValiant
{
SPELL_CHARGE = 63010,
SPELL_SHIELD_BREAKER = 65147,
-
- NPC_ARGENT_VALIANT_CREDIT = 24108
+ SPELL_KILL_CREDIT = 63049
};
class npc_argent_valiant : public CreatureScript
@@ -208,7 +211,7 @@ public:
if (uiDamage > me->GetHealth() && pDoneBy->GetTypeId() == TYPEID_PLAYER)
{
uiDamage = 0;
- CAST_PLR(pDoneBy)->KilledMonsterCredit(NPC_ARGENT_VALIANT_CREDIT, 0);
+ pDoneBy->CastSpell(pDoneBy, SPELL_KILL_CREDIT, true);
me->setFaction(35);
me->DespawnOrUnsummon(5000);
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
@@ -491,6 +494,378 @@ class npc_tournament_training_dummy : public CreatureScript
};
+// Battle for Crusaders' Pinnacle
+enum BlessedBanner
+{
+ SPELL_BLESSING_OF_THE_CRUSADE = 58026,
+ SPELL_THREAT_PULSE = 58113,
+ SPELL_CRUSADERS_SPIRE_VICTORY = 58084,
+ SPELL_TORCH = 58121,
+
+ NPC_BLESSED_BANNER = 30891,
+ NPC_CRUSADER_LORD_DALFORS = 31003,
+ NPC_ARGENT_BATTLE_PRIEST = 30919,
+ NPC_ARGENT_MASON = 30900,
+ NPC_REANIMATED_CAPTAIN = 30986,
+ NPC_SCOURGE_DRUDGE = 30984,
+ NPC_HIDEOUS_PLAGEBRINGER = 30987,
+ NPC_HALOF_THE_DEATHBRINGER = 30989,
+ NPC_LK = 31013,
+
+ BANNER_SAY = 0, // "The Blessed Banner of the Crusade has been planted.\n Defend the banner from all attackers!"
+ DALFORS_SAY_PRE_1 = 0, // "BY THE LIGHT! Those damned monsters! Look at what they've done to our people!"
+ DALFORS_SAY_PRE_2 = 1, // "Burn it down, boys. Burn it all down."
+ DALFORS_SAY_START = 2, // "Let 'em come. They'll pay for what they've done!"
+ DALFORS_YELL_FINISHED = 3, // "We've done it, lads! We've taken the pinnacle from the Scourge! Report to Father Gustav at once and tell him the good news! We're gonna get to buildin' and settin' up! Go!"
+ LK_TALK_1 = 0, // "Leave no survivors!"
+ LK_TALK_2 = 1, // "Cower before my terrible creations!"
+ LK_TALK_3 = 2, // "Feast my children! Feast upon the flesh of the living!"
+ LK_TALK_4 = 3, // "Lay down your arms and surrender your souls!"
+
+ EVENT_SPAWN = 1,
+ EVENT_INTRO_1 = 2,
+ EVENT_INTRO_2 = 3,
+ EVENT_INTRO_3 = 4,
+ EVENT_MASON_ACTION = 5,
+ EVENT_START_FIGHT = 6,
+ EVENT_WAVE_SPAWN = 7,
+ EVENT_HALOF = 8,
+ EVENT_ENDED = 9,
+};
+
+Position const DalforsPos[3] =
+{
+ {6458.703f, 403.858f, 490.498f, 3.1205f}, // Dalfors spawn point
+ {6422.950f, 423.335f, 510.451f, 0.0f}, // Dalfors intro pos
+ {6426.343f, 420.515f, 508.650f, 0.0f}, // Dalfors fight pos
+};
+
+Position const Priest1Pos[2] =
+{
+ {6462.025f, 403.681f, 489.721f, 3.1007f}, // priest1 spawn point
+ {6421.480f, 423.576f, 510.781f, 5.7421f}, // priest1 intro pos
+};
+
+Position const Priest2Pos[2] =
+{
+ {6463.969f, 407.198f, 489.240f, 2.2689f}, // priest2 spawn point
+ {6419.778f, 421.404f, 510.972f, 5.7421f}, // priest2 intro pos
+};
+
+Position const Priest3Pos[2] =
+{
+ {6464.371f, 400.944f, 489.186f, 6.1610f}, // priest3 spawn point
+ {6423.516f, 425.782f, 510.774f, 5.7421f}, // priest3 intro pos
+};
+
+Position const Mason1Pos[3] =
+{
+ {6462.929f, 409.826f, 489.392f, 3.0968f}, // mason1 spawn point
+ {6428.163f, 421.960f, 508.297f, 0.0f}, // mason1 intro pos
+ {6414.335f, 454.904f, 511.395f, 2.8972f}, // mason1 action pos
+};
+
+Position const Mason2Pos[3] =
+{
+ {6462.650f, 405.670f, 489.576f, 2.9414f}, // mason2 spawn point
+ {6426.250f, 419.194f, 508.219f, 0.0f}, // mason2 intro pos
+ {6415.014f, 446.849f, 511.395f, 3.1241f}, // mason2 action pos
+};
+
+Position const Mason3Pos[3] =
+{
+ {6462.646f, 401.218f, 489.601f, 2.7864f}, // mason3 spawn point
+ {6423.855f, 416.598f, 508.305f, 0.0f}, // mason3 intro pos
+ {6417.070f, 438.824f, 511.395f, 3.6651f}, // mason3 action pos
+};
+
+class npc_blessed_banner : public CreatureScript
+{
+public:
+ npc_blessed_banner() : CreatureScript("npc_blessed_banner") { }
+
+ struct npc_blessed_bannerAI : public Scripted_NoMovementAI
+ {
+ npc_blessed_bannerAI(Creature* creature) : Scripted_NoMovementAI(creature) , Summons(me)
+ {
+ HalofSpawned = false;
+ PhaseCount = 0;
+ Summons.DespawnAll();
+ }
+
+ EventMap events;
+
+ bool HalofSpawned;
+
+ uint32 PhaseCount;
+
+ SummonList Summons;
+
+ uint64 guidDalfors;
+ uint64 guidPriest[3];
+ uint64 guidMason[3];
+ uint64 guidHalof;
+
+ void Reset()
+ {
+ me->setRegeneratingHealth(false);
+ DoCast(SPELL_THREAT_PULSE);
+ me->AI()->Talk(BANNER_SAY);
+ events.ScheduleEvent(EVENT_SPAWN,3000);
+ }
+
+ void EnterCombat(Unit* /*who*/) {}
+
+ void MoveInLineOfSight(Unit* /*who*/) {}
+
+ void JustSummoned(Creature* Summoned)
+ {
+ Summons.Summon(Summoned);
+ }
+
+ void JustDied(Unit* /*killer*/)
+ {
+ Summons.DespawnAll();
+ me->DespawnOrUnsummon();
+ }
+
+ void UpdateAI(uint32 const diff)
+ {
+ events.Update(diff);
+
+ switch (events.ExecuteEvent())
+ {
+ case EVENT_SPAWN:
+ {
+ if (Creature* Dalfors = DoSummon(NPC_CRUSADER_LORD_DALFORS, DalforsPos[0]))
+ {
+ guidDalfors = Dalfors->GetGUID();
+ Dalfors->GetMotionMaster()->MovePoint(0, DalforsPos[1]);
+ }
+ if (Creature* Priest1 = DoSummon(NPC_ARGENT_BATTLE_PRIEST, Priest1Pos[0]))
+ {
+ guidPriest[0] = Priest1->GetGUID();
+ Priest1->GetMotionMaster()->MovePoint(0, Priest1Pos[1]);
+ }
+ if (Creature* Priest2 = DoSummon(NPC_ARGENT_BATTLE_PRIEST, Priest2Pos[0]))
+ {
+ guidPriest[1] = Priest2->GetGUID();
+ Priest2->GetMotionMaster()->MovePoint(0, Priest2Pos[1]);
+ }
+ if (Creature* Priest3 = DoSummon(NPC_ARGENT_BATTLE_PRIEST, Priest3Pos[0]))
+ {
+ guidPriest[2] = Priest3->GetGUID();
+ Priest3->GetMotionMaster()->MovePoint(0, Priest3Pos[1]);
+ }
+ if (Creature* Mason1 = DoSummon(NPC_ARGENT_MASON, Mason1Pos[0]))
+ {
+ guidMason[0] = Mason1->GetGUID();
+ Mason1->GetMotionMaster()->MovePoint(0, Mason1Pos[1]);
+ }
+ if (Creature* Mason2 = DoSummon(NPC_ARGENT_MASON, Mason2Pos[0]))
+ {
+ guidMason[1] = Mason2->GetGUID();
+ Mason2->GetMotionMaster()->MovePoint(0, Mason2Pos[1]);
+ }
+ if (Creature* Mason3 = DoSummon(NPC_ARGENT_MASON, Mason3Pos[0]))
+ {
+ guidMason[2] = Mason3->GetGUID();
+ Mason3->GetMotionMaster()->MovePoint(0, Mason3Pos[1]);
+ }
+ events.ScheduleEvent(EVENT_INTRO_1,15000);
+ }
+ break;
+ case EVENT_INTRO_1:
+ {
+ if (Creature* Dalfors = me->GetCreature(*me,guidDalfors))
+ Dalfors->AI()->Talk(DALFORS_SAY_PRE_1);
+ events.ScheduleEvent(EVENT_INTRO_2,5000);
+ }
+ break;
+ case EVENT_INTRO_2:
+ {
+ if (Creature* Dalfors = me->GetCreature(*me,guidDalfors))
+ {
+ Dalfors->SetFacingTo(6.215f);
+ Dalfors->AI()->Talk(DALFORS_SAY_PRE_2);
+ }
+ events.ScheduleEvent(EVENT_INTRO_3,5000);
+ }
+ break;
+ case EVENT_INTRO_3:
+ {
+ if (Creature* Dalfors = me->GetCreature(*me,guidDalfors))
+ {
+ Dalfors->GetMotionMaster()->MovePoint(0, DalforsPos[2]);
+ Dalfors->SetHomePosition(DalforsPos[2]);
+ }
+ if (Creature* Priest1 = me->GetCreature(*me,guidPriest[0]))
+ {
+ Priest1->SetFacingTo(5.7421f);
+ Priest1->SetHomePosition(Priest1Pos[1]);
+ }
+ if (Creature* Priest2 = me->GetCreature(*me,guidPriest[1]))
+ {
+ Priest2->SetFacingTo(5.7421f);
+ Priest2->SetHomePosition(Priest2Pos[1]);
+ }
+ if (Creature* Priest3 = me->GetCreature(*me,guidPriest[2]))
+ {
+ Priest3->SetFacingTo(5.7421f);
+ Priest3->SetHomePosition(Priest3Pos[1]);
+ }
+ if (Creature* Mason1 = me->GetCreature(*me,guidMason[0]))
+ {
+ Mason1->GetMotionMaster()->MovePoint(0, Mason1Pos[2]);
+ Mason1->SetHomePosition(Mason1Pos[2]);
+ }
+ if (Creature* Mason2 = me->GetCreature(*me,guidMason[1]))
+ {
+ Mason2->GetMotionMaster()->MovePoint(0, Mason2Pos[2]);
+ Mason2->SetHomePosition(Mason2Pos[2]);
+ }
+ if (Creature* Mason3 = me->GetCreature(*me,guidMason[2]))
+ {
+ Mason3->GetMotionMaster()->MovePoint(0, Mason3Pos[2]);
+ Mason3->SetHomePosition(Mason3Pos[2]);
+ }
+ events.ScheduleEvent(EVENT_START_FIGHT,5000);
+ events.ScheduleEvent(EVENT_MASON_ACTION,15000);
+ }
+ break;
+ case EVENT_MASON_ACTION:
+ {
+ if (Creature* Mason1 = me->GetCreature(*me,guidMason[0]))
+ {
+ Mason1->SetFacingTo(2.8972f);
+ Mason1->AI()->SetData(1,1); // triggers SAI actions on npc
+ }
+ if (Creature* Mason2 = me->GetCreature(*me,guidMason[1]))
+ {
+ Mason2->SetFacingTo(3.1241f);
+ Mason2->AI()->SetData(1,1); // triggers SAI actions on npc
+ }
+ if (Creature* Mason3 = me->GetCreature(*me,guidMason[2]))
+ {
+ Mason3->SetFacingTo(3.6651f);
+ Mason3->AI()->SetData(1,1); // triggers SAI actions on npc
+ }
+ }
+ break;
+ case EVENT_START_FIGHT:
+ {
+ if(Creature* LK = GetClosestCreatureWithEntry(me,NPC_LK,100))
+ LK->AI()->Talk(LK_TALK_1);
+ if (Creature* Dalfors = me->GetCreature(*me,guidDalfors))
+ Dalfors->AI()->Talk(DALFORS_SAY_START);
+ events.ScheduleEvent(EVENT_WAVE_SPAWN,1000);
+ }
+ break;
+ case EVENT_WAVE_SPAWN:
+ {
+ if (PhaseCount == 3)
+ {
+ if (Creature* LK = GetClosestCreatureWithEntry(me,NPC_LK,100))
+ LK->AI()->Talk(LK_TALK_2);
+ }
+ else if (PhaseCount == 6)
+ {
+ if (Creature* LK = GetClosestCreatureWithEntry(me,NPC_LK,100))
+ LK->AI()->Talk(LK_TALK_3);
+ }
+ if (Creature* tempsum = DoSummon(NPC_SCOURGE_DRUDGE,Mason3Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ if (urand(0,1) == 0)
+ {
+ if (Creature* tempsum = DoSummon(NPC_HIDEOUS_PLAGEBRINGER,Mason1Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ if (Creature* tempsum = DoSummon(NPC_HIDEOUS_PLAGEBRINGER,Mason2Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ }
+ else
+ {
+ if (Creature* tempsum = DoSummon(NPC_REANIMATED_CAPTAIN,Mason1Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ if (Creature* tempsum = DoSummon(NPC_REANIMATED_CAPTAIN,Mason2Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ }
+
+ PhaseCount++;
+
+ if (PhaseCount < 8)
+ events.ScheduleEvent(EVENT_WAVE_SPAWN,urand(10000,20000));
+ else
+ events.ScheduleEvent(EVENT_HALOF,urand(10000,20000));
+ }
+ break;
+ case EVENT_HALOF:
+ {
+ if (Creature* LK = GetClosestCreatureWithEntry(me,NPC_LK,100))
+ LK->AI()->Talk(LK_TALK_4);
+ if (Creature* tempsum = DoSummon(NPC_SCOURGE_DRUDGE,Mason1Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ if (Creature* tempsum = DoSummon(NPC_SCOURGE_DRUDGE,Mason2Pos[0]))
+ {
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ if (Creature* tempsum = DoSummon(NPC_HALOF_THE_DEATHBRINGER,DalforsPos[0]))
+ {
+ HalofSpawned = true;
+ guidHalof = tempsum->GetGUID();
+ tempsum->SetHomePosition(DalforsPos[2]);
+ tempsum->AI()->AttackStart(GetClosestCreatureWithEntry(me,NPC_BLESSED_BANNER,100));
+ }
+ }
+ break;
+ case EVENT_ENDED:
+ {
+ Summons.DespawnAll();
+ me->DespawnOrUnsummon();
+ }
+ break;
+ }
+
+ if (PhaseCount == 8)
+ if (Creature* Halof = me->GetCreature(*me,guidHalof))
+ if (Halof->isDead())
+ {
+ DoCast(me,SPELL_CRUSADERS_SPIRE_VICTORY,true);
+ Summons.DespawnEntry(NPC_HIDEOUS_PLAGEBRINGER);
+ Summons.DespawnEntry(NPC_REANIMATED_CAPTAIN);
+ Summons.DespawnEntry(NPC_SCOURGE_DRUDGE);
+ Summons.DespawnEntry(NPC_HALOF_THE_DEATHBRINGER);
+ if (Creature* Dalfors = me->GetCreature(*me,guidDalfors))
+ Dalfors->AI()->Talk(DALFORS_YELL_FINISHED);
+ events.ScheduleEvent(EVENT_ENDED,10000);
+ }
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_blessed_bannerAI(creature);
+ }
+};
+
void AddSC_icecrown()
{
new npc_arete;
@@ -499,4 +874,5 @@ void AddSC_icecrown()
new npc_guardian_pavilion;
new npc_vereth_the_cunning;
new npc_tournament_training_dummy;
+ new npc_blessed_banner();
}
diff --git a/src/server/scripts/Northrend/isle_of_conquest.cpp b/src/server/scripts/Northrend/isle_of_conquest.cpp
index 6d76e348980..88d262a1579 100644
--- a/src/server/scripts/Northrend/isle_of_conquest.cpp
+++ b/src/server/scripts/Northrend/isle_of_conquest.cpp
@@ -15,8 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#include "BattlegroundIC.h"
+#include "Player.h"
// TO-DO: This should be done with SmartAI, but yet it does not correctly support vehicles's AIs.
// Even adding ReactState Passive we still have issues using SmartAI.
diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp
index afab9b90a4a..c0635f897d9 100644
--- a/src/server/scripts/Northrend/sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/sholazar_basin.cpp
@@ -28,8 +28,13 @@ npc_vekjik
avatar_of_freya
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "SpellScript.h"
+#include "SpellAuras.h"
+#include "Player.h"
/*######
## npc_injured_rainspeaker_oracle
@@ -39,9 +44,9 @@ EndContentData */
enum eRainspeaker
{
- SAY_START_IRO = -1571000,
- SAY_QUEST_ACCEPT_IRO = -1571001,
- SAY_END_IRO = -1571002,
+ SAY_START_IRO = 0,
+ SAY_QUEST_ACCEPT_IRO = 1,
+ SAY_END_IRO = 2,
QUEST_FORTUNATE_MISUNDERSTANDINGS = 12570,
FACTION_ESCORTEE_A = 774,
@@ -101,7 +106,7 @@ public:
case 28:
player->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, me);
// me->RestoreFaction();
- DoScriptText(SAY_END_IRO, me);
+ Talk(SAY_END_IRO);
SetRun(false);
break;
}
@@ -141,7 +146,7 @@ public:
CAST_AI(npc_escortAI, (creature->AI()))->Start(true, false, player->GetGUID());
CAST_AI(npc_escortAI, (creature->AI()))->SetMaxPlayerDistance(35.0f);
creature->SetUnitMovementFlags(MOVEMENTFLAG_FALLING);
- DoScriptText(SAY_START_IRO, creature);
+ creature->AI()->Talk(SAY_START_IRO);
switch (player->GetTeam()){
case ALLIANCE:
@@ -157,7 +162,7 @@ public:
bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* /*_Quest*/)
{
- DoScriptText(SAY_QUEST_ACCEPT_IRO, creature);
+ creature->AI()->Talk(SAY_QUEST_ACCEPT_IRO);
return false;
}
@@ -179,7 +184,7 @@ enum eVekjik
GOSSIP_TEXTID_VEKJIK1 = 13137,
GOSSIP_TEXTID_VEKJIK2 = 13138,
- SAY_TEXTID_VEKJIK1 = -1000208,
+ SAY_TEXTID_VEKJIK1 = 0,
SPELL_FREANZYHEARTS_FURY = 51469,
@@ -218,7 +223,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->CLOSE_GOSSIP_MENU();
- DoScriptText(SAY_TEXTID_VEKJIK1, creature, player);
+ creature->AI()->Talk(SAY_TEXTID_VEKJIK1, player->GetGUID());
player->AreaExploredOrEventHappens(QUEST_MAKING_PEACE);
creature->CastSpell(player, SPELL_FREANZYHEARTS_FURY, false);
break;
@@ -337,13 +342,13 @@ enum eEnums
SPELL_EXPLODE_CRYSTAL = 62487,
SPELL_FLAMES = 64561,
- SAY_WP_7 = -1800047,
- SAY_WP_6 = -1800048,
- SAY_WP_5 = -1800049,
- SAY_WP_4 = -1800050,
- SAY_WP_3 = -1800051,
- SAY_WP_2 = -1800052,
- SAY_WP_1 = -1800053,
+ SAY_WP_1 = 0,
+ SAY_WP_2 = 1,
+ SAY_WP_3 = 2,
+ SAY_WP_4 = 3,
+ SAY_WP_5 = 4,
+ SAY_WP_6 = 5,
+ SAY_WP_7 = 6,
QUEST_DISASTER = 12688
};
@@ -366,19 +371,19 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_WP_2, me);
+ Talk(SAY_WP_2);
break;
case 1:
- DoScriptText(SAY_WP_3, me);
+ Talk(SAY_WP_3);
me->CastSpell(5918.33f, 5372.91f, -98.770f, SPELL_EXPLODE_CRYSTAL, true);
me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, 0, 0, 0, 0, TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break;
case 2:
- DoScriptText(SAY_WP_4, me);
+ Talk(SAY_WP_4);
break;
case 7:
- DoScriptText(SAY_WP_5, me);
+ Talk(SAY_WP_5);
break;
case 8:
me->CastSpell(5887.37f, 5379.39f, -91.289f, SPELL_EXPLODE_CRYSTAL, true);
@@ -386,13 +391,13 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
break;
case 9:
- DoScriptText(SAY_WP_6, me);
+ Talk(SAY_WP_6);
break;
case 13:
if (player)
{
player->GroupEventHappens(QUEST_DISASTER, me);
- DoScriptText(SAY_WP_7, me);
+ Talk(SAY_WP_7);
}
break;
}
@@ -443,7 +448,7 @@ public:
creature->setFaction(113);
pEscortAI->Start(false, false, player->GetGUID());
- DoScriptText(SAY_WP_1, creature);
+ creature->AI()->Talk(SAY_WP_1);
}
}
return true;
@@ -467,11 +472,27 @@ public:
enum utils
{
- NPC_HEMET = 27986,
- NPC_HADRIUS = 28047,
- NPC_TAMARA = 28568,
- SPELL_OFFER = 51962,
- QUEST_ENTRY = 12645,
+ NPC_HEMET = 27986,
+ NPC_HADRIUS = 28047,
+ NPC_TAMARA = 28568,
+ SPELL_OFFER = 51962,
+ QUEST_ENTRY = 12645,
+};
+
+enum NesingwaryChildrensWeek
+{
+ SPELL_ORPHAN_OUT = 58818,
+
+ QUEST_THE_MIGHTY_HEMET_NESINGWARY = 13957,
+
+ ORPHAN_WOLVAR = 33532,
+
+ TEXT_WOLVAR_ORPHAN_6 = 6,
+ TEXT_WOLVAR_ORPHAN_7 = 7,
+ TEXT_WOLVAR_ORPHAN_8 = 8,
+ TEXT_WOLVAR_ORPHAN_9 = 9,
+
+ TEXT_NESINGWARY_1 = 1,
};
class npc_jungle_punch_target : public CreatureScript
@@ -483,17 +504,86 @@ public:
{
npc_jungle_punch_targetAI(Creature* creature) : ScriptedAI(creature) {}
- uint16 sayTimer;
- uint8 sayStep;
-
void Reset()
{
sayTimer = 3500;
sayStep = 0;
+ timer = 0;
+ phase = 0;
+ playerGUID = 0;
+ orphanGUID = 0;
+ }
+
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!phase && who && who->GetDistance2d(me) < 10.0f)
+ if (Player* player = who->ToPlayer())
+ if (player->GetQuestStatus(QUEST_THE_MIGHTY_HEMET_NESINGWARY) == QUEST_STATUS_INCOMPLETE)
+ {
+ playerGUID = player->GetGUID();
+ if (Aura* orphanOut = player->GetAura(SPELL_ORPHAN_OUT))
+ if (orphanOut->GetCaster() && orphanOut->GetCaster()->GetEntry() == ORPHAN_WOLVAR)
+ {
+ orphanGUID = orphanOut->GetCaster()->GetGUID();
+ phase = 1;
+ }
+ }
+ }
+
+ void proceedCwEvent(const uint32 diff)
+ {
+ if (timer <= diff)
+ {
+ Player* player = Player::GetPlayer(*me, playerGUID);
+ Creature* orphan = Creature::GetCreature(*me, orphanGUID);
+
+ if(!orphan || !player)
+ {
+ Reset();
+ return;
+ }
+
+ switch(phase)
+ {
+ case 1:
+ orphan->GetMotionMaster()->MovePoint(0, me->GetPositionX() + cos(me->GetOrientation()) * 5, me->GetPositionY() + sin(me->GetOrientation()) * 5, me->GetPositionZ());
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_6);
+ timer = 5000;
+ break;
+ case 2:
+ orphan->SetFacingToObject(me);
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_7);
+ timer = 5000;
+ break;
+ case 3:
+ Talk(TEXT_NESINGWARY_1);
+ timer = 5000;
+ break;
+ case 4:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_8);
+ timer = 5000;
+ break;
+ case 5:
+ orphan->AI()->Talk(TEXT_WOLVAR_ORPHAN_9);
+ timer = 5000;
+ break;
+ case 6:
+ orphan->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ player->GroupEventHappens(QUEST_THE_MIGHTY_HEMET_NESINGWARY, me);
+ Reset();
+ return;
+ }
+ ++phase;
+ }
+ else
+ timer -= diff;
}
void UpdateAI(const uint32 uiDiff)
{
+ if (phase)
+ proceedCwEvent(uiDiff);
+
if (!sayStep)
return;
@@ -585,6 +675,14 @@ public:
break;
}
}
+
+ private:
+ uint16 sayTimer;
+ uint8 sayStep;
+ uint32 timer;
+ int8 phase;
+ uint64 playerGUID;
+ uint64 orphanGUID;
};
CreatureAI* GetAI(Creature* creature) const
@@ -615,8 +713,8 @@ enum eAdventurousDwarf
GOSSIP_MENU_DWARF = 13307,
- SAY_DWARF_OUCH = -1571042,
- SAY_DWARF_HELP = -1571043
+ SAY_DWARF_OUCH = 0,
+ SAY_DWARF_HELP = 1
};
class npc_adventurous_dwarf : public CreatureScript
@@ -624,10 +722,17 @@ class npc_adventurous_dwarf : public CreatureScript
public:
npc_adventurous_dwarf() : CreatureScript("npc_adventurous_dwarf") { }
+ struct npc_adventurous_dwarfAI : public ScriptedAI
+ {
+ npc_adventurous_dwarfAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Talk(SAY_DWARF_OUCH);
+ }
+ };
+
CreatureAI* GetAI(Creature* creature) const
{
- DoScriptText(SAY_DWARF_OUCH, creature);
- return NULL;
+ return new npc_adventurous_dwarfAI(creature);
}
bool OnGossipHello(Player* player, Creature* creature)
@@ -652,15 +757,24 @@ public:
{
player->PlayerTalkClass->ClearMenus();
uint32 spellId = 0;
+
switch (action)
{
- case GOSSIP_ACTION_INFO_DEF + 1: spellId = SPELL_ADD_ORANGE; break;
- case GOSSIP_ACTION_INFO_DEF + 2: spellId = SPELL_ADD_BANANAS; break;
- case GOSSIP_ACTION_INFO_DEF + 3: spellId = SPELL_ADD_PAPAYA; break;
+ case GOSSIP_ACTION_INFO_DEF + 1:
+ spellId = SPELL_ADD_ORANGE;
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 2:
+ spellId = SPELL_ADD_BANANAS;
+ break;
+ case GOSSIP_ACTION_INFO_DEF + 3:
+ spellId = SPELL_ADD_PAPAYA;
+ break;
}
+
if (spellId)
player->CastSpell(player, spellId, true);
- DoScriptText(SAY_DWARF_HELP, creature);
+
+ creature->AI()->Talk(SAY_DWARF_HELP);
creature->DespawnOrUnsummon();
return true;
}
diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp
index 15239e9f836..f87b24ce639 100644
--- a/src/server/scripts/Northrend/storm_peaks.cpp
+++ b/src/server/scripts/Northrend/storm_peaks.cpp
@@ -15,21 +15,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "Vehicle.h"
+#include "CombatAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npc_agnetta_tyrsdottar
######*/
-#define SAY_AGGRO -1571003
#define GOSSIP_AGNETTA "Skip the warmup, sister... or are you too scared to face soemeone your own size?"
enum eAgnetta
{
QUEST_ITS_THAT_YOUR_GOBLIN = 12969,
- FACTION_HOSTILE_AT1 = 45
+ FACTION_HOSTILE_AT1 = 45,
+ SAY_AGGRO = 0
};
class npc_agnetta_tyrsdottar : public CreatureScript
@@ -66,7 +73,7 @@ public:
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF+1)
{
- DoScriptText(SAY_AGGRO, creature);
+ creature->AI()->Talk(SAY_AGGRO);
player->CLOSE_GOSSIP_MENU();
creature->setFaction(FACTION_HOSTILE_AT1);
creature->AI()->AttackStart(player);
@@ -129,229 +136,6 @@ public:
}
};
-/*######
-## npc_thorim
-######*/
-
-#define GOSSIP_HN "Thorim?"
-#define GOSSIP_SN1 "Can you tell me what became of Sif?"
-#define GOSSIP_SN2 "He did more than that, Thorim. He controls Ulduar now."
-#define GOSSIP_SN3 "It needn't end this way."
-
-enum eThorim
-{
- QUEST_SIBLING_RIVALRY = 13064,
- NPC_THORIM = 29445,
- GOSSIP_TEXTID_THORIM1 = 13799,
- GOSSIP_TEXTID_THORIM2 = 13801,
- GOSSIP_TEXTID_THORIM3 = 13802,
- GOSSIP_TEXTID_THORIM4 = 13803
-};
-
-class npc_thorim : public CreatureScript
-{
-public:
- npc_thorim() : CreatureScript("npc_thorim") { }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(QUEST_SIBLING_RIVALRY) == QUEST_STATUS_INCOMPLETE) {
- player->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM1, creature->GetGUID());
- return true;
- }
- return false;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM2, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM3, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_THORIM4, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->CLOSE_GOSSIP_MENU();
- player->CompleteQuest(QUEST_SIBLING_RIVALRY);
- break;
- }
- return true;
- }
-};
-
-/*######
-## npc_victorious_challenger
-######*/
-
-#define GOSSIP_CHALLENGER "Let's do this, sister."
-
-enum eVictoriousChallenger
-{
- QUEST_TAKING_ALL_CHALLENGERS = 12971,
- QUEST_DEFENDING_YOUR_TITLE = 13423,
-
- SPELL_SUNDER_ARMOR = 11971,
- SPELL_REND_VC = 11977
-};
-
-class npc_victorious_challenger : public CreatureScript
-{
-public:
- npc_victorious_challenger() : CreatureScript("npc_victorious_challenger") { }
-
- struct npc_victorious_challengerAI : public ScriptedAI
- {
- npc_victorious_challengerAI(Creature* creature) : ScriptedAI(creature) {}
-
- uint32 SunderArmorTimer;
- uint32 RendTimer;
-
- void Reset()
- {
- me->RestoreFaction();
-
- SunderArmorTimer = 10000;
- RendTimer = 15000;
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Return since we have no target
- if (!UpdateVictim())
- return;
-
- if (RendTimer < diff)
- {
- DoCast(me->getVictim(), SPELL_REND_VC, true);
- RendTimer = 15000;
- }else RendTimer -= diff;
-
- if (SunderArmorTimer < diff)
- {
- DoCast(me->getVictim(), SPELL_SUNDER_ARMOR, true);
- SunderArmorTimer = 10000;
- }else SunderArmorTimer -= diff;
-
- DoMeleeAttackIfReady();
- }
-
- void KilledUnit(Unit* /*victim*/)
- {
- me->RestoreFaction();
- }
-
- };
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(QUEST_TAKING_ALL_CHALLENGERS) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_DEFENDING_YOUR_TITLE) == QUEST_STATUS_INCOMPLETE)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CHALLENGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- return true;
- }
-
- return false;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- if (action == GOSSIP_ACTION_INFO_DEF+1)
- {
- player->CLOSE_GOSSIP_MENU();
- creature->setFaction(14);
- creature->AI()->AttackStart(player);
- }
-
- return true;
- }
-
- CreatureAI* GetAI(Creature* creature) const
- {
- return new npc_victorious_challengerAI(creature);
- }
-};
-
-/*######
-## npc_loklira_crone
-######*/
-
-#define GOSSIP_LOKLIRACRONE "Tell me about this proposal"
-#define GOSSIP_LOKLIRACRONE1 "What happened then?"
-#define GOSSIP_LOKLIRACRONE2 "You want me to take part in the Hyldsmeet to end the war?"
-#define GOSSIP_LOKLIRACRONE3 "Very well. I'll take part in this competition."
-
-enum eLokliraCrone
-{
- QUEST_HYLDSMEET = 12970,
-
- GOSSIP_TEXTID_LOK1 = 13778,
- GOSSIP_TEXTID_LOK2 = 13779,
- GOSSIP_TEXTID_LOK3 = 13780
-};
-
-class npc_loklira_crone : public CreatureScript
-{
-public:
- npc_loklira_crone() : CreatureScript("npc_loklira_crone") { }
-
- bool OnGossipHello(Player* player, Creature* creature)
- {
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
-
- if (player->GetQuestStatus(QUEST_HYLDSMEET) == QUEST_STATUS_INCOMPLETE)
- {
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- return true;
- }
- return false;
- }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- {
- player->PlayerTalkClass->ClearMenus();
- switch (action)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK1, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+2:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK2, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+3:
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOKLIRACRONE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
- player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_LOK3, creature->GetGUID());
- break;
- case GOSSIP_ACTION_INFO_DEF+4:
- player->CLOSE_GOSSIP_MENU();
- player->CompleteQuest(QUEST_HYLDSMEET);
- break;
- }
- return true;
- }
-};
-
/////////////////////
///npc_injured_goblin
/////////////////////
@@ -359,8 +143,8 @@ public:
enum eInjuredGoblin
{
QUEST_BITTER_DEPARTURE = 12832,
- SAY_QUEST_ACCEPT = -1800042,
- SAY_END_WP_REACHED = -1800043
+ SAY_QUEST_ACCEPT = 0,
+ SAY_END_WP_REACHED = 1
};
#define GOSSIP_ITEM_1 "I am ready, lets get you out of here"
@@ -383,7 +167,7 @@ public:
switch (waypointId)
{
case 26:
- DoScriptText(SAY_END_WP_REACHED, me, player);
+ Talk(SAY_END_WP_REACHED, player->GetGUID());
break;
case 27:
player->GroupEventHappens(QUEST_BITTER_DEPARTURE, me);
@@ -434,7 +218,7 @@ public:
bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest)
{
if (quest->GetQuestId() == QUEST_BITTER_DEPARTURE)
- DoScriptText(SAY_QUEST_ACCEPT, creature);
+ creature->AI()->Talk(SAY_QUEST_ACCEPT);
return false;
}
@@ -504,14 +288,12 @@ public:
## npc_brunnhildar_prisoner
######*/
-enum brunhildar {
- NPC_QUEST_GIVER = 29592,
-
+enum BrunnhildarPrisoner {
SPELL_ICE_PRISON = 54894,
- SPELL_KILL_CREDIT_PRISONER = 55144,
- SPELL_KILL_CREDIT_DRAKE = 55143,
- SPELL_SUMMON_LIBERATED = 55073,
- SPELL_ICE_LANCE = 55046
+ SPELL_ICE_LANCE = 55046,
+ SPELL_FREE_PRISONER = 55048,
+ SPELL_RIDE_DRAKE = 55074,
+ SPELL_SHARD_IMPACT = 55047
};
class npc_brunnhildar_prisoner : public CreatureScript
@@ -523,129 +305,169 @@ public:
{
npc_brunnhildar_prisonerAI(Creature* creature) : ScriptedAI(creature) {}
- uint64 drakeGUID;
- uint16 enter_timer;
- bool hasEmptySeats;
+ bool freed;
void Reset()
{
+ freed = false;
me->CastSpell(me, SPELL_ICE_PRISON, true);
- enter_timer = 0;
- drakeGUID = 0;
- hasEmptySeats = false;
}
- void UpdateAI(const uint32 diff)
+ void JustRespawned()
+ {
+ Reset();
+ }
+
+ void UpdateAI(const uint32 /*diff*/)
{
- //TODO: not good script
- if (!drakeGUID)
+ if (!freed)
return;
- Creature* drake = Unit::GetCreature(*me, drakeGUID);
- if (!drake)
+ if (!me->HasUnitState(UNIT_STATE_ONVEHICLE))
{
- drakeGUID = 0;
- return;
+ me->DespawnOrUnsummon();
}
+ }
- // drake unsummoned, passengers dropped
- if (!me->IsOnVehicle(drake) && !hasEmptySeats)
- me->DespawnOrUnsummon(3000);
-
- if (enter_timer <= 0)
+ void SpellHit(Unit* caster, const SpellInfo* spell)
+ {
+ if (spell->Id != SPELL_ICE_LANCE)
return;
- if (enter_timer < diff)
+ if (caster->GetVehicleKit()->GetAvailableSeatCount() != 0)
{
- enter_timer = 0;
- if (hasEmptySeats)
- me->JumpTo(drake, 25.0f);
- else
- Reset();
+ me->CastSpell(me, SPELL_FREE_PRISONER, true);
+ me->CastSpell(caster, SPELL_RIDE_DRAKE, true);
+ me->CastSpell(me, SPELL_SHARD_IMPACT, true);
+ freed = true;
}
- else
- enter_timer -= diff;
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_brunnhildar_prisonerAI(creature);
+ }
+};
+
+/*######
+## npc_freed_protodrake
+######*/
+
+enum FreedProtoDrake
+{
+ AREA_VALLEY_OF_ANCIENT_WINTERS = 4437,
+ TEXT_EMOTE = 0,
+ SPELL_KILL_CREDIT_PRISONER = 55144,
+ SPELL_SUMMON_LIBERATED = 55073,
+ 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}
+};
+
+
+class npc_freed_protodrake : public CreatureScript
+{
+public:
+ npc_freed_protodrake() : CreatureScript("npc_freed_protodrake") { }
+
+ struct npc_freed_protodrakeAI : public VehicleAI
+ {
+ npc_freed_protodrakeAI(Creature* creature) : VehicleAI(creature) {}
+
+ bool autoMove;
+ bool wpReached;
+ uint16 CheckTimer;
+ uint16 countWP;
+
+ void Reset()
+ {
+ autoMove = false;
+ wpReached = false;
+ CheckTimer = 5000;
+ countWP = 0;
}
- void MoveInLineOfSight(Unit* who)
+ void MovementInform(uint32 type, uint32 id)
{
- if (!who || !drakeGUID)
+ if (type != POINT_MOTION_TYPE)
return;
- Creature* drake = Unit::GetCreature(*me, drakeGUID);
- if (!drake)
+ if (id < 15)
{
- drakeGUID = 0;
- return;
+ ++countWP;
+ wpReached = true;
}
-
- if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON))
+ else
+ // drake reached village
{
- if (who->IsVehicle() && me->IsWithinDist(who, 25.0f, true) && who->ToCreature() && who->ToCreature()->GetEntry() == 29709)
+ // get player that rides drake (from seat 0)
+ Unit* player = me->GetVehicleKit()->GetPassenger(0);
+ if (player && player->GetTypeId() == TYPEID_PLAYER)
{
- uint8 seat = who->GetVehicleKit()->GetNextEmptySeat(0, true);
- if (seat <= 0)
- return;
-
- me->EnterVehicle(who, seat);
- me->SendMovementFlagUpdate();
- hasEmptySeats = false;
+ // 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();
}
}
+ }
- if (who->ToCreature() && me->IsOnVehicle(drake))
+ void UpdateAI(const uint32 diff)
+ {
+ if (!autoMove)
{
- if (who->ToCreature()->GetEntry() == NPC_QUEST_GIVER && me->IsWithinDist(who, 15.0f, false))
+ if (CheckTimer < diff)
{
- Unit* rider = drake->GetVehicleKit()->GetPassenger(0);
- if (!rider)
- return;
-
- rider->CastSpell(rider, SPELL_KILL_CREDIT_PRISONER, true);
-
- me->ExitVehicle();
- me->CastSpell(me, SPELL_SUMMON_LIBERATED, true);
- me->DespawnOrUnsummon(500);
-
- // drake is empty now, deliver credit for drake and despawn him
- if (drake->GetVehicleKit()->HasEmptySeat(1) &&
- drake->GetVehicleKit()->HasEmptySeat(2) &&
- drake->GetVehicleKit()->HasEmptySeat(3))
+ CheckTimer = 5000;
+ if (me->GetAreaId() == AREA_VALLEY_OF_ANCIENT_WINTERS)
{
- // not working rider->CastSpell(rider, SPELL_KILL_CREDIT_DRAKE, true);
- if (rider->ToPlayer())
- rider->ToPlayer()->KilledMonsterCredit(29709, 0);
-
- drake->DespawnOrUnsummon(0);
+ Talk(TEXT_EMOTE, me->GetVehicleKit()->GetPassenger(0)->GetGUID());
+ autoMove = true;
+ wpReached = true;
}
}
+ else
+ CheckTimer -= diff;
}
- }
-
- void SpellHit(Unit* hitter, const SpellInfo* spell)
- {
- if (!hitter || !spell)
- return;
-
- if (spell->Id != SPELL_ICE_LANCE)
- return;
- me->RemoveAura(SPELL_ICE_PRISON);
- enter_timer = 500;
-
- if (hitter->IsVehicle())
- drakeGUID = hitter->GetGUID();
- else
- return;
-
- if (hitter->GetVehicleKit()->GetNextEmptySeat(0, true))
- hasEmptySeats = true;
+ if (wpReached && autoMove)
+ {
+ wpReached = false;
+ me->GetMotionMaster()->MovePoint(countWP, FreedDrakeWaypoints[countWP]);
+ }
}
};
CreatureAI* GetAI(Creature* creature) const
{
- return new npc_brunnhildar_prisonerAI(creature);
+ return new npc_freed_protodrakeAI(creature);
}
};
@@ -746,16 +568,62 @@ class npc_hyldsmeet_protodrake : public CreatureScript
}
};
+enum CloseRift
+{
+ SPELL_DESPAWN_RIFT = 61665
+};
+
+class spell_close_rift : public SpellScriptLoader
+{
+ public:
+ spell_close_rift() : SpellScriptLoader("spell_close_rift") { }
+
+ class spell_close_rift_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_close_rift_AuraScript);
+
+ bool Load()
+ {
+ _counter = 0;
+ return true;
+ }
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ return sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT);
+ }
+
+ void HandlePeriodic(AuraEffect const* /* aurEff */)
+ {
+ if (++_counter == 5)
+ GetTarget()->CastSpell((Unit*)NULL, SPELL_DESPAWN_RIFT, true);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_close_rift_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+
+ private:
+ uint8 _counter;
+
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_close_rift_AuraScript();
+ }
+};
+
void AddSC_storm_peaks()
{
new npc_agnetta_tyrsdottar();
new npc_frostborn_scout();
- new npc_thorim();
- new npc_victorious_challenger();
- new npc_loklira_crone();
new npc_injured_goblin();
new npc_roxi_ramrocket();
new npc_brunnhildar_prisoner();
+ new npc_freed_protodrake();
new npc_icefang();
new npc_hyldsmeet_protodrake();
+ new spell_close_rift();
}
diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp
new file mode 100644
index 00000000000..8935c77b30e
--- /dev/null
+++ b/src/server/scripts/Northrend/wintergrasp.cpp
@@ -0,0 +1,624 @@
+/* Copyright (C) 2008 - 2009 Trinity <http://www.trinitycore.org/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "BattlefieldMgr.h"
+#include "BattlefieldWG.h"
+#include "Battlefield.h"
+#include "ScriptSystem.h"
+#include "WorldSession.h"
+#include "ObjectMgr.h"
+#include "Vehicle.h"
+#include "GameObjectAI.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "SpellScript.h"
+#include "Player.h"
+
+#define GOSSIP_HELLO_DEMO1 "Build catapult."
+#define GOSSIP_HELLO_DEMO2 "Build demolisher."
+#define GOSSIP_HELLO_DEMO3 "Build siege engine."
+#define GOSSIP_HELLO_DEMO4 "I cannot build more!"
+
+enum WGqueuenpctext
+{
+ WG_NPCQUEUE_TEXT_H_NOWAR = 14775,
+ WG_NPCQUEUE_TEXT_H_QUEUE = 14790,
+ WG_NPCQUEUE_TEXT_H_WAR = 14777,
+ WG_NPCQUEUE_TEXT_A_NOWAR = 14782,
+ WG_NPCQUEUE_TEXT_A_QUEUE = 14791,
+ WG_NPCQUEUE_TEXT_A_WAR = 14781,
+ WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
+};
+
+enum Spells
+{
+ // Demolisher engineers spells
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE = 61409,
+ SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE = 56662,
+ SPELL_BUILD_CATAPULT_FORCE = 56664,
+ SPELL_BUILD_DEMOLISHER_FORCE = 56659,
+ SPELL_ACTIVATE_CONTROL_ARMS = 49899,
+ SPELL_RIDE_WG_VEHICLE = 60968,
+
+ SPELL_VEHICLE_TELEPORT = 49759,
+
+ // Spirit guide
+ SPELL_CHANNEL_SPIRIT_HEAL = 22011,
+};
+
+enum CreatureIds
+{
+ NPC_GOBLIN_MECHANIC = 30400,
+ NPC_GNOMISH_ENGINEER = 30499,
+
+ NPC_WINTERGRASP_CONTROL_ARMS = 27852,
+
+ NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23472,
+};
+
+enum QuestIds
+{
+ QUEST_BONES_AND_ARROWS_HORDE_ATT = 13193,
+ QUEST_JINXING_THE_WALLS_HORDE_ATT = 13202,
+ QUEST_SLAY_THEM_ALL_HORDE_ATT = 13180,
+ QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT = 13200,
+ QUEST_HEALING_WITH_ROSES_HORDE_ATT = 13201,
+ QUEST_DEFEND_THE_SIEGE_HORDE_ATT = 13223,
+
+ QUEST_BONES_AND_ARROWS_HORDE_DEF = 13199,
+ QUEST_WARDING_THE_WALLS_HORDE_DEF = 13192,
+ QUEST_SLAY_THEM_ALL_HORDE_DEF = 13178,
+ QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF = 13191,
+ QUEST_HEALING_WITH_ROSES_HORDE_DEF = 13194,
+ QUEST_TOPPLING_THE_TOWERS_HORDE_DEF = 13539,
+ QUEST_STOP_THE_SIEGE_HORDE_DEF = 13185,
+
+ QUEST_BONES_AND_ARROWS_ALLIANCE_ATT = 13196,
+ QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT = 13198,
+ QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT = 13179,
+ QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT = 13222,
+ QUEST_A_RARE_HERB_ALLIANCE_ATT = 13195,
+
+ QUEST_BONES_AND_ARROWS_ALLIANCE_DEF = 13154,
+ QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF = 13153,
+ QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF = 13177,
+ QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF = 13538,
+ QUEST_STOP_THE_SIEGE_ALLIANCE_DEF = 13186,
+ QUEST_A_RARE_HERB_ALLIANCE_DEF = 13156,
+};
+
+uint8 const MAX_WINTERGRASP_VEHICLES = 4;
+
+uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] =
+{
+ NPC_WINTERGRASP_CATAPULT,
+ NPC_WINTERGRASP_DEMOLISHER,
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE
+};
+
+class npc_wg_demolisher_engineer : public CreatureScript
+{
+ public:
+ npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ if (canBuild(creature))
+ {
+ if (player->HasAura(SPELL_CORPORAL))
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ else if (player->HasAura(SPELL_LIEUTENANT))
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ }
+ }
+ else
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
+
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ if (canBuild(creature))
+ {
+ switch (action - GOSSIP_ACTION_INFO_DEF)
+ {
+ case 0:
+ creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true);
+ break;
+ case 1:
+ creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true);
+ break;
+ case 2:
+ creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE : SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE, true);
+ break;
+ }
+ if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true))
+ creature->CastSpell(controlArms, SPELL_ACTIVATE_CONTROL_ARMS, true);
+ }
+ return true;
+ }
+
+ private:
+ bool canBuild(Creature* creature)
+ {
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return false;
+
+ switch (creature->GetEntry())
+ {
+ case NPC_GOBLIN_MECHANIC:
+ return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ case NPC_GNOMISH_ENGINEER:
+ return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ default:
+ return false;
+ }
+ }
+};
+
+class npc_wg_spirit_guide : public CreatureScript
+{
+ public:
+ npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
+ for (uint8 i = 0; i < graveyard.size(); i++)
+ if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
+
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (wintergrasp)
+ {
+ GraveyardVect gy = wintergrasp->GetGraveyardVector();
+ for (uint8 i = 0; i < gy.size(); i++)
+ if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
+ if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId()))
+ player->TeleportTo(safeLoc->map_id, safeLoc->x, safeLoc->y, safeLoc->z, 0);
+ }
+ return true;
+ }
+
+ struct npc_wg_spirit_guideAI : public ScriptedAI
+ {
+ npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature) { }
+
+ void UpdateAI(uint32 const /*diff*/)
+ {
+ if (!me->HasUnitState(UNIT_STATE_CASTING))
+ DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_wg_spirit_guideAI(creature);
+ }
+};
+
+class npc_wg_queue : public CreatureScript
+{
+ public:
+ npc_wg_queue() : CreatureScript("npc_wg_queue") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (wintergrasp->IsWarTime())
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
+ }
+ else
+ {
+ uint32 timer = wintergrasp->GetTimer() / 1000;
+ player->SendUpdateWorldState(4354, time(NULL) + timer);
+ if (timer < 15 * MINUTE)
+ {
+ player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
+ }
+ else
+ player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
+ }
+ return true;
+ }
+
+ bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender*/ , uint32 /*action*/)
+ {
+ player->CLOSE_GOSSIP_MENU();
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (wintergrasp->IsWarTime())
+ wintergrasp->InvitePlayerToWar(player);
+ else
+ {
+ uint32 timer = wintergrasp->GetTimer() / 1000;
+ if (timer < 15 * MINUTE)
+ wintergrasp->InvitePlayerToQueue(player);
+ }
+ return true;
+ }
+};
+
+class go_wg_vehicle_teleporter : public GameObjectScript
+{
+ public:
+ go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") { }
+
+ struct go_wg_vehicle_teleporterAI : public GameObjectAI
+ {
+ go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject), _checkTimer(1000) { }
+
+ void UpdateAI(uint32 diff)
+ {
+ if (_checkTimer <= diff)
+ {
+ if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ // Tabulation madness in the hole!
+ for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++)
+ if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true))
+ if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT) && vehicleCreature->getFaction() == WintergraspFaction[wg->GetDefenderTeam()])
+ if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true))
+ teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
+
+ _checkTimer = 1000;
+ }
+ else _checkTimer -= diff;
+ }
+
+ private:
+ uint32 _checkTimer;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const
+ {
+ return new go_wg_vehicle_teleporterAI(go);
+ }
+};
+
+class npc_wg_quest_giver : public CreatureScript
+{
+ public:
+ npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { }
+
+ bool OnGossipHello(Player* player, Creature* creature)
+ {
+ if (creature->isQuestGiver())
+ player->PrepareQuestMenu(creature->GetGUID());
+
+ Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
+ if (!wintergrasp)
+ return true;
+
+ if (creature->isQuestGiver())
+ {
+ QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
+ QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
+
+ QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
+ qm.ClearMenu();
+
+ for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
+ {
+ uint32 questId = i->second;
+ QuestStatus status = player->GetQuestStatus(questId);
+ if (status == QUEST_STATUS_COMPLETE)
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_INCOMPLETE)
+ qm.AddMenuItem(questId, 4);
+ //else if (status == QUEST_STATUS_AVAILABLE)
+ // qm.AddMenuItem(quest_id, 2);
+ }
+
+ for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
+ {
+ uint32 questId = i->second;
+ Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
+ if (!quest)
+ continue;
+
+ switch (questId)
+ {
+ // Horde attacker
+ case QUEST_BONES_AND_ARROWS_HORDE_ATT:
+ case QUEST_JINXING_THE_WALLS_HORDE_ATT:
+ case QUEST_SLAY_THEM_ALL_HORDE_ATT:
+ case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
+ case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
+ case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
+ if (wintergrasp->GetAttackerTeam() == TEAM_HORDE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Horde defender
+ case QUEST_BONES_AND_ARROWS_HORDE_DEF:
+ case QUEST_WARDING_THE_WALLS_HORDE_DEF:
+ case QUEST_SLAY_THEM_ALL_HORDE_DEF:
+ case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
+ case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
+ case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
+ case QUEST_STOP_THE_SIEGE_HORDE_DEF:
+ if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Alliance attacker
+ case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
+ case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
+ case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
+ case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
+ case QUEST_A_RARE_HERB_ALLIANCE_ATT:
+ if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ // Alliance defender
+ case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
+ case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
+ case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
+ case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
+ case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
+ case QUEST_A_RARE_HERB_ALLIANCE_DEF:
+ if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
+ {
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ }
+ break;
+ default:
+ QuestStatus status = player->GetQuestStatus(questId);
+
+ if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 4);
+ else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
+ qm.AddMenuItem(questId, 2);
+ break;
+ }
+ }
+ }
+ player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
+ return true;
+ }
+};
+
+class spell_wintergrasp_force_building : public SpellScriptLoader
+{
+ public:
+ spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { }
+
+ class spell_wintergrasp_force_building_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_force_building_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE)
+ || !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_force_building_SpellScript();
+ }
+};
+
+class spell_wintergrasp_grab_passenger : public SpellScriptLoader
+{
+ public:
+ spell_wintergrasp_grab_passenger() : SpellScriptLoader("spell_wintergrasp_grab_passenger") { }
+
+ class spell_wintergrasp_grab_passenger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_grab_passenger_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* target = GetHitPlayer())
+ target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, false);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_grab_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_grab_passenger_SpellScript();
+ }
+};
+
+class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
+{
+public:
+ achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
+
+ bool OnCheck(Player* source, Unit* target)
+ {
+ if (!target)
+ return false;
+
+ if (Player* victim = target->ToPlayer())
+ {
+ if (!victim->IsMounted())
+ return false;
+
+ if (Vehicle* vehicle = source->GetVehicle())
+ if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
+ return true;
+ }
+
+ return false;
+ }
+};
+
+enum WgTeleport
+{
+ SPELL_WINTERGRASP_TELEPORT_TRIGGER = 54643,
+};
+
+class spell_wintergrasp_defender_teleport : public SpellScriptLoader
+{
+public:
+ spell_wintergrasp_defender_teleport() : SpellScriptLoader("spell_wintergrasp_defender_teleport") { }
+
+ class spell_wintergrasp_defender_teleport_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_defender_teleport_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
+ if (Player* target = GetExplTargetUnit()->ToPlayer())
+ // check if we are in Wintergrasp at all, SotA uses same teleport spells
+ if ((target->GetZoneId() == 4197 && target->GetTeamId() != wg->GetDefenderTeam()) || target->HasAura(SPELL_WINTERGRASP_TELEPORT_TRIGGER))
+ return SPELL_FAILED_BAD_TARGETS;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_wintergrasp_defender_teleport_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_defender_teleport_SpellScript();
+ }
+};
+
+class spell_wintergrasp_defender_teleport_trigger : public SpellScriptLoader
+{
+public:
+ spell_wintergrasp_defender_teleport_trigger() : SpellScriptLoader("spell_wintergrasp_defender_teleport_trigger") { }
+
+ class spell_wintergrasp_defender_teleport_trigger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_wintergrasp_defender_teleport_trigger_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effindex*/)
+ {
+ if (Unit* target = GetHitUnit())
+ {
+ WorldLocation loc;
+ target->GetPosition(&loc);
+ SetExplTargetDest(loc);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_defender_teleport_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_wintergrasp_defender_teleport_trigger_SpellScript();
+ }
+};
+
+void AddSC_wintergrasp()
+{
+ new npc_wg_queue();
+ new npc_wg_spirit_guide();
+ new npc_wg_demolisher_engineer();
+ new go_wg_vehicle_teleporter();
+ new npc_wg_quest_giver();
+ new spell_wintergrasp_force_building();
+ new spell_wintergrasp_grab_passenger();
+ new achievement_wg_didnt_stand_a_chance();
+ new spell_wintergrasp_defender_teleport();
+ new spell_wintergrasp_defender_teleport_trigger();
+}
diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp
index 369f47cfb1c..506c34d40fb 100644
--- a/src/server/scripts/Northrend/zuldrak.cpp
+++ b/src/server/scripts/Northrend/zuldrak.cpp
@@ -15,8 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*####
## npc_drakuru_shackles
@@ -117,9 +121,9 @@ enum eRageclaw
SPELL_KNEEL = 39656
};
-const char * SAY_RAGECLAW_1 = "I poop on you, trollses!";
-const char * SAY_RAGECLAW_2 = "ARRRROOOOGGGGAAAA!";
-const char * SAY_RAGECLAW_3 = "No more mister nice wolvar!";
+const char* SAY_RAGECLAW_1 = "I poop on you, trollses!";
+const char* SAY_RAGECLAW_2 = "ARRRROOOOGGGGAAAA!";
+const char* SAY_RAGECLAW_3 = "No more mister nice wolvar!";
#define SAY_RAGECLAW RAND(SAY_RAGECLAW_1, SAY_RAGECLAW_2, SAY_RAGECLAW_3)
@@ -261,14 +265,16 @@ enum eGurgthock
NPC_FIEND_FIRE = 30042,
NPC_FIEND_EARTH = 30043,
- SAY_QUEST_ACCEPT_TUSKARRMAGEDON = -1571031,
- SAY_QUEST_ACCEPT_KORRAK_1 = -1571033,
- SAY_QUEST_ACCEPT_KORRAK_2 = -1571034,
- SAY_QUEST_ACCEPT_MAGNATAUR = -1571035,
+ SAY_QUEST_ACCEPT_TUSKARRMAGEDON = 0,
+ SAY_QUEST_ACCEPT_KORRAK_1 = 1,
+ SAY_QUEST_ACCEPT_KORRAK_2 = 2,
+ SAY_QUEST_ACCEPT_MAGNATAUR = 3,
+ EMOTE_YGGDRAS_SPAWN = 4,
+ SAY_STINKBEARD_SPAWN = 5,
+ SAY_GURGTHOCK_ELEMENTAL_SPAWN = 6,
- EMOTE_YGGDRAS_SPAWN = -1571039,
- SAY_STINKBEARD_SPAWN = -1571040,
- SAY_GURGTHOCK_ELEMENTAL_SPAWN = -1571041,
+ SAY_CALL_FOR_HELP = 0,
+ SAY_RECRUIT = 0,
SPELL_CRASHING_WAVE = 55909, // water
SPELL_SHOCKWAVE = 55918, // earth
@@ -376,12 +382,12 @@ public:
switch (uiValue)
{
case QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON:
- DoScriptText(SAY_QUEST_ACCEPT_TUSKARRMAGEDON, me);
+ Talk(SAY_QUEST_ACCEPT_TUSKARRMAGEDON);
uiPhase = 1;
uiTimer = 4000;
break;
case QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER:
- DoScriptText(SAY_QUEST_ACCEPT_KORRAK_1, me);
+ Talk(SAY_QUEST_ACCEPT_KORRAK_1);
uiPhase = 3;
uiTimer = 3000;
break;
@@ -439,7 +445,7 @@ public:
SummonGUID = 0;
break;
case 3:
- DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, me);
+ Talk(SAY_QUEST_ACCEPT_KORRAK_2);
uiTimer = 3000;
uiPhase = 4;
break;
@@ -473,7 +479,7 @@ public:
}
break;
case 8:
- DoScriptText(SAY_QUEST_ACCEPT_MAGNATAUR, me);
+ Talk(SAY_QUEST_ACCEPT_MAGNATAUR);
uiTimer = 5000;
uiPhase = 11;
break;
@@ -490,12 +496,12 @@ public:
break;
case 10:
me->SummonCreature(NPC_YGGDRAS, SpawnPosition[1], TEMPSUMMON_CORPSE_DESPAWN, 1000);
- DoScriptText(EMOTE_YGGDRAS_SPAWN, me);
+ Talk(EMOTE_YGGDRAS_SPAWN);
uiPhase = 0;
break;
case 11:
if (Creature* creature = me->SummonCreature(NPC_STINKBEARD, SpawnPosition[0], TEMPSUMMON_CORPSE_DESPAWN, 1000))
- DoScriptText(SAY_STINKBEARD_SPAWN, creature);
+ creature->AI()->Talk(SAY_STINKBEARD_SPAWN);
uiPhase = 0;
break;
case 12:
@@ -510,7 +516,7 @@ public:
}
break;
case 13:
- DoScriptText(SAY_GURGTHOCK_ELEMENTAL_SPAWN, me);
+ Talk(SAY_GURGTHOCK_ELEMENTAL_SPAWN);
uiTimer = 3000;
uiPhase = 14;
break;
@@ -571,9 +577,7 @@ enum eOrinokoTuskbreaker
SPELL_SUMMON_WHISKER = 55946,
NPC_WHISKER = 30113,
- NPC_HUNGRY_PENGUIN = 30110,
-
- SAY_CALL_FOR_HELP = -1571032
+ NPC_HUNGRY_PENGUIN = 30110
};
class npc_orinoko_tuskbreaker : public CreatureScript
@@ -655,7 +659,7 @@ public:
if (!bSummoned && !HealthAbovePct(50))
{
- DoScriptText(SAY_CALL_FOR_HELP, me);
+ Talk(SAY_CALL_FOR_HELP);
//DoCast(me->getVictim(), SPELL_SUMMON_WHISKER); petai is not working correctly???
if (Creature* pWhisker = me->SummonCreature(NPC_WHISKER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0))
@@ -1278,11 +1282,7 @@ enum eCrusade_recruit
QUEST_TROLL_PATROL_INTESTINAL_FORTITUDE = 12509,
- GOSSIP_CRUSADE_TEXT = 13069,
-
- SAY_RECRUIT_1 = -1571036,
- SAY_RECRUIT_2 = -1571037,
- SAY_RECRUIT_3 = -1571038
+ GOSSIP_CRUSADE_TEXT = 13069
};
#define GOSSIP_ITEM_1 "Get out there and make those Scourge wish they were never reborn!"
@@ -1321,7 +1321,7 @@ public:
// say random text
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
- DoScriptText(RAND(SAY_RECRUIT_1, SAY_RECRUIT_2, SAY_RECRUIT_3), me);
+ Talk(SAY_RECRUIT);
m_uiTimer = 3000;
m_uiPhase = 2;
break;
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
index 1db4fb4dfc9..2e911406979 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPEP.h"
#include "WorldPacket.h"
#include "Player.h"
@@ -26,7 +27,6 @@
#include "Language.h"
#include "World.h"
#include "GossipDef.h"
-#include "ScriptPCH.h"
OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0)
@@ -693,7 +693,7 @@ void OutdoorPvPEP::BuffTeams()
{
for (PlayerSet::iterator itr = m_players[0].begin(); itr != m_players[0].end(); ++itr)
{
- Player* player = *itr;
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
for (int i = 0; i < 4; ++i)
player->RemoveAurasDueToSpell(EP_AllianceBuffs[i]);
@@ -703,7 +703,7 @@ void OutdoorPvPEP::BuffTeams()
}
for (PlayerSet::iterator itr = m_players[1].begin(); itr != m_players[1].end(); ++itr)
{
- Player* player = *itr;
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
for (int i = 0; i < 4; ++i)
player->RemoveAurasDueToSpell(EP_HordeBuffs[i]);
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
index 14712e0150d..14712e0150d 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
index 06c1813d1dc..a4b506e9271 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPHP.h"
#include "OutdoorPvP.h"
#include "OutdoorPvPMgr.h"
@@ -23,7 +24,6 @@
#include "World.h"
#include "ObjectMgr.h"
#include "Language.h"
-#include "ScriptPCH.h"
const uint32 HP_LANG_LOSE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_LOSE_BROKENHILL_A, LANG_OPVP_HP_LOSE_OVERLOOK_A, LANG_OPVP_HP_LOSE_STADIUM_A};
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h
index 59bce7be298..59bce7be298 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
index f912f25d87f..abf807327e3 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPNA.h"
#include "Player.h"
#include "ObjectMgr.h"
@@ -22,7 +23,6 @@
#include "WorldPacket.h"
#include "Language.h"
#include "World.h"
-#include "ScriptPCH.h"
OutdoorPvPNA::OutdoorPvPNA()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
index ace68034dfc..ace68034dfc 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index a69dd3ed874..9411bd8a363 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPSI.h"
#include "WorldPacket.h"
#include "Player.h"
@@ -22,9 +23,9 @@
#include "MapManager.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
+#include "ReputationMgr.h"
#include "Language.h"
#include "World.h"
-#include "ScriptPCH.h"
OutdoorPvPSI::OutdoorPvPSI()
{
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h
index c4975d142f0..c4975d142f0 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
index ec0c10f4afe..fdf6533a64b 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPTF.h"
#include "OutdoorPvPMgr.h"
#include "OutdoorPvP.h"
@@ -23,7 +24,6 @@
#include "ObjectMgr.h"
#include "Language.h"
#include "World.h"
-#include "ScriptPCH.h"
OutdoorPvPTF::OutdoorPvPTF()
{
@@ -296,9 +296,12 @@ void OPvPCapturePointTF::ChangeState()
uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled();
if (alliance_towers < TF_TOWER_NUM)
((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers);
+
sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A));
+
for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr)
- (*itr)->AreaExploredOrEventHappens(TF_ALLY_QUEST);
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
+ player->AreaExploredOrEventHappens(TF_ALLY_QUEST);
break;
}
case OBJECTIVESTATE_HORDE:
@@ -308,9 +311,12 @@ void OPvPCapturePointTF::ChangeState()
uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled();
if (horde_towers < TF_TOWER_NUM)
((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers);
+
sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H));
+
for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr)
- (*itr)->AreaExploredOrEventHappens(TF_HORDE_QUEST);
+ if (Player* player = ObjectAccessor::FindPlayer(*itr))
+ player->AreaExploredOrEventHappens(TF_HORDE_QUEST);
break;
}
case OBJECTIVESTATE_NEUTRAL:
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h
index dfab6d12cb8..dfab6d12cb8 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
index 38fed30f542..6644dd3f47f 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "ScriptMgr.h"
#include "OutdoorPvPZM.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
@@ -24,7 +25,6 @@
#include "WorldPacket.h"
#include "GossipDef.h"
#include "World.h"
-#include "ScriptPCH.h"
OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type)
: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N)
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
index 8d2124a3791..8d2124a3791 100755..100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h
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 ae1a7296de6..5739aa49549 100644
--- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp
@@ -29,7 +29,8 @@ boss_exarch_maladaar
mob_avatar_of_martyred
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_MOONFIRE 37328
#define SPELL_FIREBALL 37329
@@ -125,30 +126,23 @@ public:
};
-#define SAY_INTRO -1558000
-#define SAY_SUMMON -1558001
-
-#define SAY_AGGRO_1 -1558002
-#define SAY_AGGRO_2 -1558003
-#define SAY_AGGRO_3 -1558004
-
-#define SAY_ROAR -1558005
-#define SAY_SOUL_CLEAVE -1558006
-
-#define SAY_SLAY_1 -1558007
-#define SAY_SLAY_2 -1558008
-
-#define SAY_DEATH -1558009
-
-#define SPELL_RIBBON_OF_SOULS 32422
-#define SPELL_SOUL_SCREAM 32421
-
-#define SPELL_STOLEN_SOUL 32346
-#define SPELL_STOLEN_SOUL_VISUAL 32395
-
-#define SPELL_SUMMON_AVATAR 32424
-
-#define ENTRY_STOLEN_SOUL 18441
+enum ExarchMaladaar
+{
+ SAY_INTRO = 0,
+ SAY_SUMMON = 1,
+ SAY_AGGRO = 2,
+ SAY_ROAR = 3,
+ SAY_SLAY = 4,
+ SAY_DEATH = 5,
+
+ SPELL_RIBBON_OF_SOULS = 32422,
+ SPELL_SOUL_SCREAM = 32421,
+ SPELL_STOLEN_SOUL = 32346,
+ SPELL_STOLEN_SOUL_VISUAL = 32395,
+ SPELL_SUMMON_AVATAR = 32424,
+
+ ENTRY_STOLEN_SOUL = 18441
+};
class boss_exarch_maladaar : public CreatureScript
{
@@ -195,7 +189,7 @@ public:
{
if (!HasTaunted && me->IsWithinDistInMap(who, 150.0f))
{
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
HasTaunted = true;
}
@@ -204,7 +198,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -230,12 +224,12 @@ public:
if (rand()%2)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
//When Exarch Maladar is defeated D'ore appear.
me->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000);
}
@@ -250,7 +244,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(true);
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
DoCast(me, SPELL_SUMMON_AVATAR);
Avatar_summoned = true;
@@ -266,11 +260,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(true);
- uint32 i = urand(1, 2);
- if (i == 1)
- DoScriptText(SAY_ROAR, me);
- else
- DoScriptText(SAY_SOUL_CLEAVE, me);
+ Talk(SAY_ROAR);
soulmodel = target->GetDisplayId();
soulholder = target->GetGUID();
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 5fc912f2a01..d6465bfe006 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
@@ -23,7 +23,9 @@ Comment: InhibitMagic should stack slower far from the boss, proper Visual for F
Category: Auchindoun, Auchenai Crypts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
#define SPELL_INHIBITMAGIC 32264
#define SPELL_ATTRACTMAGIC 32265
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 a4bba5f28fb..f7a2eb87d67 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp
@@ -28,18 +28,16 @@ boss_nexusprince_shaffar
mob_ethereal_beacon
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum ePrince
{
- SAY_INTRO = -1557000,
- SAY_AGGRO_1 = -1557001,
- SAY_AGGRO_2 = -1557002,
- SAY_AGGRO_3 = -1557003,
- SAY_SLAY_1 = -1557004,
- SAY_SLAY_2 = -1557005,
- SAY_SUMMON = -1557006,
- SAY_DEAD = -1557007,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_SUMMON = 3,
+ SAY_DEAD = 4,
SPELL_BLINK = 34605,
SPELL_FROSTBOLT = 32364,
@@ -109,14 +107,14 @@ public:
{
if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f))
{
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
HasTaunted = true;
}
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
DoZoneInCombat();
summons.DoZoneInCombat();
@@ -142,12 +140,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEAD, me);
+ Talk(SAY_DEAD);
summons.DespawnAll();
}
@@ -202,7 +200,7 @@ public:
me->InterruptNonMeleeSpells(true);
if (!urand(0, 3))
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
DoCast(me, SPELL_ETHEREAL_BEACON, true);
diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
index 487a1dd41ea..f174091311b 100644
--- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp
@@ -23,23 +23,22 @@ SDComment: Not known how void blast is done (amount of rapid cast seems to be re
SDCategory: Auchindoun, Mana Tombs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SAY_AGGRO_1 -1557008
-#define SAY_AGGRO_2 -1557009
-#define SAY_AGGRO_3 -1557010
-
-#define SAY_KILL_1 -1557011
-#define SAY_KILL_2 -1557012
-
-#define SAY_DEATH -1557013
-
-#define EMOTE_DARK_SHELL -1557014
+enum Pandemonius
+{
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_DEATH = 2,
+ EMOTE_DARK_SHELL = 3,
+
+ SPELL_VOID_BLAST = 32325,
+ H_SPELL_VOID_BLAST = 38760,
+ SPELL_DARK_SHELL = 32358,
+ H_SPELL_DARK_SHELL = 38759
+};
-#define SPELL_VOID_BLAST 32325
-#define H_SPELL_VOID_BLAST 38760
-#define SPELL_DARK_SHELL 32358
-#define H_SPELL_DARK_SHELL 38759
class boss_pandemonius : public CreatureScript
{
@@ -70,17 +69,17 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void UpdateAI(const uint32 diff)
@@ -111,7 +110,7 @@ public:
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(true);
- DoScriptText(EMOTE_DARK_SHELL, me);
+ Talk(EMOTE_DARK_SHELL);
DoCast(me, SPELL_DARK_SHELL);
DarkShell_Timer = 20000;
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 37544f9377b..5bb396965a6 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp
@@ -23,30 +23,28 @@ SDComment: Shock spells/times need more work. Heroic partly implemented.
SDCategory: Auchindoun, Sethekk Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
-#define SAY_SUMMON -1556000
-
-#define SAY_AGGRO_1 -1556001
-#define SAY_AGGRO_2 -1556002
-#define SAY_AGGRO_3 -1556003
-
-#define SAY_SLAY_1 -1556004
-#define SAY_SLAY_2 -1556005
-
-#define SAY_DEATH -1556006
-
-#define SPELL_FROST_SHOCK 21401 //37865
-#define SPELL_FLAME_SHOCK 34354
-#define SPELL_SHADOW_SHOCK 30138
-#define SPELL_ARCANE_SHOCK 37132
-
-#define SPELL_CHAIN_LIGHTNING 15659 //15305
-
-#define SPELL_SUMMON_SYTH_FIRE 33537 // Spawns 19203
-#define SPELL_SUMMON_SYTH_ARCANE 33538 // Spawns 19205
-#define SPELL_SUMMON_SYTH_FROST 33539 // Spawns 19204
-#define SPELL_SUMMON_SYTH_SHADOW 33540 // Spawns 19206
+enum DarkweaverSyth
+{
+ SAY_SUMMON = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
+
+ SPELL_FROST_SHOCK = 21401, //37865
+ SPELL_FLAME_SHOCK = 34354,
+ SPELL_SHADOW_SHOCK = 30138,
+ SPELL_ARCANE_SHOCK = 37132,
+
+ SPELL_CHAIN_LIGHTNING = 15659, //15305
+
+ SPELL_SUMMON_SYTH_FIRE = 33537, // Spawns 19203
+ SPELL_SUMMON_SYTH_ARCANE = 33538, // Spawns 19205
+ SPELL_SUMMON_SYTH_FROST = 33539, // Spawns 19204
+ SPELL_SUMMON_SYTH_SHADOW = 33540 // Spawns 19206
+};
#define SPELL_FLAME_BUFFET DUNGEON_MODE(33526, 38141)
#define SPELL_ARCANE_BUFFET DUNGEON_MODE(33527, 38138)
@@ -94,12 +92,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void KilledUnit(Unit* /*victim*/)
@@ -107,7 +105,7 @@ public:
if (rand()%2)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summoned)
@@ -118,7 +116,7 @@ public:
void SythSummoning()
{
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
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 768c4bf12d3..07169f031ab 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp
@@ -23,34 +23,30 @@ SDComment: Heroic supported. Some details missing, but most are spell related.
SDCategory: Auchindoun, Sethekk Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "sethekk_halls.h"
-#define SAY_INTRO -1556007
-
-#define SAY_AGGRO_1 -1556008
-#define SAY_AGGRO_2 -1556009
-#define SAY_AGGRO_3 -1556010
-
-#define SAY_SLAY_1 -1556011
-#define SAY_SLAY_2 -1556012
-#define SAY_DEATH -1556013
-#define EMOTE_ARCANE_EXP -1556015
-
-#define SPELL_BLINK 38194
-#define SPELL_BLINK_TELEPORT 38203
-#define SPELL_MANA_SHIELD 38151
-#define SPELL_ARCANE_BUBBLE 9438
-#define H_SPELL_SLOW 35032
-
-#define SPELL_POLYMORPH 38245
-#define H_SPELL_POLYMORPH 43309
-
-#define SPELL_ARCANE_VOLLEY 35059
-#define H_SPELL_ARCANE_VOLLEY 40424
-
-#define SPELL_ARCANE_EXPLOSION 38197
-#define H_SPELL_ARCANE_EXPLOSION 40425
+enum TailonkingIkiss
+{
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
+ EMOTE_ARCANE_EXP = 4,
+
+ SPELL_BLINK = 38194,
+ SPELL_BLINK_TELEPORT = 38203,
+ SPELL_MANA_SHIELD = 38151,
+ SPELL_ARCANE_BUBBLE = 9438,
+ H_SPELL_SLOW = 35032,
+ SPELL_POLYMORPH = 38245,
+ H_SPELL_POLYMORPH = 43309,
+ SPELL_ARCANE_VOLLEY = 35059,
+ H_SPELL_ARCANE_VOLLEY = 40424,
+ SPELL_ARCANE_EXPLOSION = 38197,
+ H_SPELL_ARCANE_EXPLOSION = 40425
+};
class boss_talon_king_ikiss : public CreatureScript
{
@@ -98,7 +94,7 @@ public:
if (!Intro && me->IsWithinDistInMap(who, 100))
{
Intro = true;
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
}
if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
@@ -115,12 +111,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_IKISSDOOREVENT, DONE);
@@ -128,7 +124,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -182,7 +178,7 @@ public:
if (Blink_Timer <= diff)
{
- DoScriptText(EMOTE_ARCANE_EXP, me);
+ Talk(EMOTE_ARCANE_EXP);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
index 02c5a035375..f57bed1207b 100644
--- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
+++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp
@@ -23,7 +23,8 @@ SDComment: Instance Data for Sethekk Halls instance
SDCategory: Auchindoun, Sethekk Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "sethekk_halls.h"
enum eEnums
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 d92e76685d1..c93143c1c5c 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp
@@ -23,20 +23,18 @@ SDComment: Enrage spell missing/not known
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "shadow_labyrinth.h"
enum eEnums
{
- SAY_INTRO = -1555000,
- SAY_AGGRO1 = -1555001,
- SAY_AGGRO2 = -1555002,
- SAY_AGGRO3 = -1555003,
- SAY_HELP = -1555004,
- SAY_SLAY1 = -1555005,
- SAY_SLAY2 = -1555006,
- SAY_DEATH = -1555007,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_HELP = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
SPELL_BANISH = 30231,
SPELL_CORROSIVE_ACID = 33551,
@@ -118,7 +116,7 @@ public:
{
if (instance->GetData(TYPE_HELLMAW) != FAIL)
{
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
Start(true, false, 0, NULL, false, true);
}
@@ -128,17 +126,17 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_HELLMAW, DONE);
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 6eac36f71c8..eb06cce87fc 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
@@ -23,36 +23,30 @@ SDComment: Incite Chaos not functional since core lacks Mind Control support
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
-#define SPELL_INCITE_CHAOS 33676
-#define SPELL_INCITE_CHAOS_B 33684 //debuff applied to each member of party
-#define SPELL_CHARGE 33709
-#define SPELL_WAR_STOMP 33707
-
-#define SAY_INTRO1 -1555008 //not used
-#define SAY_INTRO2 -1555009 //not used
-#define SAY_INTRO3 -1555010 //not used
-#define SAY_AGGRO1 -1555011
-#define SAY_AGGRO2 -1555012
-#define SAY_AGGRO3 -1555013
-#define SAY_SLAY1 -1555014
-#define SAY_SLAY2 -1555015
-#define SAY_HELP -1555016 //not used
-#define SAY_DEATH -1555017
-
-//below, not used
-#define SAY2_INTRO1 -1555018
-#define SAY2_INTRO2 -1555019
-#define SAY2_INTRO3 -1555020
-#define SAY2_AGGRO1 -1555021
-#define SAY2_AGGRO2 -1555022
-#define SAY2_AGGRO3 -1555023
-#define SAY2_SLAY1 -1555024
-#define SAY2_SLAY2 -1555025
-#define SAY2_HELP -1555026
-#define SAY2_DEATH -1555027
+enum BlackheartTheInciter
+{
+ SPELL_INCITE_CHAOS = 33676,
+ SPELL_INCITE_CHAOS_B = 33684, //debuff applied to each member of party
+ SPELL_CHARGE = 33709,
+ SPELL_WAR_STOMP = 33707,
+
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_HELP = 3,
+ SAY_DEATH = 4,
+
+ //below, not used
+ SAY2_INTRO = 5,
+ SAY2_AGGRO = 6,
+ SAY2_SLAY = 7,
+ SAY2_HELP = 8,
+ SAY2_DEATH = 9
+};
class boss_blackheart_the_inciter : public CreatureScript
{
@@ -93,12 +87,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, DONE);
@@ -106,7 +100,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS);
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 8d971c37559..d7dbb8ef722 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp
@@ -23,33 +23,35 @@ SDComment:
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
+#include "Player.h"
-#define SAY_INTRO -1555028
-#define SAY_AGGRO1 -1555029
-#define SAY_AGGRO2 -1555030
-#define SAY_AGGRO3 -1555031
-#define SAY_HELP -1555032
-#define SAY_SLAY1 -1555033
-#define SAY_SLAY2 -1555034
-#define SAY_DEATH -1555035
-
-#define SPELL_RAIN_OF_FIRE 33617
-#define H_SPELL_RAIN_OF_FIRE 39363
-
-#define SPELL_DRAW_SHADOWS 33563
-#define SPELL_SHADOWBOLT_VOLLEY 33841
-#define SPELL_BANISH 38791
-
-#define MOB_VOID_TRAVELER 19226
-#define SPELL_SACRIFICE 33587
-#define SPELL_SHADOW_NOVA 33846
-#define SPELL_EMPOWERING_SHADOWS 33783
-#define H_SPELL_EMPOWERING_SHADOWS 39364
-
-#define MOB_VOID_PORTAL 19224
-#define SPELL_VOID_PORTAL_VISUAL 33569
+enum GrandmasterVorpil
+{
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_HELP = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+
+ SPELL_RAIN_OF_FIRE = 33617,
+ H_SPELL_RAIN_OF_FIRE = 39363,
+
+ SPELL_DRAW_SHADOWS = 33563,
+ SPELL_SHADOWBOLT_VOLLEY = 33841,
+ SPELL_BANISH = 38791,
+
+ MOB_VOID_TRAVELER = 19226,
+ SPELL_SACRIFICE = 33587,
+ SPELL_SHADOW_NOVA = 33846,
+ SPELL_EMPOWERING_SHADOWS = 33783,
+ H_SPELL_EMPOWERING_SHADOWS = 39364,
+
+ MOB_VOID_PORTAL = 19224,
+ SPELL_VOID_PORTAL_VISUAL = 33569
+};
float VorpilPosition[3] = {-252.8820f, -264.3030f, 17.1f};
@@ -170,6 +172,7 @@ public:
summonTraveler_Timer = 90000;
banish_Timer = 17000;
HelpYell = false;
+ sumportals = false;
destroyPortals();
if (instance)
@@ -216,7 +219,7 @@ public:
me->SummonCreature(MOB_VOID_TRAVELER, VoidPortalCoords[pos][0], VoidPortalCoords[pos][1], VoidPortalCoords[pos][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
if (!HelpYell)
{
- DoScriptText(SAY_HELP, me);
+ Talk(SAY_HELP);
HelpYell = true;
}
}
@@ -229,12 +232,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
destroyPortals();
if (instance)
@@ -243,7 +246,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
summonPortals();
if (instance)
@@ -256,7 +259,7 @@ public:
if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsValidAttackTarget(who))
{
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
Intro = true;
}
}
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
index 99661d8818c..9ca9f7d089c 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp
@@ -23,18 +23,25 @@ SDComment: Timers may be incorrect
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shadow_labyrinth.h"
+#include "SpellInfo.h"
-#define EMOTE_SONIC_BOOM -1555036
+enum Murmur
+{
+ SPELL_RESONANCE = 33657,
+ SPELL_MAGNETIC_PULL = 33689,
+ SPELL_SONIC_SHOCK = 38797,
+ SPELL_THUNDERING_STORM = 39365,
+ EMOTE_SONIC_BOOM = 0
+};
#define SPELL_SONIC_BOOM_CAST DUNGEON_MODE(33923, 38796)
#define SPELL_SONIC_BOOM_EFFECT DUNGEON_MODE(33666, 38795)
-#define SPELL_RESONANCE 33657
+
#define SPELL_MURMURS_TOUCH DUNGEON_MODE(33711, 38794)
-#define SPELL_MAGNETIC_PULL 33689
-#define SPELL_SONIC_SHOCK 38797
-#define SPELL_THUNDERING_STORM 39365
+
class boss_murmur : public CreatureScript
{
@@ -79,8 +86,8 @@ public:
void SonicBoomEffect()
{
- std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (target && target->GetTypeId() == TYPEID_PLAYER)
@@ -121,7 +128,7 @@ public:
}
if (SonicBoom_Timer <= diff)
{
- DoScriptText(EMOTE_SONIC_BOOM, me);
+ Talk(EMOTE_SONIC_BOOM);
DoCast(me, SPELL_SONIC_BOOM_CAST);
SonicBoom_Timer = 30000;
SonicBoom = true;
@@ -164,8 +171,8 @@ public:
// Thundering Storm
if (ThunderingStorm_Timer <= diff)
{
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
if (target->isAlive() && !me->IsWithinDist(target, 35, false))
DoCast(target, SPELL_THUNDERING_STORM, true);
@@ -187,8 +194,8 @@ public:
return;
if (!me->IsWithinMeleeRange(me->getVictim()))
{
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
if (target->isAlive() && me->IsWithinMeleeRange(target))
{
@@ -200,7 +207,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_murmur()
diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
index 846669552ba..9fa90be9765 100644
--- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
+++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp
@@ -23,7 +23,8 @@ SDComment: Some cleanup left along with save
SDCategory: Auchindoun, Shadow Labyrinth
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "shadow_labyrinth.h"
#define MAX_ENCOUNTER 5
@@ -109,7 +110,7 @@ public:
if (creature->isAlive())
{
++m_uiFelOverseerCount;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount);
}
break;
}
@@ -126,7 +127,7 @@ public:
case TYPE_OVERSEER:
if (uiData != DONE)
{
- sLog->outError("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE");
+ sLog->outError(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE");
return;
}
if (m_uiFelOverseerCount)
@@ -134,11 +135,11 @@ public:
--m_uiFelOverseerCount;
if (m_uiFelOverseerCount)
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount);
+ sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount);
else
{
m_auiEncounter[1] = DONE;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE");
+ sLog->outDebug(LOG_FILTER_TSCR, "Shadow Labyrinth: TYPE_OVERSEER == DONE");
}
}
break;
@@ -178,7 +179,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -190,7 +191,7 @@ public:
return false;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
if (identifier == DATA_GRANDMASTERVORPIL)
return m_uiGrandmasterVorpil;
diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
index 546f9ee1e7d..a100f5848af 100644
--- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp
@@ -27,8 +27,11 @@ EndScriptData */
npc_spirit_of_olum
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "black_temple.h"
+#include "Player.h"
/*###
# npc_spirit_of_olum
diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
index caac89da765..427c23bafa6 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp
@@ -23,35 +23,37 @@ SDComment: Bloodboil not working correctly, missing enrage
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
-//Speech'n'Sound
-#define SAY_AGGRO -1564029
-#define SAY_SLAY1 -1564030
-#define SAY_SLAY2 -1564031
-#define SAY_SPECIAL1 -1564032
-#define SAY_SPECIAL2 -1564033
-#define SAY_ENRAGE1 -1564034
-#define SAY_ENRAGE2 -1564035
-#define SAY_DEATH -1564036
-
-//Spells
-#define SPELL_ACID_GEYSER 40630
-#define SPELL_ACIDIC_WOUND 40481
-#define SPELL_ARCING_SMASH 40599
-#define SPELL_BLOODBOIL 42005 // This spell is AoE whereas it shouldn't be
-#define SPELL_FEL_ACID 40508
-#define SPELL_FEL_RAGE_SELF 40594
-#define SPELL_FEL_RAGE_TARGET 40604
-#define SPELL_FEL_RAGE_2 40616
-#define SPELL_FEL_RAGE_3 41625
-#define SPELL_BEWILDERING_STRIKE 40491
-#define SPELL_EJECT1 40486 // 1000 Physical damage + knockback + script effect (should handle threat reduction I think)
-#define SPELL_EJECT2 40597 // 1000 Physical damage + Stun (used in phase 2?)
-#define SPELL_TAUNT_GURTOGG 40603
-#define SPELL_INSIGNIFIGANCE 40618
-#define SPELL_BERSERK 45078
+enum Bloodboil
+{
+ //Speech'n'Sound
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_SPECIAL = 2,
+ SAY_ENRAGE = 3,
+ SAY_DEATH = 4,
+
+ //Spells
+ SPELL_ACID_GEYSER = 40630,
+ SPELL_ACIDIC_WOUND = 40481,
+ SPELL_ARCING_SMASH = 40599,
+ SPELL_BLOODBOIL = 42005, // This spell is AoE whereas it shouldn't be
+ SPELL_FEL_ACID = 40508,
+ SPELL_FEL_RAGE_SELF = 40594,
+ SPELL_FEL_RAGE_TARGET = 40604,
+ SPELL_FEL_RAGE_2 = 40616,
+ SPELL_FEL_RAGE_3 = 41625,
+ SPELL_BEWILDERING_STRIKE = 40491,
+ SPELL_EJECT1 = 40486, // 1000 Physical damage + knockback + script effect (should handle threat reduction I think)
+ SPELL_EJECT2 = 40597, // 1000 Physical damage + Stun (used in phase 2?)
+ SPELL_TAUNT_GURTOGG = 40603,
+ SPELL_INSIGNIFIGANCE = 40618,
+ SPELL_BERSERK = 45078
+};
+
//This is used to sort the players by distance in preparation for the Bloodboil cast.
@@ -120,14 +122,14 @@ public:
void EnterCombat(Unit* /*who*/)
{
DoZoneInCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_GURTOGGBLOODBOILEVENT, IN_PROGRESS);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -135,7 +137,7 @@ public:
if (instance)
instance->SetData(DATA_GURTOGGBLOODBOILEVENT, DONE);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
// Note: This seems like a very complicated fix. The fix needs to be handled by the core, as implementation of limited-target AoE spells are still not limited.
@@ -218,7 +220,7 @@ public:
if (EnrageTimer <= diff)
{
DoCast(me, SPELL_BERSERK);
- DoScriptText(RAND(SAY_ENRAGE1, SAY_ENRAGE2), me);
+ Talk(SAY_ENRAGE);
} else EnrageTimer -= diff;
}
@@ -301,7 +303,7 @@ public:
//Cast this without triggered so that it appears in combat logs and shows visual.
DoCast(me, SPELL_FEL_RAGE_SELF);
- DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me);
+ Talk(SAY_SPECIAL);
AcidGeyserTimer = 1000;
PhaseChangeTimer = 30000;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
index 1926929c97c..1029648561f 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
@@ -23,8 +23,13 @@ SDComment: Somewhat of a workaround for Parasitic Shadowfiend, unable to summon
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "PassiveAI.h"
#include "black_temple.h"
+#include "Player.h"
+#include "SpellInfo.h"
#define GETGO(obj, guid) GameObject* obj = instance->instance->GetGameObject(guid)
#define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*me, guid)
@@ -43,9 +48,9 @@ EndScriptData */
#define SOUND_AKAMA_LEAVE 11390
// Self explanatory
-const char* SAY_KILL1 = "Who shall be next to taste my blades?!";
+char const* SAY_KILL1 = "Who shall be next to taste my blades?!";
#define SOUND_KILL1 11473
-const char* SAY_KILL2 = "This is too easy!";
+char const* SAY_KILL2 = "This is too easy!";
#define SOUND_KILL2 11472
// I think I'll fly now and let my subordinates take you on
@@ -251,7 +256,6 @@ struct Yells
};
static const Yells Conversation[22] =
-
{
{11463, "Akama... your duplicity is hardly surprising. I should have slaughtered you and your malformed brethren long ago.", ILLIDAN_STORMRAGE, 8000, 0, true},
{0, "", ILLIDAN_STORMRAGE, 5000, 396, true},
@@ -461,7 +465,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
/************************************** Illidan's AI* **************************************/
@@ -611,7 +614,8 @@ public:
void DeleteFromThreatList(uint64 TargetGUID)
{
- for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if ((*itr)->getUnitGuid() == TargetGUID)
{
@@ -795,7 +799,7 @@ public:
{
EnterEvadeMode();
me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, 0);
- sLog->outError("SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)");
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)");
}
}
@@ -1148,7 +1152,6 @@ public:
}
}
};
-
};
/********************************** End of Illidan AI* *****************************************/
@@ -1375,7 +1378,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class npc_akama_illidan : public CreatureScript
@@ -1488,9 +1490,9 @@ public:
void KillAllElites()
{
- std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const &threatList = me->getThreatManager().getThreatList();
std::vector<Unit*> eliteList;
- for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->GetEntry() == ILLIDARI_ELITE)
@@ -1646,7 +1648,8 @@ public:
void HandleChannelSequence()
{
- Unit* Channel = NULL, *Spirit[2] = { NULL, NULL };
+ Unit* Channel = NULL;
+ Unit* Spirit[2] = { NULL, NULL };
if (ChannelCount <= 5)
{
Channel = Unit::GetUnit(*me, ChannelGUID);
@@ -1837,7 +1840,6 @@ public:
{
return new npc_akama_illidanAI(creature);
}
-
};
void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset()
@@ -1997,7 +1999,6 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence()
Akama->SetPosition(x, y, z, 0.0f);
Akama->MonsterMoveWithSpeed(x, y, z, 0); // Illidan must not die until Akama arrives.
Akama->GetMotionMaster()->MoveChase(me);
-
}
}
break;
@@ -2191,7 +2192,6 @@ public:
me->SetDisplayId(21431);// appear when hit by Illidan's glaive
}
};
-
};
class mob_parasitic_shadowfiend : public CreatureScript
diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
index 4e4607a7d44..88e7c063c69 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp
@@ -23,34 +23,33 @@ SDComment: Saber Lash missing, Fatal Attraction slightly incorrect; need to dama
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
-//Speech'n'Sounds
-#define SAY_TAUNT1 -1564018
-#define SAY_TAUNT2 -1564019
-#define SAY_TAUNT3 -1564020
-#define SAY_AGGRO -1564021
-#define SAY_SPELL1 -1564022
-#define SAY_SPELL2 -1564023
-#define SAY_SPELL3 -1564024
-#define SAY_SLAY1 -1564025
-#define SAY_SLAY2 -1564026
-#define SAY_ENRAGE -1564027
-#define SAY_DEATH -1564028
-
-//Spells
-#define SPELL_BEAM_SINISTER 40859
-#define SPELL_BEAM_VILE 40860
-#define SPELL_BEAM_WICKED 40861
-#define SPELL_BEAM_SINFUL 40827
-#define SPELL_ATTRACTION 40871
-#define SPELL_SILENCING_SHRIEK 40823
-#define SPELL_ENRAGE 23537
-#define SPELL_SABER_LASH 40810//43267
-#define SPELL_SABER_LASH_IMM 43690
-#define SPELL_TELEPORT_VISUAL 40869
-#define SPELL_BERSERK 45078
+enum MotherShahraz
+{
+ //Speech'n'Sounds
+ SAY_TAUNT = 0,
+ SAY_AGGRO = 1,
+ SAY_SPELL = 2,
+ SAY_SLAY = 3,
+ SAY_ENRAGE = 4,
+ SAY_DEATH = 5,
+
+ //Spells
+ SPELL_BEAM_SINISTER = 40859,
+ SPELL_BEAM_VILE = 40860,
+ SPELL_BEAM_WICKED = 40861,
+ SPELL_BEAM_SINFUL = 40827,
+ SPELL_ATTRACTION = 40871,
+ SPELL_SILENCING_SHRIEK = 40823,
+ SPELL_ENRAGE = 23537,
+ SPELL_SABER_LASH = 40810,//43267
+ SPELL_SABER_LASH_IMM = 43690,
+ SPELL_TELEPORT_VISUAL = 40869,
+ SPELL_BERSERK = 45078
+};
uint32 PrismaticAuras[]=
{
@@ -141,12 +140,12 @@ public:
instance->SetData(DATA_MOTHERSHAHRAZEVENT, IN_PROGRESS);
DoZoneInCombat();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -154,7 +153,7 @@ public:
if (instance)
instance->SetData(DATA_MOTHERSHAHRAZEVENT, DONE);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void TeleportPlayers()
@@ -184,7 +183,7 @@ public:
{
Enraged = true;
DoCast(me, SPELL_ENRAGE, true);
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
}
//Randomly cast one beam.
@@ -235,7 +234,7 @@ public:
TeleportPlayers();
- DoScriptText(RAND(SAY_SPELL2, SAY_SPELL3), me);
+ Talk(SAY_SPELL);
FatalAttractionExplodeTimer = 2000;
FatalAttractionTimer = urand(40, 71) * 1000;
} else FatalAttractionTimer -= diff;
@@ -247,11 +246,9 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
- Unit* unit = NULL;
if (TargetGUID[i])
{
- unit = Unit::GetUnit(*me, TargetGUID[i]);
- if (unit)
+ if (Unit* unit = Unit::GetUnit(*me, TargetGUID[i]))
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
@@ -285,14 +282,14 @@ public:
if (EnrageTimer <= diff)
{
DoCast(me, SPELL_BERSERK);
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
} else EnrageTimer -= diff;
}
//Random taunts
if (RandomYellTimer <= diff)
{
- DoScriptText(RAND(SAY_TAUNT1, SAY_TAUNT2, SAY_TAUNT3), me);
+ Talk(SAY_TAUNT);
RandomYellTimer = urand(60, 151) * 1000;
} else RandomYellTimer -= diff;
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 c5e78f2fa7b..00ea405e109 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp
@@ -23,68 +23,66 @@ SDComment:
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
#include "Spell.h"
-//Sound'n'speech
-//Suffering
-#define SUFF_SAY_FREED -1564047
-#define SUFF_SAY_AGGRO -1564048
-#define SUFF_SAY_SLAY1 -1564049
-#define SUFF_SAY_SLAY2 -1564050
-#define SUFF_SAY_SLAY3 -1564051
-#define SUFF_SAY_RECAP -1564052
-#define SUFF_SAY_AFTER -1564053
-#define SUFF_EMOTE_ENRAGE -1564054
-
-//Desire
-#define DESI_SAY_FREED -1564055
-#define DESI_SAY_SLAY1 -1564056
-#define DESI_SAY_SLAY2 -1564057
-#define DESI_SAY_SLAY3 -1564058
-#define DESI_SAY_SPEC -1564059
-#define DESI_SAY_RECAP -1564060
-#define DESI_SAY_AFTER -1564061
-
-//Anger
-#define ANGER_SAY_FREED -1564062
-#define ANGER_SAY_FREED2 -1564063
-#define ANGER_SAY_SLAY1 -1564064
-#define ANGER_SAY_SLAY2 -1564065
-#define ANGER_SAY_SPEC -1564066
-#define ANGER_SAY_BEFORE -1564067
-#define ANGER_SAY_DEATH -1564068
-
-//Spells
-#define AURA_OF_SUFFERING 41292
-#define AURA_OF_SUFFERING_ARMOR 42017 // linked aura, need core support
-#define ESSENCE_OF_SUFFERING_PASSIVE 41296 // periodic trigger 41294
-#define ESSENCE_OF_SUFFERING_PASSIVE2 41623
-#define SPELL_FIXATE_TARGET 41294 // dummy, select target
-#define SPELL_FIXATE_TAUNT 41295 // force taunt
-#define SPELL_ENRAGE 41305
-#define SPELL_SOUL_DRAIN 41303
-
-#define AURA_OF_DESIRE 41350
-#define AURA_OF_DESIRE_DAMAGE 41352
-#define SPELL_RUNE_SHIELD 41431
-#define SPELL_DEADEN 41410
-#define SPELL_SOUL_SHOCK 41426
-
-#define AURA_OF_ANGER 41337
-#define SPELL_SELF_SEETHE 41364 // force cast 41520
-#define SPELL_ENEMY_SEETHE 41520
-#define SPELL_SOUL_SCREAM 41545
-#define SPELL_SPITE_TARGET 41376 // cast 41377 after 6 sec
-#define SPELL_SPITE_DAMAGE 41377
-
-#define ENSLAVED_SOUL_PASSIVE 41535
-#define SPELL_SOUL_RELEASE 41542
-#define SPELL_SUBMERGE 37550 //dropout 'head'
-
-#define CREATURE_ENSLAVED_SOUL 23469
-#define NUMBER_ENSLAVED_SOUL 8
+enum ReliquaryOfSouls
+{
+ //Sound'n'speech
+ //Suffering
+ SUFF_SAY_FREED = 0,
+ SUFF_SAY_AGGRO = 1,
+ SUFF_SAY_SLAY = 2,
+ SUFF_SAY_RECAP = 3,
+ SUFF_SAY_AFTER = 4,
+ SUFF_EMOTE_ENRAGE = 5,
+
+ //Desire
+ DESI_SAY_FREED = 0,
+ DESI_SAY_SLAY = 1,
+ DESI_SAY_SPEC = 2,
+ DESI_SAY_RECAP = 3,
+ DESI_SAY_AFTER = 4,
+
+ //Anger
+ ANGER_SAY_FREED = 0,
+ ANGER_SAY_SLAY = 1,
+ ANGER_SAY_SPEC = 2,
+ ANGER_SAY_BEFORE = 3,
+ ANGER_SAY_DEATH = 4,
+
+ //Spells
+ AURA_OF_SUFFERING = 41292,
+ AURA_OF_SUFFERING_ARMOR = 42017, // linked aura, need core support
+ ESSENCE_OF_SUFFERING_PASSIVE = 41296, // periodic trigger 41294
+ ESSENCE_OF_SUFFERING_PASSIVE2 = 41623,
+ SPELL_FIXATE_TARGET = 41294, // dummy, select target
+ SPELL_FIXATE_TAUNT = 41295, // force taunt
+ SPELL_ENRAGE = 41305,
+ SPELL_SOUL_DRAIN = 41303,
+
+ AURA_OF_DESIRE = 41350,
+ AURA_OF_DESIRE_DAMAGE = 41352,
+ SPELL_RUNE_SHIELD = 41431,
+ SPELL_DEADEN = 41410,
+ SPELL_SOUL_SHOCK = 41426,
+
+ AURA_OF_ANGER = 41337,
+ SPELL_SELF_SEETHE = 41364, // force cast 41520
+ SPELL_ENEMY_SEETHE = 41520,
+ SPELL_SOUL_SCREAM = 41545,
+ SPELL_SPITE_TARGET = 41376, // cast 41377 after 6 sec
+ SPELL_SPITE_DAMAGE = 41377,
+
+ ENSLAVED_SOUL_PASSIVE = 41535,
+ SPELL_SOUL_RELEASE = 41542,
+ SPELL_SUBMERGE = 37550, //dropout 'head'
+
+ CREATURE_ENSLAVED_SOUL = 23469,
+ NUMBER_ENSLAVED_SOUL = 8
+};
struct Position2d
{
@@ -127,7 +125,6 @@ public:
void JustDied(Unit* /*killer*/);
};
-
};
class boss_reliquary_of_souls : public CreatureScript
@@ -180,6 +177,23 @@ public:
me->RemoveAurasDueToSpell(SPELL_SUBMERGE);
}
+ void MoveInLineOfSight(Unit* who)
+ {
+ if (!who)
+ return;
+
+ if (me->isInCombat())
+ return;
+
+ if (who->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ if (me->GetDistance(who) > 50.0f)
+ return;
+
+ AttackStartNoMove(who);
+ }
+
void EnterCombat(Unit* who)
{
me->AddThreat(who, 10000.0f);
@@ -215,9 +229,8 @@ public:
if (!target)
return;
- std::list<HostileReference*>& m_threatlist = target->getThreatManager().getThreatList();
- std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
- for (; itr != m_threatlist.end(); ++itr)
+ ThreatContainer::StorageType threatlist = target->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit)
@@ -321,11 +334,11 @@ public:
case 5:
if (Phase == 1)
{
- DoScriptText(SUFF_SAY_AFTER, Essence);
+ Essence->AI()->Talk(SUFF_SAY_AFTER);
}
else
{
- DoScriptText(DESI_SAY_AFTER, Essence);
+ Essence->AI()->Talk(DESI_SAY_AFTER);
}
Essence->DespawnOrUnsummon();
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
@@ -358,7 +371,6 @@ public:
} else Timer -= diff;
}
};
-
};
void npc_enslaved_soul::npc_enslaved_soulAI::JustDied(Unit* /*killer*/)
@@ -410,7 +422,8 @@ public:
damage = 0;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->Yell(SUFF_SAY_RECAP, LANG_UNIVERSAL, 0);
- DoScriptText(SUFF_SAY_RECAP, me);
+ Talk(SUFF_SAY_RECAP);
+ me->SetReactState(REACT_PASSIVE);
}
}
@@ -418,7 +431,7 @@ public:
{
if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
{
- DoScriptText(SUFF_SAY_FREED, me);
+ Talk(SUFF_SAY_FREED);
DoZoneInCombat();
DoCast(me, AURA_OF_SUFFERING, true); // linked aura need core support
DoCast(me, ESSENCE_OF_SUFFERING_PASSIVE, true);
@@ -429,17 +442,17 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SUFF_SAY_SLAY1, SUFF_SAY_SLAY2, SUFF_SAY_SLAY3), me);
+ Talk(SUFF_SAY_SLAY);
}
void CastFixate()
{
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- if (m_threatlist.empty())
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ if (threatlist.empty())
return; // No point continuing if empty threatlist.
std::list<Unit*> targets;
- std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
- for (; itr != m_threatlist.end(); ++itr)
+ ThreatContainer::StorageType::const_iterator itr = threatlist.begin();
+ for (; itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players
@@ -467,7 +480,7 @@ public:
FixateTimer = 5000;
if (!(rand()%16))
{
- DoScriptText(SUFF_SAY_AGGRO, me);
+ Talk(SUFF_SAY_AGGRO);
}
} else FixateTimer -= diff;
}
@@ -480,7 +493,7 @@ public:
{
DoCast(me, SPELL_ENRAGE);
EnrageTimer = 60000;
- DoScriptText(SUFF_EMOTE_ENRAGE, me);
+ Talk(SUFF_EMOTE_ENRAGE);
} else EnrageTimer -= diff;
if (SoulDrainTimer <= diff)
@@ -492,7 +505,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class boss_essence_of_desire : public CreatureScript
@@ -530,7 +542,8 @@ public:
{
damage = 0;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- DoScriptText(SUFF_SAY_RECAP, me);
+ Talk(SUFF_SAY_RECAP);
+ me->SetReactState(REACT_PASSIVE);
}
else
{
@@ -551,14 +564,14 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(DESI_SAY_FREED, me);
+ Talk(DESI_SAY_FREED);
DoZoneInCombat();
DoCast(me, AURA_OF_DESIRE, true);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(DESI_SAY_SLAY1, DESI_SAY_SLAY2, DESI_SAY_SLAY3), me);
+ Talk(DESI_SAY_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -588,14 +601,13 @@ public:
DeadenTimer = urand(25000, 35000);
if (!(rand()%2))
{
- DoScriptText(DESI_SAY_SPEC, me);
+ Talk(DESI_SAY_SPEC);
}
} else DeadenTimer -= diff;
DoMeleeAttackIfReady();
}
};
-
};
class boss_essence_of_anger : public CreatureScript
@@ -637,7 +649,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(ANGER_SAY_FREED, ANGER_SAY_FREED2), me);
+ Talk(ANGER_SAY_FREED);
DoZoneInCombat();
DoCast(me, AURA_OF_ANGER, true);
@@ -645,12 +657,12 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(ANGER_SAY_DEATH, me);
+ Talk(ANGER_SAY_DEATH);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(ANGER_SAY_SLAY1, ANGER_SAY_SLAY2), me);
+ Talk(ANGER_SAY_SLAY);
}
void UpdateAI(const uint32 diff)
@@ -669,7 +681,7 @@ public:
{
if (me->getVictim()->GetGUID() != AggroTargetGUID)
{
- DoScriptText(ANGER_SAY_BEFORE, me);
+ Talk(ANGER_SAY_BEFORE);
DoCast(me, SPELL_SELF_SEETHE, true);
AggroTargetGUID = me->getVictim()->GetGUID();
}
@@ -682,7 +694,7 @@ public:
SoulScreamTimer = urand(9000, 11000);
if (!(rand()%3))
{
- DoScriptText(ANGER_SAY_SPEC, me);
+ Talk(ANGER_SAY_SPEC);
}
} else SoulScreamTimer -= diff;
@@ -690,13 +702,12 @@ public:
{
DoCast(me, SPELL_SPITE_TARGET);
SpiteTimer = 30000;
- DoScriptText(ANGER_SAY_SPEC, me);
+ Talk(ANGER_SAY_SPEC);
} else SpiteTimer -= diff;
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_reliquary_of_souls()
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 630e44429fa..0180281cde3 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
@@ -23,15 +23,21 @@ SDComment: Seems to be complete.
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "black_temple.h"
+#include "Player.h"
-#define SAY_DEATH -1564013
-#define SAY_LOW_HEALTH -1564014
-// Ending cinematic text
-#define SAY_FREE -1564015
-#define SAY_BROKEN_FREE_01 -1564016
-#define SAY_BROKEN_FREE_02 -1564017
+enum ShadeOfAkama
+{
+ SAY_DEATH = 0,
+ SAY_LOW_HEALTH = 1,
+ // Ending cinematic text
+ SAY_FREE = 2,
+ SAY_BROKEN_FREE_01 = 0,
+ SAY_BROKEN_FREE_02 = 1
+};
#define GOSSIP_ITEM "We are ready to fight alongside you, Akama"
@@ -320,7 +326,7 @@ public:
GridSearcherSucceeded = true;
}
}
- } else sLog->outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
+ } else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
}
}
@@ -338,13 +344,13 @@ public:
if (reseting)
return;
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Increasing Death Count for Shade of Akama encounter");
+ sLog->outDebug(LOG_FILTER_TSCR, "Increasing Death Count for Shade of Akama encounter");
++DeathCount;
me->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2);
if (guid)
{
if (Sorcerers.empty())
- sLog->outError("SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid);
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Shade of Akama - attempt to remove guid " UI64FMTD " from Sorcerers list but list is already empty", guid);
else Sorcerers.remove(guid);
}
}
@@ -396,17 +402,17 @@ public:
{
CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID();
Channelers.push_back((*itr)->GetGUID());
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID());
+ sLog->outDebug(LOG_FILTER_TSCR, "Shade of Akama Grid Search found channeler " UI64FMTD ". Adding to list", (*itr)->GetGUID());
}
}
- else sLog->outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy");
+ else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy");
}
void SetSelectableChannelers()
{
if (Channelers.empty())
{
- sLog->outError("SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy");
+ sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy");
return;
}
@@ -532,7 +538,7 @@ void mob_ashtongue_channeler::mob_ashtongue_channelerAI::JustDied(Unit* /*killer
Creature* Shade = (Unit::GetCreature((*me), ShadeGUID));
if (Shade && Shade->isAlive())
CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount();
- else sLog->outError("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
+ else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
}
void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/)
@@ -540,7 +546,7 @@ void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/
Creature* Shade = (Unit::GetCreature((*me), ShadeGUID));
if (Shade && Shade->isAlive())
CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(me->GetGUID());
- else sLog->outError("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama.");
+ else sLog->outError(LOG_FILTER_TSCR, "SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama.");
}
class npc_akama_shade : public CreatureScript
@@ -701,7 +707,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
EventBegun = false;
ShadeHasDied = false;
StartCombat = false;
@@ -726,7 +732,7 @@ public:
if (HealthBelowPct(15) && !HasYelledOnce)
{
- DoScriptText(SAY_LOW_HEALTH, me);
+ Talk(SAY_LOW_HEALTH);
HasYelledOnce = true;
}
@@ -822,7 +828,7 @@ public:
SummonBrokenTimer = 1;
break;
case 1:
- DoScriptText(SAY_FREE, me);
+ Talk(SAY_FREE);
++EndingTalkCount;
SoulRetrieveTimer = 25000;
break;
@@ -835,7 +841,7 @@ public:
{
if (!Yelled)
{
- DoScriptText(SAY_BROKEN_FREE_01, unit);
+ unit->AI()->Talk(SAY_BROKEN_FREE_01);
Yelled = true;
}
unit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
@@ -860,7 +866,7 @@ public:
{
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* unit = Unit::GetCreature((*me), *itr))
- unit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0);
+ unit->AI()->Talk(SAY_BROKEN_FREE_02);
}
SoulRetrieveTimer = 0;
break;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
index ce1732433c8..388052f0a5e 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp
@@ -23,35 +23,40 @@ SDComment: Need to implement molten punch
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#include "black_temple.h"
-#define EMOTE_NEW_TARGET -1564010
-#define EMOTE_PUNCH_GROUND -1564011 //DoScriptText(EMOTE_PUNCH_GROUND, me);
-#define EMOTE_GROUND_CRACK -1564012
-
-//Spells
-#define SPELL_MOLTEN_PUNCH 40126
-#define SPELL_HATEFUL_STRIKE 41926
-#define SPELL_MOLTEN_FLAME 40980
-#define SPELL_VOLCANIC_ERUPTION 40117
-#define SPELL_VOLCANIC_SUMMON 40276
-#define SPELL_BERSERK 45078
-
-#define CREATURE_VOLCANO 23085
-#define CREATURE_STALKER 23095
-
-#define PHASE_STRIKE 1
-#define PHASE_CHASE 2
-
-#define EVENT_BERSERK 1
-#define EVENT_SWITCH_PHASE 2
-#define EVENT_FLAME 3
-#define EVENT_VOLCANO 4
-#define EVENT_SWITCH_TARGET 5
-#define EVENT_HATEFUL_STRIKE 6
-
-#define GCD_CAST 1
+enum Supremus
+{
+ EMOTE_NEW_TARGET = 0,
+ EMOTE_PUNCH_GROUND = 1, //Talk(EMOTE_PUNCH_GROUND);
+ EMOTE_GROUND_CRACK = 2,
+
+ //Spells
+ SPELL_MOLTEN_PUNCH = 40126,
+ SPELL_HATEFUL_STRIKE = 41926,
+ SPELL_MOLTEN_FLAME = 40980,
+ SPELL_VOLCANIC_ERUPTION = 40117,
+ SPELL_VOLCANIC_SUMMON = 40276,
+ SPELL_BERSERK = 45078,
+
+ CREATURE_VOLCANO = 23085,
+ CREATURE_STALKER = 23095,
+
+ PHASE_STRIKE = 1,
+ PHASE_CHASE = 2,
+
+ EVENT_BERSERK = 1,
+ EVENT_SWITCH_PHASE = 2,
+ EVENT_FLAME = 3,
+ EVENT_VOLCANO = 4,
+ EVENT_SWITCH_TARGET = 5,
+ EVENT_HATEFUL_STRIKE = 6,
+
+ GCD_CAST = 1
+};
class molten_flame : public CreatureScript
{
@@ -76,7 +81,6 @@ public:
me->CastSpell(me, SPELL_MOLTEN_FLAME, true);
}
};
-
};
class boss_supremus : public CreatureScript
@@ -181,9 +185,9 @@ public:
uint32 health = 0;
Unit* target = NULL;
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
- for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && me->IsWithinMeleeRange(unit))
@@ -229,7 +233,7 @@ public:
{
DoResetThreat();
me->AddThreat(target, 5000000.0f);
- DoScriptText(EMOTE_NEW_TARGET, me);
+ Talk(EMOTE_NEW_TARGET);
}
events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE);
break;
@@ -241,7 +245,7 @@ public:
{
//DoCast(target, SPELL_VOLCANIC_SUMMON);//movement bugged
me->SummonCreature(CREATURE_VOLCANO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000);
- DoScriptText(EMOTE_GROUND_CRACK, me);
+ Talk(EMOTE_GROUND_CRACK);
events.DelayEvents(1500, GCD_CAST);
}
events.ScheduleEvent(EVENT_VOLCANO, 10000, GCD_CAST, PHASE_CHASE);
@@ -256,7 +260,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
class npc_volcano : public CreatureScript
@@ -301,9 +304,7 @@ public:
}
else wait -= diff;
}
-
};
-
};
void AddSC_boss_supremus()
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index bc12a6c1c6c..ce17ac48cf5 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -23,33 +23,33 @@ SDComment: Requires Mind Control support for Ghosts.
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
- //Speech'n'sound
-#define SAY_INTRO -1564037
-#define SAY_AGGRO -1564038
-#define SAY_SLAY1 -1564039
-#define SAY_SLAY2 -1564040
-#define SAY_SPELL1 -1564041
-#define SAY_SPELL2 -1564042
-#define SAY_SPECIAL1 -1564043
-#define SAY_SPECIAL2 -1564044
-#define SAY_ENRAGE -1564045
-#define SAY_DEATH -1564046
-
-//Spells
-#define SPELL_INCINERATE 40239
-#define SPELL_CRUSHING_SHADOWS 40243
-#define SPELL_SHADOWBOLT 40185
-#define SPELL_PASSIVE_SHADOWFORM 40326
-#define SPELL_SHADOW_OF_DEATH 40251
-#define SPELL_BERSERK 45078
-
-#define SPELL_ATROPHY 40327 // Shadowy Constructs use this when they get within melee range of a player
-
-#define CREATURE_DOOM_BLOSSOM 23123
-#define CREATURE_SHADOWY_CONSTRUCT 23111
+enum DoomBlossom
+{
+ //Speech'n'sound
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_SPELL = 3,
+ SAY_SPECIAL = 4,
+ SAY_ENRAGE = 5,
+ SAY_DEATH = 6,
+
+ //Spells
+ SPELL_INCINERATE = 40239,
+ SPELL_CRUSHING_SHADOWS = 40243,
+ SPELL_SHADOWBOLT = 40185,
+ SPELL_PASSIVE_SHADOWFORM = 40326,
+ SPELL_SHADOW_OF_DEATH = 40251,
+ SPELL_BERSERK = 45078,
+ SPELL_ATROPHY = 40327, // Shadowy Constructs use this when they get within melee range of a player
+
+ CREATURE_DOOM_BLOSSOM = 23123,
+ CREATURE_SHADOWY_CONSTRUCT = 23111
+};
class mob_doom_blossom : public CreatureScript
{
@@ -168,12 +168,12 @@ public:
void CheckPlayers()
{
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- if (m_threatlist.empty())
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ if (threatlist.empty())
return; // No threat list. Don't continue.
- std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
+ ThreatContainer::StorageType::const_iterator itr = threatlist.begin();
std::list<Unit*> targets;
- for (; itr != m_threatlist.end(); ++itr)
+ for (; itr != threatlist.end(); ++itr)
{
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit && unit->isAlive())
@@ -206,7 +206,6 @@ public:
} else CheckTeronTimer -= diff;
}
};
-
};
class boss_teron_gorefiend : public CreatureScript
@@ -278,7 +277,7 @@ public:
me->GetMotionMaster()->Clear(false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
AggroTargetGUID = who->GetGUID();
Intro = true;
@@ -290,7 +289,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -298,7 +297,7 @@ public:
if (instance)
instance->SetData(DATA_TERONGOREFIENDEVENT, DONE);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
float CalculateRandomLocation(float Loc, uint32 radius)
@@ -316,20 +315,20 @@ public:
return coord;
}
- void SetThreatList(Creature* Blossom)
+ void SetThreatList(Creature* blossom)
{
- if (!Blossom)
+ if (!blossom)
return;
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
- for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && unit->isAlive())
{
float threat = DoGetThreat(unit);
- Blossom->AddThreat(unit, threat);
+ blossom->AddThreat(unit, threat);
}
}
}
@@ -343,26 +342,26 @@ public:
/** WHAT IS FULLY NECESSARY FOR GOREFIEND TO BE 100% COMPLETE *****/
/************************************************************************/
- Unit* Ghost = NULL;
+ Unit* ghost = NULL;
if (GhostGUID)
- Ghost = Unit::GetUnit(*me, GhostGUID);
- if (Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH))
+ ghost = Unit::GetUnit(*me, GhostGUID);
+ if (ghost && ghost->isAlive() && ghost->HasAura(SPELL_SHADOW_OF_DEATH))
{
/*float x, y, z;
- Ghost->GetPosition(x, y, z);
+ ghost->GetPosition(x, y, z);
Creature* control = me->SummonCreature(CREATURE_GHOST, x, y, z, 0, TEMPSUMMON_TIMED_DESAWN, 30000);
if (control)
{
- CAST_PLR(Ghost)->Possess(control);
- Ghost->DealDamage(Ghost, Ghost->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL,
+ CAST_PLR(ghost)->Possess(control);
+ ghost->DealDamage(ghost, ghost->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL,
false);
}*/
for (uint8 i = 0; i < 4; ++i)
{
Creature* Construct = NULL;
- float X = CalculateRandomLocation(Ghost->GetPositionX(), 10);
- float Y = CalculateRandomLocation(Ghost->GetPositionY(), 10);
- Construct = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, Y, Ghost->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
+ float X = CalculateRandomLocation(ghost->GetPositionX(), 10);
+ float Y = CalculateRandomLocation(ghost->GetPositionY(), 10);
+ Construct = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, Y, ghost->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
if (Construct)
{
Construct->CastSpell(Construct, SPELL_PASSIVE_SHADOWFORM, true);
@@ -387,7 +386,7 @@ public:
{
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
Done = true;
if (AggroTargetGUID)
@@ -461,7 +460,7 @@ public:
if (target)
{
- DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me);
+ Talk(SAY_SPECIAL);
DoCast(target, SPELL_INCINERATE);
IncinerateTimer = urand(20, 51) * 1000;
}
@@ -494,7 +493,7 @@ public:
if (RandomYellTimer <= diff)
{
- DoScriptText(RAND(SAY_SPELL1, SAY_SPELL2), me);
+ Talk(SAY_SPELL);
RandomYellTimer = urand(50, 101) * 1000;
} else RandomYellTimer -= diff;
@@ -503,14 +502,13 @@ public:
if (EnrageTimer <= diff)
{
DoCast(me, SPELL_BERSERK);
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
} else EnrageTimer -= diff;
}
DoMeleeAttackIfReady();
}
};
-
};
void AddSC_boss_teron_gorefiend()
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 5b2bb8e7bf5..f56d55c36e3 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -23,21 +23,20 @@ SDComment:
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "black_temple.h"
+#include "Player.h"
+#include "SpellInfo.h"
enum eEnums
{
- SAY_AGGRO = -1564000,
- SAY_NEEDLE1 = -1564001,
- SAY_NEEDLE2 = -1564002,
- SAY_SLAY1 = -1564003,
- SAY_SLAY2 = -1564004,
- SAY_SPECIAL1 = -1564005,
- SAY_SPECIAL2 = -1564006,
- SAY_ENRAGE1 = -1564007, //is this text actually in use?
- SAY_ENRAGE2 = -1564008,
- SAY_DEATH = -1564009,
+ SAY_AGGRO = 0,
+ SAY_NEEDLE = 1,
+ SAY_SLAY = 2,
+ SAY_SPECIAL = 3,
+ SAY_ENRAGE = 4,
+ SAY_DEATH = 5,
//Spells
SPELL_NEEDLE_SPINE = 39992,
@@ -94,7 +93,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(urand(0, 1) ? SAY_SLAY1 : SAY_SLAY2, me);
+ Talk(SAY_SLAY);
events.DelayEvents(5000, GCD_YELL);
}
@@ -103,7 +102,7 @@ public:
if (instance)
instance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, DONE);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
@@ -121,7 +120,7 @@ public:
if (instance)
instance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, IN_PROGRESS);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoZoneInCombat();
events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
events.ScheduleEvent(EVENT_YELL, 45000 + (rand()%76)*1000, GCD_YELL);
@@ -163,7 +162,7 @@ public:
ResetTimer(45000);
break;
case EVENT_BERSERK:
- DoScriptText(SAY_ENRAGE2, me);
+ Talk(SAY_ENRAGE);
DoCast(me, SPELL_BERSERK, true);
events.DelayEvents(15000, GCD_YELL);
break;
@@ -177,7 +176,7 @@ public:
SpineTargetGUID = target->GetGUID();
//must let target summon, otherwise you cannot click the spine
target->SummonGameObject(GOBJECT_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
- DoScriptText(urand(0, 1) ? SAY_NEEDLE1 : SAY_NEEDLE2, me);
+ Talk(SAY_NEEDLE);
events.DelayEvents(1500, GCD_CAST);
events.DelayEvents(15000, GCD_YELL);
}
@@ -196,7 +195,7 @@ public:
return;
}
case EVENT_YELL:
- DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me);
+ Talk(SAY_SPECIAL);
events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
events.DelayEvents(15000, GCD_YELL);
break;
diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
index 0742f174ccf..dcbbb76162d 100644
--- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
+++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp
@@ -23,38 +23,75 @@ SDComment: Circle of Healing not working properly.
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
#include "black_temple.h"
-//Speech'n'Sounds
-#define SAY_GATH_SLAY -1564085
-#define SAY_GATH_SLAY_COMNT -1564089
-#define SAY_GATH_DEATH -1564093
-#define SAY_GATH_SPECIAL1 -1564077
-#define SAY_GATH_SPECIAL2 -1564081
-
-#define SAY_VERA_SLAY -1564086
-#define SAY_VERA_COMNT -1564089 //signed for 22949
-#define SAY_VERA_DEATH -1564094
-#define SAY_VERA_SPECIAL1 -1564078
-#define SAY_VERA_SPECIAL2 -1564082
-
-#define SAY_MALA_SLAY -1564087
-#define SAY_MALA_COMNT -1564090
-#define SAY_MALA_DEATH -1564095
-#define SAY_MALA_SPECIAL1 -1564079
-#define SAY_MALA_SPECIAL2 -1564083
-
-#define SAY_ZERE_SLAY -1564088
-#define SAY_ZERE_COMNT -1564091
-#define SAY_ZERE_DEATH -1564096
-#define SAY_ZERE_SPECIAL1 -1564080
-#define SAY_ZERE_SPECIAL2 -1564084
+enum IllidariCouncil
+{
+ //Speech'n'Sounds
+ SAY_GATH_SPECIAL1 = 2,
+ SAY_GATH_SPECIAL2 = 3,
+ SAY_GATH_SLAY = 4,
+ SAY_GATH_COMNT = 5,
+ SAY_GATH_DEATH = 6,
+
+ SAY_MALA_SPECIAL1 = 2,
+ SAY_MALA_SPECIAL2 = 3,
+ SAY_MALA_SLAY = 4,
+ SAY_MALA_COMNT = 5,
+ SAY_MALA_DEATH = 6,
+
+ SAY_ZERE_SPECIAL1 = 2,
+ SAY_ZERE_SPECIAL2 = 3,
+ SAY_ZERE_SLAY = 4,
+ SAY_ZERE_COMNT = 5,
+ SAY_ZERE_DEATH = 6,
+
+ SAY_VERA_SPECIAL1 = 2,
+ SAY_VERA_SPECIAL2 = 3,
+ SAY_VERA_SLAY = 4,
+ SAY_VERA_COMNT = 5,
+ SAY_VERA_DEATH = 6,
+
+ AKAMAID = 23089,
+
+ // High Nethermancer Zerevor's spells
+ SPELL_FLAMESTRIKE = 41481,
+ SPELL_BLIZZARD = 41482,
+ SPELL_ARCANE_BOLT = 41483,
+ SPELL_ARCANE_EXPLOSION = 41524,
+ SPELL_DAMPEN_MAGIC = 41478,
+
+ // Lady Malande's spells
+ SPELL_EMPOWERED_SMITE = 41471,
+ SPELL_CIRCLE_OF_HEALING = 41455,
+ SPELL_REFLECTIVE_SHIELD = 41475,
+ SPELL_REFLECTIVE_SHIELD_T = 33619,
+ SPELL_DIVINE_WRATH = 41472,
+ SPELL_HEAL_VISUAL = 24171,
+
+ // Gathios the Shatterer's spells
+ SPELL_BLESS_PROTECTION = 41450,
+ SPELL_BLESS_SPELLWARD = 41451,
+ SPELL_CONSECRATION = 41541,
+ SPELL_HAMMER_OF_JUSTICE = 41468,
+ SPELL_SEAL_OF_COMMAND = 41469,
+ SPELL_SEAL_OF_BLOOD = 41459,
+ SPELL_CHROMATIC_AURA = 41453,
+ SPELL_DEVOTION_AURA = 41452,
+
+ // Veras Darkshadow's spells
+ SPELL_DEADLY_POISON = 41485,
+ SPELL_ENVENOM = 41487,
+ SPELL_VANISH = 41479,
+ SPELL_BERSERK = 45078
+};
#define ERROR_INST_DATA "SD2 ERROR: Instance Data for Black Temple not set properly; Illidari Council event will not function properly."
-#define AKAMAID 23089
-
struct CouncilYells
{
int32 entry;
@@ -63,53 +100,21 @@ struct CouncilYells
static CouncilYells CouncilAggro[]=
{
- {-1564069, 5000}, // Gathios
- {-1564070, 5500}, // Veras
- {-1564071, 5000}, // Malande
- {-1564072, 0}, // Zerevor
+ {0, 5000}, // Gathios
+ {0, 5500}, // Veras
+ {0, 5000}, // Malande
+ {0, 0}, // Zerevor
};
// Need to get proper timers for this later
static CouncilYells CouncilEnrage[]=
{
- {-1564073, 2000}, // Gathios
- {-1564074, 6000}, // Veras
- {-1564075, 5000}, // Malande
- {-1564076, 0}, // Zerevor
+ {1, 2000}, // Gathios
+ {1, 6000}, // Veras
+ {1, 5000}, // Malande
+ {1, 0}, // Zerevor
};
-// High Nethermancer Zerevor's spells
-#define SPELL_FLAMESTRIKE 41481
-#define SPELL_BLIZZARD 41482
-#define SPELL_ARCANE_BOLT 41483
-#define SPELL_ARCANE_EXPLOSION 41524
-#define SPELL_DAMPEN_MAGIC 41478
-
-// Lady Malande's spells
-#define SPELL_EMPOWERED_SMITE 41471
-#define SPELL_CIRCLE_OF_HEALING 41455
-#define SPELL_REFLECTIVE_SHIELD 41475
-#define SPELL_REFLECTIVE_SHIELD_T 33619
-#define SPELL_DIVINE_WRATH 41472
-#define SPELL_HEAL_VISUAL 24171
-
-// Gathios the Shatterer's spells
-#define SPELL_BLESS_PROTECTION 41450
-#define SPELL_BLESS_SPELLWARD 41451
-#define SPELL_CONSECRATION 41541
-#define SPELL_HAMMER_OF_JUSTICE 41468
-#define SPELL_SEAL_OF_COMMAND 41469
-#define SPELL_SEAL_OF_BLOOD 41459
-#define SPELL_CHROMATIC_AURA 41453
-#define SPELL_DEVOTION_AURA 41452
-
-// Veras Darkshadow's spells
-#define SPELL_DEADLY_POISON 41485
-#define SPELL_ENVENOM 41487
-#define SPELL_VANISH 41479
-
-#define SPELL_BERSERK 45078
-
class mob_blood_elf_council_voice_trigger : public CreatureScript
{
public:
@@ -156,7 +161,7 @@ public:
Council[1] = instance->GetData64(DATA_VERASDARKSHADOW);
Council[2] = instance->GetData64(DATA_LADYMALANDE);
Council[3] = instance->GetData64(DATA_HIGHNETHERMANCERZEREVOR);
- } else sLog->outError(ERROR_INST_DATA);
+ } else sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
}
void EnterCombat(Unit* /*who*/) {}
@@ -176,9 +181,9 @@ public:
{
if (AggroYellTimer <= diff)
{
- if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter]))
+ if (Creature* pMember = Creature::GetCreature(*me, Council[YellCounter]))
{
- DoScriptText(CouncilAggro[YellCounter].entry, pMember);
+ pMember->AI()->Talk(CouncilAggro[YellCounter].entry);
AggroYellTimer = CouncilAggro[YellCounter].timer;
}
++YellCounter;
@@ -191,10 +196,10 @@ public:
{
if (EnrageTimer <= diff)
{
- if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter]))
+ if (Creature* pMember = Creature::GetCreature(*me, Council[YellCounter]))
{
pMember->CastSpell(pMember, SPELL_BERSERK, true);
- DoScriptText(CouncilEnrage[YellCounter].entry, pMember);
+ pMember->AI()->Talk(CouncilEnrage[YellCounter].entry);
EnrageTimer = CouncilEnrage[YellCounter].timer;
}
++YellCounter;
@@ -296,12 +301,11 @@ public:
for (uint8 i = 0; i < 4; ++i)
{
- Unit* Member = NULL;
if (Council[i])
{
- Member = Unit::GetUnit(*me, Council[i]);
- if (Member && Member->isAlive())
- CAST_CRE(Member)->AI()->AttackStart(target);
+ Unit* member = Unit::GetUnit(*me, Council[i]);
+ if (member && member->isAlive())
+ CAST_CRE(member)->AI()->AttackStart(target);
}
}
@@ -403,7 +407,7 @@ struct boss_illidari_councilAI : public ScriptedAI
}
else
{
- sLog->outError(ERROR_INST_DATA);
+ sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
EnterEvadeMode();
return;
}
@@ -451,7 +455,7 @@ struct boss_illidari_councilAI : public ScriptedAI
{
if (!instance)
{
- sLog->outError(ERROR_INST_DATA);
+ sLog->outError(LOG_FILTER_TSCR, ERROR_INST_DATA);
return;
}
@@ -495,12 +499,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_GATH_SLAY, me);
+ Talk(SAY_GATH_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_GATH_DEATH, me);
+ Talk(SAY_GATH_DEATH);
}
Unit* SelectCouncilMember()
@@ -629,12 +633,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_ZERE_SLAY, me);
+ Talk(SAY_ZERE_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_ZERE_DEATH, me);
+ Talk(SAY_ZERE_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -729,12 +733,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_MALA_SLAY, me);
+ Talk(SAY_MALA_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_MALA_DEATH, me);
+ Talk(SAY_MALA_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -815,12 +819,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_VERA_SLAY, me);
+ Talk(SAY_VERA_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_VERA_DEATH, me);
+ Talk(SAY_VERA_DEATH);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
index 49bce6d82c0..8a2e25b176a 100644
--- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
+++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
@@ -23,8 +23,10 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Black Temple
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "black_temple.h"
+#include "Player.h"
#define MAX_ENCOUNTER 9
@@ -137,7 +139,7 @@ public:
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Black Temple: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -236,7 +238,7 @@ public:
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -346,7 +348,7 @@ public:
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
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 3937b213e7e..5a26ffd9acd 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp
@@ -23,68 +23,67 @@ SDComment: Cyclone workaround
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "ScriptedEscortAI.h"
-#define SAY_AGGRO -1548021
-#define SAY_GAIN_BLESSING -1548022
-#define SAY_GAIN_ABILITY1 -1548023
-#define SAY_GAIN_ABILITY2 -1548024
-#define SAY_GAIN_ABILITY3 -1548025
-#define SAY_SLAY1 -1548026
-#define SAY_SLAY2 -1548027
-#define SAY_SLAY3 -1548028
-#define SAY_DEATH -1548029
-
-//Karathress spells
-#define SPELL_CATACLYSMIC_BOLT 38441
-#define SPELL_POWER_OF_SHARKKIS 38455
-#define SPELL_POWER_OF_TIDALVESS 38452
-#define SPELL_POWER_OF_CARIBDIS 38451
-#define SPELL_ENRAGE 24318
-#define SPELL_SEAR_NOVA 38445
-#define SPELL_BLESSING_OF_THE_TIDES 38449
-
-//Sharkkis spells
-#define SPELL_LEECHING_THROW 29436
-#define SPELL_THE_BEAST_WITHIN 38373
-#define SPELL_MULTISHOT 38366
-#define SPELL_SUMMON_FATHOM_LURKER 38433
-#define SPELL_SUMMON_FATHOM_SPOREBAT 38431
-#define SPELL_PET_ENRAGE 19574
-
-//Tidalvess spells
-#define SPELL_FROST_SHOCK 38234
-#define SPELL_SPITFIRE_TOTEM 38236
-#define SPELL_POISON_CLEANSING_TOTEM 38306
-// Spell obsolete
-// #define SPELL_POISON_CLEANSING_EFFECT 8167
-#define SPELL_EARTHBIND_TOTEM 38304
-#define SPELL_EARTHBIND_TOTEM_EFFECT 6474
-#define SPELL_WINDFURY_WEAPON 38184
-
-//Caribdis Spells
-#define SPELL_WATER_BOLT_VOLLEY 38335
-#define SPELL_TIDAL_SURGE 38358
-#define SPELL_TIDAL_SURGE_FREEZE 38357
-#define SPELL_HEAL 38330
-#define SPELL_SUMMON_CYCLONE 38337
-#define SPELL_CYCLONE_CYCLONE 29538
-
-//Yells and Quotes
-#define SAY_GAIN_BLESSING_OF_TIDES "Your overconfidence will be your undoing! Guards, lend me your strength!"
-#define SOUND_GAIN_BLESSING_OF_TIDES 11278
-#define SAY_MISC "Alana be'lendor!" //don't know what use this
-#define SOUND_MISC 11283
-
-//Summoned Unit GUIDs
-#define CREATURE_CYCLONE 22104
-#define CREATURE_FATHOM_SPOREBAT 22120
-#define CREATURE_FATHOM_LURKER 22119
-#define CREATURE_SPITFIRE_TOTEM 22091
-#define CREATURE_EARTHBIND_TOTEM 22486
-#define CREATURE_POISON_CLEANSING_TOTEM 22487
+enum FathomlordKarathress
+{
+ SAY_AGGRO = 0,
+ SAY_GAIN_BLESSING = 1,
+ SAY_GAIN_ABILITY1 = 2,
+ SAY_GAIN_ABILITY2 = 3,
+ SAY_GAIN_ABILITY3 = 4,
+ SAY_SLAY = 5,
+ SAY_DEATH = 6,
+
+ //Karathress spells
+ SPELL_CATACLYSMIC_BOLT = 38441,
+ SPELL_POWER_OF_SHARKKIS = 38455,
+ SPELL_POWER_OF_TIDALVESS = 38452,
+ SPELL_POWER_OF_CARIBDIS = 38451,
+ SPELL_ENRAGE = 24318,
+ SPELL_SEAR_NOVA = 38445,
+ SPELL_BLESSING_OF_THE_TIDES = 38449,
+
+ //Sharkkis spells
+ SPELL_LEECHING_THROW = 29436,
+ SPELL_THE_BEAST_WITHIN = 38373,
+ SPELL_MULTISHOT = 38366,
+ SPELL_SUMMON_FATHOM_LURKER = 38433,
+ SPELL_SUMMON_FATHOM_SPOREBAT = 38431,
+ SPELL_PET_ENRAGE = 19574,
+
+ //Tidalvess spells
+ SPELL_FROST_SHOCK = 38234,
+ SPELL_SPITFIRE_TOTEM = 38236,
+ SPELL_POISON_CLEANSING_TOTEM = 38306,
+ // Spell obsolete
+ SPELL_EARTHBIND_TOTEM = 38304,
+ SPELL_EARTHBIND_TOTEM_EFFECT = 6474,
+ SPELL_WINDFURY_WEAPON = 38184,
+
+ //Caribdis Spells
+ SPELL_WATER_BOLT_VOLLEY = 38335,
+ SPELL_TIDAL_SURGE = 38358,
+ SPELL_TIDAL_SURGE_FREEZE = 38357,
+ SPELL_HEAL = 38330,
+ SPELL_SUMMON_CYCLONE = 38337,
+ SPELL_CYCLONE_CYCLONE = 29538,
+
+ //Yells and Quotes
+ SOUND_GAIN_BLESSING_OF_TIDES = 11278,
+ SOUND_MISC = 11283,
+
+ //Summoned Unit GUIDs
+ CREATURE_CYCLONE = 22104,
+ CREATURE_FATHOM_SPOREBAT = 22120,
+ CREATURE_FATHOM_LURKER = 22119,
+ CREATURE_SPITFIRE_TOTEM = 22091,
+ CREATURE_EARTHBIND_TOTEM = 22486,
+ CREATURE_POISON_CLEANSING_TOTEM = 22487,
+};
//entry and position for Seer Olum
#define SEER_OLUM 22820
@@ -93,6 +92,9 @@ EndScriptData */
#define OLUM_Z -7.54773f
#define OLUM_O 0.401581f
+#define SAY_GAIN_BLESSING_OF_TIDES "Your overconfidence will be your undoing! Guards, lend me your strength!"
+#define SAY_MISC "Alana be'lendor!" //don't know what use this
+
#define MAX_ADVISORS 3
//Fathom-Lord Karathress AI
class boss_fathomlord_karathress : public CreatureScript
@@ -159,19 +161,19 @@ public:
void EventSharkkisDeath()
{
- DoScriptText(SAY_GAIN_ABILITY1, me);
+ Talk(SAY_GAIN_ABILITY1);
DoCast(me, SPELL_POWER_OF_SHARKKIS);
}
void EventTidalvessDeath()
{
- DoScriptText(SAY_GAIN_ABILITY2, me);
+ Talk(SAY_GAIN_ABILITY2);
DoCast(me, SPELL_POWER_OF_TIDALVESS);
}
void EventCaribdisDeath()
{
- DoScriptText(SAY_GAIN_ABILITY3, me);
+ Talk(SAY_GAIN_ABILITY3);
DoCast(me, SPELL_POWER_OF_CARIBDIS);
}
@@ -192,7 +194,7 @@ public:
GetAdvisors();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoZoneInCombat();
instance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID());
@@ -201,12 +203,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_FATHOMLORDKARATHRESSEVENT, DONE);
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 7abd2bbc8a8..c8589cc05d8 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
@@ -23,46 +23,49 @@ SDComment: Some details and adjustments left to do, probably nothing major. Spaw
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
-#define SAY_AGGRO -1548000
-#define SAY_SWITCH_TO_CLEAN -1548001
-#define SAY_CLEAN_SLAY1 -1548002
-#define SAY_CLEAN_SLAY2 -1548003
-#define SAY_CLEAN_DEATH -1548004
-#define SAY_SWITCH_TO_CORRUPT -1548005
-#define SAY_CORRUPT_SLAY1 -1548006
-#define SAY_CORRUPT_SLAY2 -1548007
-#define SAY_CORRUPT_DEATH -1548008
-
-#define SWITCH_RADIUS 18
-
-#define MODEL_CORRUPT 20609
-#define MODEL_CLEAN 20162
-
-#define SPELL_WATER_TOMB 38235
-#define SPELL_MARK_OF_HYDROSS1 38215
-#define SPELL_MARK_OF_HYDROSS2 38216
-#define SPELL_MARK_OF_HYDROSS3 38217
-#define SPELL_MARK_OF_HYDROSS4 38218
-#define SPELL_MARK_OF_HYDROSS5 38231
-#define SPELL_MARK_OF_HYDROSS6 40584
-#define SPELL_MARK_OF_CORRUPTION1 38219
-#define SPELL_MARK_OF_CORRUPTION2 38220
-#define SPELL_MARK_OF_CORRUPTION3 38221
-#define SPELL_MARK_OF_CORRUPTION4 38222
-#define SPELL_MARK_OF_CORRUPTION5 38230
-#define SPELL_MARK_OF_CORRUPTION6 40583
-#define SPELL_VILE_SLUDGE 38246
-#define SPELL_ENRAGE 27680 //this spell need verification
-#define SPELL_SUMMON_WATER_ELEMENT 36459 //not in use yet(in use ever?)
-#define SPELL_ELEMENTAL_SPAWNIN 25035
-#define SPELL_BLUE_BEAM 40227 //channeled Hydross Beam Helper (not in use yet)
-
-#define ENTRY_PURE_SPAWN 22035
-#define ENTRY_TAINTED_SPAWN 22036
-#define ENTRY_BEAM_DUMMY 21934
+enum HydrossTheUnstable
+{
+ SAY_AGGRO = 0,
+ SAY_SWITCH_TO_CLEAN = 1,
+ SAY_CLEAN_SLAY = 2,
+ SAY_CLEAN_DEATH = 3,
+ SAY_SWITCH_TO_CORRUPT = 4,
+ SAY_CORRUPT_SLAY = 5,
+ SAY_CORRUPT_DEATH = 6,
+
+ SWITCH_RADIUS = 18,
+
+ MODEL_CORRUPT = 20609,
+ MODEL_CLEAN = 20162,
+
+ SPELL_WATER_TOMB = 38235,
+ SPELL_MARK_OF_HYDROSS1 = 38215,
+ SPELL_MARK_OF_HYDROSS2 = 38216,
+ SPELL_MARK_OF_HYDROSS3 = 38217,
+ SPELL_MARK_OF_HYDROSS4 = 38218,
+ SPELL_MARK_OF_HYDROSS5 = 38231,
+ SPELL_MARK_OF_HYDROSS6 = 40584,
+ SPELL_MARK_OF_CORRUPTION1 = 38219,
+ SPELL_MARK_OF_CORRUPTION2 = 38220,
+ SPELL_MARK_OF_CORRUPTION3 = 38221,
+ SPELL_MARK_OF_CORRUPTION4 = 38222,
+ SPELL_MARK_OF_CORRUPTION5 = 38230,
+ SPELL_MARK_OF_CORRUPTION6 = 40583,
+ SPELL_VILE_SLUDGE = 38246,
+ SPELL_ENRAGE = 27680, //this spell need verification
+ SPELL_SUMMON_WATER_ELEMENT = 36459, //not in use yet(in use ever?)
+ SPELL_ELEMENTAL_SPAWNIN = 25035,
+ SPELL_BLUE_BEAM = 40227, //channeled Hydross Beam Helper (not in use yet)
+
+ ENTRY_PURE_SPAWN = 22035,
+ ENTRY_TAINTED_SPAWN = 22036,
+ ENTRY_BEAM_DUMMY = 21934
+};
+
#define HYDROSS_X -239.439f
#define HYDROSS_Y -363.481f
@@ -168,7 +171,7 @@ public:
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, IN_PROGRESS);
@@ -176,10 +179,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- if (CorruptedForm)
- DoScriptText(RAND(SAY_CORRUPT_SLAY1, SAY_CORRUPT_SLAY2), me);
- else
- DoScriptText(RAND(SAY_CLEAN_SLAY1, SAY_CLEAN_SLAY2), me);
+ Talk(CorruptedForm ? SAY_CORRUPT_SLAY : SAY_CLEAN_SLAY);
}
void JustSummoned(Creature* summoned)
@@ -205,10 +205,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- if (CorruptedForm)
- DoScriptText(SAY_CORRUPT_DEATH, me);
- else
- DoScriptText(SAY_CLEAN_DEATH, me);
+ Talk(CorruptedForm ? SAY_CORRUPT_DEATH : SAY_CLEAN_DEATH);
if (instance)
instance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, DONE);
@@ -292,7 +289,7 @@ public:
CorruptedForm = false;
MarkOfHydross_Count = 0;
- DoScriptText(SAY_SWITCH_TO_CLEAN, me);
+ Talk(SAY_SWITCH_TO_CLEAN);
DoResetThreat();
SummonBeams();
@@ -376,7 +373,7 @@ public:
MarkOfCorruption_Count = 0;
CorruptedForm = true;
- DoScriptText(SAY_SWITCH_TO_CORRUPT, me);
+ Talk(SAY_SWITCH_TO_CORRUPT);
DoResetThreat();
DeSummonBeams();
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 18d8b2b5a1e..6c4c51b03fe 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
@@ -23,52 +23,54 @@ SDComment: Missing blizzlike Shield Generators coords
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "Spell.h"
+#include "Player.h"
+#include "WorldSession.h"
-#define SAY_INTRO -1548042
-#define SAY_AGGRO1 -1548043
-#define SAY_AGGRO2 -1548044
-#define SAY_AGGRO3 -1548045
-#define SAY_AGGRO4 -1548046
-#define SAY_PHASE1 -1548047
-#define SAY_PHASE2 -1548048
-#define SAY_PHASE3 -1548049
-#define SAY_BOWSHOT1 -1548050
-#define SAY_BOWSHOT2 -1548051
-#define SAY_SLAY1 -1548052
-#define SAY_SLAY2 -1548053
-#define SAY_SLAY3 -1548054
-#define SAY_DEATH -1548055
-
-#define SPELL_SURGE 38044
-#define SPELL_MULTI_SHOT 38310
-#define SPELL_SHOCK_BLAST 38509
-#define SPELL_ENTANGLE 38316
-#define SPELL_STATIC_CHARGE_TRIGGER 38280
-#define SPELL_FORKED_LIGHTNING 40088
-#define SPELL_SHOOT 40873
-#define SPELL_POISON_BOLT 40095
-#define SPELL_TOXIC_SPORES 38575
-#define SPELL_MAGIC_BARRIER 38112
-
-#define MIDDLE_X 30.134f
-#define MIDDLE_Y -923.65f
-#define MIDDLE_Z 42.9f
-
-#define SPOREBAT_X 30.977156f
+enum LadyVashj
+{
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_PHASE1 = 2,
+ SAY_PHASE2 = 3,
+ SAY_PHASE3 = 4,
+ SAY_BOWSHOT = 5,
+ SAY_SLAY = 6,
+ SAY_DEATH = 7,
+
+ SPELL_SURGE = 38044,
+ SPELL_MULTI_SHOT = 38310,
+ SPELL_SHOCK_BLAST = 38509,
+ SPELL_ENTANGLE = 38316,
+ SPELL_STATIC_CHARGE_TRIGGER = 38280,
+ SPELL_FORKED_LIGHTNING = 40088,
+ SPELL_SHOOT = 40873,
+ SPELL_POISON_BOLT = 40095,
+ SPELL_TOXIC_SPORES = 38575,
+ SPELL_MAGIC_BARRIER = 38112,
+
+ SHIED_GENERATOR_CHANNEL = 19870,
+ ENCHANTED_ELEMENTAL = 21958,
+ TAINTED_ELEMENTAL = 22009,
+ COILFANG_STRIDER = 22056,
+ COILFANG_ELITE = 22055,
+ TOXIC_SPOREBAT = 22140,
+ TOXIC_SPORES_TRIGGER = 22207
+};
+
+#define MIDDLE_X 30.134f
+#define MIDDLE_Y -923.65f
+#define MIDDLE_Z 42.9f
+
+#define SPOREBAT_X 30.977156f
#define SPOREBAT_Y -925.297761f
#define SPOREBAT_Z 77.176567f
#define SPOREBAT_O 5.223932f
-#define SHIED_GENERATOR_CHANNEL 19870
-#define ENCHANTED_ELEMENTAL 21958
-#define TAINTED_ELEMENTAL 22009
-#define COILFANG_STRIDER 22056
-#define COILFANG_ELITE 22055
-#define TOXIC_SPOREBAT 22140
-#define TOXIC_SPORES_TRIGGER 22207
+
#define TEXT_NOT_INITIALIZED "Instance script not initialized"
#define TEXT_ALREADY_DEACTIVATED "Already deactivated"
@@ -199,7 +201,7 @@ public:
JustCreated = false;
} else CanAttack = true;
-
+
for (uint8 i = 0; i < 4; ++i)
if (Unit* remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i]))
remo->setDeathState(JUST_DIED);
@@ -223,12 +225,12 @@ public:
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_LADYVASHJEVENT, DONE);
@@ -236,7 +238,7 @@ public:
void StartEvent()
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3, SAY_AGGRO4), me);
+ Talk(SAY_AGGRO);
Phase = 1;
@@ -266,7 +268,7 @@ public:
if (!Intro)
{
Intro = true;
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
}
if (!CanAttack)
return;
@@ -304,7 +306,7 @@ public:
}
if (rand()%3)
{
- DoScriptText(RAND(SAY_BOWSHOT1, SAY_BOWSHOT2), me);
+ Talk(SAY_BOWSHOT);
}
}
@@ -353,7 +355,7 @@ public:
// Static Charge
// Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);
- if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
+ if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds
StaticChargeTimer = 10000+rand()%20000;
@@ -394,7 +396,7 @@ public:
if (Creature* creature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0))
ShieldGeneratorChannel[i] = creature->GetGUID();
- DoScriptText(SAY_PHASE2, me);
+ Talk(SAY_PHASE2);
}
}
// Phase 3
@@ -524,7 +526,7 @@ public:
me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER);
- DoScriptText(SAY_PHASE3, me);
+ Talk(SAY_PHASE3);
Phase = 3;
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 4876410890c..157473463af 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
@@ -23,50 +23,51 @@ SDComment: Possesion Support
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
+#include "Player.h"
-// --- Spells used by Leotheras The Blind
-#define SPELL_WHIRLWIND 37640
-#define SPELL_CHAOS_BLAST 37674
-#define SPELL_BERSERK 26662
-#define SPELL_INSIDIOUS_WHISPER 37676
-#define SPELL_DUAL_WIELD 42459
-
-// --- Spells used in banish phase ---
-#define BANISH_BEAM 38909
-#define AURA_BANISH 37833
-
-// --- Spells used by Greyheart Spellbinders
-#define SPELL_EARTHSHOCK 39076
-#define SPELL_MINDBLAST 37531
-
-// --- Spells used by Inner Demons and Creature ID
-#define INNER_DEMON_ID 21857
-#define AURA_DEMONIC_ALIGNMENT 37713
-#define SPELL_SHADOWBOLT 39309
-#define SPELL_SOUL_LINK 38007
-#define SPELL_CONSUMING_MADNESS 37749 //not supported by core yet
-
-//Misc.
-#define MODEL_DEMON 20125
-#define MODEL_NIGHTELF 20514
-#define DEMON_FORM 21875
-#define MOB_SPELLBINDER 21806
-#define INNER_DEMON_VICTIM 1
-
-#define SAY_AGGRO -1548009
-#define SAY_SWITCH_TO_DEMON -1548010
-#define SAY_INNER_DEMONS -1548011
-#define SAY_DEMON_SLAY1 -1548012
-#define SAY_DEMON_SLAY2 -1548013
-#define SAY_DEMON_SLAY3 -1548014
-#define SAY_NIGHTELF_SLAY1 -1548015
-#define SAY_NIGHTELF_SLAY2 -1548016
-#define SAY_NIGHTELF_SLAY3 -1548017
-#define SAY_FINAL_FORM -1548018
-#define SAY_FREE -1548019
-#define SAY_DEATH -1548020
+enum LeotherasTheBlind
+{
+ // Spells used by Leotheras The Blind
+ SPELL_WHIRLWIND = 37640,
+ SPELL_CHAOS_BLAST = 37674,
+ SPELL_BERSERK = 26662,
+ SPELL_INSIDIOUS_WHISPER = 37676,
+ SPELL_DUAL_WIELD = 42459,
+
+ // Spells used in banish phase
+ BANISH_BEAM = 38909,
+ AURA_BANISH = 37833,
+
+ // Spells used by Greyheart Spellbinders
+ SPELL_EARTHSHOCK = 39076,
+ SPELL_MINDBLAST = 37531,
+
+ // Spells used by Inner Demons and Creature ID
+ INNER_DEMON_ID = 21857,
+ AURA_DEMONIC_ALIGNMENT = 37713,
+ SPELL_SHADOWBOLT = 39309,
+ SPELL_SOUL_LINK = 38007,
+ SPELL_CONSUMING_MADNESS = 37749,
+
+ //Misc.
+ MODEL_DEMON = 20125,
+ MODEL_NIGHTELF = 20514,
+ DEMON_FORM = 21875,
+ MOB_SPELLBINDER = 21806,
+ INNER_DEMON_VICTIM = 1,
+
+ SAY_AGGRO = 0,
+ SAY_SWITCH_TO_DEMON = 1,
+ SAY_INNER_DEMONS = 2,
+ SAY_DEMON_SLAY = 3,
+ SAY_NIGHTELF_SLAY = 4,
+ SAY_FINAL_FORM = 5,
+ SAY_FREE = 6,
+ SAY_DEATH = 7
+};
class mob_inner_demon : public CreatureScript
{
@@ -102,7 +103,7 @@ public:
victimGUID = guid;
}
- uint64 GetGUID(int32 id/* = 0 */)
+ uint64 GetGUID(int32 id/* = 0 */) const
{
if (id == INNER_DEMON_VICTIM)
return victimGUID;
@@ -170,7 +171,6 @@ public:
DoMeleeAttackIfReady();
}
};
-
};
//Original Leotheras the Blind AI
@@ -262,7 +262,6 @@ public:
Creature* binder = me->SummonCreature(MOB_SPELLBINDER, nx, ny, z, o, TEMPSUMMON_DEAD_DESPAWN, 0);
if (binder)
SpellBinderGUID[i] = binder->GetGUID();
-
}
}
void MoveInLineOfSight(Unit* who)
@@ -289,7 +288,7 @@ public:
void StartEvent()
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_LEOTHERASTHEBLINDEVENT, IN_PROGRESS);
}
@@ -389,19 +388,12 @@ public:
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
- if (DemonForm)
- {
- DoScriptText(RAND(SAY_DEMON_SLAY1, SAY_DEMON_SLAY2, SAY_DEMON_SLAY3), me);
- }
- else
- {
- DoScriptText(RAND(SAY_NIGHTELF_SLAY1, SAY_NIGHTELF_SLAY2, SAY_NIGHTELF_SLAY3), me);
- }
+ Talk(DemonForm ? SAY_DEMON_SLAY : SAY_NIGHTELF_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
//despawn copy
if (Demon)
@@ -493,7 +485,7 @@ public:
//switch to demon form
me->RemoveAurasDueToSpell(SPELL_WHIRLWIND, 0);
me->SetDisplayId(MODEL_DEMON);
- DoScriptText(SAY_SWITCH_TO_DEMON, me);
+ Talk(SAY_SWITCH_TO_DEMON);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0);
DemonForm = true;
@@ -524,9 +516,9 @@ public:
//Summon Inner Demon
if (InnerDemons_Timer <= diff)
{
- std::list<HostileReference*>& ThreatList = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const & ThreatList = me->getThreatManager().getThreatList();
std::vector<Unit*> TargetList;
- for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{
Unit* tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->getVictim()->GetGUID() && TargetList.size()<5)
@@ -556,7 +548,7 @@ public:
}
}
}
- DoScriptText(SAY_INNER_DEMONS, me);
+ Talk(SAY_INNER_DEMONS);
InnerDemons_Timer = 999999;
} else InnerDemons_Timer -= diff;
@@ -595,13 +587,12 @@ public:
IsFinalForm = true;
DemonForm = false;
- DoScriptText(SAY_FINAL_FORM, me);
+ Talk(SAY_FINAL_FORM);
me->SetDisplayId(MODEL_NIGHTELF);
me->LoadEquipment(me->GetEquipmentId());
}
}
};
-
};
//Leotheras the Blind Demon Form AI
@@ -630,7 +621,7 @@ public:
void StartEvent()
{
- DoScriptText(SAY_FREE, me);
+ Talk(SAY_FREE);
}
void KilledUnit(Unit* victim)
@@ -638,7 +629,7 @@ public:
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
- DoScriptText(RAND(SAY_DEMON_SLAY1, SAY_DEMON_SLAY2, SAY_DEMON_SLAY3), me);
+ Talk(SAY_DEMON_SLAY);
}
void JustDied(Unit* /*killer*/)
@@ -811,7 +802,6 @@ public:
void JustDied(Unit* /*killer*/) {}
};
-
};
void AddSC_boss_leotheras_the_blind()
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 00de1802bc9..5bc2344fd70 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp
@@ -23,9 +23,11 @@ SDComment: Coilfang Frenzy, find out how could we fishing in the strangepool
SDCategory: The Lurker Below
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
#include "Spell.h"
+#include "Player.h"
#define SPELL_SPOUT 37433
#define SPELL_SPOUT_ANIM 42835
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 865fb143800..9c7fdadc18a 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp
@@ -23,43 +23,40 @@ SDComment: Water globules don't explode properly, remove hacks
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "serpent_shrine.h"
enum eEnums
{
// Yell
- SAY_AGGRO = -1548030,
- SAY_SUMMON1 = -1548031,
- SAY_SUMMON2 = -1548032,
- SAY_SUMMON_BUBL1 = -1548033,
- SAY_SUMMON_BUBL2 = -1548034,
- SAY_SLAY1 = -1548035,
- SAY_SLAY2 = -1548036,
- SAY_SLAY3 = -1548037,
- SAY_DEATH = -1548038,
+ SAY_AGGRO = 0,
+ SAY_SUMMON = 1,
+ SAY_SUMMON_BUBL = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
// Emotes
- EMOTE_WATERY_GRAVE = -1548039,
- EMOTE_EARTHQUAKE = -1548040,
- EMOTE_WATERY_GLOBULES = -1548041,
+ EMOTE_WATERY_GRAVE = 5,
+ EMOTE_EARTHQUAKE = 6,
+ EMOTE_WATERY_GLOBULES = 7,
// Spells
- SPELL_TIDAL_WAVE = 37730,
- SPELL_WATERY_GRAVE = 38049,
- SPELL_EARTHQUAKE = 37764,
- SPELL_WATERY_GRAVE_EXPLOSION = 37852,
-
- SPELL_WATERY_GRAVE_1 = 38023,
- SPELL_WATERY_GRAVE_2 = 38024,
- SPELL_WATERY_GRAVE_3 = 38025,
- SPELL_WATERY_GRAVE_4 = 37850,
-
- SPELL_SUMMON_WATER_GLOBULE_1 = 37854,
- SPELL_SUMMON_WATER_GLOBULE_2 = 37858,
- SPELL_SUMMON_WATER_GLOBULE_3 = 37860,
- SPELL_SUMMON_WATER_GLOBULE_4 = 37861,
+ SPELL_TIDAL_WAVE = 37730,
+ SPELL_WATERY_GRAVE = 38049,
+ SPELL_EARTHQUAKE = 37764,
+ SPELL_WATERY_GRAVE_EXPLOSION = 37852,
+
+ SPELL_WATERY_GRAVE_1 = 38023,
+ SPELL_WATERY_GRAVE_2 = 38024,
+ SPELL_WATERY_GRAVE_3 = 38025,
+ SPELL_WATERY_GRAVE_4 = 37850,
+
+ SPELL_SUMMON_WATER_GLOBULE_1 = 37854,
+ SPELL_SUMMON_WATER_GLOBULE_2 = 37858,
+ SPELL_SUMMON_WATER_GLOBULE_3 = 37860,
+ SPELL_SUMMON_WATER_GLOBULE_4 = 37861,
// Creatures
- NPC_WATER_GLOBULE = 21913,
- NPC_TIDEWALKER_LURKER = 21920,
+ NPC_WATER_GLOBULE = 21913,
+ NPC_TIDEWALKER_LURKER = 21920
};
float MurlocCords[10][4] =
@@ -129,7 +126,7 @@ public:
void StartEvent()
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, IN_PROGRESS);
@@ -137,12 +134,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, DONE);
@@ -183,7 +180,7 @@ public:
}
else
{
- DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me);
+ Talk(SAY_SUMMON);
for (uint8 i = 0; i < 10; ++i)
{
@@ -192,7 +189,7 @@ public:
if (target && Murloc)
Murloc->AI()->AttackStart(target);
}
- DoScriptText(EMOTE_EARTHQUAKE, me);
+ Talk(EMOTE_EARTHQUAKE);
Earthquake = false;
Earthquake_Timer = 40000+rand()%5000;
}
@@ -234,9 +231,9 @@ public:
}
}
- DoScriptText(RAND(SAY_SUMMON_BUBL1, SAY_SUMMON_BUBL2), me);
+ Talk(SAY_SUMMON_BUBL);
- DoScriptText(EMOTE_WATERY_GRAVE, me);
+ Talk(EMOTE_WATERY_GRAVE);
WateryGrave_Timer = 30000;
} else WateryGrave_Timer -= diff;
@@ -270,7 +267,7 @@ public:
pGlobuleTarget->CastSpell(pGlobuleTarget, globulespell[g], true);
}
}
- DoScriptText(EMOTE_WATERY_GLOBULES, me);
+ Talk(EMOTE_WATERY_GLOBULES);
WateryGlobules_Timer = 25000;
} else WateryGlobules_Timer -= diff;
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
index 3ed3d1a82de..4af38888758 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp
@@ -23,8 +23,11 @@ SDComment: Instance Data Scripts and functions to acquire mobs and set encounter
SDCategory: Coilfang Resevoir, Serpent Shrine Cavern
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "serpent_shrine.h"
+#include "Player.h"
+#include "TemporarySummon.h"
#define MAX_ENCOUNTER 6
#define SPELL_SCALDINGWATER 37284
@@ -241,7 +244,7 @@ class instance_serpent_shrine : public InstanceMapScript
LeotherasEventStarter = data;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -339,7 +342,7 @@ class instance_serpent_shrine : public InstanceMapScript
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
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 48c5a360619..e2d581128fd 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp
@@ -28,23 +28,24 @@ boss_hydromancer_thespia
mob_coilfang_waterelemental
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "steam_vault.h"
-#define SAY_SUMMON -1545000
-#define SAY_AGGRO_1 -1545001
-#define SAY_AGGRO_2 -1545002
-#define SAY_AGGRO_3 -1545003
-#define SAY_SLAY_1 -1545004
-#define SAY_SLAY_2 -1545005
-#define SAY_DEAD -1545006
+enum HydromancerThespia
+{
+ SAY_SUMMON = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_DEAD = 3,
-#define SPELL_LIGHTNING_CLOUD 25033
-#define SPELL_LUNG_BURST 31481
-#define SPELL_ENVELOPING_WINDS 31718
+ SPELL_LIGHTNING_CLOUD = 25033,
+ SPELL_LUNG_BURST = 31481,
+ SPELL_ENVELOPING_WINDS = 31718,
-#define SPELL_WATER_BOLT_VOLLEY 34449
-#define H_SPELL_WATER_BOLT_VOLLEY 37924
+ SPELL_WATER_BOLT_VOLLEY = 34449,
+ H_SPELL_WATER_BOLT_VOLLEY = 37924
+};
class boss_hydromancer_thespia : public CreatureScript
{
@@ -81,7 +82,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEAD, me);
+ Talk(SAY_DEAD);
if (instance)
instance->SetData(TYPE_HYDROMANCER_THESPIA, DONE);
@@ -89,12 +90,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(TYPE_HYDROMANCER_THESPIA, IN_PROGRESS);
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 739168863f4..6a70cb97759 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp
@@ -28,25 +28,23 @@ boss_mekgineer_steamrigger
mob_steamrigger_mechanic
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "steam_vault.h"
-#define SAY_MECHANICS -1545007
-#define SAY_AGGRO_1 -1545008
-#define SAY_AGGRO_2 -1545009
-#define SAY_AGGRO_3 -1545010
-#define SAY_AGGRO_4 -1545011
-#define SAY_SLAY_1 -1545012
-#define SAY_SLAY_2 -1545013
-#define SAY_SLAY_3 -1545014
-#define SAY_DEATH -1545015
+enum MekgineerSteamrigger
+{
+ SAY_MECHANICS = 0,
+ SAY_AGGRO = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
-#define SPELL_SUPER_SHRINK_RAY 31485
-#define SPELL_SAW_BLADE 31486
-#define SPELL_ELECTRIFIED_NET 35107
-#define H_SPELL_ENRAGE 1 //corrent enrage spell not known
+ SPELL_SUPER_SHRINK_RAY = 31485,
+ SPELL_SAW_BLADE = 31486,
+ SPELL_ELECTRIFIED_NET = 35107,
-#define ENTRY_STREAMRIGGER_MECHANIC 17951
+ ENTRY_STREAMRIGGER_MECHANIC = 17951
+};
class boss_mekgineer_steamrigger : public CreatureScript
{
@@ -90,7 +88,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_MEKGINEER_STEAMRIGGER, DONE);
@@ -98,12 +96,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(TYPE_MEKGINEER_STEAMRIGGER, IN_PROGRESS);
@@ -112,7 +110,7 @@ public:
//no known summon spells exist
void SummonMechanichs()
{
- DoScriptText(SAY_MECHANICS, me);
+ Talk(SAY_MECHANICS);
DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC, -5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000);
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 cae1117805a..51c477365a3 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp
@@ -23,24 +23,26 @@ SDComment: Contains workarounds regarding warlord's rage spells not acting as ex
SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "steam_vault.h"
+#include "SpellInfo.h"
-#define SAY_INTRO -1545016
-#define SAY_REGEN -1545017
-#define SAY_AGGRO1 -1545018
-#define SAY_AGGRO2 -1545019
-#define SAY_AGGRO3 -1545020
-#define SAY_SLAY1 -1545021
-#define SAY_SLAY2 -1545022
-#define SAY_DEATH -1545023
-
-#define SPELL_SPELL_REFLECTION 31534
-#define SPELL_IMPALE 39061
-#define SPELL_WARLORDS_RAGE 37081
-#define SPELL_WARLORDS_RAGE_NAGA 31543
-
-#define SPELL_WARLORDS_RAGE_PROC 36453
+enum NagaDistiller
+{
+ SAY_INTRO = 0,
+ SAY_REGEN = 1,
+ SAY_AGGRO = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+
+ SPELL_SPELL_REFLECTION = 31534,
+ SPELL_IMPALE = 39061,
+ SPELL_WARLORDS_RAGE = 37081,
+ SPELL_WARLORDS_RAGE_NAGA = 31543,
+
+ SPELL_WARLORDS_RAGE_PROC = 36453
+};
class mob_naga_distiller : public CreatureScript
{
@@ -137,7 +139,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(TYPE_WARLORD_KALITHRESH, IN_PROGRESS);
@@ -145,7 +147,7 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
@@ -159,7 +161,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_WARLORD_KALITHRESH, DONE);
@@ -174,7 +176,7 @@ public:
{
if (Creature* distiller = me->FindNearestCreature(17954, 100.0f))
{
- DoScriptText(SAY_REGEN, me);
+ Talk(SAY_REGEN);
DoCast(me, SPELL_WARLORDS_RAGE);
CAST_AI(mob_naga_distiller::mob_naga_distillerAI, distiller->AI())->StartRageGen(me);
}
diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
index 51032fd70ed..e8a096a83a1 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp
@@ -23,7 +23,8 @@ SDComment: Instance script and access panel GO
SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "steam_vault.h"
#define MAX_ENCOUNTER 4
@@ -138,7 +139,7 @@ public:
if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL)
HandleGameObject(MainChambersDoor, true);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Steamvault: Access panel used.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used.");
}
m_auiEncounter[0] = data;
break;
@@ -150,7 +151,7 @@ public:
if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL)
HandleGameObject(MainChambersDoor, true);
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Steamvault: Access panel used.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Steamvault: Access panel used.");
}
m_auiEncounter[1] = data;
break;
@@ -166,7 +167,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -182,7 +183,7 @@ public:
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
@@ -199,16 +200,12 @@ public:
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
+
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
index 42d617992ed..54823687e5e 100644
--- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
+++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp
@@ -23,7 +23,8 @@ SDComment: Need confirmation if spell data are same in both modes. Summons shoul
SDCategory: Coilfang Resevoir, Underbog
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_FOUL_SPORES 31673
#define SPELL_ACID_GEYSER 38739
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 f7079e5c664..4006e756ca2 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
@@ -23,7 +23,8 @@ SDComment: Timers may be incorrect
SDCategory: Coilfang Resevoir, Underbog
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#define SPELL_LEVITATE 31704
#define SPELL_SUSPENSION 31719
diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
index 3443103fa70..797d0f0d799 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp
@@ -30,17 +30,13 @@ EndScriptData */
enum eEnums
{
- SAY_AGGRO = -1565010,
- SAY_SLAM1 = -1565011,
- SAY_SLAM2 = -1565012,
- SAY_SHATTER1 = -1565013,
- SAY_SHATTER2 = -1565014,
- SAY_SLAY1 = -1565015,
- SAY_SLAY2 = -1565016,
- SAY_SLAY3 = -1565017,
- SAY_DEATH = -1565018,
-
- EMOTE_GROW = -1565019,
+ SAY_AGGRO = 0,
+ SAY_SLAM = 1,
+ SAY_SHATTER = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+
+ EMOTE_GROW = 5,
SPELL_GROWTH = 36300,
SPELL_CAVE_IN = 36240,
@@ -100,7 +96,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_GRUULEVENT, IN_PROGRESS);
@@ -108,12 +104,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
{
@@ -172,7 +168,7 @@ public:
// Gruul can cast this spell up to 30 times
if (m_uiGrowth_Timer <= uiDiff)
{
- DoScriptText(EMOTE_GROW, me);
+ Talk(EMOTE_GROW);
DoCast(me, SPELL_GROWTH);
m_uiGrowth_Timer = 30000;
}
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 0f42b1b7e53..2d2c36104a2 100644
--- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
+++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp
@@ -23,49 +23,48 @@ SDComment: Correct timers, after whirlwind melee attack bug, prayer of healing
SDCategory: Gruul's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "gruuls_lair.h"
-#define SAY_AGGRO -1565000
-#define SAY_ENRAGE -1565001
-#define SAY_OGRE_DEATH1 -1565002
-#define SAY_OGRE_DEATH2 -1565003
-#define SAY_OGRE_DEATH3 -1565004
-#define SAY_OGRE_DEATH4 -1565005
-#define SAY_SLAY1 -1565006
-#define SAY_SLAY2 -1565007
-#define SAY_SLAY3 -1565008
-#define SAY_DEATH -1565009
-
-// High King Maulgar
-#define SPELL_ARCING_SMASH 39144
-#define SPELL_MIGHTY_BLOW 33230
-#define SPELL_WHIRLWIND 33238
-#define SPELL_BERSERKER_C 26561
-#define SPELL_ROAR 16508
-#define SPELL_FLURRY 33232
-#define SPELL_DUAL_WIELD 29651 //used in phase
-
-// Olm the Summoner
-#define SPELL_DARK_DECAY 33129
-#define SPELL_DEATH_COIL 33130
-#define SPELL_SUMMON_WFH 33131
-
-//Kiggler the Craed
-#define SPELL_GREATER_POLYMORPH 33173
-#define SPELL_LIGHTNING_BOLT 36152
-#define SPELL_ARCANE_SHOCK 33175
-#define SPELL_ARCANE_EXPLOSION 33237
-
-//Blindeye the Seer
-#define SPELL_GREATER_PW_SHIELD 33147
-#define SPELL_HEAL 33144
-#define SPELL_PRAYER_OH 33152
-
-//Krosh Firehand
-#define SPELL_GREATER_FIREBALL 33051
-#define SPELL_SPELLSHIELD 33054
-#define SPELL_BLAST_WAVE 33061
+enum HighKingMaulgar
+{
+ SAY_AGGRO = 0,
+ SAY_ENRAGE = 1,
+ SAY_OGRE_DEATH = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4,
+
+ // High King Maulgar
+ SPELL_ARCING_SMASH = 39144,
+ SPELL_MIGHTY_BLOW = 33230,
+ SPELL_WHIRLWIND = 33238,
+ SPELL_BERSERKER_C = 26561,
+ SPELL_ROAR = 16508,
+ SPELL_FLURRY = 33232,
+ SPELL_DUAL_WIELD = 29651,
+
+ // Olm the Summoner
+ SPELL_DARK_DECAY = 33129,
+ SPELL_DEATH_COIL = 33130,
+ SPELL_SUMMON_WFH = 33131,
+
+ //Kiggler the Craed
+ SPELL_GREATER_POLYMORPH = 33173,
+ SPELL_LIGHTNING_BOLT = 36152,
+ SPELL_ARCANE_SHOCK = 33175,
+ SPELL_ARCANE_EXPLOSION = 33237,
+
+ //Blindeye the Seer
+ SPELL_GREATER_PW_SHIELD = 33147,
+ SPELL_HEAL = 33144,
+ SPELL_PRAYER_OH = 33152,
+
+ //Krosh Firehand
+ SPELL_GREATER_FIREBALL = 33051,
+ SPELL_SPELLSHIELD = 33054,
+ SPELL_BLAST_WAVE = 33061
+};
bool CheckAllBossDied(InstanceScript* instance, Creature* me)
{
@@ -170,12 +169,12 @@ public:
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (CheckAllBossDied(instance, me))
instance->SetData(DATA_MAULGAREVENT, DONE);
@@ -183,7 +182,7 @@ public:
void AddDeath()
{
- DoScriptText(RAND(SAY_OGRE_DEATH1, SAY_OGRE_DEATH2, SAY_OGRE_DEATH3, SAY_OGRE_DEATH4), me);
+ Talk(SAY_OGRE_DEATH);
}
void EnterCombat(Unit* who)
@@ -210,7 +209,7 @@ public:
GetCouncil();
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
instance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID());
instance->SetData(DATA_MAULGAREVENT, IN_PROGRESS);
@@ -268,7 +267,7 @@ public:
if (!Phase2 && HealthBelowPct(50))
{
Phase2 = true;
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
DoCast(me, SPELL_DUAL_WIELD, true);
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0);
diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
index 3514732b53a..120e550bd4e 100644
--- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
+++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Gruul's Lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "gruuls_lair.h"
#define MAX_ENCOUNTER 2
@@ -116,7 +117,7 @@ public:
MaulgarEvent_Tank = data;
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -155,7 +156,7 @@ public:
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -170,15 +171,9 @@ public:
OUT_SAVE_INST_DATA;
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
index e34e86c16a7..ed8c5351493 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h
@@ -39,5 +39,9 @@
#define DATA_PRISON_CELL6 18
#define DATA_PRISON_CELL7 19
#define DATA_PRISON_CELL8 20
+#define DATA_BROGGOK_LEVER 21
+#define ACTION_ACTIVATE_BROGGOK 22
+#define ACTION_RESET_BROGGOK 23
+#define ACTION_PREPARE_BROGGOK 24
#endif
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
index f6b7518661e..4b364d1c0a8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp
@@ -23,12 +23,13 @@ SDComment: pre-event not made
SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blood_furnace.h"
enum eEnums
{
- SAY_AGGRO = -1542008,
+ SAY_AGGRO = 0,
SPELL_SLIME_SPRAY = 30913,
SPELL_POISON_CLOUD = 30916,
@@ -46,9 +47,9 @@ class boss_broggok : public CreatureScript
{
}
- struct boss_broggokAI : public ScriptedAI
+ struct boss_broggokAI : public BossAI
{
- boss_broggokAI(Creature* creature) : ScriptedAI(creature)
+ boss_broggokAI(Creature* creature) : BossAI(creature, DATA_BROGGOK)
{
instance = creature->GetInstanceScript();
}
@@ -58,27 +59,21 @@ class boss_broggok : public CreatureScript
uint32 AcidSpray_Timer;
uint32 PoisonSpawn_Timer;
uint32 PoisonBolt_Timer;
+ bool canAttack;
void Reset()
{
+ _Reset();
AcidSpray_Timer = 10000;
PoisonSpawn_Timer = 5000;
PoisonBolt_Timer = 7000;
- if (instance)
- {
- instance->SetData(TYPE_BROGGOK_EVENT, NOT_STARTED);
- instance->HandleGameObject(instance->GetData64(DATA_DOOR4), true);
- }
+ DoAction(ACTION_RESET_BROGGOK);
+ instance->SetData(TYPE_BROGGOK_EVENT, NOT_STARTED);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
- if (instance)
- {
- instance->SetData(TYPE_BROGGOK_EVENT, IN_PROGRESS);
- instance->HandleGameObject(instance->GetData64(DATA_DOOR4), false);
- }
+ Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -93,7 +88,8 @@ class boss_broggok : public CreatureScript
{
if (!UpdateVictim())
return;
-
+ if (!canAttack)
+ return;
if (AcidSpray_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SLIME_SPRAY);
@@ -131,6 +127,26 @@ class boss_broggok : public CreatureScript
}
}
+ void DoAction(int32 const action)
+ {
+ switch (action)
+ {
+ case ACTION_PREPARE_BROGGOK:
+ me->SetInCombatWithZone();
+ break;
+ case ACTION_ACTIVATE_BROGGOK:
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ canAttack = true;
+ break;
+ case ACTION_RESET_BROGGOK:
+ me->SetReactState(REACT_PASSIVE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ canAttack = false;
+ break;
+ }
+ }
+
};
CreatureAI* GetAI(Creature* creature) const
@@ -139,7 +155,27 @@ class boss_broggok : public CreatureScript
}
};
+class go_broggok_lever : public GameObjectScript
+{
+ public:
+ go_broggok_lever() : GameObjectScript("go_broggok_lever") {}
+
+ bool OnGossipHello(Player* /*player*/, GameObject* go)
+ {
+ if (InstanceScript* instance = go->GetInstanceScript())
+ if (instance->GetData(TYPE_BROGGOK_EVENT) != DONE && instance->GetData(TYPE_BROGGOK_EVENT) != IN_PROGRESS)
+ {
+ instance->SetData(TYPE_BROGGOK_EVENT, IN_PROGRESS);
+ if (Creature* broggok = Creature::GetCreature(*go, instance->GetData64(DATA_BROGGOK)))
+ broggok->AI()->DoAction(ACTION_PREPARE_BROGGOK);
+ }
+ go->UseDoorOrButton();
+ return false;
+ }
+};
+
void AddSC_boss_broggok()
{
new boss_broggok();
+ new go_broggok_lever();
}
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 01873afeaa9..2fe95e1bf4d 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
@@ -28,19 +28,18 @@ boss_kelidan_the_breaker
mob_shadowmoon_channeler
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellAuras.h"
#include "blood_furnace.h"
enum eKelidan
{
- SAY_WAKE = -1542000,
- SAY_ADD_AGGRO_1 = -1542001,
- SAY_ADD_AGGRO_2 = -1542002,
- SAY_ADD_AGGRO_3 = -1542003,
- SAY_KILL_1 = -1542004,
- SAY_KILL_2 = -1542005,
- SAY_NOVA = -1542006,
- SAY_DIE = -1542007,
+ SAY_WAKE = 0,
+ SAY_ADD_AGGRO = 1,
+ SAY_KILL = 2,
+ SAY_NOVA = 3,
+ SAY_DIE = 4,
SPELL_CORRUPTION = 30938,
SPELL_EVOCATION = 30935,
@@ -55,7 +54,9 @@ enum eKelidan
SPELL_VORTEX = 37370,
ENTRY_KELIDAN = 17377,
- ENTRY_CHANNELER = 17653
+ ENTRY_CHANNELER = 17653,
+
+ ACTION_ACTIVATE_ADDS = 92
};
const float ShadowmoonChannelers[5][4]=
@@ -105,13 +106,15 @@ class boss_kelidan_the_breaker : public CreatureScript
Firenova = false;
addYell = false;
SummonChannelers();
+ me->SetReactState(REACT_PASSIVE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
if (instance)
instance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, NOT_STARTED);
}
void EnterCombat(Unit* who)
{
- DoScriptText(SAY_WAKE, me);
+ Talk(SAY_WAKE);
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(true);
DoStartMovement(who);
@@ -124,7 +127,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (rand()%2)
return;
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void ChannelerEngaged(Unit* who)
@@ -132,7 +135,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (who && !addYell)
{
addYell = true;
- DoScriptText(RAND(SAY_ADD_AGGRO_1, SAY_ADD_AGGRO_2, SAY_ADD_AGGRO_3), me);
+ Talk(SAY_ADD_AGGRO);
}
for (uint8 i=0; i<5; ++i)
{
@@ -150,7 +153,8 @@ class boss_kelidan_the_breaker : public CreatureScript
if (channeler && channeler->isAlive())
return;
}
-
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
if (killer)
me->AI()->AttackStart(killer);
}
@@ -187,7 +191,7 @@ class boss_kelidan_the_breaker : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DIE, me);
+ Talk(SAY_DIE);
if (!instance)
return;
@@ -247,7 +251,7 @@ class boss_kelidan_the_breaker : public CreatureScript
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(true);
- DoScriptText(SAY_NOVA, me);
+ Talk(SAY_NOVA);
if (SpellInfo const* nova = sSpellMgr->GetSpellInfo(SPELL_BURNING_NOVA))
{
@@ -267,7 +271,6 @@ class boss_kelidan_the_breaker : public CreatureScript
DoMeleeAttackIfReady();
}
-
};
CreatureAI* GetAI(Creature* creature) const
@@ -293,16 +296,11 @@ class mob_shadowmoon_channeler : public CreatureScript
{
public:
- mob_shadowmoon_channeler()
- : CreatureScript("mob_shadowmoon_channeler")
- {
- }
+ mob_shadowmoon_channeler() : CreatureScript("mob_shadowmoon_channeler") {}
struct mob_shadowmoon_channelerAI : public ScriptedAI
{
- mob_shadowmoon_channelerAI(Creature* creature) : ScriptedAI(creature)
- {
- }
+ mob_shadowmoon_channelerAI(Creature* creature) : ScriptedAI(creature){}
uint32 ShadowBolt_Timer;
uint32 MarkOfShadow_Timer;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
index dc9f83b073d..4dfd7e8a8e8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp
@@ -23,22 +23,20 @@ SDComment: Mind control no support
SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "blood_furnace.h"
enum eEnums
{
- SAY_AGGRO_1 = -1542009,
- SAY_AGGRO_2 = -1542010,
- SAY_AGGRO_3 = -1542011,
- SAY_KILL_1 = -1542012,
- SAY_KILL_2 = -1542013,
- SAY_DIE = -1542014,
-
- SPELL_ACID_SPRAY = 38153, // heroic 38973 ??? 38153
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_DIE = 2,
+
+ SPELL_ACID_SPRAY = 38153,
SPELL_EXPLODING_BREAKER = 30925,
SPELL_KNOCKDOWN = 20276,
- SPELL_DOMINATION = 25772 // ???
+ SPELL_DOMINATION = 25772
};
class boss_the_maker : public CreatureScript
@@ -80,7 +78,7 @@ class boss_the_maker : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
if (!instance)
return;
@@ -91,12 +89,12 @@ class boss_the_maker : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DIE, me);
+ Talk(SAY_DIE);
if (!instance)
return;
diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
index d9f6b7e303e..11e75f054ad 100644
--- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp
@@ -23,8 +23,10 @@ SDComment:
SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "blood_furnace.h"
+#include "CreatureAI.h"
#define ENTRY_SEWER1 181823
#define ENTRY_SEWER2 181766
@@ -34,9 +36,7 @@ class instance_blood_furnace : public InstanceMapScript
{
public:
instance_blood_furnace()
- : InstanceMapScript("instance_blood_furnace", 542)
- {
- }
+ : InstanceMapScript("instance_blood_furnace", 542) {}
struct instance_blood_furnace_InstanceMapScript : public InstanceScript
{
@@ -62,6 +62,18 @@ class instance_blood_furnace : public InstanceMapScript
uint64 PrisonCell7GUID;
uint64 PrisonCell8GUID;
+ std::set<uint64> PrisonersCell5;
+ std::set<uint64> PrisonersCell6;
+ std::set<uint64> PrisonersCell7;
+ std::set<uint64> PrisonersCell8;
+
+ uint8 PrisonerCounter5;
+ uint8 PrisonerCounter6;
+ uint8 PrisonerCounter7;
+ uint8 PrisonerCounter8;
+
+ uint64 BroggokLeverGUID;
+
uint32 m_auiEncounter[MAX_ENCOUNTER];
std::string str_data;
@@ -88,24 +100,45 @@ class instance_blood_furnace : public InstanceMapScript
PrisonCell6GUID = 0;
PrisonCell7GUID = 0;
PrisonCell8GUID = 0;
+
+ PrisonersCell5.clear();
+ PrisonersCell6.clear();
+ PrisonersCell7.clear();
+ PrisonersCell8.clear();
+
+ PrisonerCounter5 = 0;
+ PrisonerCounter6 = 0;
+ PrisonerCounter7 = 0;
+ PrisonerCounter8 = 0;
+
+ BroggokLeverGUID = 0;
}
void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
- case 17381:
- The_MakerGUID = creature->GetGUID();
- break;
- case 17380:
- BroggokGUID = creature->GetGUID();
- break;
- case 17377:
- Kelidan_The_BreakerGUID = creature->GetGUID();
- break;
+ case 17381:
+ The_MakerGUID = creature->GetGUID();
+ break;
+ case 17380:
+ BroggokGUID = creature->GetGUID();
+ break;
+ case 17377:
+ Kelidan_The_BreakerGUID = creature->GetGUID();
+ break;
+ case 17398:
+ StorePrisoner(creature);
+ break;
}
}
+ void OnUnitDeath(Unit* unit)
+ {
+ if (unit && unit->GetTypeId() == TYPEID_UNIT && unit->GetEntry() == 17398)
+ PrisonerDied(unit->GetGUID());
+ }
+
void OnGameObjectCreate(GameObject* go)
{
if (go->GetEntry() == 181766) //Final exit door
@@ -137,9 +170,12 @@ class instance_blood_furnace : public InstanceMapScript
PrisonCell7GUID = go->GetGUID();
if (go->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = go->GetGUID();
+
+ if (go->GetEntry() == 181982)
+ BroggokLeverGUID = go->GetGUID(); //Broggok lever
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
@@ -160,18 +196,25 @@ class instance_blood_furnace : public InstanceMapScript
case DATA_PRISON_CELL6: return PrisonCell6GUID;
case DATA_PRISON_CELL7: return PrisonCell7GUID;
case DATA_PRISON_CELL8: return PrisonCell8GUID;
+ case DATA_BROGGOK_LEVER: return BroggokLeverGUID;
}
-
return 0;
}
- void SetData(uint32 /*type*/, uint32 data)
+ void SetData(uint32 type, uint32 data)
{
- switch (data)
+ switch (type)
{
- case TYPE_THE_MAKER_EVENT: m_auiEncounter[0] = data; break;
- case TYPE_BROGGOK_EVENT: m_auiEncounter[1] = data; break;
- case TYPE_KELIDAN_THE_BREAKER_EVENT: m_auiEncounter[2] = data; break;
+ case TYPE_THE_MAKER_EVENT:
+ m_auiEncounter[0] = data;
+ break;
+ case TYPE_BROGGOK_EVENT:
+ m_auiEncounter[1] = data;
+ UpdateBroggokEvent(data);
+ break;
+ case TYPE_KELIDAN_THE_BREAKER_EVENT:
+ m_auiEncounter[2] = data;
+ break;
}
if (data == DONE)
@@ -188,15 +231,14 @@ class instance_blood_furnace : public InstanceMapScript
}
}
- uint32 GetData(uint32 data)
+ uint32 GetData(uint32 type) const
{
- switch (data)
+ switch (type)
{
case TYPE_THE_MAKER_EVENT: return m_auiEncounter[0];
case TYPE_BROGGOK_EVENT: return m_auiEncounter[1];
case TYPE_KELIDAN_THE_BREAKER_EVENT: return m_auiEncounter[2];
}
-
return 0;
}
@@ -224,6 +266,147 @@ class instance_blood_furnace : public InstanceMapScript
OUT_LOAD_INST_DATA_COMPLETE;
}
+
+ void UpdateBroggokEvent(uint32 data)
+ {
+ switch (data)
+ {
+ case IN_PROGRESS:
+ ActivateCell(DATA_PRISON_CELL5);
+ HandleGameObject(Door4GUID, false);
+ break;
+ case NOT_STARTED:
+ ResetPrisons();
+ HandleGameObject(Door5GUID, false);
+ HandleGameObject(Door4GUID, true);
+ if (GameObject* lever = instance->GetGameObject(BroggokLeverGUID))
+ lever->Respawn();
+ break;
+ }
+ }
+
+ void ResetPrisons()
+ {
+ PrisonerCounter5 = PrisonersCell5.size();
+ ResetPrisoners(PrisonersCell5);
+ HandleGameObject(PrisonCell5GUID, false);
+
+ PrisonerCounter6 = PrisonersCell6.size();
+ ResetPrisoners(PrisonersCell6);
+ HandleGameObject(PrisonCell6GUID, false);
+
+ PrisonerCounter7 = PrisonersCell7.size();
+ ResetPrisoners(PrisonersCell7);
+ HandleGameObject(PrisonCell7GUID, false);
+
+ PrisonerCounter8 = PrisonersCell8.size();
+ ResetPrisoners(PrisonersCell8);
+ HandleGameObject(PrisonCell8GUID, false);
+ }
+
+ void ResetPrisoners(std::set<uint64> prisoners)
+ {
+ for (std::set<uint64>::iterator i = prisoners.begin(); i != prisoners.end(); ++i)
+ if (Creature* prisoner = instance->GetCreature(*i))
+ ResetPrisoner(prisoner);
+ }
+
+ void ResetPrisoner(Creature* prisoner)
+ {
+ if (!prisoner->isAlive())
+ prisoner->Respawn(true);
+ prisoner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ }
+
+ void StorePrisoner(Creature* creature)
+ {
+ float posX = creature->GetPositionX();
+ float posY = creature->GetPositionY();
+
+ if (posX >= 405.0f && posX <= 423.0f)
+ {
+ if (posY >= 106.0f && posY <= 123.0f)
+ {
+ PrisonersCell5.insert(creature->GetGUID());
+ ++PrisonerCounter5;
+ }
+ else if (posY >= 76.0f && posY <= 91.0f)
+ {
+ PrisonersCell6.insert(creature->GetGUID());
+ ++PrisonerCounter6;
+ }
+ else return;
+ }
+ else if (posX >= 490.0f && posX <= 506.0f)
+ {
+ if (posY >= 106.0f && posY <= 123.0f)
+ {
+ PrisonersCell7.insert(creature->GetGUID());
+ ++PrisonerCounter7;
+ }
+ else if (posY >= 76.0f && posY <= 91.0f)
+ {
+ PrisonersCell8.insert(creature->GetGUID());
+ ++PrisonerCounter8;
+ }
+ else
+ return;
+ }
+ else
+ return;
+
+ ResetPrisoner(creature);
+ }
+
+ void PrisonerDied(uint64 guid)
+ {
+ if (PrisonersCell5.find(guid) != PrisonersCell5.end() && --PrisonerCounter5 <= 0)
+ ActivateCell(DATA_PRISON_CELL6);
+ else if (PrisonersCell6.find(guid) != PrisonersCell6.end() && --PrisonerCounter6 <= 0)
+ ActivateCell(DATA_PRISON_CELL7);
+ else if (PrisonersCell7.find(guid) != PrisonersCell7.end() && --PrisonerCounter7 <= 0)
+ ActivateCell(DATA_PRISON_CELL8);
+ else if (PrisonersCell8.find(guid) != PrisonersCell8.end() && --PrisonerCounter8 <= 0)
+ ActivateCell(DATA_DOOR5);
+ }
+
+ void ActivateCell(uint8 id)
+ {
+ switch (id)
+ {
+ case DATA_PRISON_CELL5:
+ HandleGameObject(PrisonCell5GUID,true);
+ ActivatePrisoners(PrisonersCell5);
+ break;
+ case DATA_PRISON_CELL6:
+ HandleGameObject(PrisonCell6GUID,true);
+ ActivatePrisoners(PrisonersCell6);
+ break;
+ case DATA_PRISON_CELL7:
+ HandleGameObject(PrisonCell7GUID,true);
+ ActivatePrisoners(PrisonersCell7);
+ break;
+ case DATA_PRISON_CELL8:
+ HandleGameObject(PrisonCell8GUID,true);
+ ActivatePrisoners(PrisonersCell8);
+ break;
+ case DATA_DOOR5:
+ HandleGameObject(Door5GUID,true);
+ if (Creature* broggok = instance->GetCreature(BroggokGUID))
+ broggok->AI()->DoAction(ACTION_ACTIVATE_BROGGOK);
+ break;
+ }
+ }
+
+ void ActivatePrisoners(std::set<uint64> prisoners)
+ {
+ for (std::set<uint64>::iterator i = prisoners.begin(); i != prisoners.end(); ++i)
+ if (Creature* prisoner = instance->GetCreature(*i))
+ {
+ prisoner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NON_ATTACKABLE);
+ prisoner->SetInCombatWithZone();
+ }
+ }
};
InstanceScript* GetInstanceScript(InstanceMap* map) const
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 2ab2b2b5b2e..a40c2e480bd 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
@@ -23,18 +23,18 @@ SDComment: Temporary solution for orbital/shadow whip-ability. Needs more core s
SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
enum eSays
{
- SAY_AGGRO_1 = -1543009,
- SAY_AGGRO_2 = -1543010,
- SAY_AGGRO_3 = -1543011,
- SAY_SUMMON = -1543012,
- SAY_CURSE = -1543013,
- SAY_KILL_1 = -1543014,
- SAY_DIE = -1543015,
- SAY_WIPE = -1543016,
+ SAY_AGGRO = 0,
+ SAY_SUMMON = 1,
+ SAY_CURSE = 2,
+ SAY_KILL_1 = 3,
+ SAY_DIE = 4,
+ SAY_WIPE = 5,
};
enum eSpells
@@ -77,7 +77,7 @@ class boss_omor_the_unscarred : public CreatureScript
void Reset()
{
- DoScriptText(SAY_WIPE, me);
+ Talk(SAY_WIPE);
OrbitalStrike_Timer = 25000;
ShadowWhip_Timer = 2000;
@@ -92,7 +92,7 @@ class boss_omor_the_unscarred : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
@@ -100,12 +100,12 @@ class boss_omor_the_unscarred : public CreatureScript
if (rand()%2)
return;
- DoScriptText(SAY_KILL_1, me);
+ Talk(SAY_KILL_1);
}
void JustSummoned(Creature* summoned)
{
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
if (Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0))
summoned->AI()->AttackStart(random);
@@ -115,7 +115,7 @@ class boss_omor_the_unscarred : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DIE, me);
+ Talk(SAY_DIE);
}
void UpdateAI(const uint32 diff)
@@ -190,7 +190,7 @@ class boss_omor_the_unscarred : public CreatureScript
if (Aura_Timer <= diff)
{
- DoScriptText(SAY_CURSE, me);
+ Talk(SAY_CURSE);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
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 a5cdebea754..7fa476100d5 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
@@ -23,7 +23,9 @@ Comment:
Category: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellInfo.h"
enum eSpells
{
@@ -37,7 +39,7 @@ enum eSpells
SPELL_REVENGE = 19130,
SPELL_REVENGE_H = 40392,
SPELL_KIDNEY_SHOT = 30621,
- SPELL_FIRE_NOVA_VISUAL = 19823,
+ SPELL_FIRE_NOVA_VISUAL = 19823
};
enum eUnits
@@ -48,20 +50,17 @@ enum eUnits
ENTRY_NAZAN = 17536,
ENTRY_LIQUID_FIRE = 22515,
ENTRY_REINFORCED_FEL_IRON_CHEST = 185168,
- ENTRY_REINFORCED_FEL_IRON_CHEST_H = 185169,
+ ENTRY_REINFORCED_FEL_IRON_CHEST_H = 185169
};
enum eSays
{
- SAY_INTRO = -1543017,
- SAY_WIPE = -1543018,
- SAY_AGGRO_1 = -1543019,
- SAY_AGGRO_2 = -1543020,
- SAY_AGGRO_3 = -1543021,
- SAY_KILL_1 = -1543022,
- SAY_KILL_2 = -1543023,
- SAY_DIE = -1543024,
- EMOTE = -1543025,
+ SAY_INTRO = 0,
+ SAY_WIPE = 1,
+ SAY_AGGRO = 2,
+ SAY_KILL = 3,
+ SAY_DIE = 4,
+ EMOTE = 5
};
const float VazrudenMiddle[3] = {-1406.5f, 1746.5f, 81.2f};
@@ -151,7 +150,7 @@ class boss_nazan : public CreatureScript
if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0))
me->AI()->AttackStart(victim);
DoStartMovement(me->getVictim());
- DoScriptText(EMOTE, me);
+ Talk(EMOTE);
return;
}
else
@@ -227,19 +226,19 @@ class boss_vazruden : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* who)
{
if (who && who->GetEntry() != ENTRY_VAZRUDEN)
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* killer)
{
if (killer && killer != me)
- DoScriptText(SAY_DIE, me);
+ Talk(SAY_DIE);
}
void UpdateAI(const uint32 diff)
@@ -250,7 +249,7 @@ class boss_vazruden : public CreatureScript
{
if (!WipeSaid)
{
- DoScriptText(SAY_WIPE, me);
+ Talk(SAY_WIPE);
WipeSaid = true;
}
me->DisappearAndDie();
@@ -362,7 +361,7 @@ class boss_vazruden_the_herald : public CreatureScript
{
phase = 1;
check = 0;
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
}
}
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 2c00a68321a..156d5cbae2c 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp
@@ -23,19 +23,17 @@ SDComment: Missing adds to heal him. Surge should be used on target furthest awa
SDCategory: Hellfire Citadel, Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
- SAY_TAUNT = -1543000,
- SAY_HEAL = -1543001,
- SAY_SURGE = -1543002,
- SAY_AGGRO_1 = -1543003,
- SAY_AGGRO_2 = -1543004,
- SAY_AGGRO_3 = -1543005,
- SAY_KILL_1 = -1543006,
- SAY_KILL_2 = -1543007,
- SAY_DIE = -1543008,
+ SAY_TAUNT = 0,
+ SAY_HEAL = 1,
+ SAY_SURGE = 2,
+ SAY_AGGRO = 3,
+ SAY_KILL = 4,
+ SAY_DIE = 5
};
enum eSpells
@@ -80,7 +78,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void MoveInLineOfSight(Unit* who)
@@ -98,7 +96,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
}
else if (!HasTaunted && me->IsWithinDistInMap(who, 60.0f))
{
- DoScriptText(SAY_TAUNT, me);
+ Talk(SAY_TAUNT);
HasTaunted = true;
}
}
@@ -106,12 +104,12 @@ class boss_watchkeeper_gargolmar : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DIE, me);
+ Talk(SAY_DIE);
}
void UpdateAI(const uint32 diff)
@@ -129,7 +127,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
if (Surge_Timer <= diff)
{
- DoScriptText(SAY_SURGE, me);
+ Talk(SAY_SURGE);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_SURGE);
@@ -154,7 +152,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript
{
if (HealthBelowPct(40))
{
- DoScriptText(SAY_HEAL, me);
+ Talk(SAY_HEAL);
YelledForHeal = true;
}
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
index 3dab24eab1b..ba7b5afb4c8 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Hellfire Ramparts
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "hellfire_ramparts.h"
class instance_ramparts : public InstanceMapScript
@@ -66,7 +67,7 @@ class instance_ramparts : public InstanceMapScript
void SetData(uint32 uiType, uint32 uiData)
{
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Ramparts: SetData received for type %u with data %u", uiType, uiData);
+ sLog->outDebug(LOG_FILTER_TSCR, "Instance Ramparts: SetData received for type %u with data %u", uiType, uiData);
switch (uiType)
{
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
index 1b29abf1afc..c5f79a2babd 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp
@@ -23,39 +23,28 @@ SDComment: In Development
SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "magtheridons_lair.h"
-
-struct Yell
-{
- int32 id;
-};
-
-static Yell RandomTaunt[]=
-{
- {-1544000},
- {-1544001},
- {-1544002},
- {-1544003},
- {-1544004},
- {-1544005},
-};
+#include "Player.h"
+#include "SpellInfo.h"
enum eSays
{
- SAY_FREED = -1544006,
- SAY_AGGRO = -1544007,
- SAY_BANISH = -1544008,
- SAY_CHAMBER_DESTROY = -1544009,
- SAY_PLAYER_KILLED = -1544010,
- SAY_DEATH = -1544011,
+ SAY_TAUNT = 0,
+ SAY_FREED = 1,
+ SAY_AGGRO = 2,
+ SAY_BANISH = 3,
+ SAY_CHAMBER_DESTROY = 4,
+ SAY_PLAYER_KILLED = 5,
+ SAY_DEATH = 6
};
enum eEmotes
{
- EMOTE_BERSERK = -1544012,
- EMOTE_BLASTNOVA = -1544013,
- EMOTE_BEGIN = -1544014,
+ EMOTE_BERSERK = 7,
+ EMOTE_BLASTNOVA = 8,
+ EMOTE_BEGIN = 9
};
enum eCreatures
@@ -306,7 +295,7 @@ class boss_magtheridon : public CreatureScript
// if 5 clickers from other cubes apply shadow cage
if (ClickerNum >= CLICKERS_COUNT && !me->HasAura(SPELL_SHADOW_CAGE))
{
- DoScriptText(SAY_BANISH, me);
+ Talk(SAY_BANISH);
DoCast(me, SPELL_SHADOW_CAGE, true);
}
else
@@ -319,7 +308,7 @@ class boss_magtheridon : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(SAY_PLAYER_KILLED, me);
+ Talk(SAY_PLAYER_KILLED);
}
void JustDied(Unit* /*killer*/)
@@ -327,7 +316,7 @@ class boss_magtheridon : public CreatureScript
if (instance)
instance->SetData(DATA_MAGTHERIDON_EVENT, DONE);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void MoveInLineOfSight(Unit* /*who*/) {}
@@ -347,7 +336,7 @@ class boss_magtheridon : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE_C);
- DoScriptText(SAY_FREED, me);
+ Talk(SAY_FREED);
}
void UpdateAI(const uint32 diff)
@@ -356,7 +345,7 @@ class boss_magtheridon : public CreatureScript
{
if (RandChat_Timer <= diff)
{
- DoScriptText(RandomTaunt[rand()%6].id, me);
+ Talk(SAY_TAUNT);
RandChat_Timer = 90000;
}
else
@@ -371,7 +360,7 @@ class boss_magtheridon : public CreatureScript
if (Berserk_Timer <= diff)
{
DoCast(me, SPELL_BERSERK, true);
- DoScriptText(EMOTE_BERSERK, me);
+ Talk(EMOTE_BERSERK);
Berserk_Timer = 60000;
}
else
@@ -390,7 +379,7 @@ class boss_magtheridon : public CreatureScript
// to avoid earthquake interruption
if (!me->HasUnitState(UNIT_STATE_STUNNED))
{
- DoScriptText(EMOTE_BLASTNOVA, me);
+ Talk(EMOTE_BLASTNOVA);
DoCast(me, SPELL_BLASTNOVA);
BlastNova_Timer = 60000;
}
@@ -434,7 +423,7 @@ class boss_magtheridon : public CreatureScript
&& !me->HasUnitState(UNIT_STATE_STUNNED)) // shadow cage and earthquake
{
Phase3 = true;
- DoScriptText(SAY_CHAMBER_DESTROY, me);
+ Talk(SAY_CHAMBER_DESTROY);
DoCast(me, SPELL_CAMERA_SHAKE, true);
DoCast(me, SPELL_DEBRIS_KNOCKDOWN, true);
diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
index cb55d627f7d..0bb949d3b90 100644
--- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp
@@ -23,7 +23,9 @@ SDComment:
SDCategory: Hellfire Citadel, Magtheridon's lair
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "InstanceScript.h"
#include "magtheridons_lair.h"
enum eSpells
@@ -121,7 +123,7 @@ class instance_magtheridons_lair : public InstanceMapScript
}
}
- uint64 GetData64(uint32 type)
+ uint64 GetData64(uint32 type) const
{
switch (type)
{
@@ -209,7 +211,7 @@ class instance_magtheridons_lair : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
if (type == DATA_MAGTHERIDON_EVENT)
return m_auiEncounter[0];
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
index 7dfdc40a787..e5b6ea71eb0 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp
@@ -29,41 +29,19 @@ mob_fel_orc_convert
mob_lesser_shadow_fissure
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shattered_halls.h"
-struct Say
-{
- int32 id;
-};
-
-static Say PeonAttacked[]=
-{
- {-1540001},
- {-1540002},
- {-1540003},
- {-1540004},
-};
-static Say PeonDies[]=
-{
- {-1540005},
- {-1540006},
- {-1540007},
- {-1540008},
-};
-
enum eSays
{
- SAY_INTRO = -1540000,
- SAY_TAUNT_1 = -1540009,
- SAY_TAUNT_2 = -1540010,
- SAY_TAUNT_3 = -1540011,
- SAY_AGGRO_1 = -1540012,
- SAY_AGGRO_2 = -1540013,
- SAY_AGGRO_3 = -1540014,
- SAY_SLAY_1 = -1540015,
- SAY_SLAY_2 = -1540016,
- SAY_DIE = -1540017,
+ SAY_INTRO = 0,
+ SAY_PEON_ATTACKED = 1,
+ SAY_PEON_DIES = 2,
+ SAY_TAUNT = 3,
+ SAY_AGGRO = 4,
+ SAY_SLAY = 5,
+ SAY_DIE = 6
};
enum eSpells
@@ -136,7 +114,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
if (PeonEngagedCount >= 4)
return;
- DoScriptText(PeonAttacked[PeonEngagedCount].id, me);
+ Talk(SAY_PEON_ATTACKED);
++PeonEngagedCount;
}
@@ -145,7 +123,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
if (PeonKilledCount >= 4)
return;
- DoScriptText(PeonDies[PeonKilledCount].id, me);
+ Talk(SAY_PEON_DIES);
++PeonKilledCount;
if (PeonKilledCount == 4)
@@ -158,7 +136,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
void DoTauntPeons()
{
- DoScriptText(RAND(SAY_TAUNT_1, SAY_TAUNT_2, SAY_TAUNT_3), me);
+ Talk(SAY_TAUNT);
//TODO: kill the peons first
IsIntroEvent = false;
@@ -189,7 +167,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
if (who->GetTypeId() != TYPEID_PLAYER)
return;
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
IntroOnce = true;
IsIntroEvent = true;
@@ -205,7 +183,7 @@ class boss_grand_warlock_nethekurse : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);
+ Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -221,12 +199,12 @@ class boss_grand_warlock_nethekurse : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DIE, me);
+ Talk(SAY_DIE);
if (!instance)
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 5371473e21e..5d3ff2abcc5 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
@@ -28,14 +28,15 @@ mob_omrogg_heads
boss_warbringer_omrogg
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "shattered_halls.h"
enum eEnums
{
- YELL_DIE_L = -1540039,
- YELL_DIE_R = -1540040,
- EMOTE_ENRAGE = -1540041,
+ YELL_DIE_L = 0,
+ YELL_DIE_R = 1,
+ EMOTE_ENRAGE = 2,
SPELL_BLAST_WAVE = 30600,
SPELL_FEAR = 30584,
@@ -56,49 +57,49 @@ struct Yell
static Yell GoCombat[]=
{
- {-1540018, NPC_LEFT_HEAD},
- {-1540019, NPC_LEFT_HEAD},
- {-1540020, NPC_LEFT_HEAD},
+ {0, NPC_LEFT_HEAD},
+ {1, NPC_LEFT_HEAD},
+ {2, NPC_LEFT_HEAD},
};
static Yell GoCombatDelay[]=
{
- {-1540021, NPC_RIGHT_HEAD},
- {-1540022, NPC_RIGHT_HEAD},
- {-1540023, NPC_RIGHT_HEAD},
+ {0, NPC_RIGHT_HEAD},
+ {1, NPC_RIGHT_HEAD},
+ {2, NPC_RIGHT_HEAD},
};
static Yell Threat[]=
{
- {-1540024, NPC_LEFT_HEAD},
- {-1540025, NPC_RIGHT_HEAD},
- {-1540026, NPC_LEFT_HEAD},
- {-1540027, NPC_LEFT_HEAD},
+ {3, NPC_LEFT_HEAD},
+ {3, NPC_RIGHT_HEAD},
+ {4, NPC_LEFT_HEAD},
+ {5, NPC_LEFT_HEAD},
};
static Yell ThreatDelay1[]=
{
- {-1540028, NPC_RIGHT_HEAD},
- {-1540029, NPC_LEFT_HEAD},
- {-1540030, NPC_RIGHT_HEAD},
- {-1540031, NPC_RIGHT_HEAD},
+ {4, NPC_RIGHT_HEAD},
+ {6, NPC_LEFT_HEAD},
+ {5, NPC_RIGHT_HEAD},
+ {6, NPC_RIGHT_HEAD},
};
static Yell ThreatDelay2[]=
{
- {-1540032, NPC_LEFT_HEAD},
- {-1540033, NPC_RIGHT_HEAD},
- {-1540034, NPC_LEFT_HEAD},
- {-1540035, NPC_LEFT_HEAD},
+ {7, NPC_LEFT_HEAD},
+ {7, NPC_RIGHT_HEAD},
+ {8, NPC_LEFT_HEAD},
+ {9, NPC_LEFT_HEAD},
};
static Yell Killing[]=
{
- {-1540036, NPC_LEFT_HEAD},
- {-1540037, NPC_RIGHT_HEAD},
+ {10, NPC_LEFT_HEAD},
+ {8, NPC_RIGHT_HEAD},
};
static Yell KillingDelay[]=
{
- {-1540038, NPC_RIGHT_HEAD},
- {-1000000, NPC_LEFT_HEAD},
+ {9, NPC_RIGHT_HEAD},
+ {11, NPC_LEFT_HEAD},
};
class mob_omrogg_heads : public CreatureScript
@@ -136,7 +137,7 @@ class mob_omrogg_heads : public CreatureScript
if (Death_Timer <= diff)
{
- DoScriptText(YELL_DIE_R, me);
+ Talk(YELL_DIE_R);
Death_Timer = false;
me->setDeathState(JUST_DIED);
} else Death_Timer -= diff;
@@ -221,17 +222,17 @@ class boss_warbringer_omrogg : public CreatureScript
void DoYellForThreat()
{
- Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID);
- Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID);
+ Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID);
+ Creature* pRightHead = Unit::GetCreature(*me, RightHeadGUID);
if (!pLeftHead || !pRightHead)
return;
ithreat = rand()%4;
- Unit* source = (pLeftHead->GetEntry() == Threat[ithreat].creature ? pLeftHead : pRightHead);
+ Creature* source = (pLeftHead->GetEntry() == Threat[ithreat].creature ? pLeftHead : pRightHead);
- DoScriptText(Threat[ithreat].id, source);
+ source->AI()->Talk(Threat[ithreat].id);
Delay_Timer = 3500;
ThreatYell = true;
@@ -242,11 +243,11 @@ class boss_warbringer_omrogg : public CreatureScript
me->SummonCreature(NPC_LEFT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
me->SummonCreature(NPC_RIGHT_HEAD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_DEAD_DESPAWN, 0);
- if (Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID))
+ if (Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID))
{
iaggro = rand()%3;
- DoScriptText(GoCombat[iaggro].id, pLeftHead);
+ pLeftHead->AI()->Talk(GoCombat[iaggro].id);
Delay_Timer = 3500;
AggroYell = true;
@@ -271,25 +272,25 @@ class boss_warbringer_omrogg : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID);
- Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID);
+ Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID);
+ Creature* pRightHead = Creature::GetCreature(*me, RightHeadGUID);
if (!pLeftHead || !pRightHead)
return;
ikilling = rand()%2;
- Unit* source = (pLeftHead->GetEntry() == Killing[ikilling].creature ? pLeftHead : pRightHead);
+ Creature* source = (pLeftHead->GetEntry() == Killing[ikilling].creature ? pLeftHead : pRightHead);
switch (ikilling)
{
case 0:
- DoScriptText(Killing[ikilling].id, source);
+ source->AI()->Talk(Killing[ikilling].id);
Delay_Timer = 3500;
KillingYell = true;
break;
case 1:
- DoScriptText(Killing[ikilling].id, source);
+ source->AI()->Talk(Killing[ikilling].id);
KillingYell = false;
break;
}
@@ -297,13 +298,13 @@ class boss_warbringer_omrogg : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID);
- Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID);
+ Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID);
+ Creature* pRightHead = Creature::GetCreature(*me, RightHeadGUID);
if (!pLeftHead || !pRightHead)
return;
- DoScriptText(YELL_DIE_L, pLeftHead);
+ pLeftHead->AI()->Talk(YELL_DIE_L);
CAST_AI(mob_omrogg_heads::mob_omrogg_headsAI, CAST_CRE(pRightHead)->AI())->DoDeathYell();
@@ -317,40 +318,40 @@ class boss_warbringer_omrogg : public CreatureScript
{
Delay_Timer = 3500;
- Unit* pLeftHead = Unit::GetUnit(*me, LeftHeadGUID);
- Unit* pRightHead = Unit::GetUnit(*me, RightHeadGUID);
+ Creature* pLeftHead = Creature::GetCreature(*me, LeftHeadGUID);
+ Creature* pRightHead = Creature::GetCreature(*me, RightHeadGUID);
if (!pLeftHead || !pRightHead)
return;
if (AggroYell)
{
- DoScriptText(GoCombatDelay[iaggro].id, pRightHead);
+ pRightHead->AI()->Talk(GoCombatDelay[iaggro].id);
AggroYell = false;
}
if (ThreatYell2)
{
- Unit* source = (pLeftHead->GetEntry() == ThreatDelay2[ithreat].creature ? pLeftHead : pRightHead);
+ Creature* source = (pLeftHead->GetEntry() == ThreatDelay2[ithreat].creature ? pLeftHead : pRightHead);
- DoScriptText(ThreatDelay2[ithreat].id, source);
+ source->AI()->Talk(ThreatDelay2[ithreat].id);
ThreatYell2 = false;
}
if (ThreatYell)
{
- Unit* source = (pLeftHead->GetEntry() == ThreatDelay1[ithreat].creature ? pLeftHead : pRightHead);
+ Creature* source = (pLeftHead->GetEntry() == ThreatDelay1[ithreat].creature ? pLeftHead : pRightHead);
- DoScriptText(ThreatDelay1[ithreat].id, source);
+ source->AI()->Talk(ThreatDelay1[ithreat].id);
ThreatYell = false;
ThreatYell2 = true;
}
if (KillingYell)
{
- Unit* source = (pLeftHead->GetEntry() == KillingDelay[ikilling].creature ? pLeftHead : pRightHead);
+ Creature* source = (pLeftHead->GetEntry() == KillingDelay[ikilling].creature ? pLeftHead : pRightHead);
- DoScriptText(KillingDelay[ikilling].id, source);
+ source->AI()->Talk(KillingDelay[ikilling].id);
KillingYell = false;
}
} else Delay_Timer -= diff;
@@ -372,7 +373,7 @@ class boss_warbringer_omrogg : public CreatureScript
if (BurningMaul_Timer <= diff)
{
- DoScriptText(EMOTE_ENRAGE, me);
+ Talk(EMOTE_ENRAGE);
DoCast(me, SPELL_BURNING_MAUL);
BurningMaul_Timer = 40000;
BlastWave_Timer = 16000;
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 c1489671292..37cd5666f73 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
@@ -27,16 +27,14 @@ EndScriptData */
boss_warchief_kargath_bladefist
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
- SAY_AGGRO1 = -1540042,
- SAY_AGGRO2 = -1540043,
- SAY_AGGRO3 = -1540044,
- SAY_SLAY1 = -1540045,
- SAY_SLAY2 = -1540046,
- SAY_DEATH = -1540047,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2
};
enum eSpells
@@ -110,7 +108,7 @@ class boss_warchief_kargath_bladefist : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_AGGRO1, SAY_AGGRO2, SAY_AGGRO3), me);
+ Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -133,13 +131,13 @@ class boss_warchief_kargath_bladefist : public CreatureScript
{
if (victim->GetTypeId() == TYPEID_PLAYER)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
removeAdds();
}
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
index cc36bf9a385..c7c1cbba880 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp
@@ -23,7 +23,8 @@ SDComment: currently missing info about door. instance not complete
SDCategory: Hellfire Citadel, Shattered Halls
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "shattered_halls.h"
#define MAX_ENCOUNTER 2
@@ -86,7 +87,7 @@ class instance_shattered_halls : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -98,7 +99,7 @@ class instance_shattered_halls : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
index 25207073708..a8be934c710 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
@@ -23,8 +23,10 @@ SDComment:
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
+#include "SpellInfo.h"
enum eSpells
{
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
index 5b5c3ff2326..91ff608a6c7 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp
@@ -32,15 +32,13 @@ EndScriptData */
enum eEnums
{
- SAY_AGGRO = -1550007,
- SAY_SUMMON1 = -1550008,
- SAY_SUMMON2 = -1550009,
- SAY_KILL1 = -1550010,
- SAY_KILL2 = -1550011,
- SAY_KILL3 = -1550012,
- SAY_DEATH = -1550013,
- SAY_VOIDA = -1550014,
- SAY_VOIDB = -1550015,
+ SAY_AGGRO = 0,
+ SAY_SUMMON1 = 1,
+ SAY_SUMMON2 = 2,
+ SAY_KILL = 3,
+ SAY_DEATH = 4,
+ SAY_VOIDA = 5,
+ SAY_VOIDB = 6,
SPELL_ARCANE_MISSILES = 33031,
SPELL_WRATH_OF_THE_ASTROMANCER = 42783,
@@ -149,21 +147,21 @@ class boss_high_astromancer_solarian : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL1, SAY_KILL2, SAY_KILL3), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
me->SetObjectScale(defaultsize);
me->SetDisplayId(MODEL_HUMAN);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_HIGHASTROMANCERSOLARIANEVENT, DONE);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoZoneInCombat();
if (instance)
@@ -333,7 +331,7 @@ class boss_high_astromancer_solarian : public CreatureScript
for (int j=1; j <= 4; j++)
SummonMinion(NPC_SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]);
- DoScriptText(SAY_SUMMON1, me);
+ Talk(SAY_SUMMON1);
Phase2_Timer = 10000;
}
else
@@ -360,7 +358,7 @@ class boss_high_astromancer_solarian : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisible(true);
- DoScriptText(SAY_SUMMON2, me);
+ Talk(SAY_SUMMON2);
AppearDelay = true;
Phase3_Timer = 15000;
}
@@ -394,8 +392,8 @@ class boss_high_astromancer_solarian : public CreatureScript
//To make sure she wont be invisible or not selecatble
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetVisible(true);
- DoScriptText(SAY_VOIDA, me);
- DoScriptText(SAY_VOIDB, me);
+ Talk(SAY_VOIDA);
+ Talk(SAY_VOIDB);
me->SetArmor(WV_ARMOR);
me->SetDisplayId(MODEL_VOIDWALKER);
me->SetObjectScale(defaultsize*2.5f);
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
index 1d8c7e71bef..e87009737f1 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp
@@ -23,49 +23,46 @@ SDComment: SQL, weapon scripts, mind control, need correct spells(interruptible/
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
#include "WorldPacket.h"
+#include "Opcodes.h"
enum eEnums
{
//kael'thas Speech
- SAY_INTRO = -1550016,
- SAY_INTRO_CAPERNIAN = -1550017,
- SAY_INTRO_TELONICUS = -1550018,
- SAY_INTRO_THALADRED = -1550019,
- SAY_INTRO_SANGUINAR = -1550020,
- SAY_PHASE2_WEAPON = -1550021,
- SAY_PHASE3_ADVANCE = -1550022,
- SAY_PHASE4_INTRO2 = -1550023,
- SAY_PHASE5_NUTS = -1550024,
- SAY_SLAY1 = -1550025,
- SAY_SLAY2 = -1550026,
- SAY_SLAY3 = -1550027,
- SAY_MINDCONTROL1 = -1550028,
- SAY_MINDCONTROL2 = -1550029,
- SAY_GRAVITYLAPSE1 = -1550030,
- SAY_GRAVITYLAPSE2 = -1550031,
- SAY_SUMMON_PHOENIX1 = -1550032,
- SAY_SUMMON_PHOENIX2 = -1550033,
- SAY_DEATH = -1550034,
+ SAY_INTRO = 0,
+ SAY_INTRO_CAPERNIAN = 1,
+ SAY_INTRO_TELONICUS = 2,
+ SAY_INTRO_THALADRED = 3,
+ SAY_INTRO_SANGUINAR = 4,
+ SAY_PHASE2_WEAPON = 5,
+ SAY_PHASE3_ADVANCE = 6,
+ SAY_PHASE4_INTRO2 = 7,
+ SAY_PHASE5_NUTS = 8,
+ SAY_SLAY = 9,
+ SAY_MINDCONTROL = 10,
+ SAY_GRAVITYLAPSE = 11,
+ SAY_SUMMON_PHOENIX = 12,
+ SAY_DEATH = 13,
//Thaladred the Darkener speech
- SAY_THALADRED_AGGRO = -1550035,
- SAY_THALADRED_DEATH = -1550036,
- EMOTE_THALADRED_GAZE = -1550037,
+ SAY_THALADRED_AGGRO = 0,
+ SAY_THALADRED_DEATH = 1,
+ EMOTE_THALADRED_GAZE = 2,
//Lord Sanguinar speech
- SAY_SANGUINAR_AGGRO = -1550038,
- SAY_SANGUINAR_DEATH = -1550039,
+ SAY_SANGUINAR_AGGRO = 0,
+ SAY_SANGUINAR_DEATH = 1,
//Grand Astromancer Capernian speech
- SAY_CAPERNIAN_AGGRO = -1550040,
- SAY_CAPERNIAN_DEATH = -1550041,
+ SAY_CAPERNIAN_AGGRO = 0,
+ SAY_CAPERNIAN_DEATH = 1,
//Master Engineer Telonicus speech
- SAY_TELONICUS_AGGRO = -1550042,
- SAY_TELONICUS_DEATH = -1550043,
+ SAY_TELONICUS_AGGRO = 0,
+ SAY_TELONICUS_DEATH = 1,
//Phase 2 spells
SPELL_SUMMON_WEAPONS = 36976,
@@ -175,7 +172,7 @@ struct advisorbase_ai : public ScriptedAI
//reset encounter
if (instance && (instance->GetData(DATA_KAELTHASEVENT) == 1 || instance->GetData(DATA_KAELTHASEVENT) == 3))
- if (Creature* Kaelthas = Unit::GetCreature((*me), instance->GetData64(DATA_KAELTHAS)))
+ if (Creature* Kaelthas = Unit::GetCreature(*me, instance->GetData64(DATA_KAELTHAS)))
Kaelthas->AI()->EnterEvadeMode();
}
@@ -343,7 +340,7 @@ class boss_kaelthas : public CreatureScript
{
for (uint8 i = 0; i < MAX_ADVISORS; ++i)
{
- if (Creature* creature = Unit::GetCreature((*me), m_auiAdvisorGuid[i]))
+ if (Creature* creature = Unit::GetCreature(*me, m_auiAdvisorGuid[i]))
{
creature->Respawn();
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -365,9 +362,9 @@ class boss_kaelthas : public CreatureScript
if (!m_auiAdvisorGuid[0] || !m_auiAdvisorGuid[1] || !m_auiAdvisorGuid[2] || !m_auiAdvisorGuid[3])
{
- sLog->outError("TSCR: Kael'Thas One or more advisors missing, Skipping Phases 1-3");
+ sLog->outError(LOG_FILTER_TSCR, "Kael'Thas One or more advisors missing, Skipping Phases 1-3");
- DoScriptText(SAY_PHASE4_INTRO2, me);
+ Talk(SAY_PHASE4_INTRO2);
Phase = 4;
@@ -378,13 +375,12 @@ class boss_kaelthas : public CreatureScript
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
AttackStart(target);
-
}
else
{
PrepareAdvisors();
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
instance->SetData(DATA_KAELTHASEVENT, 1);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -430,7 +426,7 @@ class boss_kaelthas : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustSummoned(Creature* summoned)
@@ -455,7 +451,7 @@ class boss_kaelthas : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
summons.DespawnAll();
@@ -486,7 +482,7 @@ class boss_kaelthas : public CreatureScript
case 0:
if (Phase_Timer <= diff)
{
- DoScriptText(SAY_INTRO_THALADRED, me);
+ Talk(SAY_INTRO_THALADRED);
//start advisor within 7 seconds
Phase_Timer = 7000;
@@ -498,7 +494,7 @@ class boss_kaelthas : public CreatureScript
case 1:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[0]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[0]));
if (Advisor)
{
@@ -516,11 +512,11 @@ class boss_kaelthas : public CreatureScript
//Subphase 2 - Start
case 2:
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[0]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[0]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
- DoScriptText(SAY_INTRO_SANGUINAR, me);
+ Talk(SAY_INTRO_SANGUINAR);
//start advisor within 12.5 seconds
Phase_Timer = 12500;
@@ -532,7 +528,7 @@ class boss_kaelthas : public CreatureScript
case 3:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[1]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[1]));
if (Advisor)
{
@@ -550,11 +546,11 @@ class boss_kaelthas : public CreatureScript
//Subphase 3 - Start
case 4:
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[1]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[1]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
- DoScriptText(SAY_INTRO_CAPERNIAN, me);
+ Talk(SAY_INTRO_CAPERNIAN);
//start advisor within 7 seconds
Phase_Timer = 7000;
@@ -566,7 +562,7 @@ class boss_kaelthas : public CreatureScript
case 5:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[2]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[2]));
if (Advisor)
{
@@ -584,11 +580,11 @@ class boss_kaelthas : public CreatureScript
//Subphase 4 - Start
case 6:
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[2]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[2]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
- DoScriptText(SAY_INTRO_TELONICUS, me);
+ Talk(SAY_INTRO_TELONICUS);
//start advisor within 8.4 seconds
Phase_Timer = 8400;
@@ -600,7 +596,7 @@ class boss_kaelthas : public CreatureScript
case 7:
if (Phase_Timer <= diff)
{
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[3]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[3]));
if (Advisor)
{
@@ -619,7 +615,7 @@ class boss_kaelthas : public CreatureScript
//End of phase 1
case 8:
- Advisor = (Unit::GetCreature((*me), m_auiAdvisorGuid[3]));
+ Advisor = (Unit::GetCreature(*me, m_auiAdvisorGuid[3]));
if (Advisor && (Advisor->getStandState() == UNIT_STAND_STATE_DEAD))
{
@@ -627,7 +623,7 @@ class boss_kaelthas : public CreatureScript
if (instance)
instance->SetData(DATA_KAELTHASEVENT, 2);
- DoScriptText(SAY_PHASE2_WEAPON, me);
+ Talk(SAY_PHASE2_WEAPON);
PhaseSubphase = 0;
Phase_Timer = 3500;
@@ -668,7 +664,7 @@ class boss_kaelthas : public CreatureScript
{
if (Phase_Timer <= diff)
{
- DoScriptText(SAY_PHASE3_ADVANCE, me);
+ Talk(SAY_PHASE3_ADVANCE);
if (instance)
instance->SetData(DATA_KAELTHASEVENT, 3);
Phase = 3;
@@ -690,10 +686,10 @@ class boss_kaelthas : public CreatureScript
Creature* Advisor;
for (uint8 i = 0; i < MAX_ADVISORS; ++i)
{
- Advisor = Unit::GetCreature((*me), m_auiAdvisorGuid[i]);
+ Advisor = Unit::GetCreature(*me, m_auiAdvisorGuid[i]);
if (!Advisor)
- sLog->outError("SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i);
+ sLog->outError(LOG_FILTER_TSCR, "SD2: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i);
else
CAST_AI(advisorbase_ai, Advisor->AI())->Revive(target);
}
@@ -704,7 +700,7 @@ class boss_kaelthas : public CreatureScript
if (Phase_Timer <= diff)
{
- DoScriptText(SAY_PHASE4_INTRO2, me);
+ Talk(SAY_PHASE4_INTRO2);
Phase = 4;
if (instance)
@@ -786,7 +782,7 @@ class boss_kaelthas : public CreatureScript
if (me->getThreatManager().getThreatList().size() >= 2)
for (uint32 i = 0; i < 3; ++i)
{
- sLog->outDebug(LOG_FILTER_TSCR, "SD2: Kael'Thas mind control not supported.");
+ sLog->outDebug(LOG_FILTER_TSCR, "Kael'Thas mind control not supported.");
//DoCast(unit, SPELL_MIND_CONTROL);
}
@@ -800,7 +796,7 @@ class boss_kaelthas : public CreatureScript
if (Phoenix_Timer <= diff)
{
DoCast(me, SPELL_PHOENIX_ANIMATION);
- DoScriptText(RAND(SAY_SUMMON_PHOENIX1, SAY_SUMMON_PHOENIX2), me);
+ Talk(SAY_SUMMON_PHOENIX);
Phoenix_Timer = 60000;
}
@@ -817,7 +813,7 @@ class boss_kaelthas : public CreatureScript
Phase = 5;
Phase_Timer = 10000;
- DoScriptText(SAY_PHASE5_NUTS, me);
+ Talk(SAY_PHASE5_NUTS);
me->StopMoving();
me->GetMotionMaster()->Clear();
@@ -878,11 +874,12 @@ class boss_kaelthas : public CreatureScript
//Phase 5
if (Phase == 6)
{
-
//GravityLapse_Timer
if (GravityLapse_Timer <= diff)
{
- std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
+ ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
+ ThreatContainer::StorageType::const_iterator i = threatlist.begin();
+
switch (GravityLapse_Phase)
{
case 0:
@@ -893,7 +890,7 @@ class boss_kaelthas : public CreatureScript
me->MonsterMoveWithSpeed(afGravityPos[0], afGravityPos[1], afGravityPos[2], 0);
// 1) Kael'thas will portal the whole raid right into his body
- for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
@@ -911,10 +908,10 @@ class boss_kaelthas : public CreatureScript
break;
case 1:
- DoScriptText(RAND(SAY_GRAVITYLAPSE1, SAY_GRAVITYLAPSE2), me);
+ Talk(SAY_GRAVITYLAPSE);
// 2) At that point he will put a Gravity Lapse debuff on everyone
- for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
@@ -925,8 +922,7 @@ class boss_kaelthas : public CreatureScript
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID());
//Using packet workaround
- WorldPacket data(12);
- data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
+ WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12);
data.append(unit->GetPackGUID());
data << uint32(0);
unit->SendMessageToSet(&data, true);
@@ -947,13 +943,12 @@ class boss_kaelthas : public CreatureScript
case 3:
//Remove flight
- for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
+ for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
//Using packet workaround
- WorldPacket data(12);
- data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
+ WorldPacket data(SMSG_MOVE_UNSET_CAN_FLY, 12);
data.append(unit->GetPackGUID());
data << uint32(0);
unit->SendMessageToSet(&data, true);
@@ -1041,14 +1036,14 @@ class boss_thaladred_the_darkener : public CreatureScript
if (!who || FakeDeath)
return;
- DoScriptText(SAY_THALADRED_AGGRO, me);
+ Talk(SAY_THALADRED_AGGRO);
me->AddThreat(who, 5000000.0f);
}
void JustDied(Unit* /*killer*/)
{
if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3)
- DoScriptText(SAY_THALADRED_DEATH, me);
+ Talk(SAY_THALADRED_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -1070,7 +1065,7 @@ class boss_thaladred_the_darkener : public CreatureScript
{
DoResetThreat();
me->AddThreat(target, 5000000.0f);
- DoScriptText(EMOTE_THALADRED_GAZE, me, target);
+ Talk(EMOTE_THALADRED_GAZE, target->GetGUID());
Gaze_Timer = 8500;
}
}
@@ -1134,13 +1129,13 @@ class boss_lord_sanguinar : public CreatureScript
if (!who || FakeDeath)
return;
- DoScriptText(SAY_SANGUINAR_AGGRO, me);
+ Talk(SAY_SANGUINAR_AGGRO);
}
void JustDied(Unit* /*killer*/)
{
if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3)
- DoScriptText(SAY_SANGUINAR_DEATH, me);
+ Talk(SAY_SANGUINAR_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -1205,7 +1200,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
void JustDied(Unit* /*killer*/)
{
if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3)
- DoScriptText(SAY_CAPERNIAN_DEATH, me);
+ Talk(SAY_CAPERNIAN_DEATH);
}
void AttackStart(Unit* who)
@@ -1249,7 +1244,7 @@ class boss_grand_astromancer_capernian : public CreatureScript
{
if (Yell_Timer <= diff)
{
- DoScriptText(SAY_CAPERNIAN_AGGRO, me);
+ Talk(SAY_CAPERNIAN_AGGRO);
Yell = true;
}
else
@@ -1286,8 +1281,8 @@ class boss_grand_astromancer_capernian : public CreatureScript
{
bool InMeleeRange = false;
Unit* target = NULL;
- std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
+ ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i!= threatlist.end(); ++i)
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
//if in melee range
@@ -1344,7 +1339,7 @@ class boss_master_engineer_telonicus : public CreatureScript
void JustDied(Unit* /*killer*/)
{
if (instance && instance->GetData(DATA_KAELTHASEVENT) == 3)
- DoScriptText(SAY_TELONICUS_DEATH, me);
+ Talk(SAY_TELONICUS_DEATH);
}
void EnterCombat(Unit* who)
@@ -1355,7 +1350,7 @@ class boss_master_engineer_telonicus : public CreatureScript
if (!who || FakeDeath)
return;
- DoScriptText(SAY_TELONICUS_AGGRO, me);
+ Talk(SAY_TELONICUS_AGGRO);
}
void UpdateAI(const uint32 diff)
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 275a72e75ac..14895f1d898 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp
@@ -23,18 +23,16 @@ SDComment: Should reset if raid are out of room.
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
enum eEnums
{
- SAY_AGGRO = -1550000,
- SAY_SLAY1 = -1550001,
- SAY_SLAY2 = -1550002,
- SAY_SLAY3 = -1550003,
- SAY_DEATH = -1550004,
- SAY_POUNDING1 = -1550005,
- SAY_POUNDING2 = -1550006,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_DEATH = 2,
+ SAY_POUNDING = 3,
SPELL_POUNDING = 34162,
SPELL_ARCANE_ORB = 34172,
@@ -82,12 +80,12 @@ class boss_void_reaver : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2, SAY_SLAY3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
DoZoneInCombat();
if (instance)
@@ -96,7 +94,7 @@ class boss_void_reaver : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
instance->SetData(DATA_VOIDREAVEREVENT, IN_PROGRESS);
@@ -110,7 +108,7 @@ class boss_void_reaver : public CreatureScript
if (Pounding_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_POUNDING);
- DoScriptText(RAND(SAY_POUNDING1, SAY_POUNDING2), me);
+ Talk(SAY_POUNDING);
Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000)
}
else
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
index f25b6749055..e9ee5a62bb8 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Tempest Keep, The Eye
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "the_eye.h"
#define MAX_ENCOUNTER 5
@@ -112,7 +113,7 @@ class instance_the_eye : public InstanceMapScript
}
}
- uint64 GetData64(uint32 identifier)
+ uint64 GetData64(uint32 identifier) const
{
switch (identifier)
{
@@ -150,7 +151,7 @@ class instance_the_eye : public InstanceMapScript
SaveToDB();
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -165,16 +166,12 @@ class instance_the_eye : public InstanceMapScript
std::string GetSaveData()
{
OUT_SAVE_INST_DATA;
+
std::ostringstream stream;
stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
- char* out = new char[stream.str().length() + 1];
- strcpy(out, stream.str().c_str());
- if (out)
- {
- OUT_SAVE_INST_DATA_COMPLETE;
- return out;
- }
- return NULL;
+
+ OUT_SAVE_INST_DATA_COMPLETE;
+ return stream.str();
}
void Load(const char* in)
diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
index 421f9f2f545..a38ad1d734e 100644
--- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.cpp
@@ -27,7 +27,8 @@ EndScriptData */
mob_crystalcore_devastator
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "the_eye.h"
enum eSpells
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 4d579ac8c16..1d816f1eee3 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_gyrokill.cpp
@@ -23,7 +23,8 @@ SDComment: Place Holder
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
//not used
#define SAY_AGGRO -1554000
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 a1287a57402..15241e35a4a 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_gatewatcher_ironhand.cpp
@@ -23,17 +23,16 @@ SDComment:
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
- SAY_AGGRO_1 = -1554006,
- SAY_HAMMER_1 = -1554007,
- SAY_HAMMER_2 = -1554008,
- SAY_SLAY_1 = -1554009,
- SAY_SLAY_2 = -1554010,
- SAY_DEATH_1 = -1554011,
- EMOTE_HAMMER = -1554012,
+ SAY_AGGRO = 0,
+ SAY_HAMMER = 1,
+ SAY_SLAY = 2,
+ SAY_DEATH = 3,
+ EMOTE_HAMMER = 4
};
enum eSpells
@@ -75,7 +74,7 @@ class boss_gatewatcher_iron_hand : public CreatureScript
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO_1, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
@@ -83,12 +82,12 @@ class boss_gatewatcher_iron_hand : public CreatureScript
if (rand()%2)
return;
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH_1, me);
+ Talk(SAY_DEATH);
//TODO: Add door check/open code
}
@@ -111,14 +110,14 @@ class boss_gatewatcher_iron_hand : public CreatureScript
if (Jackhammer_Timer <= diff)
{
//TODO: expect cast this about 5 times in a row (?), announce it by emote only once
- DoScriptText(EMOTE_HAMMER, me);
+ Talk(EMOTE_HAMMER);
DoCast(me->getVictim(), SPELL_JACKHAMMER);
//chance to yell, but not same time as emote (after spell in fact casted)
if (rand()%2)
- return;
+ return;
- DoScriptText(RAND(SAY_HAMMER_1, SAY_HAMMER_2), me);
+ Talk(SAY_HAMMER);
Jackhammer_Timer = 30000;
}
else
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 1cd67065af1..697d2c9f9f9 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
@@ -18,7 +18,9 @@
//! TODO - Boss not scripted, just ported required spellscript from core
#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "SpellScript.h"
+#include "Player.h"
enum Spells
{
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 59837fdbed1..1602ea56d93 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
@@ -23,18 +23,17 @@ SDComment: Need adjustments to initial summons
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "mechanar.h"
enum eSays
{
- SAY_AGGRO = -1554013,
- SAY_SUMMON = -1554014,
- SAY_DRAGONS_BREATH_1 = -1554015,
- SAY_DRAGONS_BREATH_2 = -1554016,
- SAY_SLAY1 = -1554017,
- SAY_SLAY2 = -1554018,
- SAY_DEATH = -1554019,
+ SAY_AGGRO = 0,
+ SAY_SUMMON = 1,
+ SAY_DRAGONS_BREATH = 2,
+ SAY_SLAY = 3,
+ SAY_DEATH = 4
};
enum eSpells
@@ -91,19 +90,19 @@ class boss_nethermancer_sepethrea : public CreatureScript
if (instance)
instance->SetData(DATA_NETHERMANCER_EVENT, IN_PROGRESS);
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
DoCast(who, SPELL_SUMMON_RAGIN_FLAMES);
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_NETHERMANCER_EVENT, DONE);
}
@@ -139,7 +138,7 @@ class boss_nethermancer_sepethrea : public CreatureScript
{
if (rand()%2)
return;
- DoScriptText(RAND(SAY_DRAGONS_BREATH_1, SAY_DRAGONS_BREATH_2), me);
+ Talk(SAY_DRAGONS_BREATH);
}
dragons_breath_Timer = urand(12000, 22000);
}
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 3a4d449707d..adf1aac0639 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
@@ -23,18 +23,17 @@ SDComment: Event missing. Script for himself 99% blizzlike.
SDCategory: Tempest Keep, The Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
- SAY_AGGRO = -1554020,
- SAY_DOMINATION_1 = -1554021,
- SAY_DOMINATION_2 = -1554022,
- SAY_SUMMON = -1554023,
- SAY_ENRAGE = -1554024,
- SAY_SLAY_1 = -1554025,
- SAY_SLAY_2 = -1554026,
- SAY_DEATH = -1554027,
+ SAY_AGGRO = 0,
+ SAY_DOMINATION = 1,
+ SAY_SUMMON = 2,
+ SAY_ENRAGE = 3,
+ SAY_SLAY = 4,
+ SAY_DEATH = 5
};
// Spells to be casted
enum eSpells
@@ -95,17 +94,17 @@ class boss_pathaleon_the_calculator : public CreatureScript
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
summons.DespawnAll();
}
@@ -134,7 +133,7 @@ class boss_pathaleon_the_calculator : public CreatureScript
if (target && Wraith)
Wraith->AI()->AttackStart(target);
}
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
Summon_Timer = urand(30000, 45000);
}
else
@@ -160,7 +159,7 @@ class boss_pathaleon_the_calculator : public CreatureScript
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
{
- DoScriptText(RAND(SAY_DOMINATION_1, SAY_DOMINATION_2), me);
+ Talk(SAY_DOMINATION);
DoCast(target, SPELL_DOMINATION);
}
Domination_Timer = urand(25000, 30000);
@@ -183,7 +182,7 @@ class boss_pathaleon_the_calculator : public CreatureScript
if (!Enraged && HealthBelowPct(21))
{
DoCast(me, SPELL_FRENZY);
- DoScriptText(SAY_ENRAGE, me);
+ Talk(SAY_ENRAGE);
Enraged = true;
}
diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
index ad3c899237f..37e314b6576 100644
--- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
+++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp
@@ -23,7 +23,8 @@ SDComment:
SDCategory: Mechanar
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "mechanar.h"
#define MAX_ENCOUNTER 1
@@ -56,7 +57,7 @@ class instance_mechanar : public InstanceMapScript
return false;
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -66,7 +67,7 @@ class instance_mechanar : public InstanceMapScript
return false;
}
- uint64 GetData64(uint32 /*identifier*/)
+ uint64 GetData64(uint32 /*identifier*/) const
{
return 0;
}
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
index d675b438968..f45ece47220 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp
@@ -29,7 +29,8 @@ npc_warden_mellichar
mob_zerekethvoidzone
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "arcatraz.h"
/*#####
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 c2eeaf9fe7a..8a107090a28 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
@@ -28,21 +28,19 @@ boss_harbinger_skyriss
boss_harbinger_skyriss_illusion
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "arcatraz.h"
enum eSays
{
- SAY_INTRO = -1552000,
- SAY_AGGRO = -1552001,
- SAY_KILL_1 = -1552002,
- SAY_KILL_2 = -1552003,
- SAY_MIND_1 = -1552004,
- SAY_MIND_2 = -1552005,
- SAY_FEAR_1 = -1552006,
- SAY_FEAR_2 = -1552007,
- SAY_IMAGE = -1552008,
- SAY_DEATH = -1552009,
+ SAY_INTRO = 0,
+ SAY_AGGRO = 1,
+ SAY_KILL = 2,
+ SAY_MIND = 3,
+ SAY_FEAR = 4,
+ SAY_IMAGE = 5,
+ SAY_DEATH = 6
};
enum eSpells
@@ -114,7 +112,7 @@ class boss_harbinger_skyriss : public CreatureScript
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(TYPE_HARBINGERSKYRISS, DONE);
}
@@ -138,7 +136,7 @@ class boss_harbinger_skyriss : public CreatureScript
if (victim->GetEntry() == 21436)
return;
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void DoSplit(uint32 val)
@@ -146,7 +144,7 @@ class boss_harbinger_skyriss : public CreatureScript
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
- DoScriptText(SAY_IMAGE, me);
+ Talk(SAY_IMAGE);
if (val == 66)
DoCast(me, SPELL_66_ILLUSION);
@@ -166,13 +164,13 @@ class boss_harbinger_skyriss : public CreatureScript
switch (Intro_Phase)
{
case 1:
- DoScriptText(SAY_INTRO, me);
+ Talk(SAY_INTRO);
instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), true);
++Intro_Phase;
Intro_Timer = 25000;
break;
case 2:
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (Unit* mellic = Unit::GetUnit(*me, instance->GetData64(DATA_MELLICHAR)))
{
//should have a better way to do this. possibly spell exist.
@@ -223,7 +221,7 @@ class boss_harbinger_skyriss : public CreatureScript
if (me->IsNonMeleeSpellCasted(false))
return;
- DoScriptText(RAND(SAY_FEAR_1, SAY_FEAR_2), me);
+ Talk(SAY_FEAR);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
DoCast(target, SPELL_FEAR);
@@ -240,7 +238,7 @@ class boss_harbinger_skyriss : public CreatureScript
if (me->IsNonMeleeSpellCasted(false))
return;
- DoScriptText(RAND(SAY_MIND_1, SAY_MIND_2), me);
+ Talk(SAY_MIND);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
DoCast(target, SPELL_DOMINATION);
diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
index ffe96fb7bd1..e956ea0ed85 100644
--- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
+++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp
@@ -23,7 +23,8 @@ SDComment: Mainly Harbringer Skyriss event
SDCategory: Tempest Keep, The Arcatraz
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "InstanceScript.h"
#include "arcatraz.h"
#define MAX_ENCOUNTER 9
@@ -229,7 +230,7 @@ class instance_arcatraz : public InstanceMapScript
}
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
switch (type)
{
@@ -243,7 +244,7 @@ class instance_arcatraz : public InstanceMapScript
return 0;
}
- uint64 GetData64(uint32 data)
+ uint64 GetData64(uint32 data) const
{
switch (data)
{
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 ba61a1bfb12..4288061860e 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
@@ -23,16 +23,15 @@ SDComment: some strange visual related to tree form(if aura lost before normal d
SDCategory: Tempest Keep, The Botanica
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
- SAY_AGGRO = -1553000,
- SAY_KILL_1 = -1553001,
- SAY_KILL_2 = -1553002,
- SAY_TREE_1 = -1553003,
- SAY_TREE_2 = -1553004,
- SAY_DEATH = -1553005,
+ SAY_AGGRO = 0,
+ SAY_KILL = 1,
+ SAY_TREE = 2,
+ SAY_DEATH = 3
};
enum eSpells
@@ -82,7 +81,7 @@ class boss_high_botanist_freywinn : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void JustSummoned(Creature* summoned)
@@ -104,12 +103,12 @@ class boss_high_botanist_freywinn : public CreatureScript
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_KILL_1, SAY_KILL_2), me);
+ Talk(SAY_KILL);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void UpdateAI(const uint32 diff)
@@ -119,7 +118,7 @@ class boss_high_botanist_freywinn : public CreatureScript
if (TreeForm_Timer <= diff)
{
- DoScriptText(RAND(SAY_TREE_1, SAY_TREE_2), me);
+ Talk(SAY_TREE);
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(true);
diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
index e8188f892b3..3bda920fdeb 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_laj.cpp
@@ -23,7 +23,8 @@ SDComment: Immunities are wrong, must be adjusted to use resistance from creatur
SDCategory: Tempest Keep, The Botanica
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSpells
{
@@ -41,7 +42,7 @@ enum eSpells
};
enum eOthers
{
- EMOTE_SUMMON = -1553006,
+ EMOTE_SUMMON = 0,
MODEL_DEFAULT = 13109,
MODEL_ARCANE = 14213,
MODEL_FIRE = 13110,
@@ -174,7 +175,7 @@ class boss_laj : public CreatureScript
{
if (Summon_Timer <= diff)
{
- DoScriptText(EMOTE_SUMMON, me);
+ Talk(EMOTE_SUMMON);
DoSummons();
Summon_Timer = 2500;
}
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 3acde2455db..74f10f97754 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -23,16 +23,15 @@ SDComment: Includes Sapling (need some better control with these).
SDCategory: Tempest Keep, The Botanica
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum eSays
{
- SAY_AGGRO = -1553007,
- SAY_SLAY_1 = -1553008,
- SAY_SLAY_2 = -1553009,
- SAY_SUMMON_1 = -1553010,
- SAY_SUMMON_2 = -1553011,
- SAY_DEATH = -1553012,
+ SAY_AGGRO = 0,
+ SAY_SLAY = 1,
+ SAY_SUMMON = 2,
+ SAY_DEATH = 3
};
enum eSpells
@@ -161,17 +160,17 @@ class boss_warp_splinter : public CreatureScript
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
}
void KilledUnit(Unit* /*victim*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH, me);
+ Talk(SAY_DEATH);
}
void SummonTreants()
@@ -180,14 +179,14 @@ class boss_warp_splinter : public CreatureScript
{
float angle = (M_PI / 3) * i;
- float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * cos(angle);
- float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * sin(angle);
+ float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle);
+ float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle);
float O = - me->GetAngle(X, Y);
if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000))
CAST_AI(mob_warp_splinter_treant::mob_warp_splinter_treantAI, pTreant->AI())->WarpGuid = me->GetGUID();
}
- DoScriptText(RAND(SAY_SUMMON_1, SAY_SUMMON_2), me);
+ Talk(SAY_SUMMON);
}
void UpdateAI(const uint32 diff)
diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp
index c46757a3956..3932b96ad07 100644
--- a/src/server/scripts/Outland/blades_edge_mountains.cpp
+++ b/src/server/scripts/Outland/blades_edge_mountains.cpp
@@ -33,7 +33,13 @@ go_legion_obelisk
go_thunderspike
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
//Support for quest: You're Fired! (10821)
bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five;
@@ -81,11 +87,12 @@ public:
enum eNetherdrake
{
- SAY_NIHIL_1 = -1000169, //signed for 5955
- SAY_NIHIL_2 = -1000170, //signed for 5955
- SAY_NIHIL_3 = -1000171, //signed for 5955
- SAY_NIHIL_4 = -1000172, //signed for 20021, used by 20021, 21817, 21820, 21821, 21823
- SAY_NIHIL_INTERRUPT = -1000173, //signed for 20021, used by 20021, 21817, 21820, 21821, 21823
+ //Used by 20021, 21817, 21820, 21821, 21823 but not existing in database
+ SAY_NIHIL_1 = 0,
+ SAY_NIHIL_2 = 1,
+ SAY_NIHIL_3 = 2,
+ SAY_NIHIL_4 = 3,
+ SAY_NIHIL_INTERRUPT = 4,
ENTRY_WHELP = 20021,
ENTRY_PROTO = 21821,
@@ -170,7 +177,7 @@ public:
//we are nihil, so say before transform
if (me->GetEntry() == ENTRY_NIHIL)
{
- DoScriptText(SAY_NIHIL_INTERRUPT, me);
+ Talk(SAY_NIHIL_INTERRUPT);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
IsNihil = false;
}
@@ -197,19 +204,19 @@ public:
switch (NihilSpeech_Phase)
{
case 0:
- DoScriptText(SAY_NIHIL_1, me);
+ Talk(SAY_NIHIL_1);
++NihilSpeech_Phase;
break;
case 1:
- DoScriptText(SAY_NIHIL_2, me);
+ Talk(SAY_NIHIL_2);
++NihilSpeech_Phase;
break;
case 2:
- DoScriptText(SAY_NIHIL_3, me);
+ Talk(SAY_NIHIL_3);
++NihilSpeech_Phase;
break;
case 3:
- DoScriptText(SAY_NIHIL_4, me);
+ Talk(SAY_NIHIL_4);
++NihilSpeech_Phase;
break;
case 4:
@@ -260,7 +267,7 @@ public:
enum eDaranelle
{
- SAY_SPELL_INFLUENCE = -1000174,
+ SAY_SPELL_INFLUENCE = 0,
SPELL_LASHHAN_CHANNEL = 36904
};
@@ -288,7 +295,7 @@ public:
{
if (who->HasAura(SPELL_LASHHAN_CHANNEL) && me->IsWithinDistInMap(who, 10.0f))
{
- DoScriptText(SAY_SPELL_INFLUENCE, me, who);
+ Talk(SAY_SPELL_INFLUENCE, who->GetGUID());
//TODO: Move the below to updateAI and run if this statement == true
DoCast(who, 37028, true);
}
diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
index 96897ae3033..8398e48e09f 100644
--- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
+++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp
@@ -194,7 +194,7 @@ class spell_mark_of_kazzak : public SpellScriptLoader
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
- amount = CalculatePctU(owner->GetPower(POWER_MANA), 5);
+ amount = CalculatePct(owner->GetPower(POWER_MANA), 5);
}
void OnPeriodic(AuraEffect const* aurEff)
diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp
index 67834601d6f..ae3bd283db4 100644
--- a/src/server/scripts/Outland/boss_doomwalker.cpp
+++ b/src/server/scripts/Outland/boss_doomwalker.cpp
@@ -16,7 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
enum Texts
{
diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp
index b0e19f0e322..7ac90320347 100644
--- a/src/server/scripts/Outland/hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/hellfire_peninsula.cpp
@@ -33,8 +33,12 @@ npc_trollbane
npc_wounded_blood_elf
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npc_aeranas
@@ -42,8 +46,8 @@ EndContentData */
enum eAeranas
{
- SAY_SUMMON = -1000138,
- SAY_FREE = -1000139,
+ SAY_SUMMON = 0,
+ SAY_FREE = 1,
FACTION_HOSTILE = 16,
FACTION_FRIENDLY = 35,
@@ -81,7 +85,7 @@ public:
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_FRIENDLY);
- DoScriptText(SAY_SUMMON, me);
+ Talk(SAY_SUMMON);
}
void UpdateAI(const uint32 diff)
@@ -105,7 +109,7 @@ public:
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
- DoScriptText(SAY_FREE, me);
+ Talk(SAY_FREE);
return;
}
@@ -132,9 +136,9 @@ public:
enum eAncestralWolf
{
- EMOTE_WOLF_LIFT_HEAD = -1000496,
- EMOTE_WOLF_HOWL = -1000497,
- SAY_WOLF_WELCOME = -1000498,
+ EMOTE_WOLF_LIFT_HEAD = 0,
+ EMOTE_WOLF_HOWL = 1,
+ SAY_WOLF_WELCOME = 2,
SPELL_ANCESTRAL_WOLF_BUFF = 29981,
@@ -158,13 +162,13 @@ public:
if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
Start(false, false, creature->GetOwner()->GetGUID());
else
- sLog->outError("TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player.");
+ sLog->outError(LOG_FILTER_TSCR, "TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player.");
creature->SetSpeed(MOVE_WALK, 1.5f);
Reset();
}
- Unit* pRyga;
+ Creature* pRyga;
void Reset()
{
@@ -174,8 +178,9 @@ public:
void MoveInLineOfSight(Unit* who)
{
- if (!pRyga && who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f))
- pRyga = who;
+ if (!pRyga && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f))
+ if (Creature* temp = who->ToCreature())
+ pRyga = temp;
npc_escortAI::MoveInLineOfSight(who);
}
@@ -185,14 +190,14 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(EMOTE_WOLF_LIFT_HEAD, me);
+ Talk(EMOTE_WOLF_LIFT_HEAD);
break;
case 2:
- DoScriptText(EMOTE_WOLF_HOWL, me);
+ Talk(EMOTE_WOLF_HOWL);
break;
case 50:
if (pRyga && pRyga->isAlive() && !pRyga->isInCombat())
- DoScriptText(SAY_WOLF_WELCOME, pRyga);
+ pRyga->AI()->Talk(SAY_WOLF_WELCOME);
break;
}
}
@@ -364,12 +369,12 @@ public:
enum eWoundedBloodElf
{
- SAY_ELF_START = -1000117,
- SAY_ELF_SUMMON1 = -1000118,
- SAY_ELF_RESTING = -1000119,
- SAY_ELF_SUMMON2 = -1000120,
- SAY_ELF_COMPLETE = -1000121,
- SAY_ELF_AGGRO = -1000122,
+ SAY_ELF_START = 0,
+ SAY_ELF_SUMMON1 = 1,
+ SAY_ELF_RESTING = 2,
+ SAY_ELF_SUMMON2 = 3,
+ SAY_ELF_COMPLETE = 4,
+ SAY_ELF_AGGRO = 5,
QUEST_ROAD_TO_FALCON_WATCH = 9375
};
@@ -411,25 +416,25 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY_ELF_START, me, player);
+ Talk(SAY_ELF_START, player->GetGUID());
break;
case 9:
- DoScriptText(SAY_ELF_SUMMON1, me, player);
+ Talk(SAY_ELF_SUMMON1, player->GetGUID());
// Spawn two Haal'eshi Talonguard
DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
break;
case 13:
- DoScriptText(SAY_ELF_RESTING, me, player);
+ Talk(SAY_ELF_RESTING, player->GetGUID());
break;
case 14:
- DoScriptText(SAY_ELF_SUMMON2, me, player);
+ Talk(SAY_ELF_SUMMON2, player->GetGUID());
// Spawn two Haal'eshi Windwalker
DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
break;
case 27:
- DoScriptText(SAY_ELF_COMPLETE, me, player);
+ Talk(SAY_ELF_COMPLETE, player->GetGUID());
// Award quest credit
player->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH, me);
break;
@@ -441,7 +446,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
- DoScriptText(SAY_ELF_AGGRO, me);
+ Talk(SAY_ELF_AGGRO);
}
void JustSummoned(Creature* summoned)
diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp
index 871a2f200bb..54565553e94 100644
--- a/src/server/scripts/Outland/nagrand.cpp
+++ b/src/server/scripts/Outland/nagrand.cpp
@@ -28,9 +28,12 @@ npc_greatmother_geyah
npc_maghar_captive
npc_creditmarker_visit_with_ancestors
EndContentData */
-
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
/*######
## npc_greatmother_geyah
@@ -146,13 +149,13 @@ public:
enum eMagharCaptive
{
- SAY_MAG_START = -1000482,
- SAY_MAG_NO_ESCAPE = -1000483,
- SAY_MAG_MORE = -1000484,
- SAY_MAG_MORE_REPLY = -1000485,
- SAY_MAG_LIGHTNING = -1000486,
- SAY_MAG_SHOCK = -1000487,
- SAY_MAG_COMPLETE = -1000488,
+ SAY_MAG_START = 0,
+ SAY_MAG_NO_ESCAPE = 0,
+ SAY_MAG_MORE = 1,
+ SAY_MAG_MORE_REPLY = 0,
+ SAY_MAG_LIGHTNING = 2,
+ SAY_MAG_SHOCK = 3,
+ SAY_MAG_COMPLETE = 4,
SPELL_CHAIN_LIGHTNING = 16006,
SPELL_EARTHBIND_TOTEM = 15786,
@@ -186,7 +189,7 @@ public:
pEscortAI->Start(true, false, player->GetGUID(), quest);
- DoScriptText(SAY_MAG_START, creature);
+ creature->AI()->Talk(SAY_MAG_START);
creature->SummonCreature(NPC_MURK_RAIDER, m_afAmbushA[0]+2.5f, m_afAmbushA[1]-2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
creature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushA[0]-2.5f, m_afAmbushA[1]+2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
@@ -226,17 +229,17 @@ public:
switch (waypointId)
{
case 7:
- DoScriptText(SAY_MAG_MORE, me);
+ Talk(SAY_MAG_MORE);
if (Creature* temp = me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0], m_afAmbushB[1], m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000))
- DoScriptText(SAY_MAG_MORE_REPLY, temp);
+ temp->AI()->Talk(SAY_MAG_MORE_REPLY);
me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
break;
case 16:
- DoScriptText(SAY_MAG_COMPLETE, me);
+ Talk(SAY_MAG_COMPLETE);
if (Player* player = GetPlayerForEscort())
player->GroupEventHappens(QUEST_TOTEM_KARDASH_H, me);
@@ -249,7 +252,7 @@ public:
void JustSummoned(Creature* summoned)
{
if (summoned->GetEntry() == NPC_MURK_BRUTE)
- DoScriptText(SAY_MAG_NO_ESCAPE, summoned);
+ summoned->AI()->Talk(SAY_MAG_NO_ESCAPE);
if (summoned->isTotem())
return;
@@ -267,7 +270,7 @@ public:
if (rand()%10)
return;
- DoScriptText(SAY_MAG_LIGHTNING, me);
+ Talk(SAY_MAG_LIGHTNING);
}
}
@@ -364,18 +367,18 @@ enum CorkiData
NPC_CORKI = 18445,
NPC_CORKI_CREDIT_1 = 18369,
GO_CORKIS_PRISON = 182349,
- CORKI_SAY_THANKS = -1800071,
+ CORKI_SAY_THANKS = 0,
// 2nd quest
QUEST_CORKIS_GONE_MISSING_AGAIN = 9924,
NPC_CORKI_2 = 20812,
GO_CORKIS_PRISON_2 = 182350,
- CORKI_SAY_PROMISE = -1800072,
+ CORKI_SAY_PROMISE = 0,
// 3rd quest
QUEST_CHOWAR_THE_PILLAGER = 9955,
NPC_CORKI_3 = 18369,
NPC_CORKI_CREDIT_3 = 18444,
GO_CORKIS_PRISON_3 = 182521,
- CORKI_SAY_LAST = -1800073
+ CORKI_SAY_LAST = 0
};
class go_corkis_prison : public GameObjectScript
@@ -465,11 +468,11 @@ public:
Say_Timer = 5000;
ReleasedFromCage = true;
if (me->GetEntry() == NPC_CORKI)
- DoScriptText(CORKI_SAY_THANKS, me);
+ Talk(CORKI_SAY_THANKS);
if (me->GetEntry() == NPC_CORKI_2)
- DoScriptText(CORKI_SAY_PROMISE, me);
+ Talk(CORKI_SAY_PROMISE);
if (me->GetEntry() == NPC_CORKI_3)
- DoScriptText(CORKI_SAY_LAST, me);
+ Talk(CORKI_SAY_LAST);
}
};
};
@@ -518,7 +521,7 @@ public:
{
creature->SetStandState(UNIT_STAND_STATE_STAND);
EscortAI->Start(true, false, player->GetGUID(), quest);
- DoScriptText(SAY_KUR_START, creature);
+ creature->AI()->Talk(SAY_KUR_START);
creature->SummonCreature(NPC_KUR_MURK_RAIDER, kurenaiAmbushA[0]+2.5f, kurenaiAmbushA[1]-2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
creature->SummonCreature(NPC_KUR_MURK_BRUTE, kurenaiAmbushA[0]-2.5f, kurenaiAmbushA[1]+2.5f, kurenaiAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp
index 16dac13d1a9..7bec3674a84 100644
--- a/src/server/scripts/Outland/netherstorm.cpp
+++ b/src/server/scripts/Outland/netherstorm.cpp
@@ -32,8 +32,11 @@ npc_maxx_a_million
go_captain_tyralius_prison
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
/*######
## npc_manaforge_control_console
@@ -42,12 +45,12 @@ EndContentData */
//used by 20209, 20417, 20418, 20440, signed for 20209
enum eManaforgeConsoleData
{
- EMOTE_START = -1000211,
- EMOTE_60 = -1000212,
- EMOTE_30 = -1000213,
- EMOTE_10 = -1000214,
- EMOTE_COMPLETE = -1000215,
- EMOTE_ABORT = -1000216,
+ EMOTE_START = 0,
+ EMOTE_60 = 1,
+ EMOTE_30 = 2,
+ EMOTE_10 = 3,
+ EMOTE_COMPLETE = 4,
+ EMOTE_ABORT = 5,
ENTRY_BNAAR_C_CONSOLE = 20209,
ENTRY_CORUU_C_CONSOLE = 20417,
@@ -111,7 +114,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(EMOTE_ABORT, me);
+ Talk(EMOTE_ABORT);
if (someplayer)
{
@@ -244,31 +247,32 @@ public:
if (someplayer)
{
Unit* u = Unit::GetUnit(*me, someplayer);
- if (u && u->GetTypeId() == TYPEID_PLAYER) DoScriptText(EMOTE_START, me, u);
+ if (u && u->GetTypeId() == TYPEID_PLAYER)
+ Talk(EMOTE_START, u->GetGUID());
}
Event_Timer = 60000;
Wave = true;
++Phase;
break;
case 2:
- DoScriptText(EMOTE_60, me);
+ Talk(EMOTE_60);
Event_Timer = 30000;
++Phase;
break;
case 3:
- DoScriptText(EMOTE_30, me);
+ Talk(EMOTE_30);
Event_Timer = 20000;
DoFinalSpawnForCreature(me);
++Phase;
break;
case 4:
- DoScriptText(EMOTE_10, me);
+ Talk(EMOTE_10);
Event_Timer = 10000;
Wave = false;
++Phase;
break;
case 5:
- DoScriptText(EMOTE_COMPLETE, me);
+ Talk(EMOTE_COMPLETE);
if (someplayer)
{
Unit* u = Unit::GetUnit(*me, someplayer);
@@ -321,22 +325,22 @@ public:
{
case 3726: //b'naar
if ((player->GetQuestStatus(10299) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10329) == QUEST_STATUS_INCOMPLETE) &&
- player->HasItemCount(29366, 1))
+ player->HasItemCount(29366))
manaforge = player->SummonCreature(ENTRY_BNAAR_C_CONSOLE, 2918.95f, 4189.98f, 161.88f, 0.34f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000);
break;
case 3730: //coruu
if ((player->GetQuestStatus(10321) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10330) == QUEST_STATUS_INCOMPLETE) &&
- player->HasItemCount(29396, 1))
+ player->HasItemCount(29396))
manaforge = player->SummonCreature(ENTRY_CORUU_C_CONSOLE, 2426.77f, 2750.38f, 133.24f, 2.14f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000);
break;
case 3734: //duro
if ((player->GetQuestStatus(10322) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10338) == QUEST_STATUS_INCOMPLETE) &&
- player->HasItemCount(29397, 1))
+ player->HasItemCount(29397))
manaforge = player->SummonCreature(ENTRY_DURO_C_CONSOLE, 2976.48f, 2183.29f, 163.20f, 1.85f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000);
break;
case 3722: //ara
if ((player->GetQuestStatus(10323) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10365) == QUEST_STATUS_INCOMPLETE) &&
- player->HasItemCount(29411, 1))
+ player->HasItemCount(29411))
manaforge = player->SummonCreature(ENTRY_ARA_C_CONSOLE, 4013.71f, 4028.76f, 192.10f, 1.25f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000);
break;
}
@@ -358,17 +362,19 @@ public:
// The Speech of Dawnforge, Ardonis & Pathaleon
enum eCommanderDawnforgeData
{
- SAY_COMMANDER_DAWNFORGE_1 = -1000128,
- SAY_ARCANIST_ARDONIS_1 = -1000129,
- SAY_COMMANDER_DAWNFORGE_2 = -1000130,
- SAY_PATHALEON_CULATOR_IMAGE_1 = -1000131,
- SAY_COMMANDER_DAWNFORGE_3 = -1000132,
- SAY_PATHALEON_CULATOR_IMAGE_2 = -1000133,
- SAY_PATHALEON_CULATOR_IMAGE_2_1 = -1000134,
- SAY_PATHALEON_CULATOR_IMAGE_2_2 = -1000135,
- SAY_COMMANDER_DAWNFORGE_4 = -1000136,
- SAY_ARCANIST_ARDONIS_2 = -1000136,
- SAY_COMMANDER_DAWNFORGE_5 = -1000137,
+ SAY_COMMANDER_DAWNFORGE_1 = 0,
+ SAY_COMMANDER_DAWNFORGE_2 = 1,
+ SAY_COMMANDER_DAWNFORGE_3 = 2,
+ SAY_COMMANDER_DAWNFORGE_4 = 3,
+ SAY_COMMANDER_DAWNFORGE_5 = 4,
+
+ SAY_ARCANIST_ARDONIS_1 = 0,
+ SAY_ARCANIST_ARDONIS_2 = 1,
+
+ SAY_PATHALEON_CULATOR_IMAGE_1 = 0,
+ SAY_PATHALEON_CULATOR_IMAGE_2 = 1,
+ SAY_PATHALEON_CULATOR_IMAGE_2_1 = 2,
+ SAY_PATHALEON_CULATOR_IMAGE_2_2 = 3,
QUEST_INFO_GATHERING = 10198,
SPELL_SUNFURY_DISGUISE = 34603,
@@ -496,7 +502,7 @@ public:
return true;
}
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_commander_dawnforge event already in progress, need to wait.");
+ sLog->outDebug(LOG_FILTER_TSCR, "npc_commander_dawnforge event already in progress, need to wait.");
return false;
}
@@ -513,8 +519,8 @@ public:
return;
}
- Unit* ardonis = Unit::GetUnit(*me, ardonisGUID);
- Unit* pathaleon = Unit::GetUnit(*me, pathaleonGUID);
+ Creature* ardonis = Creature::GetCreature(*me, ardonisGUID);
+ Creature* pathaleon = Creature::GetCreature(*me, pathaleonGUID);
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (!ardonis || !player)
@@ -533,19 +539,19 @@ public:
switch (Phase)
{
case 1:
- DoScriptText(SAY_COMMANDER_DAWNFORGE_1, me);
+ Talk(SAY_COMMANDER_DAWNFORGE_1);
++Phase;
Phase_Timer = 16000;
break;
//Phase 2 Ardonis say
case 2:
- DoScriptText(SAY_ARCANIST_ARDONIS_1, ardonis);
+ ardonis->AI()->Talk(SAY_ARCANIST_ARDONIS_1);
++Phase;
Phase_Timer = 16000;
break;
//Phase 3 Dawnforge say
case 3:
- DoScriptText(SAY_COMMANDER_DAWNFORGE_2, me);
+ Talk(SAY_COMMANDER_DAWNFORGE_2);
++Phase;
Phase_Timer = 16000;
break;
@@ -558,7 +564,7 @@ public:
break;
//Phase 5 Pathaleon say
case 5:
- DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_1, pathaleon);
+ pathaleon->AI()->Talk(SAY_PATHALEON_CULATOR_IMAGE_1);
++Phase;
Phase_Timer = 6000;
break;
@@ -574,7 +580,7 @@ public:
break;
//Subphase 2 Dawnforge say
case 1:
- DoScriptText(SAY_COMMANDER_DAWNFORGE_3, me);
+ Talk(SAY_COMMANDER_DAWNFORGE_3);
PhaseSubphase = 0;
++Phase;
Phase_Timer = 8000;
@@ -587,19 +593,19 @@ public:
{
//Subphase 1
case 0:
- DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2, pathaleon);
+ pathaleon->AI()->Talk(SAY_PATHALEON_CULATOR_IMAGE_2);
++PhaseSubphase;
Phase_Timer = 12000;
break;
//Subphase 2
case 1:
- DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_1, pathaleon);
+ pathaleon->AI()->Talk(SAY_PATHALEON_CULATOR_IMAGE_2_1);
++PhaseSubphase;
Phase_Timer = 16000;
break;
//Subphase 3
case 2:
- DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_2, pathaleon);
+ pathaleon->AI()->Talk(SAY_PATHALEON_CULATOR_IMAGE_2_2);
PhaseSubphase = 0;
++Phase;
Phase_Timer = 10000;
@@ -608,8 +614,8 @@ public:
break;
//Phase 8 Dawnforge & Ardonis say
case 8:
- DoScriptText(SAY_COMMANDER_DAWNFORGE_4, me);
- DoScriptText(SAY_ARCANIST_ARDONIS_2, ardonis);
+ Talk(SAY_COMMANDER_DAWNFORGE_4);
+ ardonis->AI()->Talk(SAY_ARCANIST_ARDONIS_2);
++Phase;
Phase_Timer = 4000;
break;
@@ -624,7 +630,7 @@ public:
break;
//Phase 10 Dawnforge say
case 10:
- DoScriptText(SAY_COMMANDER_DAWNFORGE_5, me);
+ Talk(SAY_COMMANDER_DAWNFORGE_5);
player->AreaExploredOrEventHappens(QUEST_INFO_GATHERING);
Reset();
break;
@@ -664,7 +670,7 @@ enum eProfessorDabiriData
{
SPELL_PHASE_DISTRUPTOR = 35780,
- WHISPER_DABIRI = -1000522,
+ //WHISPER_DABIRI = 0, not existing in database
QUEST_DIMENSIUS = 10439,
QUEST_ON_NETHERY_WINGS = 10438,
@@ -677,13 +683,9 @@ class npc_professor_dabiri : public CreatureScript
public:
npc_professor_dabiri() : CreatureScript("npc_professor_dabiri") { }
- bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
- {
- if (quest->GetQuestId() == QUEST_DIMENSIUS)
- DoScriptText(WHISPER_DABIRI, creature, player);
-
- return true;
- }
+ //OnQuestAccept:
+ //if (quest->GetQuestId() == QUEST_DIMENSIUS)
+ //creature->AI()->Talk(WHISPER_DABIRI, player->GetGUID());
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
@@ -702,7 +704,7 @@ public:
if (creature->isQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
- if (player->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(29778, 1))
+ if (player->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(29778))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
@@ -722,7 +724,7 @@ enum ePhaseHunterData
NPC_PHASE_HUNTER_ENTRY = 18879,
NPC_DRAINED_PHASE_HUNTER_ENTRY = 19595,
- EMOTE_WEAK = -1000303,
+ EMOTE_WEAK = 0,
// Spells
SPELL_RECHARGING_BATTERY = 34219,
@@ -824,7 +826,7 @@ public:
if (!Weak && HealthBelowPct(WeakPercent)
&& player->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE)
{
- DoScriptText(EMOTE_WEAK, me);
+ Talk(EMOTE_WEAK);
Weak = true;
}
if (Weak && !Drained && me->HasAura(SPELL_RECHARGING_BATTERY))
@@ -854,8 +856,8 @@ enum eBessyData
N_THADELL = 20464,
SPAWN_FIRST = 20512,
SPAWN_SECOND = 19881,
- SAY_THADELL_1 = -1000524,
- SAY_THADELL_2 = -1000525,
+ SAY_THADELL_1 = 0,
+ SAY_THADELL_2 = 1,
};
class npc_bessy : public CreatureScript
@@ -909,11 +911,11 @@ public:
case 12:
player->GroupEventHappens(Q_ALMABTRIEB, me);
if (me->FindNearestCreature(N_THADELL, 30))
- DoScriptText(SAY_THADELL_1, me);
+ Talk(SAY_THADELL_1);
break;
case 13:
if (me->FindNearestCreature(N_THADELL, 30))
- DoScriptText(SAY_THADELL_2, me, player);
+ Talk(SAY_THADELL_2, player->GetGUID());
break;
}
}
diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 340049ba4fa..65a4dbe92a5 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -40,9 +40,14 @@ go_crystal_prison
npc_enraged_spirit
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
+#include "SpellScript.h"
+#include "Player.h"
+#include "WorldSession.h"
/*#####
# mob_mature_netherwing_drake
@@ -50,7 +55,7 @@ EndContentData */
enum eMatureNetherwing
{
- SAY_JUST_EATEN = -1000175,
+ SAY_JUST_EATEN = 0,
SPELL_PLACE_CARCASS = 38439,
SPELL_JUST_EATEN = 38502,
@@ -147,7 +152,7 @@ public:
else if (bIsEating)
{
DoCast(me, SPELL_JUST_EATEN);
- DoScriptText(SAY_JUST_EATEN, me);
+ Talk(SAY_JUST_EATEN);
if (Player* pPlr = Unit::GetPlayer(*me, uiPlayerGUID))
{
@@ -669,25 +674,25 @@ enum eOverlordData
SPELL_THREE = 40216, // Dragonaw Faction
SPELL_FOUR = 42016, // Dragonaw Trasform
- OVERLORD_SAY_1 = -1000606,
- OVERLORD_SAY_2 = -1000607,
- OVERLORD_SAY_3 = -1000608, //signed for 28315
- OVERLORD_SAY_4 = -1000609,
- OVERLORD_SAY_5 = -1000610,
- OVERLORD_SAY_6 = -1000611,
-
- OVERLORD_YELL_1 = -1000612,
- OVERLORD_YELL_2 = -1000613,
-
- LORD_ILLIDAN_SAY_1 = -1000614,
- LORD_ILLIDAN_SAY_2 = -1000615,
- LORD_ILLIDAN_SAY_3 = -1000616,
- LORD_ILLIDAN_SAY_4 = -1000617,
- LORD_ILLIDAN_SAY_5 = -1000618,
- LORD_ILLIDAN_SAY_6 = -1000619,
- LORD_ILLIDAN_SAY_7 = -1000620,
-
- YARZILL_THE_MERC_SAY = -1000621,
+ OVERLORD_SAY_1 = 0,
+ OVERLORD_SAY_2 = 1,
+ //OVERLORD_SAY_3 = 2,
+ OVERLORD_SAY_4 = 3,
+ OVERLORD_SAY_5 = 4,
+ OVERLORD_SAY_6 = 5,
+
+ OVERLORD_YELL_1 = 6,
+ OVERLORD_YELL_2 = 7,
+
+ LORD_ILLIDAN_SAY_1 = 0,
+ LORD_ILLIDAN_SAY_2 = 1,
+ LORD_ILLIDAN_SAY_3 = 2,
+ LORD_ILLIDAN_SAY_4 = 3,
+ LORD_ILLIDAN_SAY_5 = 4,
+ LORD_ILLIDAN_SAY_6 = 5,
+ LORD_ILLIDAN_SAY_7 = 6,
+
+ YARZILL_THE_MERC_SAY = 0
};
class npc_overlord_morghor : public CreatureScript
@@ -749,7 +754,7 @@ public:
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
if (player)
- DoScriptText(OVERLORD_SAY_1, me, player);
+ Talk(OVERLORD_SAY_1, player->GetGUID());
}
ConversationTimer = 4200;
Step = 0;
@@ -759,7 +764,7 @@ public:
uint32 NextStep(uint32 Step)
{
Player* player = Unit::GetPlayer(*me, PlayerGUID);
- Unit* Illi = Unit::GetUnit(*me, IllidanGUID);
+ Creature* Illi = Creature::GetCreature(*me, IllidanGUID);
if (!player || !Illi)
{
@@ -777,7 +782,7 @@ public:
return 9000;
break;
case 2:
- DoScriptText(OVERLORD_YELL_1, me, player);
+ Talk(OVERLORD_YELL_1, player->GetGUID());
return 4500;
break;
case 3:
@@ -785,7 +790,7 @@ public:
return 3200;
break;
case 4:
- DoScriptText(OVERLORD_SAY_2, me, player);
+ Talk(OVERLORD_SAY_2, player->GetGUID());
return 2000;
break;
case 5:
@@ -800,31 +805,27 @@ public:
return 2000;
break;
case 7:
- DoScriptText(OVERLORD_YELL_2, me);
+ Talk(OVERLORD_YELL_2);
return 4500;
break;
case 8:
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8);
- return 2500;
- break;
- case 9:
- DoScriptText(OVERLORD_SAY_3, me);
- return 6500;
+ return 9000;
break;
case 10:
- DoScriptText(LORD_ILLIDAN_SAY_1, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_1);
return 5000;
break;
case 11:
- DoScriptText(OVERLORD_SAY_4, me, player);
+ Talk(OVERLORD_SAY_4, player->GetGUID());
return 6000;
break;
case 12:
- DoScriptText(LORD_ILLIDAN_SAY_2, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_2);
return 5500;
break;
case 13:
- DoScriptText(LORD_ILLIDAN_SAY_3, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_3);
return 4000;
break;
case 14:
@@ -832,34 +833,25 @@ public:
return 1500;
break;
case 15:
- DoScriptText(LORD_ILLIDAN_SAY_4, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_4);
return 1500;
break;
case 16:
- if (player)
- {
- Illi->CastSpell(player, SPELL_TWO, true);
- player->RemoveAurasDueToSpell(SPELL_THREE);
- player->RemoveAurasDueToSpell(SPELL_FOUR);
- return 5000;
- }
- else
- {
- player->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE);
- Step = 30;
- return 100;
- }
+ Illi->CastSpell(player, SPELL_TWO, true);
+ player->RemoveAurasDueToSpell(SPELL_THREE);
+ player->RemoveAurasDueToSpell(SPELL_FOUR);
+ return 5000;
break;
case 17:
- DoScriptText(LORD_ILLIDAN_SAY_5, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_5);
return 5000;
break;
case 18:
- DoScriptText(LORD_ILLIDAN_SAY_6, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_6);
return 5000;
break;
case 19:
- DoScriptText(LORD_ILLIDAN_SAY_7, Illi);
+ Illi->AI()->Talk(LORD_ILLIDAN_SAY_7);
return 5000;
break;
case 20:
@@ -868,7 +860,7 @@ public:
return 500;
break;
case 21:
- DoScriptText(OVERLORD_SAY_5, me);
+ Talk(OVERLORD_SAY_5);
return 500;
break;
case 22:
@@ -885,7 +877,7 @@ public:
return 5000;
break;
case 25:
- DoScriptText(OVERLORD_SAY_6, me);
+ Talk(OVERLORD_SAY_6);
return 2000;
break;
case 26:
@@ -909,24 +901,21 @@ public:
break;
case 29:
{
- Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
- if (Yarzill)
- DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, player);
+ if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f))
+ Yarzill->AI()->Talk(YARZILL_THE_MERC_SAY, player->GetGUID());
return 5000;
}
break;
case 30:
{
- Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
- if (Yarzill)
+ if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f))
Yarzill->SetTarget(0);
return 5000;
}
break;
case 31:
{
- Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50);
- if (Yarzill)
+ if (Creature* Yarzill = me->FindNearestCreature(C_YARZILL, 50.0f))
Yarzill->CastSpell(player, 41540, true);
return 1000;
}
@@ -964,16 +953,13 @@ public:
enum eEarthmender
{
- SAY_WIL_START = -1000381,
- SAY_WIL_AGGRO1 = -1000382,
- SAY_WIL_AGGRO2 = -1000383,
- SAY_WIL_PROGRESS1 = -1000384,
- SAY_WIL_PROGRESS2 = -1000385,
- SAY_WIL_FIND_EXIT = -1000386,
- SAY_WIL_PROGRESS4 = -1000387,
- SAY_WIL_PROGRESS5 = -1000388,
- SAY_WIL_JUST_AHEAD = -1000389,
- SAY_WIL_END = -1000390,
+ SAY_WIL_START = 0,
+ SAY_WIL_AGGRO = 1,
+ SAY_WIL_PROGRESS1 = 2,
+ SAY_WIL_PROGRESS2 = 3,
+ SAY_WIL_FIND_EXIT = 4,
+ SAY_WIL_JUST_AHEAD = 5,
+ SAY_WIL_END = 6,
SPELL_CHAIN_LIGHTNING = 16006,
SPELL_EARTHBING_TOTEM = 15786,
@@ -994,7 +980,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ESCAPE_COILSCAR)
{
- DoScriptText(SAY_WIL_START, creature, player);
+ creature->AI()->Talk(SAY_WIL_START, player->GetGUID());
creature->setFaction(FACTION_EARTHEN);
if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wilda::npc_earthmender_wildaAI, creature->AI()))
@@ -1028,14 +1014,14 @@ public:
switch (waypointId)
{
case 13:
- DoScriptText(SAY_WIL_PROGRESS1, me, player);
+ Talk(SAY_WIL_PROGRESS1, player->GetGUID());
DoSpawnAssassin();
break;
case 14:
DoSpawnAssassin();
break;
case 15:
- DoScriptText(SAY_WIL_FIND_EXIT, me, player);
+ Talk(SAY_WIL_FIND_EXIT, player->GetGUID());
break;
case 19:
DoRandomSay();
@@ -1062,7 +1048,7 @@ public:
DoSpawnAssassin();
break;
case 39:
- DoScriptText(SAY_WIL_JUST_AHEAD, me, player);
+ Talk(SAY_WIL_JUST_AHEAD, player->GetGUID());
break;
case 43:
DoRandomSay();
@@ -1071,7 +1057,7 @@ public:
DoSpawnAssassin();
break;
case 50:
- DoScriptText(SAY_WIL_END, me, player);
+ Talk(SAY_WIL_END, player->GetGUID());
player->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me);
break;
}
@@ -1086,7 +1072,7 @@ public:
//this is very unclear, random say without no real relevance to script/event
void DoRandomSay()
{
- DoScriptText(RAND(SAY_WIL_PROGRESS2, SAY_WIL_PROGRESS4, SAY_WIL_PROGRESS5), me);
+ Talk(SAY_WIL_PROGRESS2);
}
void DoSpawnAssassin()
@@ -1106,7 +1092,7 @@ public:
{
//appears to be random
if (urand(0, 1))
- DoScriptText(RAND(SAY_WIL_AGGRO1, SAY_WIL_AGGRO2), who);
+ Talk(SAY_WIL_AGGRO);
}
}
@@ -1144,28 +1130,25 @@ npc_lord_illidan_stormrage : Creature that controls the event.
go_crystal_prison : GameObject that begins the event and hands out quest
EndContentData */
-#define END_TEXT -1000366 //signed for 10646
-
#define QUEST_BATTLE_OF_THE_CRIMSON_WATCH 10781
#define EVENT_AREA_RADIUS 65 //65yds
#define EVENT_COOLDOWN 30000 //in ms. appear after event completed or failed (should be = Adds despawn time)
struct TorlothCinematic
{
- int32 TextId;
uint32 creature, Timer;
};
// Creature 0 - Torloth, 1 - Illidan
static TorlothCinematic TorlothAnim[]=
{
- {-1000367, 0, 2000},
- {-1000368, 1, 7000},
- {-1000369, 0, 3000},
- {0, 0, 2000}, // Torloth stand
- {-1000370, 0, 1000},
- {0, 0, 3000},
- {0, 0, 0}
+ {0, 2000},
+ {1, 7000},
+ {0, 3000},
+ {0, 2000}, // Torloth stand
+ {0, 1000},
+ {0, 3000},
+ {0, 0}
};
struct Location
@@ -1199,15 +1182,14 @@ struct WaveData
{
uint8 SpawnCount, UsedSpawnPoint;
uint32 CreatureId, SpawnTimer, YellTimer;
- int32 WaveTextId;
};
static WaveData WavesInfo[]=
{
- {9, 0, 22075, 10000, 7000, -1000371}, //Illidari Soldier
- {2, 9, 22074, 10000, 7000, -1000372}, //Illidari Mind Breaker
- {4, 11, 19797, 10000, 7000, -1000373}, //Illidari Highlord
- {1, 15, 22076, 10000, 7000, -1000374} //Torloth The Magnificent
+ {9, 0, 22075, 10000, 7000}, //Illidari Soldier
+ {2, 9, 22074, 10000, 7000}, //Illidari Mind Breaker
+ {4, 11, 19797, 10000, 7000}, //Illidari Highlord
+ {1, 15, 22076, 10000, 7000} //Torloth The Magnificent
};
struct SpawnSpells
@@ -1282,9 +1264,6 @@ public:
return;
}
- if (TorlothAnim[AnimationCount].TextId)
- DoScriptText(TorlothAnim[AnimationCount].TextId, creature);
-
AnimationTimer = TorlothAnim[AnimationCount].Timer;
switch (AnimationCount)
@@ -1381,7 +1360,6 @@ public:
if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID)))
{
- DoScriptText(END_TEXT, LordIllidan, killer);
LordIllidan->AI()->EnterEvadeMode();
}
}
@@ -1516,14 +1494,17 @@ public:
{
if (!Announced && AnnounceTimer <= diff)
{
- DoScriptText(WavesInfo[WaveCount].WaveTextId, me);
Announced = true;
- } else AnnounceTimer -= diff;
+ }
+ else
+ AnnounceTimer -= diff;
if (WaveTimer <= diff)
{
SummonNextWave();
- } else WaveTimer -= diff;
+ }
+ else
+ WaveTimer -= diff;
}
CheckEventFail();
@@ -1866,9 +1847,134 @@ public:
};
};
-/*#####
-#
-######*/
+enum ZuluhedChains
+{
+ QUEST_ZULUHED = 10866,
+ NPC_KARYNAKU = 22112,
+};
+
+class spell_unlocking_zuluheds_chains : public SpellScriptLoader
+{
+ public:
+ spell_unlocking_zuluheds_chains() : SpellScriptLoader("spell_unlocking_zuluheds_chains") { }
+
+ class spell_unlocking_zuluheds_chains_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_unlocking_zuluheds_chains_SpellScript);
+
+ bool Load()
+ {
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void HandleAfterHit()
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ if (caster->GetQuestStatus(QUEST_ZULUHED) == QUEST_STATUS_INCOMPLETE)
+ caster->KilledMonsterCredit(NPC_KARYNAKU, 0);
+ }
+
+ void Register()
+ {
+ AfterHit += SpellHitFn(spell_unlocking_zuluheds_chains_SpellScript::HandleAfterHit);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_unlocking_zuluheds_chains_SpellScript();
+ }
+};
+
+enum ShadowMoonTuberEnum
+{
+ SPELL_WHISTLE = 36652,
+ SPELL_SHADOWMOON_TUBER = 36462,
+
+ NPC_BOAR_ENTRY = 21195,
+ GO_SHADOWMOON_TUBER_MOUND = 184701,
+
+ POINT_TUBER = 1,
+ TYPE_BOAR = 1,
+ DATA_BOAR = 1
+};
+
+class npc_shadowmoon_tuber_node : public CreatureScript
+{
+public:
+ npc_shadowmoon_tuber_node() : CreatureScript("npc_shadowmoon_tuber_node") {}
+
+ struct npc_shadowmoon_tuber_nodeAI : public ScriptedAI
+ {
+ npc_shadowmoon_tuber_nodeAI(Creature* creature) : ScriptedAI(creature) {}
+
+ void Reset()
+ {
+ tapped = false;
+ tuberGUID = 0;
+ resetTimer = 60000;
+ }
+
+ void SetData(uint32 id, uint32 data)
+ {
+ if (id == TYPE_BOAR && data == DATA_BOAR)
+ {
+ // Spawn chest GO
+ DoCast(SPELL_SHADOWMOON_TUBER);
+
+ // Despawn the tuber
+ if (GameObject* tuber = me->FindNearestGameObject(GO_SHADOWMOON_TUBER_MOUND, 5.0f))
+ {
+ tuberGUID = tuber->GetGUID();
+ // @Workaround: find how to properly despawn the GO
+ tuber->SetPhaseMask(2, true);
+ }
+ }
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
+ {
+ if (!tapped && spell->Id == SPELL_WHISTLE)
+ {
+ if (Creature* boar = me->FindNearestCreature(NPC_BOAR_ENTRY, 30.0f))
+ {
+ // Disable trigger and force nearest boar to walk to him
+ tapped = true;
+ boar->SetWalk(false);
+ boar->GetMotionMaster()->MovePoint(POINT_TUBER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (tapped)
+ {
+ if (resetTimer <= diff)
+ {
+ // Respawn the tuber
+ if (tuberGUID)
+ if (GameObject* tuber = GameObject::GetGameObject(*me, tuberGUID))
+ // @Workaround: find how to properly respawn the GO
+ tuber->SetPhaseMask(1, true);
+
+ Reset();
+ }
+ else
+ resetTimer -= diff;
+ }
+ }
+ private:
+ bool tapped;
+ uint64 tuberGUID;
+ uint32 resetTimer;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_shadowmoon_tuber_nodeAI(creature);
+ }
+};
void AddSC_shadowmoon_valley()
{
@@ -1887,4 +1993,6 @@ void AddSC_shadowmoon_valley()
new mob_illidari_spawn();
new mob_torloth_the_magnificent();
new npc_enraged_spirit();
+ new spell_unlocking_zuluheds_chains();
+ new npc_shadowmoon_tuber_node();
}
diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp
index 79cce47e16c..c45ad519d39 100644
--- a/src/server/scripts/Outland/shattrath_city.cpp
+++ b/src/server/scripts/Outland/shattrath_city.cpp
@@ -34,8 +34,12 @@ npc_ishanah
npc_khadgar
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npc_raliq_the_drunk
@@ -282,28 +286,32 @@ public:
# npc_kservant
######*/
-#define SAY1 -1000234
-#define WHISP1 -1000235
-#define WHISP2 -1000236
-#define WHISP3 -1000237
-#define WHISP4 -1000238
-#define WHISP5 -1000239
-#define WHISP6 -1000240
-#define WHISP7 -1000241
-#define WHISP8 -1000242
-#define WHISP9 -1000243
-#define WHISP10 -1000244
-#define WHISP11 -1000245
-#define WHISP12 -1000246
-#define WHISP13 -1000247
-#define WHISP14 -1000248
-#define WHISP15 -1000249
-#define WHISP16 -1000250
-#define WHISP17 -1000251
-#define WHISP18 -1000252
-#define WHISP19 -1000253
-#define WHISP20 -1000254
-#define WHISP21 -1000255
+enum KServant
+{
+ SAY1 = 0,
+ WHISP1 = 1,
+ WHISP2 = 2,
+ WHISP3 = 3,
+ WHISP4 = 4,
+ WHISP5 = 5,
+ WHISP6 = 6,
+ WHISP7 = 7,
+ WHISP8 = 8,
+ WHISP9 = 9,
+ WHISP10 = 10,
+ WHISP11 = 11,
+ WHISP12 = 12,
+ WHISP13 = 13,
+ WHISP14 = 14,
+ WHISP15 = 15,
+ WHISP16 = 16,
+ WHISP17 = 17,
+ WHISP18 = 18,
+ WHISP19 = 19,
+ WHISP20 = 20,
+ WHISP21 = 21
+};
+
class npc_kservant : public CreatureScript
{
public:
@@ -328,70 +336,70 @@ public:
switch (waypointId)
{
case 0:
- DoScriptText(SAY1, me, player);
+ Talk(SAY1, player->GetGUID());
break;
case 4:
- DoScriptText(WHISP1, me, player);
+ Talk(WHISP1, player->GetGUID());
break;
case 6:
- DoScriptText(WHISP2, me, player);
+ Talk(WHISP2, player->GetGUID());
break;
case 7:
- DoScriptText(WHISP3, me, player);
+ Talk(WHISP3, player->GetGUID());
break;
case 8:
- DoScriptText(WHISP4, me, player);
+ Talk(WHISP4, player->GetGUID());
break;
case 17:
- DoScriptText(WHISP5, me, player);
+ Talk(WHISP5, player->GetGUID());
break;
case 18:
- DoScriptText(WHISP6, me, player);
+ Talk(WHISP6, player->GetGUID());
break;
case 19:
- DoScriptText(WHISP7, me, player);
+ Talk(WHISP7, player->GetGUID());
break;
case 33:
- DoScriptText(WHISP8, me, player);
+ Talk(WHISP8, player->GetGUID());
break;
case 34:
- DoScriptText(WHISP9, me, player);
+ Talk(WHISP9, player->GetGUID());
break;
case 35:
- DoScriptText(WHISP10, me, player);
+ Talk(WHISP10, player->GetGUID());
break;
case 36:
- DoScriptText(WHISP11, me, player);
+ Talk(WHISP11, player->GetGUID());
break;
case 43:
- DoScriptText(WHISP12, me, player);
+ Talk(WHISP12, player->GetGUID());
break;
case 44:
- DoScriptText(WHISP13, me, player);
+ Talk(WHISP13, player->GetGUID());
break;
case 49:
- DoScriptText(WHISP14, me, player);
+ Talk(WHISP14, player->GetGUID());
break;
case 50:
- DoScriptText(WHISP15, me, player);
+ Talk(WHISP15, player->GetGUID());
break;
case 51:
- DoScriptText(WHISP16, me, player);
+ Talk(WHISP16, player->GetGUID());
break;
case 52:
- DoScriptText(WHISP17, me, player);
+ Talk(WHISP17, player->GetGUID());
break;
case 53:
- DoScriptText(WHISP18, me, player);
+ Talk(WHISP18, player->GetGUID());
break;
case 54:
- DoScriptText(WHISP19, me, player);
+ Talk(WHISP19, player->GetGUID());
break;
case 55:
- DoScriptText(WHISP20, me, player);
+ Talk(WHISP20, player->GetGUID());
break;
case 56:
- DoScriptText(WHISP21, me, player);
+ Talk(WHISP21, player->GetGUID());
player->GroupEventHappens(10211, me);
break;
}
@@ -425,16 +433,19 @@ public:
#define GOSSIP_BOOK "Ezekiel said that you might have a certain book..."
-#define SAY_1 -1000274
-#define SAY_2 -1000275
-#define SAY_3 -1000276
-#define SAY_4 -1000277
-#define SAY_5 -1000278
-#define SAY_GIVEUP -1000279
-
-#define QUEST_WBI 10231
-#define NPC_CREEPJACK 19726
-#define NPC_MALONE 19725
+enum DirtyLarry
+{
+ SAY_1 = 0,
+ SAY_2 = 1,
+ SAY_3 = 2,
+ SAY_4 = 3,
+ SAY_5 = 4,
+ SAY_GIVEUP = 5,
+
+ QUEST_WBI = 10231,
+ NPC_CREEPJACK = 19726,
+ NPC_MALONE = 19725
+};
class npc_dirty_larry : public CreatureScript
{
@@ -496,11 +507,11 @@ public:
if (Malone)
Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000;
- case 1: DoScriptText(SAY_1, me, player); return 3000;
- case 2: DoScriptText(SAY_2, me, player); return 5000;
- case 3: DoScriptText(SAY_3, me, player); return 2000;
- case 4: DoScriptText(SAY_4, me, player); return 2000;
- case 5: DoScriptText(SAY_5, me, player); return 2000;
+ case 1: Talk(SAY_1, player->GetGUID()); return 3000;
+ case 2: Talk(SAY_2, player->GetGUID()); return 5000;
+ case 3: Talk(SAY_3, player->GetGUID()); return 2000;
+ case 4: Talk(SAY_4, player->GetGUID()); return 2000;
+ case 5: Talk(SAY_5, player->GetGUID()); return 2000;
case 6: Attack = true; return 2000;
default: return 0;
}
@@ -568,7 +579,7 @@ public:
}
me->setFaction(1194);
Done = true;
- DoScriptText(SAY_GIVEUP, me, NULL);
+ Talk(SAY_GIVEUP);
me->DeleteThreatList();
me->CombatStop();
me->GetMotionMaster()->MoveTargetedHome();
diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp
index 6c2214cde37..d1f37dd5bfc 100644
--- a/src/server/scripts/Outland/terokkar_forest.cpp
+++ b/src/server/scripts/Outland/terokkar_forest.cpp
@@ -33,22 +33,28 @@ npc_isla_starmane
npc_slim
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Group.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## mob_unkor_the_ruthless
######*/
-#define SAY_SUBMIT -1000194
+enum UnkorTheRuthless
+{
+ SAY_SUBMIT = 0,
-#define FACTION_HOSTILE 45
-#define FACTION_FRIENDLY 35
-#define QUEST_DONTKILLTHEFATONE 9889
+ FACTION_HOSTILE = 45,
+ FACTION_FRIENDLY = 35,
+ QUEST_DONTKILLTHEFATONE = 9889,
-#define SPELL_PULVERIZE 2676
-//#define SPELL_QUID9889 32174
+ SPELL_PULVERIZE = 2676
+};
class mob_unkor_the_ruthless : public CreatureScript
{
@@ -81,7 +87,7 @@ public:
void DoNice()
{
- DoScriptText(SAY_SUBMIT, me);
+ Talk(SAY_SUBMIT);
me->setFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT);
me->RemoveAllAuras();
@@ -340,7 +346,7 @@ public:
enum eFloon
{
- SAY_FLOON_ATTACK = -1000195,
+ SAY_FLOON_ATTACK = 0,
SPELL_SILENCE = 6726,
SPELL_FROSTBOLT = 9672,
@@ -367,7 +373,7 @@ public:
{
player->CLOSE_GOSSIP_MENU();
creature->setFaction(FACTION_HOSTILE_FL);
- DoScriptText(SAY_FLOON_ATTACK, creature, player);
+ creature->AI()->Talk(SAY_FLOON_ATTACK, player->GetGUID());
creature->AI()->AttackStart(player);
}
return true;
@@ -443,10 +449,10 @@ public:
######*/
enum eIslaStarmaneData
{
- SAY_PROGRESS_1 = -1000571,
- SAY_PROGRESS_2 = -1000572,
- SAY_PROGRESS_3 = -1000573,
- SAY_PROGRESS_4 = -1000574,
+ SAY_PROGRESS_1 = 0,
+ SAY_PROGRESS_2 = 1,
+ SAY_PROGRESS_3 = 2,
+ SAY_PROGRESS_4 = 3,
QUEST_EFTW_H = 10052,
QUEST_EFTW_A = 10051,
@@ -476,16 +482,16 @@ public:
Cage->SetGoState(GO_STATE_ACTIVE);
break;
case 2:
- DoScriptText(SAY_PROGRESS_1, me, player);
+ Talk(SAY_PROGRESS_1, player->GetGUID());
break;
case 5:
- DoScriptText(SAY_PROGRESS_2, me, player);
+ Talk(SAY_PROGRESS_2, player->GetGUID());
break;
case 6:
- DoScriptText(SAY_PROGRESS_3, me, player);
+ Talk(SAY_PROGRESS_3, player->GetGUID());
break;
case 29:
- DoScriptText(SAY_PROGRESS_4, me, player);
+ Talk(SAY_PROGRESS_4, player->GetGUID());
if (player->GetTeam() == ALLIANCE)
player->GroupEventHappens(QUEST_EFTW_A, me);
else if (player->GetTeam() == HORDE)
diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp
index 90ce070ecc7..1fbb8a48324 100644
--- a/src/server/scripts/Outland/zangarmarsh.cpp
+++ b/src/server/scripts/Outland/zangarmarsh.cpp
@@ -32,8 +32,12 @@ npc_kayra_longmane
npc_timothy_daniels
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## npcs_ashyen_and_keleth
@@ -41,9 +45,24 @@ EndContentData */
#define GOSSIP_ITEM_BLESS_ASH "Grant me your mark, wise ancient."
#define GOSSIP_ITEM_BLESS_KEL "Grant me your mark, mighty ancient."
-//signed for 17900 but used by 17900, 17901
-#define GOSSIP_REWARD_BLESS -1000359
-//#define TEXT_BLESSINGS "<You need higher standing with Cenarion Expedition to recive a blessing.>"
+
+enum AshyenAndKeleth
+{
+ GOSSIP_REWARD_BLESS = 0,
+
+ NPC_ASHYEN = 17900,
+ NPC_KELETH = 17901,
+
+ SPELL_BLESS_ASH_EXA = 31815,
+ SPELL_BLESS_ASH_REV = 31811,
+ SPELL_BLESS_ASH_HON = 31810,
+ SPELL_BLESS_ASH_FRI = 31808,
+
+ SPELL_BLESS_KEL_EXA = 31814,
+ SPELL_BLESS_KEL_REV = 31813,
+ SPELL_BLESS_KEL_HON = 31812,
+ SPELL_BLESS_KEL_FRI = 31807
+};
class npcs_ashyen_and_keleth : public CreatureScript
{
@@ -54,10 +73,10 @@ public:
{
if (player->GetReputationRank(942) > REP_NEUTRAL)
{
- if (creature->GetEntry() == 17900)
+ if (creature->GetEntry() == NPC_ASHYEN)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_ASH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- if (creature->GetEntry() == 17901)
+ if (creature->GetEntry() == NPC_KELETH)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BLESS_KEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
}
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
@@ -74,54 +93,60 @@ public:
creature->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case
creature->SetPower(POWER_MANA, 200);
- if (creature->GetEntry() == 17900) //check which Creature we are dealing with
+ if (creature->GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
{
+ uint32 spell = 0;
switch (player->GetReputationRank(942))
{ //mark of lore
case REP_FRIENDLY:
- creature->CastSpell(player, 31808, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_ASH_FRI;
break;
case REP_HONORED:
- creature->CastSpell(player, 31810, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_ASH_HON;
break;
case REP_REVERED:
- creature->CastSpell(player, 31811, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_ASH_REV;
break;
case REP_EXALTED:
- creature->CastSpell(player, 31815, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_ASH_EXA;
break;
default:
break;
}
+
+ if (spell)
+ {
+ creature->CastSpell(player, spell, true);
+ creature->AI()->Talk(GOSSIP_REWARD_BLESS);
+ }
}
- if (creature->GetEntry() == 17901)
+ if (creature->GetEntry() == NPC_KELETH)
{
+ uint32 spell = 0;
switch (player->GetReputationRank(942)) //mark of war
{
case REP_FRIENDLY:
- creature->CastSpell(player, 31807, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_KEL_FRI;
break;
case REP_HONORED:
- creature->CastSpell(player, 31812, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_KEL_HON;
break;
case REP_REVERED:
- creature->CastSpell(player, 31813, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_KEL_REV;
break;
case REP_EXALTED:
- creature->CastSpell(player, 31814, true);
- DoScriptText(GOSSIP_REWARD_BLESS, creature);
+ spell = SPELL_BLESS_KEL_EXA;
break;
default:
break;
}
+
+ if (spell)
+ {
+ creature->CastSpell(player, spell, true);
+ creature->AI()->Talk(GOSSIP_REWARD_BLESS);
+ }
}
player->CLOSE_GOSSIP_MENU();
player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
@@ -247,7 +272,7 @@ public:
break;
case GOSSIP_ACTION_INFO_DEF + 2:
{
- if (!player->HasItemCount(24573, 1))
+ if (!player->HasItemCount(24573))
{
ItemPosCountVec dest;
uint32 itemId = 24573;
@@ -300,12 +325,11 @@ public:
enum eKayra
{
- SAY_START = -1000343,
- SAY_AMBUSH1 = -1000344,
- SAY_PROGRESS = -1000345,
- SAY_AMBUSH2 = -1000346,
- SAY_NEAR_END = -1000347,
- SAY_END = -1000348, //this is signed for 10646
+ SAY_START = 0,
+ SAY_AMBUSH1 = 1,
+ SAY_PROGRESS = 2,
+ SAY_AMBUSH2 = 3,
+ SAY_END = 4,
QUEST_ESCAPE_FROM = 9752,
NPC_SLAVEBINDER = 18042
@@ -331,25 +355,24 @@ public:
switch (waypointId)
{
case 4:
- DoScriptText(SAY_AMBUSH1, me, player);
+ Talk(SAY_AMBUSH1, player->GetGUID());
DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 5:
- DoScriptText(SAY_PROGRESS, me, player);
+ Talk(SAY_PROGRESS, player->GetGUID());
SetRun();
break;
case 16:
- DoScriptText(SAY_AMBUSH2, me, player);
+ Talk(SAY_AMBUSH2, player->GetGUID());
DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 17:
SetRun(false);
- DoScriptText(SAY_NEAR_END, me, player);
break;
case 25:
- DoScriptText(SAY_END, me, player);
+ Talk(SAY_END, player->GetGUID());
player->GroupEventHappens(QUEST_ESCAPE_FROM, me);
break;
}
@@ -360,7 +383,7 @@ public:
{
if (quest->GetQuestId() == QUEST_ESCAPE_FROM)
{
- DoScriptText(SAY_START, creature, player);
+ creature->AI()->Talk(SAY_START, player->GetGUID());
if (npc_escortAI* pEscortAI = CAST_AI(npc_kayra_longmane::npc_kayra_longmaneAI, creature->AI()))
pEscortAI->Start(false, false, player->GetGUID());
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index a1c48878507..224e909ca57 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_dk_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
@@ -70,7 +71,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -118,7 +119,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
+ absorbAmount = std::min(CalculatePct(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
}
void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
@@ -179,7 +180,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader
void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -413,7 +414,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f);
// Death Knight T8 Melee 4P Bonus
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0))
- AddPctF(multiplier, aurEff->GetAmount());
+ AddPct(multiplier, aurEff->GetAmount());
}
}
@@ -425,7 +426,7 @@ class spell_dk_scourge_strike : public SpellScriptLoader
int32 bp = GetHitDamage() * multiplier;
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
- AddPctN(bp, aurEff->GetAmount());
+ AddPct(bp, aurEff->GetAmount());
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
}
@@ -472,7 +473,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader
{
// You have a chance equal to your Parry chance
if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance()))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -582,7 +583,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
// Damage that would take you below [effect0] health or taken while you are at [effect0]
if (remainingHp < minHp)
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -722,7 +723,7 @@ class spell_dk_death_strike : public SpellScriptLoader
int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier)));
// Improved Death Strike
if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0))
- AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
+ AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2));
caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false);
}
}
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 4dd115f22ca..0fe6c367a9a 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -21,9 +21,11 @@
* Scriptnames of files in this file should be prefixed with "spell_dru_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "Containers.h"
enum DruidSpells
{
@@ -34,6 +36,36 @@ enum DruidSpells
DRUID_SURVIVAL_INSTINCTS = 50322,
DRUID_SAVAGE_ROAR = 62071,
SPELL_DRUID_ITEM_T8_BALANCE_RELIC = 64950,
+ SPELL_KING_OF_THE_JUNGLE = 48492,
+ SPELL_TIGER_S_FURY_ENERGIZE = 51178,
+ SPELL_ENRAGE_MOD_DAMAGE = 51185,
+};
+
+class spell_dru_enrage : public SpellScriptLoader
+{
+ public:
+ spell_dru_enrage() : SpellScriptLoader("spell_dru_enrage") { }
+
+ class spell_dru_enrage_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dru_enrage_SpellScript);
+
+ void OnHit()
+ {
+ if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffectOfRankedSpell(SPELL_KING_OF_THE_JUNGLE, EFFECT_0))
+ GetHitUnit()->CastCustomSpell(SPELL_ENRAGE_MOD_DAMAGE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetHitUnit(), true);
+ }
+
+ void Register()
+ {
+ AfterHit += SpellHitFn(spell_dru_enrage_SpellScript::OnHit);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_dru_enrage_SpellScript();
+ }
};
// 54846 Glyph of Starfire
@@ -88,6 +120,115 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader
}
};
+class spell_dru_insect_swarm : public SpellScriptLoader
+{
+ public:
+ spell_dru_insect_swarm() : SpellScriptLoader("spell_dru_insect_swarm") { }
+
+ class spell_dru_insect_swarm_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_insect_swarm_AuraScript);
+
+ void CalculateAmount(AuraEffect const* aurEff, int32 & amount, bool & /*canBeRecalculated*/)
+ {
+ if (Unit* caster = GetCaster())
+ if (AuraEffect const* relicAurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0))
+ amount += relicAurEff->GetAmount() / aurEff->GetTotalTicks();
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_insect_swarm_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_insect_swarm_AuraScript();
+ }
+};
+
+class spell_dru_lifebloom : public SpellScriptLoader
+{
+ public:
+ spell_dru_lifebloom() : SpellScriptLoader("spell_dru_lifebloom") { }
+
+ class spell_dru_lifebloom_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_lifebloom_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_FINAL_HEAL))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_ENERGIZE))
+ return false;
+ return true;
+ }
+
+ void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ // Final heal only on duration end
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
+ return;
+
+ // final heal
+ int32 stack = GetStackAmount();
+ int32 healAmount = aurEff->GetAmount();
+ if (Unit* caster = GetCaster())
+ {
+ healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack);
+ healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack);
+
+ GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+
+ // restore mana
+ int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
+ caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ return;
+ }
+
+ GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
+ }
+
+ void HandleDispel(DispelInfo* dispelInfo)
+ {
+ if (Unit* target = GetUnitOwner())
+ {
+ if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
+ {
+ // final heal
+ int32 healAmount = aurEff->GetAmount();
+ if (Unit* caster = GetCaster())
+ {
+ healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
+ healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
+ target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+
+ // restore mana
+ int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
+ caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ return;
+ }
+
+ target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
+ }
+ }
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_lifebloom_AuraScript();
+ }
+};
+
// 69366 - Moonkin Form passive
class spell_dru_moonkin_form_passive : public SpellScriptLoader
{
@@ -116,7 +257,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader
{
// reduces all damage taken while Stunned in Moonkin Form
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -132,6 +273,34 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader
}
};
+class spell_dru_predatory_strikes : public SpellScriptLoader
+{
+ public:
+ spell_dru_predatory_strikes() : SpellScriptLoader("spell_dru_predatory_strikes") { }
+
+ class spell_dru_predatory_strikes_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_predatory_strikes_AuraScript);
+
+ void UpdateAmount(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Player* target = GetTarget()->ToPlayer())
+ target->UpdateAttackPowerAndDamage();
+ }
+
+ void Register()
+ {
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_predatory_strikes_AuraScript();
+ }
+};
+
// 33851 - Primal Tenacity
class spell_dru_primal_tenacity : public SpellScriptLoader
{
@@ -160,7 +329,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader
{
// reduces all damage taken while Stunned in Cat Form
if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -202,7 +371,7 @@ class spell_dru_savage_defense : public SpellScriptLoader
void Absorb(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
{
- absorbAmount = uint32(CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
+ absorbAmount = uint32(CalculatePct(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct));
aurEff->SetAmount(0);
}
@@ -219,57 +388,67 @@ class spell_dru_savage_defense : public SpellScriptLoader
}
};
-class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
+class spell_dru_savage_roar : public SpellScriptLoader
{
public:
- spell_dru_t10_restoration_4p_bonus() : SpellScriptLoader("spell_dru_t10_restoration_4p_bonus") { }
+ spell_dru_savage_roar() : SpellScriptLoader("spell_dru_savage_roar") { }
- class spell_dru_t10_restoration_4p_bonus_SpellScript : public SpellScript
+ class spell_dru_savage_roar_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_dru_t10_restoration_4p_bonus_SpellScript);
+ PrepareSpellScript(spell_dru_savage_roar_SpellScript);
- bool Load()
+ SpellCastResult CheckCast()
{
- return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ Unit* caster = GetCaster();
+ if (caster->GetShapeshiftForm() != FORM_CAT)
+ return SPELL_FAILED_ONLY_SHAPESHIFT;
+
+ return SPELL_CAST_OK;
}
- void FilterTargets(std::list<WorldObject*>& targets)
+ void Register()
{
- if (!GetCaster()->ToPlayer()->GetGroup())
- {
- targets.clear();
- targets.push_back(GetCaster());
- }
- else
- {
- targets.remove(GetExplTargetUnit());
- std::list<Unit*> tempTargets;
- for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
- if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith((*itr)->ToUnit()))
- tempTargets.push_back((*itr)->ToUnit());
+ OnCheckCast += SpellCheckCastFn(spell_dru_savage_roar_SpellScript::CheckCast);
+ }
+ };
- if (tempTargets.empty())
- {
- targets.clear();
- FinishCast(SPELL_FAILED_DONT_REPORT);
- return;
- }
+ class spell_dru_savage_roar_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dru_savage_roar_AuraScript);
- Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets);
- targets.clear();
- targets.push_back(target);
- }
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(DRUID_SAVAGE_ROAR))
+ return false;
+ return true;
+ }
+
+ void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID());
+ }
+
+ void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ GetTarget()->RemoveAurasDueToSpell(DRUID_SAVAGE_ROAR);
}
void Register()
{
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
SpellScript* GetSpellScript() const
{
- return new spell_dru_t10_restoration_4p_bonus_SpellScript();
+ return new spell_dru_savage_roar_SpellScript();
+ }
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dru_savage_roar_AuraScript();
}
};
@@ -299,40 +478,6 @@ class spell_dru_starfall_aoe : public SpellScriptLoader
}
};
-// 40121 - Swift Flight Form (Passive)
-class spell_dru_swift_flight_passive : public SpellScriptLoader
-{
- public:
- spell_dru_swift_flight_passive() : SpellScriptLoader("spell_dru_swift_flight_passive") { }
-
- class spell_dru_swift_flight_passive_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_dru_swift_flight_passive_AuraScript);
-
- bool Load()
- {
- return GetCaster()->GetTypeId() == TYPEID_PLAYER;
- }
-
- void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
- {
- if (Player* caster = GetCaster()->ToPlayer())
- if (caster->Has310Flyer(false))
- amount = 310;
- }
-
- void Register()
- {
- DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_swift_flight_passive_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED);
- }
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_dru_swift_flight_passive_AuraScript();
- }
-};
-
class spell_dru_starfall_dummy : public SpellScriptLoader
{
public:
@@ -378,128 +523,19 @@ class spell_dru_starfall_dummy : public SpellScriptLoader
}
};
-class spell_dru_lifebloom : public SpellScriptLoader
-{
- public:
- spell_dru_lifebloom() : SpellScriptLoader("spell_dru_lifebloom") { }
-
- class spell_dru_lifebloom_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_dru_lifebloom_AuraScript);
-
- bool Validate(SpellInfo const* /*spell*/)
- {
- if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_FINAL_HEAL))
- return false;
- if (!sSpellMgr->GetSpellInfo(DRUID_LIFEBLOOM_ENERGIZE))
- return false;
- return true;
- }
-
- void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
- {
- // Final heal only on duration end
- if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
- return;
-
- // final heal
- int32 stack = GetStackAmount();
- int32 healAmount = aurEff->GetAmount();
- if (Unit* caster = GetCaster())
- {
- healAmount = caster->SpellHealingBonusDone(GetTarget(), GetSpellInfo(), healAmount, HEAL, stack);
- healAmount = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, stack);
-
- GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
-
- // restore mana
- int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
- caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
- return;
- }
-
- GetTarget()->CastCustomSpell(GetTarget(), DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
- }
-
- void HandleDispel(DispelInfo* dispelInfo)
- {
- if (Unit* target = GetUnitOwner())
- {
- if (AuraEffect const* aurEff = GetEffect(EFFECT_1))
- {
- // final heal
- int32 healAmount = aurEff->GetAmount();
- if (Unit* caster = GetCaster())
- {
- healAmount = caster->SpellHealingBonusDone(target, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
- healAmount = target->SpellHealingBonusTaken(caster, GetSpellInfo(), healAmount, HEAL, dispelInfo->GetRemovedCharges());
- target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
-
- // restore mana
- int32 returnMana = CalculatePctU(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
- caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
- return;
- }
-
- target->CastCustomSpell(target, DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, NULL, NULL, true, NULL, NULL, GetCasterGUID());
- }
- }
- }
-
- void Register()
- {
- AfterEffectRemove += AuraEffectRemoveFn(spell_dru_lifebloom_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- AfterDispel += AuraDispelFn(spell_dru_lifebloom_AuraScript::HandleDispel);
- }
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_dru_lifebloom_AuraScript();
- }
-};
-
-class spell_dru_predatory_strikes : public SpellScriptLoader
-{
- public:
- spell_dru_predatory_strikes() : SpellScriptLoader("spell_dru_predatory_strikes") { }
-
- class spell_dru_predatory_strikes_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_dru_predatory_strikes_AuraScript);
-
- void UpdateAmount(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
- {
- if (Player* target = GetTarget()->ToPlayer())
- target->UpdateAttackPowerAndDamage();
- }
-
- void Register()
- {
- AfterEffectApply += AuraEffectApplyFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
- AfterEffectRemove += AuraEffectRemoveFn(spell_dru_predatory_strikes_AuraScript::UpdateAmount, EFFECT_ALL, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
- }
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_dru_predatory_strikes_AuraScript();
- }
-};
-
-class spell_dru_savage_roar : public SpellScriptLoader
+class spell_dru_survival_instincts : public SpellScriptLoader
{
public:
- spell_dru_savage_roar() : SpellScriptLoader("spell_dru_savage_roar") { }
+ spell_dru_survival_instincts() : SpellScriptLoader("spell_dru_survival_instincts") { }
- class spell_dru_savage_roar_SpellScript : public SpellScript
+ class spell_dru_survival_instincts_SpellScript : public SpellScript
{
- PrepareSpellScript(spell_dru_savage_roar_SpellScript);
+ PrepareSpellScript(spell_dru_survival_instincts_SpellScript);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
- if (caster->GetShapeshiftForm() != FORM_CAT)
+ if (!caster->IsInFeralForm())
return SPELL_FAILED_ONLY_SHAPESHIFT;
return SPELL_CAST_OK;
@@ -507,17 +543,17 @@ class spell_dru_savage_roar : public SpellScriptLoader
void Register()
{
- OnCheckCast += SpellCheckCastFn(spell_dru_savage_roar_SpellScript::CheckCast);
+ OnCheckCast += SpellCheckCastFn(spell_dru_survival_instincts_SpellScript::CheckCast);
}
};
- class spell_dru_savage_roar_AuraScript : public AuraScript
+ class spell_dru_survival_instincts_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_dru_savage_roar_AuraScript);
+ PrepareAuraScript(spell_dru_survival_instincts_AuraScript);
bool Validate(SpellInfo const* /*spell*/)
{
- if (!sSpellMgr->GetSpellInfo(DRUID_SAVAGE_ROAR))
+ if (!sSpellMgr->GetSpellInfo(DRUID_SURVIVAL_INSTINCTS))
return false;
return true;
}
@@ -525,138 +561,163 @@ class spell_dru_savage_roar : public SpellScriptLoader
void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
- target->CastSpell(target, DRUID_SAVAGE_ROAR, true, NULL, aurEff, GetCasterGUID());
+ int32 bp0 = target->CountPctFromMaxHealth(aurEff->GetAmount());
+ target->CastCustomSpell(target, DRUID_SURVIVAL_INSTINCTS, &bp0, NULL, NULL, true);
}
void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- GetTarget()->RemoveAurasDueToSpell(DRUID_SAVAGE_ROAR);
+ GetTarget()->RemoveAurasDueToSpell(DRUID_SURVIVAL_INSTINCTS);
}
void Register()
{
- AfterEffectApply += AuraEffectApplyFn(spell_dru_savage_roar_AuraScript::AfterApply, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
- AfterEffectRemove += AuraEffectRemoveFn(spell_dru_savage_roar_AuraScript::AfterRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ AfterEffectApply += AuraEffectApplyFn(spell_dru_survival_instincts_AuraScript::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectRemove += AuraEffectRemoveFn(spell_dru_survival_instincts_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
}
};
SpellScript* GetSpellScript() const
{
- return new spell_dru_savage_roar_SpellScript();
+ return new spell_dru_survival_instincts_SpellScript();
}
AuraScript* GetAuraScript() const
{
- return new spell_dru_savage_roar_AuraScript();
+ return new spell_dru_survival_instincts_AuraScript();
}
};
-class spell_dru_survival_instincts : public SpellScriptLoader
+// 40121 - Swift Flight Form (Passive)
+class spell_dru_swift_flight_passive : public SpellScriptLoader
{
public:
- spell_dru_survival_instincts() : SpellScriptLoader("spell_dru_survival_instincts") { }
+ spell_dru_swift_flight_passive() : SpellScriptLoader("spell_dru_swift_flight_passive") { }
- class spell_dru_survival_instincts_SpellScript : public SpellScript
+ class spell_dru_swift_flight_passive_AuraScript : public AuraScript
{
- PrepareSpellScript(spell_dru_survival_instincts_SpellScript);
+ PrepareAuraScript(spell_dru_swift_flight_passive_AuraScript);
- SpellCastResult CheckCast()
+ bool Load()
{
- Unit* caster = GetCaster();
- if (!caster->IsInFeralForm())
- return SPELL_FAILED_ONLY_SHAPESHIFT;
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
- return SPELL_CAST_OK;
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
+ {
+ if (Player* caster = GetCaster()->ToPlayer())
+ if (caster->Has310Flyer(false))
+ amount = 310;
}
void Register()
{
- OnCheckCast += SpellCheckCastFn(spell_dru_survival_instincts_SpellScript::CheckCast);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_swift_flight_passive_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED);
}
};
- class spell_dru_survival_instincts_AuraScript : public AuraScript
+ AuraScript* GetAuraScript() const
{
- PrepareAuraScript(spell_dru_survival_instincts_AuraScript);
+ return new spell_dru_swift_flight_passive_AuraScript();
+ }
+};
- bool Validate(SpellInfo const* /*spell*/)
- {
- if (!sSpellMgr->GetSpellInfo(DRUID_SURVIVAL_INSTINCTS))
- return false;
- return true;
- }
+class spell_dru_tiger_s_fury : public SpellScriptLoader
+{
+ public:
+ spell_dru_tiger_s_fury() : SpellScriptLoader("spell_dru_tiger_s_fury") { }
- void AfterApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
- {
- Unit* target = GetTarget();
- int32 bp0 = target->CountPctFromMaxHealth(aurEff->GetAmount());
- target->CastCustomSpell(target, DRUID_SURVIVAL_INSTINCTS, &bp0, NULL, NULL, true);
- }
+ class spell_dru_tiger_s_fury_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dru_tiger_s_fury_SpellScript);
- void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ void OnHit()
{
- GetTarget()->RemoveAurasDueToSpell(DRUID_SURVIVAL_INSTINCTS);
+ if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffectOfRankedSpell(SPELL_KING_OF_THE_JUNGLE, EFFECT_1))
+ GetHitUnit()->CastCustomSpell(SPELL_TIGER_S_FURY_ENERGIZE, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), GetHitUnit(), true);
}
void Register()
{
- AfterEffectApply += AuraEffectApplyFn(spell_dru_survival_instincts_AuraScript::AfterApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
- AfterEffectRemove += AuraEffectRemoveFn(spell_dru_survival_instincts_AuraScript::AfterRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterHit += SpellHitFn(spell_dru_tiger_s_fury_SpellScript::OnHit);
}
};
SpellScript* GetSpellScript() const
{
- return new spell_dru_survival_instincts_SpellScript();
- }
-
- AuraScript* GetAuraScript() const
- {
- return new spell_dru_survival_instincts_AuraScript();
+ return new spell_dru_tiger_s_fury_SpellScript();
}
};
-class spell_dru_insect_swarm : public SpellScriptLoader
+class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
{
public:
- spell_dru_insect_swarm() : SpellScriptLoader("spell_dru_insect_swarm") { }
+ spell_dru_t10_restoration_4p_bonus() : SpellScriptLoader("spell_dru_t10_restoration_4p_bonus") { }
- class spell_dru_insect_swarm_AuraScript : public AuraScript
+ class spell_dru_t10_restoration_4p_bonus_SpellScript : public SpellScript
{
- PrepareAuraScript(spell_dru_insect_swarm_AuraScript);
+ PrepareSpellScript(spell_dru_t10_restoration_4p_bonus_SpellScript);
- void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
+ bool Load()
{
- if (Unit* caster = GetCaster())
- if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DRUID_ITEM_T8_BALANCE_RELIC, EFFECT_0))
- amount += aurEff->GetAmount();
+ return GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ if (!GetCaster()->ToPlayer()->GetGroup())
+ {
+ targets.clear();
+ targets.push_back(GetCaster());
+ }
+ else
+ {
+ targets.remove(GetExplTargetUnit());
+ std::list<Unit*> tempTargets;
+ for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
+ if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith((*itr)->ToUnit()))
+ tempTargets.push_back((*itr)->ToUnit());
+
+ if (tempTargets.empty())
+ {
+ targets.clear();
+ FinishCast(SPELL_FAILED_DONT_REPORT);
+ return;
+ }
+
+ Unit* target = Trinity::Containers::SelectRandomContainerElement(tempTargets);
+ targets.clear();
+ targets.push_back(target);
+ }
}
void Register()
{
- DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_insect_swarm_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_t10_restoration_4p_bonus_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
}
};
- AuraScript* GetAuraScript() const
+ SpellScript* GetSpellScript() const
{
- return new spell_dru_insect_swarm_AuraScript();
+ return new spell_dru_t10_restoration_4p_bonus_SpellScript();
}
};
void AddSC_druid_spell_scripts()
{
+ new spell_dru_enrage();
new spell_dru_glyph_of_starfire();
+ new spell_dru_insect_swarm();
+ new spell_dru_lifebloom();
new spell_dru_moonkin_form_passive();
+ new spell_dru_predatory_strikes();
new spell_dru_primal_tenacity();
new spell_dru_savage_defense();
- new spell_dru_t10_restoration_4p_bonus();
+ new spell_dru_savage_roar();
new spell_dru_starfall_aoe();
- new spell_dru_swift_flight_passive();
new spell_dru_starfall_dummy();
- new spell_dru_lifebloom();
- new spell_dru_predatory_strikes();
- new spell_dru_savage_roar();
new spell_dru_survival_instincts();
- new spell_dru_insect_swarm();
+ new spell_dru_swift_flight_passive();
+ new spell_dru_tiger_s_fury();
+ new spell_dru_t10_restoration_4p_bonus();
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 9cbf81b39af..667b6841b63 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -23,16 +23,19 @@
*/
#include "ScriptMgr.h"
-#include "SpellScript.h"
-#include "SpellAuraEffects.h"
-#include "SkillDiscovery.h"
+#include "Battleground.h"
#include "Cell.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
-#include "InstanceScript.h"
#include "Group.h"
+#include "InstanceScript.h"
#include "LFGMgr.h"
+#include "Pet.h"
+#include "ReputationMgr.h"
+#include "SkillDiscovery.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
class spell_gen_absorb0_hitlimit1 : public SpellScriptLoader
{
@@ -364,59 +367,9 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader
}
};
-// 66118 Leeching Swarm
-enum LeechingSwarmSpells
-{
- SPELL_LEECHING_SWARM_DMG = 66240,
- SPELL_LEECHING_SWARM_HEAL = 66125,
-};
-
-class spell_gen_leeching_swarm : public SpellScriptLoader
-{
- public:
- spell_gen_leeching_swarm() : SpellScriptLoader("spell_gen_leeching_swarm") { }
-
- class spell_gen_leeching_swarm_AuraScript : public AuraScript
- {
- PrepareAuraScript(spell_gen_leeching_swarm_AuraScript);
-
- bool Validate(SpellInfo const* /*spellEntry*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG) || !sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
- return false;
- return true;
- }
-
- void HandleEffectPeriodic(AuraEffect const* aurEff)
- {
- Unit* caster = GetCaster();
- if (Unit* target = GetTarget())
- {
- int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount());
- if (lifeLeeched < 250)
- lifeLeeched = 250;
- // Damage
- caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
- // Heal
- caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false);
- }
- }
-
- void Register()
- {
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
- }
- };
-
- AuraScript* GetAuraScript() const
- {
- return new spell_gen_leeching_swarm_AuraScript();
- }
-};
-
enum EluneCandle
{
- NPC_OMEN = 15467,
+ NPC_OMEN = 15467,
SPELL_ELUNE_CANDLE_OMEN_HEAD = 26622,
SPELL_ELUNE_CANDLE_OMEN_CHEST = 26624,
@@ -480,128 +433,6 @@ class spell_gen_elune_candle : public SpellScriptLoader
}
};
-// 24750 Trick
-enum TrickSpells
-{
- SPELL_PIRATE_COSTUME_MALE = 24708,
- SPELL_PIRATE_COSTUME_FEMALE = 24709,
- SPELL_NINJA_COSTUME_MALE = 24710,
- SPELL_NINJA_COSTUME_FEMALE = 24711,
- SPELL_LEPER_GNOME_COSTUME_MALE = 24712,
- SPELL_LEPER_GNOME_COSTUME_FEMALE = 24713,
- SPELL_SKELETON_COSTUME = 24723,
- SPELL_GHOST_COSTUME_MALE = 24735,
- SPELL_GHOST_COSTUME_FEMALE = 24736,
- SPELL_TRICK_BUFF = 24753,
-};
-
-class spell_gen_trick : public SpellScriptLoader
-{
- public:
- spell_gen_trick() : SpellScriptLoader("spell_gen_trick") {}
-
- class spell_gen_trick_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_gen_trick_SpellScript);
- bool Validate(SpellInfo const* /*spellEntry*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE)
- || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE)
- || !sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
- return false;
- return true;
- }
-
- void HandleScript(SpellEffIndex /*effIndex*/)
- {
- Unit* caster = GetCaster();
- if (Player* target = GetHitPlayer())
- {
- uint8 gender = target->getGender();
- uint32 spellId = SPELL_TRICK_BUFF;
- switch (urand(0, 5))
- {
- case 1:
- spellId = gender ? SPELL_LEPER_GNOME_COSTUME_FEMALE : SPELL_LEPER_GNOME_COSTUME_MALE;
- break;
- case 2:
- spellId = gender ? SPELL_PIRATE_COSTUME_FEMALE : SPELL_PIRATE_COSTUME_MALE;
- break;
- case 3:
- spellId = gender ? SPELL_GHOST_COSTUME_FEMALE : SPELL_GHOST_COSTUME_MALE;
- break;
- case 4:
- spellId = gender ? SPELL_NINJA_COSTUME_FEMALE : SPELL_NINJA_COSTUME_MALE;
- break;
- case 5:
- spellId = SPELL_SKELETON_COSTUME;
- break;
- default:
- break;
- }
-
- caster->CastSpell(target, spellId, true, NULL);
- }
- }
-
- void Register()
- {
- OnEffectHitTarget += SpellEffectFn(spell_gen_trick_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_gen_trick_SpellScript();
- }
-};
-
-// 24751 Trick or Treat
-enum TrickOrTreatSpells
-{
- SPELL_TRICK = 24714,
- SPELL_TREAT = 24715,
- SPELL_TRICKED_OR_TREATED = 24755
-};
-
-class spell_gen_trick_or_treat : public SpellScriptLoader
-{
- public:
- spell_gen_trick_or_treat() : SpellScriptLoader("spell_gen_trick_or_treat") {}
-
- class spell_gen_trick_or_treat_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_gen_trick_or_treat_SpellScript);
-
- bool Validate(SpellInfo const* /*spellEntry*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_TRICK) || !sSpellMgr->GetSpellInfo(SPELL_TREAT) || !sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
- return false;
- return true;
- }
-
- void HandleScript(SpellEffIndex /*effIndex*/)
- {
- Unit* caster = GetCaster();
- if (Player* target = GetHitPlayer())
- {
- caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL);
- caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL);
- }
- }
-
- void Register()
- {
- OnEffectHitTarget += SpellEffectFn(spell_gen_trick_or_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
- }
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_gen_trick_or_treat_SpellScript();
- }
-};
-
class spell_creature_permanent_feign_death : public SpellScriptLoader
{
public:
@@ -907,9 +738,22 @@ class spell_gen_profession_research : public SpellScriptLoader
return SPELL_CAST_OK;
}
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ uint32 spellId = GetSpellInfo()->Id;
+
+ // learn random explicit discovery recipe (if any)
+ if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster))
+ caster->learnSpell(discoveredSpellId, false);
+
+ caster->UpdateCraftSkill(spellId);
+ }
+
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_gen_profession_research_SpellScript::CheckRequirement);
+ OnEffectHitTarget += SpellEffectFn(spell_gen_profession_research_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -950,14 +794,14 @@ class spell_generic_clone : public SpellScriptLoader
enum CloneWeaponSpells
{
- SPELL_COPY_WEAPON = 41055,
- SPELL_COPY_WEAPON_2 = 63416,
- SPELL_COPY_WEAPON_3 = 69891,
+ SPELL_COPY_WEAPON_AURA = 41054,
+ SPELL_COPY_WEAPON_2_AURA = 63418,
+ SPELL_COPY_WEAPON_3_AURA = 69893,
- SPELL_COPY_OFFHAND = 45206,
- SPELL_COPY_OFFHAND_2 = 69892,
+ SPELL_COPY_OFFHAND_AURA = 45205,
+ SPELL_COPY_OFFHAND_2_AURA = 69896,
- SPELL_COPY_RANGED = 57593
+ SPELL_COPY_RANGED_AURA = 57594
};
class spell_generic_clone_weapon : public SpellScriptLoader
@@ -969,80 +813,147 @@ class spell_generic_clone_weapon : public SpellScriptLoader
{
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
- bool Validate(SpellInfo const* /*spellEntry*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)
- || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
- return false;
- return true;
- }
-
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
+
if (Unit* target = GetHitUnit())
{
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
- target->CastSpell(caster, spellId, true);
+ caster->CastSpell(target, spellId, true);
+ }
+ }
- if (target->GetTypeId() == TYPEID_PLAYER)
- return;
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_generic_clone_weapon_SpellScript();
+ }
+};
+
+class spell_gen_clone_weapon_aura : public SpellScriptLoader
+{
+ public:
+ spell_gen_clone_weapon_aura() : SpellScriptLoader("spell_gen_clone_weapon_aura") { }
+
+ class spell_gen_clone_weapon_auraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_clone_weapon_auraScript);
+
+ uint32 prevItem;
+
+ bool Validate(SpellInfo const* /*spellEntry*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA)
+ || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ Unit* target = GetTarget();
- switch (GetSpellInfo()->Id)
+ if (!caster)
+ return;
+
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_COPY_WEAPON_AURA:
+ case SPELL_COPY_WEAPON_2_AURA:
+ case SPELL_COPY_WEAPON_3_AURA:
{
- case SPELL_COPY_WEAPON:
- case SPELL_COPY_WEAPON_2:
- case SPELL_COPY_WEAPON_3:
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID);
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
- break;
+ if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
}
- case SPELL_COPY_OFFHAND:
- case SPELL_COPY_OFFHAND_2:
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
+ break;
+ }
+ case SPELL_COPY_OFFHAND_AURA:
+ case SPELL_COPY_OFFHAND_2_AURA:
+ {
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 1;
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
- break;
+ if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
}
- case SPELL_COPY_RANGED:
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
+ break;
+ }
+ case SPELL_COPY_RANGED_AURA:
+ {
+ prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 2;
+
+ if (Player* player = caster->ToPlayer())
{
- if (Player* player = caster->ToPlayer())
- {
- if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
- }
- else
- target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
- break;
+ if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
}
- default:
- break;
+ else
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
+ break;
}
+ default:
+ break;
+ }
+ }
+
+ void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_COPY_WEAPON_AURA:
+ case SPELL_COPY_WEAPON_2_AURA:
+ case SPELL_COPY_WEAPON_3_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, prevItem);
+ break;
+ }
+ case SPELL_COPY_OFFHAND_AURA:
+ case SPELL_COPY_OFFHAND_2_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, prevItem);
+ break;
+ }
+ case SPELL_COPY_RANGED_AURA:
+ {
+ target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, prevItem);
+ break;
+ }
+ default:
+ break;
}
}
void Register()
{
- OnEffectHitTarget += SpellEffectFn(spell_generic_clone_weapon_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffectApply += AuraEffectApplyFn(spell_gen_clone_weapon_auraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectRemove += AuraEffectRemoveFn(spell_gen_clone_weapon_auraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
+
};
- SpellScript* GetSpellScript() const
+ AuraScript* GetAuraScript() const
{
- return new spell_generic_clone_weapon_SpellScript();
+ return new spell_gen_clone_weapon_auraScript();
}
};
@@ -1156,7 +1067,7 @@ class spell_gen_lifeblood : public SpellScriptLoader
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* owner = GetUnitOwner())
- amount += int32(CalculatePctF(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
+ amount += int32(CalculatePct(owner->GetMaxHealth(), 1.5f / aurEff->GetTotalTicks()));
}
void Register()
@@ -1501,12 +1412,12 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
}
- LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr);
+ 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 (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
+ if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId))
if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty()))
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
return; // in correct dungeon
@@ -1844,16 +1755,18 @@ class spell_gen_break_shield: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- Aura* aura = itr->second->GetBase();
- SpellInfo const* auraInfo = aura->GetSpellInfo();
- if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ if (Aura* aura = itr->second->GetBase())
{
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- // Remove dummys from rider (Necessary for updating visual shields)
- if (Unit* rider = target->GetCharmer())
- if (Aura* defend = rider->GetAura(aura->GetId()))
- defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- break;
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ {
+ aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ // Remove dummys from rider (Necessary for updating visual shields)
+ if (Unit* rider = target->GetCharmer())
+ if (Aura* defend = rider->GetAura(aura->GetId()))
+ defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ break;
+ }
}
}
break;
@@ -1972,16 +1885,18 @@ class spell_gen_mounted_charge: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
- Aura* aura = itr->second->GetBase();
- SpellInfo const* auraInfo = aura->GetSpellInfo();
- if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ if (Aura* aura = itr->second->GetBase())
{
- aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- // Remove dummys from rider (Necessary for updating visual shields)
- if (Unit* rider = target->GetCharmer())
- if (Aura* defend = rider->GetAura(aura->GetId()))
- defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
- break;
+ SpellInfo const* auraInfo = aura->GetSpellInfo();
+ if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
+ {
+ aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ // Remove dummys from rider (Necessary for updating visual shields)
+ if (Unit* rider = target->GetCharmer())
+ if (Aura* defend = rider->GetAura(aura->GetId()))
+ defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
+ break;
+ }
}
}
break;
@@ -2357,7 +2272,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
case NPC_ARGENT_STEED_ASPIRANT:
case NPC_STORMWIND_STEED:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_STORMWIND))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_STORMWIND))
return SPELL_PENNANT_STORMWIND_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_STORMWIND) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_STORMWIND))
return SPELL_PENNANT_STORMWIND_VALIANT;
@@ -2366,7 +2281,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_GNOMEREGAN_MECHANOSTRIDER:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_GNOMEREGAN))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_GNOMEREGAN))
return SPELL_PENNANT_GNOMEREGAN_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_GNOMEREGAN) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_GNOMEREGAN))
return SPELL_PENNANT_GNOMEREGAN_VALIANT;
@@ -2375,7 +2290,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_DARK_SPEAR_RAPTOR:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_SEN_JIN))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_SEN_JIN))
return SPELL_PENNANT_SEN_JIN_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_SEN_JIN) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_SEN_JIN))
return SPELL_PENNANT_SEN_JIN_VALIANT;
@@ -2385,7 +2300,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
case NPC_ARGENT_HAWKSTRIDER_ASPIRANT:
case NPC_SILVERMOON_HAWKSTRIDER:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_SILVERMOON))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_SILVERMOON))
return SPELL_PENNANT_SILVERMOON_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_SILVERMOON) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_SILVERMOON))
return SPELL_PENNANT_SILVERMOON_VALIANT;
@@ -2394,7 +2309,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_DARNASSIAN_NIGHTSABER:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_DARNASSUS))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_DARNASSUS))
return SPELL_PENNANT_DARNASSUS_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_DARNASSUS) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_DARNASSUS))
return SPELL_PENNANT_DARNASSUS_VALIANT;
@@ -2403,7 +2318,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_EXODAR_ELEKK:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_THE_EXODAR))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_THE_EXODAR))
return SPELL_PENNANT_EXODAR_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_THE_EXODAR) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_THE_EXODAR))
return SPELL_PENNANT_EXODAR_VALIANT;
@@ -2412,7 +2327,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_IRONFORGE_RAM:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_IRONFORGE))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_IRONFORGE))
return SPELL_PENNANT_IRONFORGE_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_IRONFORGE) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_IRONFORGE))
return SPELL_PENNANT_IRONFORGE_VALIANT;
@@ -2421,7 +2336,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_FORSAKEN_WARHORSE:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_UNDERCITY))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_UNDERCITY))
return SPELL_PENNANT_UNDERCITY_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_UNDERCITY) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_UNDERCITY))
return SPELL_PENNANT_UNDERCITY_VALIANT;
@@ -2430,7 +2345,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_ORGRIMMAR_WOLF:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_ORGRIMMAR))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_ORGRIMMAR))
return SPELL_PENNANT_ORGRIMMAR_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_ORGRIMMAR) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_ORGRIMMAR))
return SPELL_PENNANT_ORGRIMMAR_VALIANT;
@@ -2439,7 +2354,7 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_THUNDER_BLUFF_KODO:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_THUNDER_BLUFF))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_THUNDER_BLUFF))
return SPELL_PENNANT_THUNDER_BLUFF_CHAMPION;
else if (player->GetQuestRewardStatus(QUEST_VALIANT_OF_THUNDER_BLUFF) || player->GetQuestRewardStatus(QUEST_A_VALIANT_OF_THUNDER_BLUFF))
return SPELL_PENNANT_THUNDER_BLUFF_VALIANT;
@@ -2448,9 +2363,9 @@ class spell_gen_on_tournament_mount : public SpellScriptLoader
}
case NPC_ARGENT_WARHORSE:
{
- if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_ALLIANCE) || player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_CHAMPION_HORDE))
+ if (player->HasAchieved(ACHIEVEMENT_CHAMPION_ALLIANCE) || player->HasAchieved(ACHIEVEMENT_CHAMPION_HORDE))
return player->getClass() == CLASS_DEATH_KNIGHT ? SPELL_PENNANT_EBON_BLADE_CHAMPION : SPELL_PENNANT_ARGENT_CRUSADE_CHAMPION;
- else if (player->GetAchievementMgr().HasAchieved(ACHIEVEMENT_ARGENT_VALOR))
+ else if (player->HasAchieved(ACHIEVEMENT_ARGENT_VALOR))
return player->getClass() == CLASS_DEATH_KNIGHT ? SPELL_PENNANT_EBON_BLADE_VALIANT : SPELL_PENNANT_ARGENT_CRUSADE_VALIANT;
else
return player->getClass() == CLASS_DEATH_KNIGHT ? SPELL_PENNANT_EBON_BLADE_ASPIRANT : SPELL_PENNANT_ARGENT_CRUSADE_ASPIRANT;
@@ -3076,6 +2991,203 @@ class spell_gen_mount : public SpellScriptLoader
uint32 _mount310;
};
+enum FoamSword
+{
+ ITEM_FOAM_SWORD_GREEN = 45061,
+ ITEM_FOAM_SWORD_PINK = 45176,
+ ITEM_FOAM_SWORD_BLUE = 45177,
+ ITEM_FOAM_SWORD_RED = 45178,
+ ITEM_FOAM_SWORD_YELLOW = 45179,
+
+ SPELL_BONKED = 62991,
+ SPELL_FOAM_SWORD_DEFEAT = 62994,
+ SPELL_ON_GUARD = 62972,
+};
+
+class spell_gen_upper_deck_create_foam_sword : public SpellScriptLoader
+{
+ public:
+ spell_gen_upper_deck_create_foam_sword() : SpellScriptLoader("spell_gen_upper_deck_create_foam_sword") { }
+
+ class spell_gen_upper_deck_create_foam_sword_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_upper_deck_create_foam_sword_SpellScript);
+
+ void HandleScript(SpellEffIndex effIndex)
+ {
+ if (Player* player = GetHitPlayer())
+ {
+ static uint32 const itemId[5] = { ITEM_FOAM_SWORD_GREEN, ITEM_FOAM_SWORD_PINK, ITEM_FOAM_SWORD_BLUE, ITEM_FOAM_SWORD_RED, ITEM_FOAM_SWORD_YELLOW };
+ // player can only have one of these items
+ for (uint8 i = 0; i < 5; ++i)
+ {
+ if (player->HasItemCount(itemId[i], 1, true))
+ return;
+ }
+
+ CreateItem(effIndex, itemId[urand(0, 4)]);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_upper_deck_create_foam_sword_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_upper_deck_create_foam_sword_SpellScript();
+ }
+};
+
+class spell_gen_bonked : public SpellScriptLoader
+{
+ public:
+ spell_gen_bonked() : SpellScriptLoader("spell_gen_bonked") { }
+
+ class spell_gen_bonked_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_gen_bonked_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* target = GetHitPlayer())
+ {
+ Aura const* aura = GetHitAura();
+ if (!(aura && aura->GetStackAmount() == 3))
+ return;
+
+ target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true);
+ target->RemoveAurasDueToSpell(SPELL_BONKED);
+
+ if (Aura const* aura = target->GetAura(SPELL_ON_GUARD))
+ {
+ if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID()))
+ target->DestroyItemCount(item->GetEntry(), 1, true);
+ }
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_gen_bonked_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_gen_bonked_SpellScript();
+ }
+};
+
+class spell_gen_gift_of_naaru : public SpellScriptLoader
+{
+ public:
+ spell_gen_gift_of_naaru() : SpellScriptLoader("spell_gen_gift_of_naaru") { }
+
+ class spell_gen_gift_of_naaru_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_gift_of_naaru_AuraScript);
+
+ void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster())
+ return;
+
+ float heal = 0.0f;
+ switch (GetSpellInfo()->SpellFamilyName)
+ {
+ case SPELLFAMILY_MAGE:
+ case SPELLFAMILY_WARLOCK:
+ case SPELLFAMILY_PRIEST:
+ heal = 1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask()));
+ break;
+ case SPELLFAMILY_PALADIN:
+ case SPELLFAMILY_SHAMAN:
+ heal = std::max(1.885f * float(GetCaster()->SpellBaseDamageBonusDone(GetSpellInfo()->GetSchoolMask())), 1.1f * float(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK)));
+ break;
+ case SPELLFAMILY_WARRIOR:
+ case SPELLFAMILY_HUNTER:
+ case SPELLFAMILY_DEATHKNIGHT:
+ heal = 1.1f * float(std::max(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetCaster()->GetTotalAttackPowerValue(RANGED_ATTACK)));
+ break;
+ case SPELLFAMILY_GENERIC:
+ default:
+ break;
+ }
+
+ int32 healTick = floor(heal / aurEff->GetTotalTicks());
+ amount += int32(std::max(healTick, 0));
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_gift_of_naaru_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_HEAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_gift_of_naaru_AuraScript();
+ }
+};
+
+enum Replenishment
+{
+ SPELL_REPLENISHMENT = 57669,
+ SPELL_INFINITE_REPLENISHMENT = 61782
+};
+
+class spell_gen_replenishment : public SpellScriptLoader
+{
+ public:
+ spell_gen_replenishment() : SpellScriptLoader("spell_gen_replenishment") { }
+
+ class spell_gen_replenishment_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_gen_replenishment_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT) ||
+ !sSpellMgr->GetSpellInfo(SPELL_INFINITE_REPLENISHMENT))
+ return false;
+ return true;
+ }
+
+ bool Load()
+ {
+ return GetUnitOwner()->GetPower(POWER_MANA);
+ }
+
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ switch (GetSpellInfo()->Id)
+ {
+ case SPELL_REPLENISHMENT:
+ amount = GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.002f;
+ break;
+ case SPELL_INFINITE_REPLENISHMENT:
+ amount = GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
+ break;
+ default:
+ break;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_replenishment_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_PERIODIC_ENERGIZE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_gen_replenishment_AuraScript();
+ }
+};
+
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -3083,12 +3195,9 @@ void AddSC_generic_spell_scripts()
new spell_gen_av_drekthar_presence();
new spell_gen_burn_brutallus();
new spell_gen_cannibalize();
- new spell_gen_leeching_swarm();
new spell_gen_parachute();
new spell_gen_pet_summoned();
new spell_gen_remove_flight_auras();
- new spell_gen_trick();
- new spell_gen_trick_or_treat();
new spell_creature_permanent_feign_death();
new spell_pvp_trinket_wotf_shared_cd();
new spell_gen_animal_blood();
@@ -3099,6 +3208,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_profession_research();
new spell_generic_clone();
new spell_generic_clone_weapon();
+ new spell_gen_clone_weapon_aura();
new spell_gen_seaforium_blast();
new spell_gen_turkey_marker();
new spell_gen_lifeblood();
@@ -3148,4 +3258,8 @@ void AddSC_generic_spell_scripts()
new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280);
new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310);
new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310);
+ new spell_gen_upper_deck_create_foam_sword();
+ new spell_gen_bonked();
+ new spell_gen_gift_of_naaru();
+ new spell_gen_replenishment();
}
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index dabe978b58c..4f48c311612 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -20,7 +20,13 @@
* Scriptnames in this file should be prefixed with "spell_#holidayname_".
*/
-#include "ScriptPCH.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
+#include "GridNotifiers.h"
+#include "CellImpl.h"
// 45102 Romantic Picnic
enum SpellsPicnic
@@ -104,7 +110,176 @@ class spell_love_is_in_the_air_romantic_picnic : public SpellScriptLoader
}
};
+// 24750 Trick
+enum TrickSpells
+{
+ SPELL_PIRATE_COSTUME_MALE = 24708,
+ SPELL_PIRATE_COSTUME_FEMALE = 24709,
+ SPELL_NINJA_COSTUME_MALE = 24710,
+ SPELL_NINJA_COSTUME_FEMALE = 24711,
+ SPELL_LEPER_GNOME_COSTUME_MALE = 24712,
+ SPELL_LEPER_GNOME_COSTUME_FEMALE = 24713,
+ SPELL_SKELETON_COSTUME = 24723,
+ SPELL_GHOST_COSTUME_MALE = 24735,
+ SPELL_GHOST_COSTUME_FEMALE = 24736,
+ SPELL_TRICK_BUFF = 24753,
+};
+
+class spell_hallow_end_trick : public SpellScriptLoader
+{
+ public:
+ spell_hallow_end_trick() : SpellScriptLoader("spell_hallow_end_trick") { }
+
+ class spell_hallow_end_trick_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_hallow_end_trick_SpellScript);
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE)
+ || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE)
+ || !sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ if (Player* target = GetHitPlayer())
+ {
+ uint8 gender = target->getGender();
+ uint32 spellId = SPELL_TRICK_BUFF;
+ switch (urand(0, 5))
+ {
+ case 1:
+ spellId = gender ? SPELL_LEPER_GNOME_COSTUME_FEMALE : SPELL_LEPER_GNOME_COSTUME_MALE;
+ break;
+ case 2:
+ spellId = gender ? SPELL_PIRATE_COSTUME_FEMALE : SPELL_PIRATE_COSTUME_MALE;
+ break;
+ case 3:
+ spellId = gender ? SPELL_GHOST_COSTUME_FEMALE : SPELL_GHOST_COSTUME_MALE;
+ break;
+ case 4:
+ spellId = gender ? SPELL_NINJA_COSTUME_FEMALE : SPELL_NINJA_COSTUME_MALE;
+ break;
+ case 5:
+ spellId = SPELL_SKELETON_COSTUME;
+ break;
+ default:
+ break;
+ }
+
+ caster->CastSpell(target, spellId, true, NULL);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_hallow_end_trick_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_hallow_end_trick_SpellScript();
+ }
+};
+
+// 24751 Trick or Treat
+enum TrickOrTreatSpells
+{
+ SPELL_TRICK = 24714,
+ SPELL_TREAT = 24715,
+ SPELL_TRICKED_OR_TREATED = 24755,
+ SPELL_TRICKY_TREAT_SPEED = 42919,
+ SPELL_TRICKY_TREAT_TRIGGER = 42965,
+ SPELL_UPSET_TUMMY = 42966
+};
+
+class spell_hallow_end_trick_or_treat : public SpellScriptLoader
+{
+ public:
+ spell_hallow_end_trick_or_treat() : SpellScriptLoader("spell_hallow_end_trick_or_treat") {}
+
+ class spell_hallow_end_trick_or_treat_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_hallow_end_trick_or_treat_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRICK) || !sSpellMgr->GetSpellInfo(SPELL_TREAT) || !sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ if (Player* target = GetHitPlayer())
+ {
+ caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL);
+ caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_hallow_end_trick_or_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_hallow_end_trick_or_treat_SpellScript();
+ }
+};
+
+class spell_hallow_end_tricky_treat : public SpellScriptLoader
+{
+ public:
+ spell_hallow_end_tricky_treat() : SpellScriptLoader("spell_hallow_end_tricky_treat") { }
+
+ class spell_hallow_end_tricky_treat_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_hallow_end_tricky_treat_SpellScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRICKY_TREAT_SPEED))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_TRICKY_TREAT_TRIGGER))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_UPSET_TUMMY))
+ return false;
+ return true;
+ }
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ if (caster->HasAura(SPELL_TRICKY_TREAT_TRIGGER) && caster->GetAuraCount(SPELL_TRICKY_TREAT_SPEED) > 3 && roll_chance_i(33))
+ caster->CastSpell(caster, SPELL_UPSET_TUMMY, true);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_hallow_end_tricky_treat_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_hallow_end_tricky_treat_SpellScript();
+ }
+};
+
void AddSC_holiday_spell_scripts()
{
+ // Love is in the Air
new spell_love_is_in_the_air_romantic_picnic();
+ // Hallow's End
+ new spell_hallow_end_trick();
+ new spell_hallow_end_trick_or_treat();
+ new spell_hallow_end_tricky_treat();
}
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index a2ee6c1c3a3..a5122ff5f08 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_hun_".
*/
+#include "Pet.h"
#include "ScriptMgr.h"
#include "Cell.h"
#include "CellImpl.h"
@@ -32,6 +33,7 @@
enum HunterSpells
{
HUNTER_SPELL_READINESS = 23989,
+ DRAENEI_SPELL_GIFT_OF_THE_NAARU = 59543,
HUNTER_SPELL_BESTIAL_WRATH = 19574,
HUNTER_PET_SPELL_LAST_STAND_TRIGGERED = 53479,
HUNTER_PET_HEART_OF_THE_PHOENIX = 55709,
@@ -138,7 +140,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader
int32 TickCount = aurEff->GetTotalTicks();
spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount());
- ApplyPctN(basePoint, TickCount * 40);
+ ApplyPct(basePoint, TickCount * 40);
basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount());
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
@@ -148,11 +150,11 @@ class spell_hun_chimera_shot : public SpellScriptLoader
spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;
// Amount of one aura tick
- basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
+ basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount()));
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget?
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
- ApplyPctN(basePoint, TickCount * 60);
+ ApplyPct(basePoint, TickCount * 60);
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)
@@ -277,27 +279,31 @@ class spell_hun_masters_call : public SpellScriptLoader
return true;
}
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (Unit* ally = GetHitUnit())
+ if (Player* caster = GetCaster()->ToPlayer())
+ if (Pet* target = caster->GetPet())
+ {
+ TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_CASTER_AURASTATE);
+ target->CastSpell(ally, GetEffectValue(), castMask);
+ target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask);
+ }
+ }
+
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
{
// Cannot be processed while pet is dead
TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_CASTER_AURASTATE);
- target->CastSpell(target, GetEffectValue(), castMask);
target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask);
- // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that
- // it's more likely that on on retail it's possible to call target selector based on dbc values
- // anyways, we're using GetExplTargetUnit() here and it's ok
- if (Unit* ally = GetExplTargetUnit())
- {
- target->CastSpell(ally, GetEffectValue(), castMask);
- target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask);
- }
}
}
void Register()
{
+ OnEffectHitTarget += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnEffectHitTarget += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -336,6 +342,7 @@ class spell_hun_readiness : public SpellScriptLoader
spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
spellInfo->Id != HUNTER_SPELL_READINESS &&
spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH &&
+ spellInfo->Id != DRAENEI_SPELL_GIFT_OF_THE_NAARU &&
spellInfo->GetRecoveryTime() > 0)
caster->RemoveSpellCooldown((itr++)->first, true);
else
@@ -574,7 +581,7 @@ class spell_hun_misdirection : public SpellScriptLoader
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* caster = GetCaster())
- if (!GetDuration())
+ if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT)
caster->SetReducedThreatPercent(0, 0);
}
@@ -699,6 +706,36 @@ class spell_hun_tame_beast : public SpellScriptLoader
}
};
+class spell_hun_target_only_pet_and_owner : public SpellScriptLoader
+{
+ public:
+ spell_hun_target_only_pet_and_owner() : SpellScriptLoader("spell_hun_target_only_pet_and_owner") { }
+
+ class spell_hun_target_only_pet_and_owner_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_hun_target_only_pet_and_owner_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.clear();
+ targets.push_back(GetCaster());
+ if (Unit* owner = GetCaster()->GetOwner())
+ targets.push_back(owner);
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hun_target_only_pet_and_owner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY);
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_hun_target_only_pet_and_owner_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_CASTER_AREA_PARTY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_hun_target_only_pet_and_owner_SpellScript();
+ }
+};
+
void AddSC_hunter_spell_scripts()
{
new spell_hun_aspect_of_the_beast();
@@ -715,4 +752,5 @@ void AddSC_hunter_spell_scripts()
new spell_hun_misdirection_proc();
new spell_hun_disengage();
new spell_hun_tame_beast();
+ new spell_hun_target_only_pet_and_owner();
}
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index 3c89cb7005a..e0c88ad6846 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -21,11 +21,13 @@
* Scriptnames of files in this file should be prefixed with "spell_item_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "SkillDiscovery.h"
+#include "Battleground.h"
// Generic script for handling item dummy effects which trigger another spell.
class spell_item_trigger_spell : public SpellScriptLoader
@@ -836,9 +838,20 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader
return SPELL_CAST_OK;
}
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Player* caster = GetCaster()->ToPlayer();
+ uint32 spellId = GetSpellInfo()->Id;
+
+ // learn random explicit discovery recipe (if any)
+ if (uint32 discoveredSpellId = GetExplicitDiscoverySpell(spellId, caster))
+ caster->learnSpell(discoveredSpellId, false);
+ }
+
void Register()
{
OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery_SpellScript::CheckRequirement);
+ OnEffectHitTarget += SpellEffectFn(spell_item_book_of_glyph_mastery_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -1833,7 +1846,7 @@ class spell_item_unusual_compass : public SpellScriptLoader
{
Unit* caster = GetCaster();
caster->SetOrientation(frand(0.0f, 62832.0f) / 10000.0f);
- caster->SendMovementFlagUpdate();
+ caster->SendMovementFlagUpdate(true);
}
void Register()
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 0edfbaee437..cd096ebed5e 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -21,11 +21,11 @@
* Scriptnames of files in this file should be prefixed with "spell_mage_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-
enum MageSpells
{
SPELL_MAGE_COLD_SNAP = 11958,
@@ -292,7 +292,7 @@ class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
{
- int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
+ int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 7d248b35853..58f94edb387 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -21,10 +21,11 @@
* Scriptnames of files in this file should be prefixed with "spell_pal_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
-
+#include "Group.h"
enum PaladinSpells
{
@@ -47,6 +48,9 @@ enum PaladinSpells
SPELL_FORBEARANCE = 25771,
SPELL_AVENGING_WRATH_MARKER = 61987,
SPELL_IMMUNE_SHIELD_MARKER = 61988,
+
+ SPELL_HAND_OF_SACRIFICE = 6940,
+ SPELL_DIVINE_SACRIFICE = 64205,
};
// 31850 - Ardent Defender
@@ -108,7 +112,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
uint32 damageToReduce = (victim->GetHealth() < allowedHealth)
? dmgInfo.GetDamage()
: allowedHealth - remainingHealth;
- absorbAmount = CalculatePctN(damageToReduce, absorbPct);
+ absorbAmount = CalculatePct(damageToReduce, absorbPct);
}
}
@@ -531,6 +535,139 @@ class spell_pal_righteous_defense : public SpellScriptLoader
}
};
+class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader
+{
+ public:
+ spell_pal_exorcism_and_holy_wrath_damage() : SpellScriptLoader("spell_pal_exorcism_and_holy_wrath_damage") { }
+
+ class spell_pal_exorcism_and_holy_wrath_damage_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pal_exorcism_and_holy_wrath_damage_AuraScript);
+
+ void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
+ {
+ if (!spellMod)
+ {
+ spellMod = new SpellModifier(aurEff->GetBase());
+ spellMod->op = SPELLMOD_DAMAGE;
+ spellMod->type = SPELLMOD_FLAT;
+ spellMod->spellId = GetId();
+ spellMod->mask[1] = 0x200002;
+ }
+
+ spellMod->value = aurEff->GetAmount();
+ }
+
+ void Register()
+ {
+ DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_pal_exorcism_and_holy_wrath_damage_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_pal_exorcism_and_holy_wrath_damage_AuraScript();
+ }
+};
+
+class spell_pal_hand_of_sacrifice : public SpellScriptLoader
+{
+ public:
+ spell_pal_hand_of_sacrifice() : SpellScriptLoader("spell_pal_hand_of_sacrifice") { }
+
+ class spell_pal_hand_of_sacrifice_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pal_hand_of_sacrifice_AuraScript);
+
+ int32 remainingAmount;
+
+ bool Load()
+ {
+ if (Unit* caster = GetCaster())
+ {
+ remainingAmount = caster->GetMaxHealth();
+ return true;
+ }
+ return false;
+ }
+
+ void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount)
+ {
+ remainingAmount -= splitAmount;
+
+ if (remainingAmount <= 0)
+ {
+ GetTarget()->RemoveAura(SPELL_HAND_OF_SACRIFICE);
+ }
+ }
+
+ void Register()
+ {
+ OnEffectSplit += AuraEffectSplitFn(spell_pal_hand_of_sacrifice_AuraScript::Split, EFFECT_0);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_pal_hand_of_sacrifice_AuraScript();
+ }
+};
+
+class spell_pal_divine_sacrifice : public SpellScriptLoader
+{
+ public:
+ spell_pal_divine_sacrifice() : SpellScriptLoader("spell_pal_divine_sacrifice") { }
+
+ class spell_pal_divine_sacrifice_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pal_divine_sacrifice_AuraScript);
+
+ uint32 groupSize, minHpPct;
+ int32 remainingAmount;
+
+ bool Load()
+ {
+
+ if (Unit* caster = GetCaster())
+ {
+ if (caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ if (caster->ToPlayer()->GetGroup())
+ groupSize = caster->ToPlayer()->GetGroup()->GetMembersCount();
+ else
+ groupSize = 1;
+ }
+ else
+ return false;
+
+ remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize);
+ minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster);
+ return true;
+ }
+ return false;
+ }
+
+ void Split(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & splitAmount)
+ {
+ remainingAmount -= splitAmount;
+ // break when absorbed everything it could, or if the casters hp drops below 20%
+ if (Unit* caster = GetCaster())
+ if (remainingAmount <= 0 || (caster->GetHealthPct() < minHpPct))
+ caster->RemoveAura(SPELL_DIVINE_SACRIFICE);
+ }
+
+ void Register()
+ {
+ OnEffectSplit += AuraEffectSplitFn(spell_pal_divine_sacrifice_AuraScript::Split, EFFECT_0);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_pal_divine_sacrifice_AuraScript();
+ }
+};
+
void AddSC_paladin_spell_scripts()
{
new spell_pal_ardent_defender();
@@ -543,4 +680,7 @@ void AddSC_paladin_spell_scripts()
new spell_pal_divine_storm_dummy();
new spell_pal_lay_on_hands();
new spell_pal_righteous_defense();
+ new spell_pal_exorcism_and_holy_wrath_damage();
+ new spell_pal_hand_of_sacrifice();
+ new spell_pal_divine_sacrifice();
}
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 7830d46260c..876d7c80a44 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -243,7 +243,7 @@ public:
if (pet->isPet())
if (Unit* owner = pet->ToPet()->GetOwner())
{
- float ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
+ float ownerBonus = CalculatePct(owner->GetStat(STAT_STAMINA), 75);
amount += ownerBonus;
}
@@ -313,7 +313,7 @@ public:
if (AuraEffect* /* aurEff */ect = owner->GetAuraEffect(56246, EFFECT_0))
{
float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
- amount += CalculatePctN(amount+base_attPower, /* aurEff */ect->GetAmount());
+ amount += CalculatePct(amount+base_attPower, /* aurEff */ect->GetAmount());
}
}
}
@@ -382,7 +382,7 @@ public:
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
+ ownerBonus = CalculatePct(owner->GetStat(STAT_INTELLECT), 30);
amount += ownerBonus;
_tempBonus = ownerBonus;
@@ -434,7 +434,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+ ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
}
@@ -446,7 +446,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
}
@@ -493,7 +493,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
}
@@ -505,7 +505,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
}
@@ -517,7 +517,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
}
@@ -560,7 +560,7 @@ public:
if (Unit* owner = pet->ToPet()->GetOwner())
{
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
}
@@ -686,7 +686,7 @@ public:
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
- amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount());
+ amount += CalculatePct(CritSpell, improvedDemonicTacticsEffect->GetAmount());
}
}
@@ -708,7 +708,7 @@ public:
if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
- amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount());
+ amount += CalculatePct(CritMelee, improvedDemonicTacticsEffect->GetAmount());
}
}
@@ -898,7 +898,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ AddPct(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
@@ -941,7 +941,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
@@ -971,7 +971,7 @@ public:
if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
- mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ mod += CalculatePct(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
}
bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
@@ -1028,7 +1028,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
amount += ownerBonus;
}
@@ -1047,7 +1047,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
amount += ownerBonus;
}
@@ -1066,7 +1066,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
amount += ownerBonus;
}
@@ -1115,7 +1115,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
amount += ownerBonus;
}
@@ -1134,7 +1134,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ ownerBonus = CalculatePct(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
amount += ownerBonus;
}
@@ -1153,7 +1153,7 @@ public:
float ownerBonus = 0.0f;
- ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+ ownerBonus = CalculatePct(owner->GetArmor(), 35);
amount += ownerBonus;
}
@@ -1544,12 +1544,12 @@ public:
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
{
- mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ mod += CalculatePct(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
if (aurEff)
- mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ mod += CalculatePct(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod;
amount += ownerBonus;
}
@@ -1706,7 +1706,7 @@ public:
if (pet->isGuardian())
((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK));
- amount += owner->CalculateDamage(BASE_ATTACK, true, true);;
+ amount += owner->CalculateDamage(BASE_ATTACK, true, true);
}
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index aab1e974e53..2feb6e2b6ef 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_pri_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
@@ -37,6 +38,8 @@ enum PriestSpells
PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085,
PRIEST_SPELL_EMPOWERED_RENEW = 63544,
PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021,
+ PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874,
+ PRIEST_SHADOW_WORD_DEATH = 32409,
};
// Guardian Spirit
@@ -276,7 +279,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
if (GetCaster())
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
- int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
+ int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount());
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
}
}
@@ -311,10 +314,10 @@ public:
{
if (Unit* caster = GetOriginalCaster())
{
- if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE,EFFECT_0))
+ if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0))
{
int32 heal = GetHitHeal();
- AddPctN(heal, aurEff->GetAmount());
+ AddPct(heal, aurEff->GetAmount());
SetHitHeal(heal);
}
}
@@ -373,14 +376,14 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
}
};
-class spell_priest_renew : public SpellScriptLoader
+class spell_pri_renew : public SpellScriptLoader
{
public:
- spell_priest_renew() : SpellScriptLoader("spell_priest_renew") { }
+ spell_pri_renew() : SpellScriptLoader("spell_pri_renew") { }
- class spell_priest_renew_AuraScript : public AuraScript
+ class spell_pri_renew_AuraScript : public AuraScript
{
- PrepareAuraScript(spell_priest_renew_AuraScript);
+ PrepareAuraScript(spell_pri_renew_AuraScript);
bool Load()
{
@@ -405,13 +408,45 @@ class spell_priest_renew : public SpellScriptLoader
void Register()
{
- OnEffectApply += AuraEffectApplyFn(spell_priest_renew_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
+ OnEffectApply += AuraEffectApplyFn(spell_pri_renew_AuraScript::HandleApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const
{
- return new spell_priest_renew_AuraScript();
+ return new spell_pri_renew_AuraScript();
+ }
+};
+
+class spell_pri_shadow_word_death : public SpellScriptLoader
+{
+ public:
+ spell_pri_shadow_word_death() : SpellScriptLoader("spell_pri_shadow_word_death") { }
+
+ class spell_pri_shadow_word_death_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_pri_shadow_word_death_SpellScript);
+
+ void HandleDamage()
+ {
+ int32 damage = GetHitDamage();
+
+ // Pain and Suffering reduces damage
+ if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
+ AddPct(damage, aurEff->GetAmount());
+
+ GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
+ }
+
+ void Register()
+ {
+ OnHit += SpellHitFn(spell_pri_shadow_word_death_SpellScript::HandleDamage);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_pri_shadow_word_death_SpellScript();
}
};
@@ -425,5 +460,6 @@ void AddSC_priest_spell_scripts()
new spell_pri_mind_sear();
new spell_pri_prayer_of_mending_heal();
new spell_pri_vampiric_touch();
- new spell_priest_renew();
+ new spell_pri_renew();
+ new spell_pri_shadow_word_death();
}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 5648c510413..da80ec8f1da 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -21,10 +21,14 @@
* Scriptnames of files in this file should be prefixed with "spell_q#questID_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "Vehicle.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
class spell_generic_quest_update_entry_SpellScript : public SpellScript
{
@@ -1245,6 +1249,243 @@ class spell_q12735_song_of_cleansing : public SpellScriptLoader
}
};
+enum DefendingWyrmrestTemple
+{
+ SPELL_SUMMON_WYRMREST_DEFENDER = 49207
+};
+
+class spell_q12372_cast_from_gossip_trigger : public SpellScriptLoader
+{
+ public:
+ spell_q12372_cast_from_gossip_trigger() : SpellScriptLoader("spell_q12372_cast_from_gossip_trigger") { }
+
+ class spell_q12372_cast_from_gossip_trigger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12372_cast_from_gossip_trigger_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_WYRMREST_DEFENDER, true);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12372_cast_from_gossip_trigger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12372_cast_from_gossip_trigger_SpellScript();
+ }
+};
+
+// http://www.wowhead.com/quest=12372 Defending Wyrmrest Temple
+// 49370 - Wyrmrest Defender: Destabilize Azure Dragonshrine Effect
+enum Quest12372Data
+{
+ NPC_WYRMREST_TEMPLE_CREDIT = 27698,
+};
+
+class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoader
+{
+ public:
+ spell_q12372_destabilize_azure_dragonshrine_dummy() : SpellScriptLoader("spell_q12372_destabilize_azure_dragonshrine_dummy") { }
+
+ class spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (GetHitCreature())
+ if (Unit* caster = GetOriginalCaster())
+ if (Vehicle* vehicle = caster->GetVehicleKit())
+ if (Unit* passenger = vehicle->GetPassenger(0))
+ if (Player* player = passenger->ToPlayer())
+ player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT, 0);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript();
+ }
+};
+
+// "Bombing Run" and "Bomb Them Again!"
+enum Quest11010_11102_11023Data
+{
+ // Spell
+ SPELL_FLAK_CANNON_TRIGGER = 40110,
+ SPELL_CHOOSE_LOC = 40056,
+ SPELL_AGGRO_CHECK = 40112,
+ // NPCs
+ NPC_FEL_CANNON2 = 23082
+};
+
+// 40113 Knockdown Fel Cannon: The Aggro Check Aura
+class spell_q11010_q11102_q11023_aggro_check_aura : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_aggro_check_aura() : SpellScriptLoader("spell_q11010_q11102_q11023_aggro_check_aura") { }
+
+ class spell_q11010_q11102_q11023_aggro_check_aura_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_q11010_q11102_q11023_aggro_check_aura_AuraScript);
+
+ void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
+ {
+ if (Unit* target = GetTarget())
+ // On trigger proccing
+ target->CastSpell(target, SPELL_AGGRO_CHECK);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_q11010_q11102_q11023_aggro_check_aura_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_q11010_q11102_q11023_aggro_check_aura_AuraScript();
+ }
+};
+
+// 40112 Knockdown Fel Cannon: The Aggro Check
+class spell_q11010_q11102_q11023_aggro_check : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_aggro_check() : SpellScriptLoader("spell_q11010_q11102_q11023_aggro_check") { }
+
+ class spell_q11010_q11102_q11023_aggro_check_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q11010_q11102_q11023_aggro_check_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ if (Player* playerTarget = GetHitPlayer())
+ // Check if found player target is on fly mount or using flying form
+ if (playerTarget->HasAuraType(SPELL_AURA_FLY) || playerTarget->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
+ playerTarget->CastSpell(playerTarget, SPELL_FLAK_CANNON_TRIGGER, TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE);
+ }
+
+ void Register()
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q11010_q11102_q11023_aggro_check_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q11010_q11102_q11023_aggro_check_SpellScript();
+ }
+};
+
+// 40119 Knockdown Fel Cannon: The Aggro Burst
+class spell_q11010_q11102_q11023_aggro_burst : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_aggro_burst() : SpellScriptLoader("spell_q11010_q11102_q11023_aggro_burst") { }
+
+ class spell_q11010_q11102_q11023_aggro_burst_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_q11010_q11102_q11023_aggro_burst_AuraScript);
+
+ void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
+ {
+ if (Unit* target = GetTarget())
+ // On each tick cast Choose Loc to trigger summon
+ target->CastSpell(target, SPELL_CHOOSE_LOC);
+ }
+
+ void Register()
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_q11010_q11102_q11023_aggro_burst_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_q11010_q11102_q11023_aggro_burst_AuraScript();
+ }
+};
+
+// 40056 Knockdown Fel Cannon: Choose Loc
+class spell_q11010_q11102_q11023_choose_loc : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_choose_loc() : SpellScriptLoader("spell_q11010_q11102_q11023_choose_loc") { }
+
+ class spell_q11010_q11102_q11023_choose_loc_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q11010_q11102_q11023_choose_loc_SpellScript);
+
+ void HandleDummy(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ // Check for player that is in 65 y range
+ std::list<Player*> playerList;
+ Trinity::AnyPlayerInObjectRangeCheck checker(caster, 765.0f);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(caster, playerList, checker);
+ caster->VisitNearbyWorldObject(65.0f, searcher);
+ for (std::list<Player*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
+ // Check if found player target is on fly mount or using flying form
+ if ((*itr)->HasAuraType(SPELL_AURA_FLY) || (*itr)->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED))
+ // Summom Fel Cannon (bunny version) at found player
+ caster->SummonCreature(NPC_FEL_CANNON2, (*itr)->GetPositionX(), (*itr)->GetPositionY(), (*itr)->GetPositionZ());
+ }
+
+ void Register()
+ {
+ OnEffectHit += SpellEffectFn(spell_q11010_q11102_q11023_choose_loc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q11010_q11102_q11023_choose_loc_SpellScript();
+ }
+};
+
+// 39844 - Skyguard Blasting Charge
+// 40160 - Throw Bomb
+class spell_q11010_q11102_q11023_q11008_check_fly_mount : public SpellScriptLoader
+{
+ public:
+ spell_q11010_q11102_q11023_q11008_check_fly_mount() : SpellScriptLoader("spell_q11010_q11102_q11023_q11008_check_fly_mount") { }
+
+ class spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript);
+
+ SpellCastResult CheckRequirement()
+ {
+ Unit* caster = GetCaster();
+ // This spell will be cast only if caster has one of these auras
+ if (!(caster->HasAuraType(SPELL_AURA_FLY) || caster->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)))
+ return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript::CheckRequirement);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_q11010_q11102_q11023_q11008_check_fly_mount_SpellScript();
+ }
+};
+
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
@@ -1274,4 +1515,11 @@ void AddSC_quest_spell_scripts()
new spell_q12277_wintergarde_mine_explosion();
new spell_q12066_bunny_kill_credit();
new spell_q12735_song_of_cleansing();
+ new spell_q12372_cast_from_gossip_trigger();
+ new spell_q12372_destabilize_azure_dragonshrine_dummy();
+ new spell_q11010_q11102_q11023_aggro_check_aura();
+ new spell_q11010_q11102_q11023_aggro_check();
+ new spell_q11010_q11102_q11023_aggro_burst();
+ new spell_q11010_q11102_q11023_choose_loc();
+ new spell_q11010_q11102_q11023_q11008_check_fly_mount();
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index 3a4132f62fe..0294533bdcd 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_rog_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
@@ -124,7 +125,7 @@ class spell_rog_nerves_of_steel : public SpellScriptLoader
{
// reduces all damage taken while stun or fear
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -350,7 +351,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]);
continue;
}
@@ -386,6 +387,34 @@ class spell_rog_deadly_poison : public SpellScriptLoader
}
};
+class spell_rog_shadowstep : public SpellScriptLoader
+{
+ public:
+ spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { }
+
+ class spell_rog_shadowstep_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_rog_shadowstep_SpellScript);
+
+ SpellCastResult CheckCast()
+ {
+ if (GetCaster()->HasUnitState(UNIT_STATE_ROOT))
+ return SPELL_FAILED_ROOTED;
+ return SPELL_CAST_OK;
+ }
+
+ void Register()
+ {
+ OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_rog_shadowstep_SpellScript();
+ }
+};
+
void AddSC_rogue_spell_scripts()
{
new spell_rog_cheat_death();
@@ -394,4 +423,5 @@ void AddSC_rogue_spell_scripts()
new spell_rog_prey_on_the_weak();
new spell_rog_shiv();
new spell_rog_deadly_poison();
+ new spell_rog_shadowstep();
}
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index c863c2363af..1ba962982e4 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_sha_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "GridNotifiers.h"
#include "Unit.h"
@@ -78,7 +79,7 @@ class spell_sha_astral_shift : public SpellScriptLoader
{
// reduces all damage taken while stun, fear or silence
if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)))
- absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
+ absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct);
}
void Register()
@@ -184,7 +185,7 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader
if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0))
effValue += dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
- int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue));
+ int32 effBasePoints0 = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), effValue));
caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID());
}
}
@@ -501,11 +502,11 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader
// Restorative Totems
if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1))
- AddPctN(damage, dummy->GetAmount());
+ AddPct(damage, dummy->GetAmount());
// Glyph of Healing Stream Totem
if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0))
- AddPctN(damage, aurEff->GetAmount());
+ AddPct(damage, aurEff->GetAmount());
damage = int32(target->SpellHealingBonusTaken(owner, triggeringSpell, damage, HEAL));
}
@@ -592,7 +593,7 @@ class spell_sha_lava_lash : public SpellScriptLoader
{
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
- AddPctN(hitDamage, damage);
+ AddPct(hitDamage, damage);
SetHitDamage(hitDamage);
}
}
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 74118599b9f..f83056aa8b6 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_warl_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
@@ -40,6 +41,11 @@ enum WarlockSpells
WARLOCK_HAUNT = 48181,
WARLOCK_HAUNT_HEAL = 48210,
WARLOCK_UNSTABLE_AFFLICTION_DISPEL = 31117,
+ WARLOCK_CURSE_OF_DOOM_EFFECT = 18662,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_R1 = 18703,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_R2 = 18704,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1 = 60955,
+ WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2 = 60956,
};
class spell_warl_banish : public SpellScriptLoader
@@ -201,7 +207,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader
case WARLOCK_IMPROVED_HEALTHSTONE_R1: rank = 1; break;
case WARLOCK_IMPROVED_HEALTHSTONE_R2: rank = 2; break;
default:
- sLog->outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Unknown rank of Improved Healthstone id: %d", aurEff->GetId());
break;
}
}
@@ -405,7 +411,7 @@ class spell_warl_life_tap : public SpellScriptLoader
// Improved Life Tap mod
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0))
- AddPctN(mana, aurEff->GetAmount());
+ AddPct(mana, aurEff->GetAmount());
caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false);
@@ -416,7 +422,7 @@ class spell_warl_life_tap : public SpellScriptLoader
if (manaFeedVal > 0)
{
- ApplyPctN(manaFeedVal, mana);
+ ApplyPct(manaFeedVal, mana);
caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL);
}
}
@@ -539,7 +545,7 @@ class spell_warl_haunt : public SpellScriptLoader
{
if (Aura* aura = GetHitAura())
if (AuraEffect* aurEff = aura->GetEffect(EFFECT_1))
- aurEff->SetAmount(CalculatePctN(aurEff->GetAmount(), GetHitDamage()));
+ aurEff->SetAmount(CalculatePct(aurEff->GetAmount(), GetHitDamage()));
}
void Register()
@@ -561,9 +567,6 @@ class spell_warl_haunt : public SpellScriptLoader
void HandleRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
- if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
- return;
-
if (Unit* caster = GetCaster())
{
int32 amount = aurEff->GetAmount();
@@ -627,6 +630,94 @@ class spell_warl_unstable_affliction : public SpellScriptLoader
}
};
+class spell_warl_curse_of_doom : public SpellScriptLoader
+{
+ public:
+ spell_warl_curse_of_doom() : SpellScriptLoader("spell_warl_curse_of_doom") { }
+
+ class spell_warl_curse_of_doom_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_curse_of_doom_AuraScript);
+
+ bool Validate(SpellInfo const* /*spell*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(WARLOCK_CURSE_OF_DOOM_EFFECT))
+ return false;
+ return true;
+ }
+
+ bool Load()
+ {
+ return GetCaster() && GetCaster()->GetTypeId() == TYPEID_PLAYER;
+ }
+
+ void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ if (!GetCaster())
+ return;
+
+ AuraRemoveMode removeMode = GetTargetApplication()->GetRemoveMode();
+ if (removeMode != AURA_REMOVE_BY_DEATH || !IsExpired())
+ return;
+
+ if (GetCaster()->ToPlayer()->isHonorOrXPTarget(GetTarget()))
+ GetCaster()->CastSpell(GetTarget(), WARLOCK_CURSE_OF_DOOM_EFFECT, true, NULL, aurEff);
+ }
+
+ void Register()
+ {
+ AfterEffectRemove += AuraEffectRemoveFn(spell_warl_curse_of_doom_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_curse_of_doom_AuraScript();
+ }
+};
+
+class spell_warl_health_funnel : public SpellScriptLoader
+{
+public:
+ spell_warl_health_funnel() : SpellScriptLoader("spell_warl_health_funnel") { }
+
+ class spell_warl_health_funnel_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_health_funnel_AuraScript);
+
+ void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster)
+ return;
+
+ Unit* target = GetTarget();
+ if (caster->HasAura(WARLOCK_IMPROVED_HEALTH_FUNNEL_R2))
+ target->CastSpell(target, WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2, true);
+ else if (caster->HasAura(WARLOCK_IMPROVED_HEALTH_FUNNEL_R1))
+ target->CastSpell(target, WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1, true);
+ }
+
+ void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->RemoveAurasDueToSpell(WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R1);
+ target->RemoveAurasDueToSpell(WARLOCK_IMPROVED_HEALTH_FUNNEL_BUFF_R2);
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_warl_health_funnel_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
+ OnEffectApply += AuraEffectApplyFn(spell_warl_health_funnel_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_HEAL, AURA_EFFECT_HANDLE_REAL);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_health_funnel_AuraScript();
+ }
+};
+
void AddSC_warlock_spell_scripts()
{
new spell_warl_banish();
@@ -641,4 +732,6 @@ void AddSC_warlock_spell_scripts()
new spell_warl_demonic_circle_teleport();
new spell_warl_haunt();
new spell_warl_unstable_affliction();
+ new spell_warl_curse_of_doom();
+ new spell_warl_health_funnel();
}
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index c64101e11ea..613bf0fef5d 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -21,6 +21,7 @@
* Scriptnames of files in this file should be prefixed with "spell_warr_".
*/
+#include "Player.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
@@ -183,7 +184,7 @@ class spell_warr_deep_wounds : public SpellScriptLoader
// apply percent damage mods
damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
- ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
+ ApplyPct(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id));
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE);
@@ -368,7 +369,7 @@ class spell_warr_concussion_blow : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */)
{
- SetHitDamage(CalculatePctN(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
+ SetHitDamage(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectValue()));
}
void Register()
@@ -400,7 +401,7 @@ class spell_warr_bloodthirst : public SpellScriptLoader
void HandleDamage(SpellEffIndex /*effIndex*/)
{
int32 damage = GetEffectValue();
- ApplyPctF(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
+ ApplyPct(damage, GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK));
if (Unit* target = GetHitUnit())
{
diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp
index 3dc737f0c95..178df2078f8 100755..100644
--- a/src/server/scripts/World/achievement_scripts.cpp
+++ b/src/server/scripts/World/achievement_scripts.cpp
@@ -23,6 +23,8 @@
#include "BattlegroundSA.h"
#include "BattlegroundAV.h"
#include "Vehicle.h"
+#include "Player.h"
+#include "Creature.h"
class achievement_resilient_victory : public AchievementCriteriaScript
{
@@ -235,30 +237,6 @@ class achievement_bg_av_perfection : public AchievementCriteriaScript
}
};
-class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
-{
-public:
- achievement_wg_didnt_stand_a_chance() : AchievementCriteriaScript("achievement_wg_didnt_stand_a_chance") { }
-
- bool OnCheck(Player* source, Unit* target)
- {
- if (!target)
- return false;
-
- if (Player* victim = target->ToPlayer())
- {
- if (!victim->IsMounted())
- return false;
-
- if (Vehicle* vehicle = source->GetVehicle())
- if (vehicle->GetVehicleInfo()->m_ID == 244) // Wintergrasp Tower Cannon
- return true;
- }
-
- return false;
- }
-};
-
class achievement_bg_sa_defense_of_ancients : public AchievementCriteriaScript
{
public:
@@ -302,6 +280,9 @@ class achievement_tilted : public AchievementCriteriaScript
bool OnCheck(Player* player, Unit* /*target*/)
{
+ if (!player)
+ return false;
+
bool checkArea = player->GetAreaId() == AREA_ARGENT_TOURNAMENT_FIELDS ||
player->GetAreaId() == AREA_RING_OF_ASPIRANTS ||
player->GetAreaId() == AREA_RING_OF_ARGENT_VALIANTS ||
@@ -309,7 +290,7 @@ class achievement_tilted : public AchievementCriteriaScript
player->GetAreaId() == AREA_RING_OF_HORDE_VALIANTS ||
player->GetAreaId() == AREA_RING_OF_CHAMPIONS;
- return player && checkArea && player->duel && player->duel->isMounted;
+ return checkArea && player->duel && player->duel->isMounted;
}
};
@@ -344,7 +325,6 @@ void AddSC_achievement_scripts()
new achievement_bg_ic_mowed_down();
new achievement_bg_sa_artillery();
new achievement_sickly_gazelle();
- new achievement_wg_didnt_stand_a_chance();
new achievement_everything_counts();
new achievement_bg_av_perfection();
new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2);
diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
index daf0ef213d9..db3c6dd2274 100644
--- a/src/server/scripts/World/areatrigger_scripts.cpp
+++ b/src/server/scripts/World/areatrigger_scripts.cpp
@@ -35,7 +35,9 @@ at_brewfest
at_area_52_entrance
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "Player.h"
/*######
## at_coilfang_waterfall
@@ -234,21 +236,19 @@ enum eWaygate
QUEST_THE_MAKERS_OVERLOOK = 12613,
QUEST_THE_MAKERS_PERCH = 12559,
+ QUEST_MEETING_A_GREAT_ONE = 13956,
};
class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
{
public:
- AreaTrigger_at_sholazar_waygate()
- : AreaTriggerScript("at_sholazar_waygate")
- {
- }
+ AreaTrigger_at_sholazar_waygate() : AreaTriggerScript("at_sholazar_waygate") {}
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
{
- if (player->GetQuestStatus(QUEST_THE_MAKERS_OVERLOOK) == QUEST_STATUS_REWARDED && !player->isDead() &&
- player->GetQuestStatus(QUEST_THE_MAKERS_PERCH) == QUEST_STATUS_REWARDED)
+ if (!player->isDead() && (player->GetQuestStatus(QUEST_MEETING_A_GREAT_ONE) != QUEST_STATUS_NONE ||
+ (player->GetQuestStatus(QUEST_THE_MAKERS_OVERLOOK) == QUEST_STATUS_REWARDED && player->GetQuestStatus(QUEST_THE_MAKERS_PERCH) == QUEST_STATUS_REWARDED)))
{
switch (trigger->id)
{
@@ -302,76 +302,6 @@ class AreaTrigger_at_nats_landing : public AreaTriggerScript
};
/*######
-## at_bring_your_orphan_to
-######*/
-
-enum BringYourOrphanTo
-{
- QUEST_DOWN_AT_THE_DOCKS = 910,
- QUEST_GATEWAY_TO_THE_FRONTIER = 911,
- QUEST_LORDAERON_THRONE_ROOM = 1800,
- QUEST_BOUGHT_OF_ETERNALS = 1479,
- QUEST_SPOOKY_LIGHTHOUSE = 1687,
- QUEST_STONEWROUGHT_DAM = 1558,
- QUEST_DARK_PORTAL_H = 10951,
- QUEST_DARK_PORTAL_A = 10952,
-
- AT_DOWN_AT_THE_DOCKS = 3551,
- AT_GATEWAY_TO_THE_FRONTIER = 3549,
- AT_LORDAERON_THRONE_ROOM = 3547,
- AT_BOUGHT_OF_ETERNALS = 3546,
- AT_SPOOKY_LIGHTHOUSE = 3552,
- AT_STONEWROUGHT_DAM = 3548,
- AT_DARK_PORTAL = 4356,
-
- AURA_ORPHAN_OUT = 58818,
-};
-
-class AreaTrigger_at_bring_your_orphan_to : public AreaTriggerScript
-{
- public:
- AreaTrigger_at_bring_your_orphan_to() : AreaTriggerScript("at_bring_your_orphan_to") { }
-
- bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
- {
- uint32 questId = 0;
-
- if (player->isDead() || !player->HasAura(AURA_ORPHAN_OUT))
- return false;
-
- switch (trigger->id)
- {
- case AT_DOWN_AT_THE_DOCKS:
- questId = QUEST_DOWN_AT_THE_DOCKS;
- break;
- case AT_GATEWAY_TO_THE_FRONTIER:
- questId = QUEST_GATEWAY_TO_THE_FRONTIER;
- break;
- case AT_LORDAERON_THRONE_ROOM:
- questId = QUEST_LORDAERON_THRONE_ROOM;
- break;
- case AT_BOUGHT_OF_ETERNALS:
- questId = QUEST_BOUGHT_OF_ETERNALS;
- break;
- case AT_SPOOKY_LIGHTHOUSE:
- questId = QUEST_SPOOKY_LIGHTHOUSE;
- break;
- case AT_STONEWROUGHT_DAM:
- questId = QUEST_STONEWROUGHT_DAM;
- break;
- case AT_DARK_PORTAL:
- questId = player->GetTeam() == ALLIANCE ? QUEST_DARK_PORTAL_A : QUEST_DARK_PORTAL_H;
- break;
- }
-
- if (questId && player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE)
- player->AreaExploredOrEventHappens(questId);
-
- return true;
- }
-};
-
-/*######
## at_brewfest
######*/
@@ -504,7 +434,6 @@ void AddSC_areatrigger_scripts()
new AreaTrigger_at_last_rites();
new AreaTrigger_at_sholazar_waygate();
new AreaTrigger_at_nats_landing();
- new AreaTrigger_at_bring_your_orphan_to();
new AreaTrigger_at_brewfest();
new AreaTrigger_at_area_52_entrance();
}
diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp
index abb20130ef8..a8f65b0bc9b 100644
--- a/src/server/scripts/World/boss_emerald_dragons.cpp
+++ b/src/server/scripts/World/boss_emerald_dragons.cpp
@@ -22,6 +22,7 @@
#include "SpellScript.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
+#include "PassiveAI.h"
//
// Emerald Dragon NPCs and IDs (kept here for reference)
@@ -91,14 +92,12 @@ struct emerald_dragonAI : public WorldBossAI
{
emerald_dragonAI(Creature* creature) : WorldBossAI(creature)
{
-// me->m_CombatDistance = 12.0f;
-// me->m_SightDistance = 60.0f;
}
void Reset()
{
- _Reset();
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE);
+ WorldBossAI::Reset();
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_AGGRESSIVE);
DoCast(me, SPELL_MARK_OF_NATURE_AURA, true);
events.ScheduleEvent(EVENT_TAIL_SWEEP, 4000);
@@ -109,7 +108,8 @@ struct emerald_dragonAI : public WorldBossAI
// Target killed during encounter, mark them as suspectible for Aura Of Nature
void KilledUnit(Unit* who)
{
- who->CastSpell(who, SPELL_MARK_OF_NATURE, true);
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ who->CastSpell(who, SPELL_MARK_OF_NATURE, true);
}
// Execute and reschedule base events shared between all Emerald Dragons
@@ -216,109 +216,6 @@ class npc_dream_fog : public CreatureScript
};
/*
- * --- Spell: Dream Fog
- */
-
-class DreamFogTargetSelector
-{
- public:
- DreamFogTargetSelector() { }
-
- bool operator()(WorldObject* object) const
- {
- return object->ToUnit() && object->ToUnit()->HasAura(SPELL_SLEEP);
- }
-};
-
-class spell_dream_fog_sleep : public SpellScriptLoader
-{
- public:
- spell_dream_fog_sleep() : SpellScriptLoader("spell_dream_fog_sleep") { }
-
- class spell_dream_fog_sleep_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_dream_fog_sleep_SpellScript);
-
- void FilterTargets(std::list<WorldObject*>& unitList)
- {
- unitList.remove_if(DreamFogTargetSelector());
- }
-
- void Register()
- {
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
- }
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_dream_fog_sleep_SpellScript();
- }
-};
-
-/*
- * --- Spell: Mark of Nature
- */
-
-class MarkOfNatureTargetSelector
-{
- public:
- MarkOfNatureTargetSelector() { }
-
- bool operator()(WorldObject* object) const
- {
- if (Unit* unit = object->ToUnit())
- // return anyone that isn't tagged or already under the influence of Aura of Nature
- return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE));
- return true;
- }
-};
-
-class spell_mark_of_nature : public SpellScriptLoader
-{
- public:
- spell_mark_of_nature() : SpellScriptLoader("spell_mark_of_nature") { }
-
- class spell_mark_of_nature_SpellScript : public SpellScript
- {
- PrepareSpellScript(spell_mark_of_nature_SpellScript);
-
- bool Validate(SpellInfo const* /*spellInfo*/)
- {
- if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_NATURE))
- return false;
- if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_NATURE))
- return false;
- return true;
- }
-
- void FilterTargets(std::list<WorldObject*>& targets)
- {
- targets.remove_if(MarkOfNatureTargetSelector());
- }
-
- void HandleEffect(SpellEffIndex effIndex)
- {
- PreventHitDefaultEffect(effIndex);
-
- if (GetHitUnit())
- GetHitUnit()->CastSpell(GetHitUnit(), SPELL_AURA_OF_NATURE, true);
- }
-
- void Register()
- {
- OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
- OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
- }
- };
-
- SpellScript* GetSpellScript() const
- {
- return new spell_mark_of_nature_SpellScript();
- }
-};
-
-/*
* ---
* --- Dragonspecific scripts and handling: YSONDRE
* ---
@@ -355,7 +252,6 @@ class boss_ysondre : public CreatureScript
void Reset()
{
_stage = 1;
- _Reset();
emerald_dragonAI::Reset();
events.ScheduleEvent(EVENT_LIGHTNING_WAVE, 12000);
}
@@ -394,7 +290,7 @@ class boss_ysondre : public CreatureScript
}
private:
- uint8 _stage;
+ uint8 _stage;
};
CreatureAI* GetAI(Creature* creature) const
@@ -409,8 +305,6 @@ class boss_ysondre : public CreatureScript
* ---
*
* TODO:
- * - NPC helper for spirit shades(?)
- * - Spirit shade NPC moves towards Lethon and heals him if close enough (each shade heals for 15000 HP)
* - Spell: Shadow bolt whirl casts needs custom handling (spellscript)
*/
@@ -424,7 +318,12 @@ enum LethonSpells
{
SPELL_DRAW_SPIRIT = 24811,
SPELL_SHADOW_BOLT_WHIRL = 24834,
- SPELL_SPIRIT_SHADE_VISUAL = 24908,
+ SPELL_DARK_OFFERING = 24804,
+};
+
+enum LethonCreatures
+{
+ NPC_SPIRIT_SHADE = 15261,
};
class boss_lethon : public CreatureScript
@@ -441,7 +340,6 @@ class boss_lethon : public CreatureScript
void Reset()
{
_stage = 1;
- _Reset();
emerald_dragonAI::Reset();
events.ScheduleEvent(EVENT_SHADOW_BOLT_WHIRL, 10000);
}
@@ -462,12 +360,22 @@ class boss_lethon : public CreatureScript
}
}
+ void SpellHitTarget(Unit* target, SpellInfo const* spell)
+ {
+ if (spell->Id == SPELL_DRAW_SPIRIT && target->GetTypeId() == TYPEID_PLAYER)
+ {
+ Position targetPos;
+ target->GetPosition(&targetPos);
+ me->SummonCreature(NPC_SPIRIT_SHADE, targetPos, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 50000);
+ }
+ }
+
void ExecuteEvent(uint32 const eventId)
{
switch (eventId)
{
case EVENT_SHADOW_BOLT_WHIRL:
- DoCast(me, SPELL_SHADOW_BOLT_WHIRL, true);
+ me->CastSpell((Unit*)NULL, SPELL_SHADOW_BOLT_WHIRL, false);
events.ScheduleEvent(EVENT_SHADOW_BOLT_WHIRL, urand(15000, 30000));
break;
default:
@@ -477,7 +385,7 @@ class boss_lethon : public CreatureScript
}
private:
- uint8 _stage;
+ uint8 _stage;
};
CreatureAI* GetAI(Creature* creature) const
@@ -486,6 +394,42 @@ class boss_lethon : public CreatureScript
}
};
+class npc_spirit_shade : public CreatureScript
+{
+ public:
+ npc_spirit_shade() : CreatureScript("npc_spirit_shade") { }
+
+ struct npc_spirit_shadeAI : public PassiveAI
+ {
+ npc_spirit_shadeAI(Creature* creature) : PassiveAI(creature), _summonerGuid(0)
+ {
+ }
+
+ void IsSummonedBy(Unit* summoner)
+ {
+ _summonerGuid = summoner->GetGUID();
+ me->GetMotionMaster()->MoveFollow(summoner, 0.0f, 0.0f);
+ }
+
+ void MovementInform(uint32 moveType, uint32 data)
+ {
+ if (moveType == FOLLOW_MOTION_TYPE && data == _summonerGuid)
+ {
+ me->CastSpell((Unit*)NULL, SPELL_DARK_OFFERING, false);
+ me->DespawnOrUnsummon(1000);
+ }
+ }
+
+ private:
+ uint64 _summonerGuid;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const
+ {
+ return new npc_spirit_shadeAI(creature);
+ }
+};
+
/*
* ---
* --- Dragonspecific scripts and handling: EMERISS
@@ -519,7 +463,6 @@ class boss_emeriss : public CreatureScript
void Reset()
{
_stage = 1;
- _Reset();
emerald_dragonAI::Reset();
events.ScheduleEvent(EVENT_VOLATILE_INFECTION, 12000);
}
@@ -562,7 +505,7 @@ class boss_emeriss : public CreatureScript
}
private:
- uint8 _stage;
+ uint8 _stage;
};
CreatureAI* GetAI(Creature* creature) const
@@ -607,10 +550,6 @@ class boss_taerar : public CreatureScript
{
boss_taerarAI(Creature* creature) : emerald_dragonAI(creature)
{
- _stage = 1;
- _shades = 0;
- _banished = false;
- _banishedTimer = 0;
}
void Reset()
@@ -622,7 +561,6 @@ class boss_taerar : public CreatureScript
_banished = false;
_banishedTimer = 0;
- _Reset();
emerald_dragonAI::Reset();
events.ScheduleEvent(EVENT_ARCANE_BLAST, 12000);
events.ScheduleEvent(EVENT_BELLOWING_ROAR, 30000);
@@ -655,11 +593,11 @@ class boss_taerar : public CreatureScript
uint32 count = sizeof(TaerarShadeSpells) / sizeof(uint32);
for (uint32 i = 0; i < count; ++i)
- DoCastVictim(TaerarShadeSpells[i], true);
+ DoCast(me->getVictim(), TaerarShadeSpells[i], true);
_shades += count;
DoCast(SPELL_SHADE);
- me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE);
+ me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
++_stage;
@@ -696,7 +634,7 @@ class boss_taerar : public CreatureScript
{
_banished = false;
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE);
+ me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->RemoveAurasDueToSpell(SPELL_SHADE);
me->SetReactState(REACT_AGGRESSIVE);
}
@@ -714,10 +652,10 @@ class boss_taerar : public CreatureScript
}
private:
- bool _banished; // used for shades activation testing
- uint32 _banishedTimer; // counter for banishment timeout
- uint8 _shades; // keep track of how many shades are dead
- uint8 _stage; // check which "shade phase" we're at (75-50-25 percentage counters)
+ bool _banished; // used for shades activation testing
+ uint32 _banishedTimer; // counter for banishment timeout
+ uint8 _shades; // keep track of how many shades are dead
+ uint8 _stage; // check which "shade phase" we're at (75-50-25 percentage counters)
};
CreatureAI* GetAI(Creature* creature) const
@@ -726,18 +664,122 @@ class boss_taerar : public CreatureScript
}
};
+/*
+ * --- Spell: Dream Fog
+ */
+
+class DreamFogTargetSelector
+{
+ public:
+ DreamFogTargetSelector() { }
+
+ bool operator()(WorldObject* object)
+ {
+ if (Unit* unit = object->ToUnit())
+ return unit->HasAura(SPELL_SLEEP);
+ return true;
+ }
+};
+
+class spell_dream_fog_sleep : public SpellScriptLoader
+{
+ public:
+ spell_dream_fog_sleep() : SpellScriptLoader("spell_dream_fog_sleep") { }
+
+ class spell_dream_fog_sleep_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_dream_fog_sleep_SpellScript);
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(DreamFogTargetSelector());
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dream_fog_sleep_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_dream_fog_sleep_SpellScript();
+ }
+};
+
+/*
+ * --- Spell: Mark of Nature
+ */
+
+class MarkOfNatureTargetSelector
+{
+ public:
+ MarkOfNatureTargetSelector() { }
+
+ bool operator()(WorldObject* object)
+ {
+ // return those not tagged or already under the influence of Aura of Nature
+ if (Unit* unit = object->ToUnit())
+ return !(unit->HasAura(SPELL_MARK_OF_NATURE) && !unit->HasAura(SPELL_AURA_OF_NATURE));
+ return true;
+ }
+};
+
+class spell_mark_of_nature : public SpellScriptLoader
+{
+ public:
+ spell_mark_of_nature() : SpellScriptLoader("spell_mark_of_nature") { }
+
+ class spell_mark_of_nature_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_mark_of_nature_SpellScript);
+
+ bool Validate(SpellInfo const* /*spellInfo*/)
+ {
+ if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_NATURE))
+ return false;
+ if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_NATURE))
+ return false;
+ return true;
+ }
+
+ void FilterTargets(std::list<WorldObject*>& targets)
+ {
+ targets.remove_if(MarkOfNatureTargetSelector());
+ }
+
+ void HandleEffect(SpellEffIndex effIndex)
+ {
+ PreventHitDefaultEffect(effIndex);
+ GetHitUnit()->CastSpell(GetHitUnit(), SPELL_AURA_OF_NATURE, true);
+ }
+
+ void Register()
+ {
+ OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_nature_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
+ OnEffectHitTarget += SpellEffectFn(spell_mark_of_nature_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
+ }
+ };
+
+ SpellScript* GetSpellScript() const
+ {
+ return new spell_mark_of_nature_SpellScript();
+ }
+};
+
void AddSC_emerald_dragons()
{
// helper NPC scripts
new npc_dream_fog();
-
- // dragon spellscripts
- new spell_dream_fog_sleep();
- new spell_mark_of_nature();
+ new npc_spirit_shade();
// dragons
new boss_ysondre();
new boss_taerar();
new boss_emeriss();
new boss_lethon();
+
+ // dragon spellscripts
+ new spell_dream_fog_sleep();
+ new spell_mark_of_nature();
};
diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp
index 2a5d814bfde..236436b229b 100755..100644
--- a/src/server/scripts/World/chat_log.cpp
+++ b/src/server/scripts/World/chat_log.cpp
@@ -15,7 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
#include "Channel.h"
#include "Guild.h"
#include "Group.h"
@@ -31,26 +31,26 @@ public:
{
case CHAT_MSG_ADDON:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s sends: %s",
- player->GetName(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s",
+ player->GetName().c_str(), msg.c_str());
break;
case CHAT_MSG_SAY:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
- sLog->outChat("[SAY] Player %s says (language %u): %s",
- player->GetName(), lang, msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s",
+ player->GetName().c_str(), lang, msg.c_str());
break;
case CHAT_MSG_EMOTE:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
- sLog->outChat("[TEXTEMOTE] Player %s emotes: %s",
- player->GetName(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s",
+ player->GetName().c_str(), msg.c_str());
break;
case CHAT_MSG_YELL:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC))
- sLog->outChat("[YELL] Player %s yells (language %u): %s",
- player->GetName(), lang, msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s",
+ player->GetName().c_str(), lang, msg.c_str());
break;
}
}
@@ -58,11 +58,11 @@ public:
void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver)
{
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER))
- sLog->outChat("[WHISPER] Player %s tells %s: %s",
- player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s",
+ player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells %s: %s",
- player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s",
+ player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
}
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group)
@@ -73,53 +73,53 @@ public:
{
case CHAT_MSG_PARTY:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY))
- sLog->outChat("[PARTY] Player %s tells group with leader %s: %s",
- player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s",
+ player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells group with leader %s: %s",
- player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s",
+ player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_PARTY_LEADER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY))
- sLog->outChat("[PARTY] Leader %s tells group: %s",
- player->GetName(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s",
+ player->GetName().c_str(), msg.c_str());
break;
case CHAT_MSG_RAID:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
- sLog->outChat("[RAID] Player %s tells raid with leader %s: %s",
- player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s",
+ player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells raid with leader %s: %s",
- player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s",
+ player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_RAID_LEADER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
- sLog->outChat("[RAID] Leader player %s tells raid: %s",
- player->GetName(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s",
+ player->GetName().c_str(), msg.c_str());
break;
case CHAT_MSG_RAID_WARNING:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID))
- sLog->outChat("[RAID] Leader player %s warns raid with: %s",
- player->GetName(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s",
+ player->GetName().c_str(), msg.c_str());
break;
case CHAT_MSG_BATTLEGROUND:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND))
- sLog->outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
- player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s",
+ player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s tells battleground with leader %s: %s",
- player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s",
+ player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_BATTLEGROUND_LEADER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND))
- sLog->outChat("[BATTLEGROUND] Leader player %s tells battleground: %s",
- player->GetName(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s",
+ player->GetName().c_str(), msg.c_str());
break;
}
}
@@ -130,17 +130,17 @@ public:
{
case CHAT_MSG_GUILD:
if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD))
- sLog->outChat("[GUILD] Player %s tells guild %s: %s",
- player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s",
+ player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
- sLog->outChat("[ADDON] Player %s sends to guild %s: %s",
- player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s",
+ player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
break;
case CHAT_MSG_OFFICER:
if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD))
- sLog->outChat("[OFFICER] Player %s tells guild %s officers: %s",
- player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s",
+ player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
break;
}
}
@@ -154,11 +154,11 @@ public:
channel->HasFlag(CHANNEL_FLAG_LFG));
if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem)
- sLog->outChat("[SYSCHAN] Player %s tells channel %s: %s",
- player->GetName(), channel->GetName().c_str(), msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s",
+ player->GetName().c_str(), channel->GetName().c_str(), msg.c_str());
else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL))
- sLog->outChat("[CHANNEL] Player %s tells channel %s: %s",
- player->GetName(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str());
+ sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s",
+ player->GetName().c_str(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str());
}
};
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp
index 21a852ae9ed..dac67b566e3 100644
--- a/src/server/scripts/World/go_scripts.cpp
+++ b/src/server/scripts/World/go_scripts.cpp
@@ -50,13 +50,19 @@ go_large_gjalerbron_cage
go_veil_skith_cage
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "GameObjectAI.h"
+#include "Spell.h"
+#include "Player.h"
+#include "WorldSession.h"
/*######
## go_cat_figurine
######*/
-enum eCatFigurine
+enum CatFigurine
{
SPELL_SUMMON_GHOST_SABER = 5968,
};
@@ -176,7 +182,7 @@ public:
## go_gilded_brazier (Paladin First Trail quest (9678))
######*/
-enum eGildedBrazier
+enum GildedBrazier
{
NPC_STILLBLADE = 17716,
};
@@ -280,7 +286,7 @@ public:
## go_ethereum_prison
######*/
-enum eEthereumPrison
+enum EthereumPrison
{
SPELL_REP_LC = 39456,
SPELL_REP_SHAT = 39457,
@@ -327,7 +333,7 @@ public:
if (Spell)
creature->CastSpell(player, Spell, false);
else
- sLog->outError("TSCR: go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction());
+ sLog->outError(LOG_FILTER_TSCR, "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->getFaction());
}
}
}
@@ -365,7 +371,7 @@ public:
## go_resonite_cask
######*/
-enum eResoniteCask
+enum ResoniteCask
{
NPC_GOGGEROC = 11920
};
@@ -408,7 +414,7 @@ public:
## go_shrine_of_the_birds
######*/
-enum eShrineOfTheBirds
+enum ShrineOfTheBirds
{
NPC_HAWK_GUARD = 22992,
NPC_EAGLE_GUARD = 22993,
@@ -454,7 +460,7 @@ public:
## go_southfury_moonstone
######*/
-enum eSouthfury
+enum Southfury
{
NPC_RIZZLE = 23002,
SPELL_BLACKJACK = 39865, //stuns player
@@ -482,7 +488,7 @@ public:
## go_tele_to_dalaran_crystal
######*/
-enum eDalaranCrystal
+enum DalaranCrystal
{
QUEST_LEARN_LEAVE_RETURN = 12790,
QUEST_TELE_CRYSTAL_FLAG = 12845
@@ -534,7 +540,7 @@ public:
#define GOSSIP_FEL_CRYSTALFORGE_ITEM_5 "Purchase 5 Unstable Flask of the Beast for the cost of 50 Apexis Shards"
#define GOSSIP_FEL_CRYSTALFORGE_ITEM_RETURN "Use the fel crystalforge to make another purchase."
-enum eFelCrystalforge
+enum FelCrystalforge
{
SPELL_CREATE_1_FLASK_OF_BEAST = 40964,
SPELL_CREATE_5_FLASK_OF_BEAST = 40965,
@@ -593,7 +599,7 @@ public:
#define GOSSIP_BASHIR_CRYSTALFORGE_ITEM_5 "Purchase 5 Unstable Flask of the Sorcerer for the cost of 50 Apexis Shards"
#define GOSSIP_BASHIR_CRYSTALFORGE_ITEM_RETURN "Use the bashir crystalforge to make another purchase."
-enum eBashirCrystalforge
+enum BashirCrystalforge
{
SPELL_CREATE_1_FLASK_OF_SORCERER = 40968,
SPELL_CREATE_5_FLASK_OF_SORCERER = 40970,
@@ -646,7 +652,7 @@ public:
## matrix_punchograph
######*/
-enum eMatrixPunchograph
+enum MatrixPunchograph
{
ITEM_WHITE_PUNCH_CARD = 9279,
ITEM_YELLOW_PUNCH_CARD = 9280,
@@ -673,28 +679,28 @@ public:
switch (go->GetEntry())
{
case MATRIX_PUNCHOGRAPH_3005_A:
- if (player->HasItemCount(ITEM_WHITE_PUNCH_CARD, 1))
+ if (player->HasItemCount(ITEM_WHITE_PUNCH_CARD))
{
player->DestroyItemCount(ITEM_WHITE_PUNCH_CARD, 1, true);
player->CastSpell(player, SPELL_YELLOW_PUNCH_CARD, true);
}
break;
case MATRIX_PUNCHOGRAPH_3005_B:
- if (player->HasItemCount(ITEM_YELLOW_PUNCH_CARD, 1))
+ if (player->HasItemCount(ITEM_YELLOW_PUNCH_CARD))
{
player->DestroyItemCount(ITEM_YELLOW_PUNCH_CARD, 1, true);
player->CastSpell(player, SPELL_BLUE_PUNCH_CARD, true);
}
break;
case MATRIX_PUNCHOGRAPH_3005_C:
- if (player->HasItemCount(ITEM_BLUE_PUNCH_CARD, 1))
+ if (player->HasItemCount(ITEM_BLUE_PUNCH_CARD))
{
player->DestroyItemCount(ITEM_BLUE_PUNCH_CARD, 1, true);
player->CastSpell(player, SPELL_RED_PUNCH_CARD, true);
}
break;
case MATRIX_PUNCHOGRAPH_3005_D:
- if (player->HasItemCount(ITEM_RED_PUNCH_CARD, 1))
+ if (player->HasItemCount(ITEM_RED_PUNCH_CARD))
{
player->DestroyItemCount(ITEM_RED_PUNCH_CARD, 1, true);
player->CastSpell(player, SPELL_PRISMATIC_PUNCH_CARD, true);
@@ -711,7 +717,7 @@ public:
## go_scourge_cage
######*/
-enum eScourgeCage
+enum ScourgeCage
{
NPC_SCOURGE_PRISONER = 25610
};
@@ -738,7 +744,7 @@ public:
## go_arcane_prison
######*/
-enum eArcanePrison
+enum ArcanePrison
{
QUEST_PRISON_BREAK = 11587,
SPELL_ARCANE_PRISONER_KILL_CREDIT = 45456
@@ -785,7 +791,7 @@ public:
## go_jotunheim_cage
######*/
-enum eJotunheimCage
+enum JotunheimCage
{
NPC_EBON_BLADE_PRISONER_HUMAN = 30186,
NPC_EBON_BLADE_PRISONER_NE = 30194,
@@ -840,7 +846,7 @@ public:
}
};
-enum eTableTheka
+enum TableTheka
{
GOSSIP_TABLE_THEKA = 1653,
@@ -867,7 +873,7 @@ public:
## go_inconspicuous_landmark
######*/
-enum eInconspicuousLandmark
+enum InconspicuousLandmark
{
SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB = 11462,
ITEM_CUERGOS_KEY = 9275,
@@ -880,7 +886,7 @@ public:
bool OnGossipHello(Player* player, GameObject* /*go*/)
{
- if (player->HasItemCount(ITEM_CUERGOS_KEY, 1))
+ if (player->HasItemCount(ITEM_CUERGOS_KEY))
return false;
player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true);
@@ -893,7 +899,7 @@ public:
## go_ethereal_teleport_pad
######*/
-enum eEtherealTeleportPad
+enum EtherealTeleportPad
{
NPC_IMAGE_WIND_TRADER = 20518,
ITEM_TELEPORTER_POWER_PACK = 28969,
@@ -906,7 +912,7 @@ public:
bool OnGossipHello(Player* player, GameObject* go)
{
- if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK, 1))
+ if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK))
return false;
go->SummonCreature(NPC_IMAGE_WIND_TRADER, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000);
@@ -919,45 +925,105 @@ public:
## go_soulwell
######*/
-class go_soulwell : public GameObjectScript
+enum SoulWellData
{
-public:
- go_soulwell() : GameObjectScript("go_soulwell") { }
+ GO_SOUL_WELL_R1 = 181621,
+ GO_SOUL_WELL_R2 = 193169,
- bool OnGossipHello(Player* player, GameObject* go)
- {
- Unit* caster = go->GetOwner();
- if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
- return true;
+ SPELL_IMPROVED_HEALTH_STONE_R1 = 18692,
+ SPELL_IMPROVED_HEALTH_STONE_R2 = 18693,
- if (!player->IsInSameRaidWith(static_cast<Player*>(caster)))
- return true;
+ SPELL_CREATE_MASTER_HEALTH_STONE_R0 = 34130,
+ SPELL_CREATE_MASTER_HEALTH_STONE_R1 = 34149,
+ SPELL_CREATE_MASTER_HEALTH_STONE_R2 = 34150,
+
+ SPELL_CREATE_FEL_HEALTH_STONE_R0 = 58890,
+ SPELL_CREATE_FEL_HEALTH_STONE_R1 = 58896,
+ SPELL_CREATE_FEL_HEALTH_STONE_R2 = 58898,
+};
- // Repeating this at every use is ugly and inefficient. But as long as we don't have proper
- // GO scripting with at least On Create and On Update events, the other options are no less
- // ugly and hacky.
- uint32 newSpell = 0;
- if (go->GetEntry() == 193169) // Soulwell for rank 2
+class go_soulwell : public GameObjectScript
+{
+ public:
+ go_soulwell() : GameObjectScript("go_soulwell") {}
+
+ struct go_soulwellAI : public GameObjectAI
{
- if (caster->HasAura(18693)) // Improved Healthstone rank 2
- newSpell = 58898;
- else if (caster->HasAura(18692)) // Improved Healthstone rank 1
- newSpell = 58896;
- else newSpell = 58890;
- }
- else if (go->GetEntry() == 181621) // Soulwell for rank 1
+ go_soulwellAI(GameObject* go) : GameObjectAI(go)
+ {
+ _stoneSpell = 0;
+ _stoneId = 0;
+ switch (go->GetEntry())
+ {
+ case GO_SOUL_WELL_R1:
+ _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R0;
+ if (Unit* owner = go->GetOwner())
+ {
+ if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R1))
+ _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R1;
+ else if (owner->HasAura(SPELL_CREATE_MASTER_HEALTH_STONE_R2))
+ _stoneSpell = SPELL_CREATE_MASTER_HEALTH_STONE_R2;
+ }
+ break;
+ case GO_SOUL_WELL_R2:
+ _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R0;
+ if (Unit* owner = go->GetOwner())
+ {
+ if (owner->HasAura(SPELL_IMPROVED_HEALTH_STONE_R1))
+ _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R1;
+ else if (owner->HasAura(SPELL_CREATE_MASTER_HEALTH_STONE_R2))
+ _stoneSpell = SPELL_CREATE_FEL_HEALTH_STONE_R2;
+ }
+ break;
+ }
+ if (_stoneSpell == 0) // Should never happen
+ return;
+
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_stoneSpell);
+ if (!spellInfo)
+ return;
+
+ _stoneId = spellInfo->Effects[EFFECT_0].ItemType;
+ }
+
+ /// Due to the fact that this GameObject triggers CMSG_GAMEOBJECT_USE
+ /// _and_ CMSG_GAMEOBJECT_REPORT_USE, this GossipHello hook is called
+ /// twice. The script's handling is fine as it won't remove two charges
+ /// on the well. We have to find how to segregate REPORT_USE and USE.
+ bool GossipHello(Player* player)
+ {
+ Unit* owner = go->GetOwner();
+ if (_stoneSpell == 0 || _stoneId == 0)
+ return true;
+
+ if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer()))
+ return true;
+
+ // Don't try to add a stone if we already have one.
+ if (player->HasItemCount(_stoneId))
+ {
+ if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_stoneSpell))
+ Spell::SendCastResult(player, spell, 0, SPELL_FAILED_TOO_MANY_OF_ITEM);
+ return true;
+ }
+
+ owner->CastSpell(player, _stoneSpell, true);
+ // Item has to actually be created to remove a charge on the well.
+ if (player->HasItemCount(_stoneId))
+ go->AddUse();
+
+ return false;
+ }
+
+ private:
+ uint32 _stoneSpell;
+ uint32 _stoneId;
+ };
+
+ GameObjectAI* GetAI(GameObject* go) const
{
- if (caster->HasAura(18693)) // Improved Healthstone rank 2
- newSpell = 34150;
- else if (caster->HasAura(18692)) // Improved Healthstone rank 1
- newSpell = 34149;
- else newSpell = 34130;
+ return new go_soulwellAI(go);
}
-
- go->AddUse();
- player->CastSpell(player, newSpell, true);
- return true;
- }
};
/*######
@@ -965,7 +1031,7 @@ public:
## go_dragonflayer_cage
######*/
-enum ePrisonersOfWyrmskull
+enum PrisonersOfWyrmskull
{
QUEST_PRISONERS_OF_WYRMSKULL = 11255,
NPC_PRISONER_PRIEST = 24086,
@@ -1015,7 +1081,7 @@ public:
## go_tadpole_cage
######*/
-enum eTadpoles
+enum Tadpoles
{
QUEST_OH_NOES_THE_TADPOLES = 11560,
NPC_WINTERFIN_TADPOLE = 25201
@@ -1050,7 +1116,7 @@ public:
#define GOSSIP_USE_OUTHOUSE "Use the outhouse."
#define GO_ANDERHOLS_SLIDER_CIDER_NOT_FOUND "Quest item Anderhol's Slider Cider not found."
-enum eAmberpineOuthouse
+enum AmberpineOuthouse
{
ITEM_ANDERHOLS_SLIDER_CIDER = 37247,
NPC_OUTHOUSE_BUNNY = 27326,
@@ -1094,7 +1160,7 @@ public:
go->CastSpell(target, SPELL_INDISPOSED_III);
}
go->CastSpell(player, SPELL_INDISPOSED);
- if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER, 1))
+ if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER))
go->CastSpell(player, SPELL_CREATE_AMBERSEEDS);
return true;
}
@@ -1112,7 +1178,7 @@ public:
## go_hive_pod
######*/
-enum eHives
+enum Hives
{
QUEST_HIVE_IN_THE_TOWER = 9544,
NPC_HIVE_AMBUSHER = 13301
@@ -1279,7 +1345,7 @@ public:
## go_midsummer_bonfire
######*/
-enum eMidsummerBonfire
+enum MidsummerBonfire
{
STAMP_OUT_BONFIRE_QUEST_COMPLETE = 45458,
};
diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp
index e3100522fbe..8fc63a1eacf 100644
--- a/src/server/scripts/World/guards.cpp
+++ b/src/server/scripts/World/guards.cpp
@@ -29,16 +29,17 @@ guard_shattrath_aldor
guard_shattrath_scryer
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "GuardAI.h"
+#include "Player.h"
+#include "SpellInfo.h"
enum GuardGeneric
{
GENERIC_CREATURE_COOLDOWN = 5000,
- SAY_GUARD_SIL_AGGRO1 = -1070001,
- SAY_GUARD_SIL_AGGRO2 = -1070002,
- SAY_GUARD_SIL_AGGRO3 = -1070003,
+ SAY_GUARD_SIL_AGGRO = 0,
NPC_CENARION_HOLD_INFANTRY = 15184,
NPC_STORMWIND_CITY_GUARD = 68,
@@ -64,7 +65,7 @@ public:
void EnterCombat(Unit* who)
{
if (me->GetEntry() == NPC_CENARION_HOLD_INFANTRY)
- DoScriptText(RAND(SAY_GUARD_SIL_AGGRO1, SAY_GUARD_SIL_AGGRO2, SAY_GUARD_SIL_AGGRO3), me, who);
+ Talk(SAY_GUARD_SIL_AGGRO, who->GetGUID());
if (SpellInfo const* spell = me->reachWithSpellAttack(who))
DoCast(who, spell->Id);
}
diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp
index ae69744ea2b..535bebd9415 100644
--- a/src/server/scripts/World/item_scripts.cpp
+++ b/src/server/scripts/World/item_scripts.cpp
@@ -30,8 +30,10 @@ item_gor_dreks_ointment(i30175) Protecting Our Own(q10488)
item_only_for_flight Items which should only useable while flying
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
#include "Spell.h"
+#include "Player.h"
/*#####
# item_only_for_flight
diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp
index 208effee61b..be409670f5d 100644
--- a/src/server/scripts/World/mob_generic_creature.cpp
+++ b/src/server/scripts/World/mob_generic_creature.cpp
@@ -23,7 +23,9 @@ SDComment: Should be replaced with core based AI
SDCategory: Creatures
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "PassiveAI.h"
#define GENERIC_CREATURE_COOLDOWN 5000
diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp
index fb7c0833d22..502ecb1acb2 100644
--- a/src/server/scripts/World/npc_innkeeper.cpp
+++ b/src/server/scripts/World/npc_innkeeper.cpp
@@ -23,7 +23,12 @@ SDComment: Complete
SDCategory: NPCs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "GameEventMgr.h"
+#include "Player.h"
+#include "WorldSession.h"
#define HALLOWEEN_EVENTID 12
#define SPELL_TRICK_OR_TREATED 24755
diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp
index 2afa80dd42c..4524a3a9374 100644
--- a/src/server/scripts/World/npc_professions.cpp
+++ b/src/server/scripts/World/npc_professions.cpp
@@ -23,7 +23,12 @@ SDComment: Provides learn/unlearn/relearn-options for professions. Not supported
SDCategory: NPCs
EndScriptData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
+#include "SpellInfo.h"
+#include "WorldSession.h"
/*
A few notes for future developement:
@@ -242,7 +247,7 @@ bool EquippedOk(Player* player, uint32 spellId)
if (item && item->GetTemplate()->RequiredSpell == reqSpell)
{
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
- sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
+ sLog->outDebug(LOG_FILTER_TSCR, "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
return false;
}
}
@@ -780,7 +785,7 @@ enum eEngineeringTrinkets
SPELL_TO_TOSHLEY = 36955,
};
-#define GOSSIP_ITEM_ZAP "[PH] Unknown"
+#define GOSSIP_ITEM_ZAP "This Dimensional Imploder sounds dangerous! How can I make one?"
#define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!"
#define GOSSIP_ITEM_KABLAM "[PH] Unknown"
@@ -814,7 +819,7 @@ public:
switch (creature->GetEntry())
{
case NPC_ZAP:
- canLearn = CanLearn(player, 7249, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId);
+ canLearn = CanLearn(player, 6092, 0, 260, S_GOBLIN, SPELL_TO_EVERLOOK, npcTextId);
if (canLearn)
gossipItem = GOSSIP_ITEM_ZAP;
break;
diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp
index ceda8e0f6ac..4ed5b0d9276 100644
--- a/src/server/scripts/World/npc_taxi.cpp
+++ b/src/server/scripts/World/npc_taxi.cpp
@@ -24,7 +24,11 @@ SDCategory: NPCs
EndScriptData
*/
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
+#include "Player.h"
+#include "WorldSession.h"
#define GOSSIP_SUSURRUS "I am ready."
#define GOSSIP_NETHER_DRAKE "I'm ready to fly! Take me up, dragon!"
@@ -49,8 +53,6 @@ EndScriptData
#define GOSSIP_TARIOLSTRASZ2 "Can you spare a drake to travel to Lord Of Afrasastrasz, in the middle of the temple?"
#define GOSSIP_TORASTRASZA1 "I would like to see Lord Of Afrasastrasz, in the middle of the temple."
#define GOSSIP_TORASTRASZA2 "Yes, Please. I would like to return to the ground floor of the temple."
-#define GOSSIP_CAMILLE1 "I need to fly to the Windrunner Official business!"
-#define GOSSIP_CAMILLE2 "<The riding bat for the special task is necessary to me.>"
#define GOSSIP_CRIMSONWING "<Ride the gryphons to Survey Alcaz Island>"
#define GOSSIP_THRICESTAR1 "Do you think I could take a ride on one of those flying machines?"
#define GOSSIP_THRICESTAR2 "Kara, I need to be flown out the Dens of Dying to find Bixie."
@@ -75,7 +77,7 @@ public:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
break;
case 20903: // Netherstorm - Protectorate Nether Drake
- if (player->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(29778, 1))
+ if (player->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(29778))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NETHER_DRAKE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
break;
case 18725: // Old Hillsbrad Foothills - Brazen
@@ -157,12 +159,6 @@ public:
// top -> ground
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22);
break;
- case 23816: // Howling Fjord - Bat Handler Camille
- if (!player->GetQuestRewardStatus(11229))
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CAMILLE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23);
- if (player->GetQuestStatus(11170) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CAMILLE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24);
- break;
case 23704: // Dustwallow Marsh - Cassa Crimsonwing
if (player->GetQuestStatus(11142) == QUEST_STATUS_INCOMPLETE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CRIMSONWING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+25);
@@ -201,7 +197,7 @@ public:
player->ActivateTaxiPathTo(627); //TaxiPath 627 (possibly 627+628(152->153->154->155))
break;
case GOSSIP_ACTION_INFO_DEF + 2:
- if (!player->HasItemCount(25853, 1))
+ if (!player->HasItemCount(25853))
player->SEND_GOSSIP_MENU(9780, creature->GetGUID());
else
{
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 57a65423b6f..59ab9cd61e7 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -42,12 +42,23 @@ npc_locksmith 75% list of keys needs to be confirmed
npc_firework 100% NPC's summoned by rockets and rocket clusters, for making them cast visual
EndContentData */
-#include "ScriptPCH.h"
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "World.h"
#include "PetAI.h"
+#include "PassiveAI.h"
+#include "CombatAI.h"
+#include "GameEventMgr.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "SpellAuras.h"
+#include "Pet.h"
/*########
# npc_air_force_bots
@@ -131,14 +142,14 @@ public:
}
if (!SpawnAssoc)
- sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
+ sLog->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry());
else
{
CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry);
if (!spawnedTemplate)
{
- sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry);
SpawnAssoc = NULL;
return;
}
@@ -158,7 +169,7 @@ public:
SpawnedGUID = summoned->GetGUID();
else
{
- sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
+ sLog->outError(LOG_FILTER_SQL, "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry);
SpawnAssoc = NULL;
}
@@ -302,12 +313,16 @@ public:
# npc_chicken_cluck
#########*/
-#define EMOTE_HELLO -1070004
-#define EMOTE_CLUCK_TEXT -1070006
+enum ChickenCluck
+{
+ EMOTE_HELLO_A = 0,
+ EMOTE_HELLO_H = 1,
+ EMOTE_CLUCK_TEXT = 2,
-#define QUEST_CLUCK 3861
-#define FACTION_FRIENDLY 35
-#define FACTION_CHICKEN 31
+ QUEST_CLUCK = 3861,
+ FACTION_FRIENDLY = 35,
+ FACTION_CHICKEN = 31
+};
class npc_chicken_cluck : public CreatureScript
{
@@ -356,7 +371,7 @@ public:
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_FRIENDLY);
- DoScriptText(EMOTE_HELLO, me);
+ Talk(player->GetTeam() == HORDE ? EMOTE_HELLO_H : EMOTE_HELLO_A);
}
break;
case TEXT_EMOTE_CHEER:
@@ -364,7 +379,7 @@ public:
{
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
me->setFaction(FACTION_FRIENDLY);
- DoScriptText(EMOTE_CLUCK_TEXT, me);
+ Talk(EMOTE_CLUCK_TEXT);
}
break;
}
@@ -489,15 +504,15 @@ public:
## Triage quest
######*/
-//signed for 9623
-#define SAY_DOC1 -1000201
-#define SAY_DOC2 -1000202
-#define SAY_DOC3 -1000203
+enum Doctor
+{
+ SAY_DOC = 0,
-#define DOCTOR_ALLIANCE 12939
-#define DOCTOR_HORDE 12920
-#define ALLIANCE_COORDS 7
-#define HORDE_COORDS 6
+ DOCTOR_ALLIANCE = 12939,
+ DOCTOR_HORDE = 12920,
+ ALLIANCE_COORDS = 7,
+ HORDE_COORDS = 6
+};
struct Location
{
@@ -762,7 +777,7 @@ public:
//stand up
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
- DoScriptText(RAND(SAY_DOC1, SAY_DOC2, SAY_DOC3), me);
+ Talk(SAY_DOC);
uint32 mobId = me->GetEntry();
me->SetWalk(false);
@@ -836,7 +851,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff)
patientEntry = HordeSoldierId[rand() % 3];
break;
default:
- sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database");
+ sLog->outError(LOG_FILTER_TSCR, "Invalid entry for Triage doctor. Please check your database");
return;
}
@@ -868,7 +883,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff)
//TODO: get text for each NPC
-enum eGarments
+enum Garments
{
SPELL_LESSER_HEAL_R2 = 2052,
SPELL_FORTITUDE_R1 = 1243,
@@ -885,18 +900,10 @@ enum eGarments
ENTRY_KORJA = 12430,
ENTRY_DG_KEL = 12428,
- //used by 12429, 12423, 12427, 12430, 12428, but signed for 12429
- SAY_COMMON_HEALED = -1000164,
- SAY_DG_KEL_THANKS = -1000165,
- SAY_DG_KEL_GOODBYE = -1000166,
- SAY_ROBERTS_THANKS = -1000167,
- SAY_ROBERTS_GOODBYE = -1000168,
- SAY_KORJA_THANKS = -1000169,
- SAY_KORJA_GOODBYE = -1000170,
- SAY_DOLF_THANKS = -1000171,
- SAY_DOLF_GOODBYE = -1000172,
- SAY_SHAYA_THANKS = -1000173,
- SAY_SHAYA_GOODBYE = -1000174, //signed for 21469
+ // used by 12429, 12423, 12427, 12430, 12428, but signed for 12429
+ SAY_THANKS = 0,
+ SAY_GOODBYE = 1,
+ SAY_HEALED = 2,
};
class npc_garments_of_quests : public CreatureScript
@@ -906,7 +913,10 @@ public:
struct npc_garments_of_questsAI : public npc_escortAI
{
- npc_garments_of_questsAI(Creature* creature) : npc_escortAI(creature) {Reset();}
+ npc_garments_of_questsAI(Creature* creature) : npc_escortAI(creature)
+ {
+ Reset();
+ }
uint64 CasterGUID;
@@ -925,15 +935,15 @@ public:
RunAwayTimer = 5000;
me->SetStandState(UNIT_STAND_STATE_KNEEL);
- //expect database to have RegenHealth=0
+ // expect database to have RegenHealth=0
me->SetHealth(me->CountPctFromMaxHealth(70));
}
- void EnterCombat(Unit* /*who*/) {}
+ void EnterCombat(Unit* /*who*/) { }
- void SpellHit(Unit* caster, SpellInfo const* Spell)
+ void SpellHit(Unit* caster, SpellInfo const* spell)
{
- if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1)
+ if (spell->Id == SPELL_LESSER_HEAL_R2 || spell->Id == SPELL_FORTITUDE_R1)
{
//not while in combat
if (me->isInCombat())
@@ -950,16 +960,16 @@ public:
case ENTRY_SHAYA:
if (player->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE)
{
- if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_SHAYA_THANKS, me, caster);
+ Talk(SAY_THANKS, caster->GetGUID());
CanRun = true;
}
- else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && spell->Id == SPELL_LESSER_HEAL_R2)
{
CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, caster);
+ Talk(SAY_HEALED, caster->GetGUID());
IsHealed = true;
}
}
@@ -967,16 +977,16 @@ public:
case ENTRY_ROBERTS:
if (player->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE)
{
- if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_ROBERTS_THANKS, me, caster);
+ Talk(SAY_THANKS, caster->GetGUID());
CanRun = true;
}
- else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && spell->Id == SPELL_LESSER_HEAL_R2)
{
CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, caster);
+ Talk(SAY_HEALED, caster->GetGUID());
IsHealed = true;
}
}
@@ -984,16 +994,16 @@ public:
case ENTRY_DOLF:
if (player->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE)
{
- if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_DOLF_THANKS, me, caster);
+ Talk(SAY_THANKS, caster->GetGUID());
CanRun = true;
}
- else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && spell->Id == SPELL_LESSER_HEAL_R2)
{
CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, caster);
+ Talk(SAY_HEALED, caster->GetGUID());
IsHealed = true;
}
}
@@ -1001,16 +1011,16 @@ public:
case ENTRY_KORJA:
if (player->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE)
{
- if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_KORJA_THANKS, me, caster);
+ Talk(SAY_THANKS, caster->GetGUID());
CanRun = true;
}
- else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && spell->Id == SPELL_LESSER_HEAL_R2)
{
CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, caster);
+ Talk(SAY_HEALED, caster->GetGUID());
IsHealed = true;
}
}
@@ -1018,23 +1028,23 @@ public:
case ENTRY_DG_KEL:
if (player->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE)
{
- if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1)
+ if (IsHealed && !CanRun && spell->Id == SPELL_FORTITUDE_R1)
{
- DoScriptText(SAY_DG_KEL_THANKS, me, caster);
+ Talk(SAY_THANKS, caster->GetGUID());
CanRun = true;
}
- else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2)
+ else if (!IsHealed && spell->Id == SPELL_LESSER_HEAL_R2)
{
CasterGUID = caster->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
- DoScriptText(SAY_COMMON_HEALED, me, caster);
+ Talk(SAY_HEALED, caster->GetGUID());
IsHealed = true;
}
}
break;
}
- //give quest credit, not expect any special quest objectives
+ // give quest credit, not expect any special quest objectives
if (CanRun)
player->TalkedToCreature(me->GetEntry(), me->GetGUID());
}
@@ -1057,19 +1067,19 @@ public:
switch (me->GetEntry())
{
case ENTRY_SHAYA:
- DoScriptText(SAY_SHAYA_GOODBYE, me, unit);
+ Talk(SAY_GOODBYE, unit->GetGUID());
break;
case ENTRY_ROBERTS:
- DoScriptText(SAY_ROBERTS_GOODBYE, me, unit);
+ Talk(SAY_GOODBYE, unit->GetGUID());
break;
case ENTRY_DOLF:
- DoScriptText(SAY_DOLF_GOODBYE, me, unit);
+ Talk(SAY_GOODBYE, unit->GetGUID());
break;
case ENTRY_KORJA:
- DoScriptText(SAY_KORJA_GOODBYE, me, unit);
+ Talk(SAY_GOODBYE, unit->GetGUID());
break;
case ENTRY_DG_KEL:
- DoScriptText(SAY_DG_KEL_GOODBYE, me, unit);
+ Talk(SAY_GOODBYE, unit->GetGUID());
break;
}
@@ -1258,7 +1268,7 @@ public:
if (player->GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(player) && player->getLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE3, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_LEARNDUALSPEC);
- if (player->getClass() == CLASS_ROGUE && player->getLevel() >= 24 && !player->HasItemCount(17126, 1) && !player->GetQuestRewardStatus(6681))
+ if (player->getClass() == CLASS_ROGUE && player->getLevel() >= 24 && !player->HasItemCount(17126) && !player->GetQuestRewardStatus(6681))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(5996, creature->GetGUID());
@@ -1944,8 +1954,8 @@ public:
me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING);
me->SetSpeed(MOVE_FLIGHT, 0.75f, true);
me->SetSpeed(MOVE_RUN, 0.75f, true);
- float x = me->GetPositionX() + 20 * cos(me->GetOrientation());
- float y = me->GetPositionY() + 20 * sin(me->GetOrientation());
+ float x = me->GetPositionX() + 20 * std::cos(me->GetOrientation());
+ float y = me->GetPositionY() + 20 * std::sin(me->GetOrientation());
float z = me->GetPositionZ() + 40;
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MovePoint(0, x, y, z);
@@ -2105,14 +2115,12 @@ class npc_shadowfiend : public CreatureScript
{
npc_shadowfiendAI(Creature* creature) : PetAI(creature) {}
- void JustDied(Unit* killer)
+ void JustDied(Unit* /*killer*/)
{
if (me->isSummon())
if (Unit* owner = me->ToTempSummon()->GetSummoner())
if (owner->HasAura(GLYPH_OF_SHADOWFIEND))
owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true);
-
- PetAI::JustDied(killer);
}
};
@@ -2276,7 +2284,7 @@ class npc_wormhole : public CreatureScript
_showUnderground = urand(0, 100) == 0; // Guessed value, it is really rare though
}
- uint32 GetData(uint32 type)
+ uint32 GetData(uint32 type) const
{
return (type == DATA_SHOW_UNDERGROUND && _showUnderground) ? 1 : 0;
}
@@ -2942,7 +2950,7 @@ public:
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
- void EnterCombat(Unit * /*who*/) { }
+ void EnterCombat(Unit* /*who*/) { }
void DoAction(const int32 /*param*/)
{
diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h
index 988c46cc5a2..9afa05325c9 100644
--- a/src/server/shared/AutoPtr.h
+++ b/src/server/shared/AutoPtr.h
@@ -22,32 +22,32 @@
namespace Trinity
{
- template <class Pointer, class Lock>
- class AutoPtr : public ACE_Strong_Bound_Ptr<Pointer, Lock>
+
+template <class Pointer, class Lock>
+class AutoPtr : public ACE_Strong_Bound_Ptr<Pointer, Lock>
+{
+ typedef ACE_Strong_Bound_Ptr<Pointer, Lock> Base;
+
+public:
+ AutoPtr()
+ : Base()
+ { }
+
+ AutoPtr(Pointer* x)
+ : Base(x)
+ { }
+
+ operator bool() const
+ {
+ return !Base::null();
+ }
+
+ bool operator !() const
{
- public:
- AutoPtr() : ACE_Strong_Bound_Ptr<Pointer, Lock>() {}
-
- AutoPtr(Pointer* x)
- {
- ACE_Strong_Bound_Ptr<Pointer, Lock>::reset(x);
- }
-
- operator bool() const
- {
- return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() != NULL;
- }
-
- bool operator !() const
- {
- return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() == NULL;
- }
-
- bool operator !=(Pointer* x) const
- {
- return ACE_Strong_Bound_Ptr<Pointer, Lock>::get() != x;
- }
- };
+ return Base::null();
+ }
};
-#endif \ No newline at end of file
+} // namespace Trinity
+
+#endif
diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt
index de998442419..e9f414d34e5 100644
--- a/src/server/shared/CMakeLists.txt
+++ b/src/server/shared/CMakeLists.txt
@@ -28,11 +28,9 @@ file(GLOB sources_localdir *.cpp *.h)
# Build shared sourcelist
#
-if( USE_COREPCH AND MSVC )
- set(shared_STAT_SRCS
- PrecompiledHeaders/sharedPCH.cpp
- PrecompiledHeaders/sharedPCH.h
- )
+if (USE_COREPCH)
+ set(shared_STAT_PCH_HDR PrecompiledHeaders/sharedPCH.h)
+ set(shared_STAT_PCH_SRC PrecompiledHeaders/sharedPCH.cpp)
endif()
set(shared_STAT_SRCS
@@ -73,18 +71,16 @@ include_directories(
${OPENSSL_INCLUDE_DIR}
)
-add_library(shared STATIC ${shared_STAT_SRCS})
+add_library(shared STATIC
+ ${shared_STAT_SRCS}
+ ${shared_STAT_PCH_SRC}
+)
target_link_libraries(shared
${ACE_LIBRARY}
)
# Generate precompiled header
-if( USE_COREPCH )
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_precompiled_header(shared ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/sharedPCH.h)
- elseif(MSVC)
- add_native_precompiled_header(shared ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/sharedPCH)
- endif()
-endif()
-
+if (USE_COREPCH)
+ add_cxx_pch(shared ${shared_STAT_PCH_HDR} ${shared_STAT_PCH_SRC})
+endif ()
diff --git a/src/server/shared/Common.cpp b/src/server/shared/Common.cpp
index 88e7d5a76fc..88e7d5a76fc 100755..100644
--- a/src/server/shared/Common.cpp
+++ b/src/server/shared/Common.cpp
diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h
index 259c60ade20..ad0e6dd6437 100755..100644
--- a/src/server/shared/Common.h
+++ b/src/server/shared/Common.h
@@ -130,14 +130,6 @@
#endif
-#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER
-#define UI64LIT(N) ACE_UINT64_LITERAL(N)
-
-#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER
-#define SI64LIT(N) ACE_INT64_LITERAL(N)
-
-#define SIZEFMTD ACE_SIZE_T_FORMAT_SPECIFIER
-
inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; }
#define atol(a) strtoul( a, NULL, 10)
diff --git a/src/server/shared/CompilerDefs.h b/src/server/shared/CompilerDefs.h
index f7e3d0b4979..b8be66d928f 100755..100644
--- a/src/server/shared/CompilerDefs.h
+++ b/src/server/shared/CompilerDefs.h
@@ -50,12 +50,20 @@
# define COMPILER COMPILER_INTEL
#elif defined( __GNUC__ )
# define COMPILER COMPILER_GNU
+# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#else
-# pragma error "FATAL ERROR: Unknown compiler."
+# error "FATAL ERROR: Unknown compiler."
#endif
#if COMPILER == COMPILER_MICROSOFT
# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data
# pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
#endif
+
+#if defined(__cplusplus) && __cplusplus == 201103L
+# define COMPILER_HAS_CPP11_SUPPORT 1
+#else
+# define COMPILER_HAS_CPP11_SUPPORT 0
+#endif
+
#endif
diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp
index b82d86cc5d0..e0df22b88ae 100755..100644
--- a/src/server/shared/Configuration/Config.cpp
+++ b/src/server/shared/Configuration/Config.cpp
@@ -80,7 +80,7 @@ std::string GetStringDefault(const char* name, const std::string &def)
{
ACE_TString val;
return GetValueHelper(name, val) ? val.c_str() : def;
-};
+}
bool GetBoolDefault(const char* name, bool def)
{
@@ -91,19 +91,19 @@ bool GetBoolDefault(const char* name, bool def)
return (val == "true" || val == "TRUE" || val == "yes" || val == "YES" ||
val == "1");
-};
+}
int GetIntDefault(const char* name, int def)
{
ACE_TString val;
return GetValueHelper(name, val) ? atoi(val.c_str()) : def;
-};
+}
float GetFloatDefault(const char* name, float def)
{
ACE_TString val;
return GetValueHelper(name, val) ? (float)atof(val.c_str()) : def;
-};
+}
const std::string & GetFilename()
{
diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h
index a870379881b..82e4d9bcce0 100755..100644
--- a/src/server/shared/Configuration/Config.h
+++ b/src/server/shared/Configuration/Config.h
@@ -34,4 +34,3 @@ namespace ConfigMgr
}
#endif
-
diff --git a/src/server/shared/Containers.h b/src/server/shared/Containers.h
index f0242cbff0e..0a1b6738f1a 100644
--- a/src/server/shared/Containers.h
+++ b/src/server/shared/Containers.h
@@ -63,9 +63,9 @@ namespace Trinity
std::advance(it, urand(0, container.size() - 1));
return *it;
}
- };
+ }
//! namespace Containers
-};
+}
//! namespace Trinity
-#endif //! #ifdef TRINITY_CONTAINERS_H \ No newline at end of file
+#endif //! #ifdef TRINITY_CONTAINERS_H
diff --git a/src/server/shared/Cryptography/ARC4.cpp b/src/server/shared/Cryptography/ARC4.cpp
index 5b2cf7a0a93..5b2cf7a0a93 100755..100644
--- a/src/server/shared/Cryptography/ARC4.cpp
+++ b/src/server/shared/Cryptography/ARC4.cpp
diff --git a/src/server/shared/Cryptography/ARC4.h b/src/server/shared/Cryptography/ARC4.h
index 541135e52f2..541135e52f2 100755..100644
--- a/src/server/shared/Cryptography/ARC4.h
+++ b/src/server/shared/Cryptography/ARC4.h
diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp
index 5b4ffabd4f6..5b4ffabd4f6 100755..100644
--- a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp
+++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp
diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.h b/src/server/shared/Cryptography/Authentication/AuthCrypt.h
index 7081b4973d4..b40ce8ac40c 100755..100644
--- a/src/server/shared/Cryptography/Authentication/AuthCrypt.h
+++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.h
@@ -41,4 +41,3 @@ class AuthCrypt
bool _initialized;
};
#endif
-
diff --git a/src/server/shared/Cryptography/BigNumber.cpp b/src/server/shared/Cryptography/BigNumber.cpp
index 364ee76ec75..def0a7fd02e 100755..100644
--- a/src/server/shared/Cryptography/BigNumber.cpp
+++ b/src/server/shared/Cryptography/BigNumber.cpp
@@ -75,7 +75,7 @@ void BigNumber::SetRand(int numbits)
BN_rand(_bn, numbits, 0, 1);
}
-BigNumber BigNumber::operator=(const BigNumber &bn)
+BigNumber& BigNumber::operator=(const BigNumber &bn)
{
if (this == &bn)
return *this;
@@ -164,7 +164,7 @@ uint32 BigNumber::AsDword()
bool BigNumber::isZero() const
{
- return BN_is_zero(_bn)!=0;
+ return BN_is_zero(_bn);
}
uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
@@ -192,12 +192,12 @@ uint8 *BigNumber::AsByteArray(int minSize, bool reverse)
return _array;
}
-const char *BigNumber::AsHexStr()
+char * BigNumber::AsHexStr() const
{
return BN_bn2hex(_bn);
}
-const char *BigNumber::AsDecStr()
+char * BigNumber::AsDecStr() const
{
return BN_bn2dec(_bn);
}
diff --git a/src/server/shared/Cryptography/BigNumber.h b/src/server/shared/Cryptography/BigNumber.h
index 6646245a6a0..36a618056a5 100755..100644
--- a/src/server/shared/Cryptography/BigNumber.h
+++ b/src/server/shared/Cryptography/BigNumber.h
@@ -39,7 +39,7 @@ class BigNumber
void SetRand(int numbits);
- BigNumber operator=(const BigNumber &bn);
+ BigNumber& operator=(const BigNumber &bn);
BigNumber operator+=(const BigNumber &bn);
BigNumber operator+(const BigNumber &bn)
@@ -84,8 +84,8 @@ class BigNumber
uint32 AsDword();
uint8* AsByteArray(int minSize = 0, bool reverse = true);
- const char *AsHexStr();
- const char *AsDecStr();
+ char * AsHexStr() const;
+ char * AsDecStr() const;
private:
struct bignum_st *_bn;
diff --git a/src/server/shared/Cryptography/HMACSHA1.cpp b/src/server/shared/Cryptography/HMACSHA1.cpp
index c9de1191464..c9de1191464 100755..100644
--- a/src/server/shared/Cryptography/HMACSHA1.cpp
+++ b/src/server/shared/Cryptography/HMACSHA1.cpp
diff --git a/src/server/shared/Cryptography/HMACSHA1.h b/src/server/shared/Cryptography/HMACSHA1.h
index 4b7667968ca..4b7667968ca 100755..100644
--- a/src/server/shared/Cryptography/HMACSHA1.h
+++ b/src/server/shared/Cryptography/HMACSHA1.h
diff --git a/src/server/shared/Cryptography/SHA1.cpp b/src/server/shared/Cryptography/SHA1.cpp
index 2af8e4d4cbe..2af8e4d4cbe 100755..100644
--- a/src/server/shared/Cryptography/SHA1.cpp
+++ b/src/server/shared/Cryptography/SHA1.cpp
diff --git a/src/server/shared/Cryptography/SHA1.h b/src/server/shared/Cryptography/SHA1.h
index 7c77defebfa..7c77defebfa 100755..100644
--- a/src/server/shared/Cryptography/SHA1.h
+++ b/src/server/shared/Cryptography/SHA1.h
diff --git a/src/server/shared/DataStores/DBCFileLoader.cpp b/src/server/shared/DataStores/DBCFileLoader.cpp
index f909c8566bb..6f78ce5a02d 100755..100644
--- a/src/server/shared/DataStores/DBCFileLoader.cpp
+++ b/src/server/shared/DataStores/DBCFileLoader.cpp
@@ -23,10 +23,8 @@
#include "DBCFileLoader.h"
#include "Errors.h"
-DBCFileLoader::DBCFileLoader()
+DBCFileLoader::DBCFileLoader() : fieldsOffset(NULL), data(NULL), stringTable(NULL)
{
- data = NULL;
- fieldsOffset = NULL;
}
bool DBCFileLoader::Load(const char* filename, const char* fmt)
diff --git a/src/server/shared/DataStores/DBCFileLoader.h b/src/server/shared/DataStores/DBCFileLoader.h
index a43807a3b59..eb8317fbefd 100755..100644
--- a/src/server/shared/DataStores/DBCFileLoader.h
+++ b/src/server/shared/DataStores/DBCFileLoader.h
@@ -32,8 +32,8 @@ enum
FT_BYTE='b', //uint8
FT_SORT='d', //sorted by this field, field is not included
FT_IND='n', //the same, but parsed to data
- FT_LOGIC='l', //Logical (boolean)
- FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
+ FT_LOGIC='l', //Logical (boolean)
+ FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
};
diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h
index c5b8b6f5a21..e872ead35db 100755..100644
--- a/src/server/shared/DataStores/DBCStore.h
+++ b/src/server/shared/DataStores/DBCStore.h
@@ -117,7 +117,7 @@ class DBCStorage
// Check if sql index pos is valid
if (int32(result->GetFieldCount()-1) < sql->sqlIndexPos)
{
- sLog->outError("Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Invalid index pos for dbc:'%s'", sql->sqlTableName.c_str());
return false;
}
}
@@ -148,7 +148,7 @@ class DBCStorage
uint32 id = fields[sql->sqlIndexPos].GetUInt32();
if (indexTable.asT[id])
{
- sLog->outError("Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Index %d already exists in dbc:'%s'", id, sql->sqlTableName.c_str());
return false;
}
indexTable.asT[id]=(T*)&sqlDataTable[offset];
@@ -203,7 +203,7 @@ class DBCStorage
offset+=1;
break;
case FT_STRING:
- sLog->outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
return false;
case FT_SORT:
break;
@@ -215,13 +215,13 @@ class DBCStorage
}
else
{
- sLog->outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber);
return false;
}
}
if (sqlColumnNumber != (result->GetFieldCount()-1))
{
- sLog->outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str());
return false;
}
diff --git a/src/server/shared/Database/AdhocStatement.cpp b/src/server/shared/Database/AdhocStatement.cpp
index 9e795ae853a..95dce77e53c 100755..100644
--- a/src/server/shared/Database/AdhocStatement.cpp
+++ b/src/server/shared/Database/AdhocStatement.cpp
@@ -44,6 +44,7 @@ bool BasicStatementTask::Execute()
ResultSet* result = m_conn->Query(m_sql);
if (!result || !result->GetRowCount())
{
+ delete result;
m_result.set(QueryResult(NULL));
return false;
}
diff --git a/src/server/shared/Database/AdhocStatement.h b/src/server/shared/Database/AdhocStatement.h
index e17a85e7466..e17a85e7466 100755..100644
--- a/src/server/shared/Database/AdhocStatement.h
+++ b/src/server/shared/Database/AdhocStatement.h
diff --git a/src/server/shared/Database/DatabaseEnv.h b/src/server/shared/Database/DatabaseEnv.h
index 13b900d8392..13b900d8392 100755..100644
--- a/src/server/shared/Database/DatabaseEnv.h
+++ b/src/server/shared/Database/DatabaseEnv.h
diff --git a/src/server/shared/Database/DatabaseWorker.h b/src/server/shared/Database/DatabaseWorker.h
index c01a9c1bc3c..c01a9c1bc3c 100755..100644
--- a/src/server/shared/Database/DatabaseWorker.h
+++ b/src/server/shared/Database/DatabaseWorker.h
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index 314d196cc06..a0816686734 100755..100644
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -64,7 +64,7 @@ class DatabaseWorkerPool
bool res = true;
_connectionInfo = MySQLConnectionInfo(infoString);
- sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
GetDatabaseName(), async_threads, synch_threads);
//! Open asynchronous connections (delayed operations)
@@ -88,17 +88,17 @@ class DatabaseWorkerPool
}
if (res)
- sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(),
(_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
else
- sLog->outError("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
+ sLog->outError(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile "
"for specific errors.", GetDatabaseName());
return res;
}
void Close()
{
- sLog->outSQLDriver("Closing down DatabasePool '%s'.", GetDatabaseName());
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName());
//! Shuts down delaythreads for this connection pool by underlying deactivate().
//! The next dequeue attempt in the worker thread tasks will result in an error,
@@ -114,7 +114,7 @@ class DatabaseWorkerPool
t->Close(); //! Closes the actualy MySQL connection.
}
- sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
GetDatabaseName());
//! Shut down the synchronous connections
@@ -127,7 +127,7 @@ class DatabaseWorkerPool
//! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue
delete _queue;
- sLog->outSQLDriver("All connections on DatabasePool '%s' closed.", GetDatabaseName());
+ sLog->outInfo(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName());
}
/**
@@ -224,7 +224,10 @@ class DatabaseWorkerPool
ResultSet* result = conn->Query(sql);
conn->Unlock();
if (!result || !result->GetRowCount())
+ {
+ delete result;
return QueryResult(NULL);
+ }
result->NextRow();
return QueryResult(result);
@@ -275,7 +278,10 @@ class DatabaseWorkerPool
delete stmt;
if (!ret || !ret->GetRowCount())
+ {
+ delete ret;
return PreparedQueryResult(NULL);
+ }
return PreparedQueryResult(ret);
}
@@ -351,10 +357,10 @@ class DatabaseWorkerPool
switch (transaction->GetSize())
{
case 0:
- sLog->outSQLDriver("Transaction contains 0 queries. Not executing.");
+ sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing.");
return;
case 1:
- sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
+ sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
break;
default:
break;
@@ -501,7 +507,7 @@ class DatabaseWorkerPool
{
IDX_ASYNC,
IDX_SYNCH,
- IDX_SIZE,
+ IDX_SIZE
};
ACE_Activation_Queue* _queue; //! Queue shared by async worker threads.
diff --git a/src/server/shared/Database/Field.cpp b/src/server/shared/Database/Field.cpp
index 3ea153bdc0c..3ea153bdc0c 100755..100644
--- a/src/server/shared/Database/Field.cpp
+++ b/src/server/shared/Database/Field.cpp
diff --git a/src/server/shared/Database/Field.h b/src/server/shared/Database/Field.h
index bfa42dbe574..61e8fb7ccef 100755..100644
--- a/src/server/shared/Database/Field.h
+++ b/src/server/shared/Database/Field.h
@@ -43,7 +43,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
- sLog->outSQLDriver("Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -61,7 +61,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
- sLog->outSQLDriver("Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -79,7 +79,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
- sLog->outSQLDriver("Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -97,7 +97,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
- sLog->outSQLDriver("Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -115,7 +115,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
- sLog->outSQLDriver("Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -133,7 +133,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
- sLog->outSQLDriver("Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -151,7 +151,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
- sLog->outSQLDriver("Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -169,7 +169,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
- sLog->outSQLDriver("Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@@ -187,7 +187,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_FLOAT))
{
- sLog->outSQLDriver("Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
return 0.0f;
}
#endif
@@ -205,7 +205,7 @@ class Field
#ifdef TRINITY_DEBUG
if (!IsType(MYSQL_TYPE_DOUBLE))
{
- sLog->outSQLDriver("Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
return 0.0f;
}
#endif
@@ -223,7 +223,7 @@ class Field
#ifdef TRINITY_DEBUG
if (IsNumeric())
{
- sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
+ sLog->outWarn(LOG_FILTER_SQL, "Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
return NULL;
}
#endif
@@ -322,7 +322,7 @@ class Field
MYSQL_TYPE_SET:
*/
default:
- sLog->outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type));
+ sLog->outWarn(LOG_FILTER_SQL, "SQL::SizeForType(): invalid field type %u", uint32(field->type));
return 0;
}
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 3bb6783f8cf..33f0cab5170 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -49,14 +49,16 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHAR_RACE, "SELECT race FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_LEVEL, "SELECT level FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH);
- PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender FROM characters WHERE guid = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender, level FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_DAILY, "DELETE FROM character_queststatus_daily", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_WEEKLY, "DELETE FROM character_queststatus_weekly", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_MONTHLY, "DELETE FROM character_queststatus_monthly", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_SEASONAL, "DELETE FROM character_queststatus_seasonal WHERE event = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_DAILY_CHAR, "DELETE FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR, "DELETE FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR, "DELETE FROM character_queststatus_monthly WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR, "DELETE FROM character_queststatus_seasonal WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_BATTLEGROUND_RANDOM, "DELETE FROM character_battleground_random", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_INS_BATTLEGROUND_RANDOM, "INSERT INTO character_battleground_random (guid) VALUES (?)", CONNECTION_ASYNC);
@@ -76,9 +78,11 @@ void CharacterDatabaseConnection::DoPrepareStatements()
"itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ? AND status <> 0", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_DAILYQUESTSTATUS, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_SEL_CHARACTER_MONTHLYQUESTSTATUS, "SELECT quest FROM character_queststatus_monthly WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS, "SELECT quest, event FROM character_queststatus_seasonal WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_INS_CHARACTER_DAILYQUESTSTATUS, "INSERT INTO character_queststatus_daily (guid, quest, time) VALUES (?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS, "INSERT INTO character_queststatus_weekly (guid, quest) VALUES (?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS, "INSERT INTO character_queststatus_monthly (guid, quest) VALUES (?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS, "INSERT INTO character_queststatus_seasonal (guid, quest, event) VALUES (?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_REPUTATION, "SELECT faction, standing, flags FROM character_reputation WHERE guid = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_INVENTORY, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, bag, slot, "
@@ -109,7 +113,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? ORDER BY button", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_MAILITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, item_guid, itemEntry, owner_guid FROM mail_items mi JOIN item_instance ii ON mi.item_guid = ii.guid WHERE mail_id = ?", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_AUCTION_ITEMS, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, itemguid, itemEntry FROM auctionhouse ah JOIN item_instance ii ON ah.itemguid = ii.guid", CONNECTION_SYNCH)
- PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_SEL_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_INS_AUCTION, "INSERT INTO auctionhouse (id, auctioneerguid, itemguid, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_AUCTION, "DELETE FROM auctionhouse WHERE id = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_AUCTION_BY_TIME, "SELECT id FROM auctionhouse WHERE time <= ? ORDER BY TIME ASC", CONNECTION_SYNCH);
@@ -140,7 +144,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_GIFT_BY_ITEM, "SELECT entry, flags FROM character_gifts WHERE item_guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_BY_NAME, "SELECT account FROM characters WHERE name = ?", CONNECTION_SYNCH)
PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_BY_GUID, "SELECT account FROM characters WHERE guid = ?", CONNECTION_SYNCH);
- PREPARE_STATEMENT(CHAR_SEL_ACCOUNT_NAME_BY_GUID, "SELECT account, name FROM characters WHERE guid = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_SEL_CHARACTER_DATA_BY_GUID, "SELECT account, name, level FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_DEL_ACCOUNT_INSTANCE_LOCK_TIMES, "DELETE FROM account_instance_times WHERE accountId = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_INS_ACCOUNT_INSTANCE_LOCK_TIMES, "INSERT INTO account_instance_times (accountId, instanceId, releaseTime) VALUES (?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_NAME_CLASS, "SELECT name, class FROM characters WHERE guid = ?", CONNECTION_SYNCH);
@@ -169,10 +173,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_INS_GUILD_BANK_ITEM, "INSERT INTO guild_bank_item (guildid, TabId, SlotId, item_guid) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_GUILD_BANK_ITEM, "DELETE FROM guild_bank_item WHERE guildid = ? AND TabId = ? AND SlotId = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint8, 2: uint8
PREPARE_STATEMENT(CHAR_DEL_GUILD_BANK_ITEMS, "DELETE FROM guild_bank_item WHERE guildid = ?", CONNECTION_ASYNC) // 0: uint32
- PREPARE_STATEMENT(CHAR_INS_GUILD_BANK_RIGHT_DEFAULT, "INSERT INTO guild_bank_right (guildid, TabId, rid) VALUES (?, ?, ?)", CONNECTION_ASYNC) // 0: uint32, 1: uint8, 2: uint8
// 0: uint32, 1: uint8, 2: uint8, 3: uint8, 4: uint32
- PREPARE_STATEMENT(CHAR_INS_GUILD_BANK_RIGHT, "INSERT INTO guild_bank_right (guildid, TabId, rid, gbright, SlotPerDay) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_DEL_GUILD_BANK_RIGHT, "DELETE FROM guild_bank_right WHERE guildid = ? AND TabId = ? AND rid = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint8, 2: uint8
+ PREPARE_STATEMENT(CHAR_INS_GUILD_BANK_RIGHT, "INSERT INTO guild_bank_right (guildid, TabId, rid, gbright, SlotPerDay) VALUES (?, ?, ?, ?, ?) "
+ "ON DUPLICATE KEY UPDATE gbright = VALUES(gbright), SlotPerDay = VALUES(SlotPerDay)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_GUILD_BANK_RIGHTS, "DELETE FROM guild_bank_right WHERE guildid = ?", CONNECTION_ASYNC) // 0: uint32
PREPARE_STATEMENT(CHAR_DEL_GUILD_BANK_RIGHTS_FOR_RANK, "DELETE FROM guild_bank_right WHERE guildid = ? AND rid = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint8
// 0-1: uint32, 2-3: uint8, 4-5: uint32, 6: uint16, 7: uint8, 8: uint64
@@ -198,32 +201,15 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_UPD_GUILD_BANK_MONEY, "UPDATE guild SET BankMoney = ? WHERE guildid = ?", CONNECTION_ASYNC) // 0: uint64, 1: uint32
// 0: uint8, 1: uint32, 2: uint8, 3: uint32
PREPARE_STATEMENT(CHAR_UPD_GUILD_BANK_EVENTLOG_TAB, "UPDATE guild_bank_eventlog SET TabId = ? WHERE guildid = ? AND TabId = ? AND LogGuid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_MONEY, "UPDATE guild_member SET BankRemMoney = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint32, 2: uint32
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_MONEY, "UPDATE guild_member SET BankResetTimeMoney = ?, BankRemMoney = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint32, 2: uint32, 3: uint32
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_RESET_TIME, "UPDATE guild_member SET BankResetTimeMoney = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint8
PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_MONEY, "UPDATE guild_rank SET BankMoneyPerDay = ? WHERE rid = ? AND guildid = ?", CONNECTION_ASYNC) // 0: uint32, 1: uint8, 2: uint32
PREPARE_STATEMENT(CHAR_UPD_GUILD_BANK_TAB_TEXT, "UPDATE guild_bank_tab SET TabText = ? WHERE guildid = ? AND TabId = ?", CONNECTION_ASYNC) // 0: string, 1: uint32, 2: uint8
+
+ PREPARE_STATEMENT(CHAR_INS_GUILD_MEMBER_WITHDRAW,
+ "INSERT INTO guild_member_withdraw (guid, tab0, tab1, tab2, tab3, tab4, tab5, money) VALUES (?, ?, ?, ?, ?, ?, ?, ?) "
+ "ON DUPLICATE KEY UPDATE tab0 = VALUES (tab0), tab1 = VALUES (tab1), tab2 = VALUES (tab2), tab3 = VALUES (tab3), tab4 = VALUES (tab4), tab5 = VALUES (tab5)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_DEL_GUILD_MEMBER_WITHDRAW, "TRUNCATE guild_member_withdraw", CONNECTION_ASYNC)
+
// 0: uint32, 1: uint32, 2: uint32
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS0, "UPDATE guild_member SET BankRemSlotsTab0 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS1, "UPDATE guild_member SET BankRemSlotsTab1 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS2, "UPDATE guild_member SET BankRemSlotsTab2 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS3, "UPDATE guild_member SET BankRemSlotsTab3 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS4, "UPDATE guild_member SET BankRemSlotsTab4 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS5, "UPDATE guild_member SET BankRemSlotsTab5 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- // 0: uint32, 1: uint32, 2: uint32, 3: uint32
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS0, "UPDATE guild_member SET BankResetTimeTab0 = ?, BankRemSlotsTab0 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS1, "UPDATE guild_member SET BankResetTimeTab1 = ?, BankRemSlotsTab1 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS2, "UPDATE guild_member SET BankResetTimeTab2 = ?, BankRemSlotsTab2 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS3, "UPDATE guild_member SET BankResetTimeTab3 = ?, BankRemSlotsTab3 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS4, "UPDATE guild_member SET BankResetTimeTab4 = ?, BankRemSlotsTab4 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS5, "UPDATE guild_member SET BankResetTimeTab5 = ?, BankRemSlotsTab5 = ? WHERE guildid = ? AND guid = ?", CONNECTION_ASYNC)
- // 0: uint32, 1: uint8
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_TIME0, "UPDATE guild_member SET BankResetTimeTab0 = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_TIME1, "UPDATE guild_member SET BankResetTimeTab1 = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_TIME2, "UPDATE guild_member SET BankResetTimeTab2 = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_TIME3, "UPDATE guild_member SET BankResetTimeTab3 = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_TIME4, "UPDATE guild_member SET BankResetTimeTab4 = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC)
- PREPARE_STATEMENT(CHAR_UPD_GUILD_RANK_BANK_TIME5, "UPDATE guild_member SET BankResetTimeTab5 = 0 WHERE guildid = ? AND rank = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_SEL_CHAR_DATA_FOR_GUILD, "SELECT name, level, class, zone, account FROM characters WHERE guid = ?", CONNECTION_SYNCH)
// Chat channel handling
@@ -327,8 +313,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_DEL_GO_RESPAWN_BY_INSTANCE, "DELETE FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC)
// GM Tickets
- PREPARE_STATEMENT(CHAR_SEL_GM_TICKETS, "SELECT ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed FROM gm_tickets", CONNECTION_SYNCH)
- PREPARE_STATEMENT(CHAR_REP_GM_TICKET, "REPLACE INTO gm_tickets (ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, completed, escalated, viewed) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
+ PREPARE_STATEMENT(CHAR_SEL_GM_TICKETS, "SELECT ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket FROM gm_tickets", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_REP_GM_TICKET, "REPLACE INTO gm_tickets (ticketId, guid, name, message, createTime, mapId, posX, posY, posZ, lastModifiedTime, closedBy, assignedTo, comment, response, completed, escalated, viewed, haveTicket) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_GM_TICKET, "DELETE FROM gm_tickets WHERE ticketId = ?", CONNECTION_ASYNC)
PREPARE_STATEMENT(CHAR_DEL_PLAYER_GM_TICKETS, "DELETE FROM gm_tickets WHERE guid = ?", CONNECTION_ASYNC)
@@ -338,7 +324,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_INS_LAG_REPORT, "INSERT INTO lag_reports (guid, lagType, mapId, posX, posY, posZ, latency, createTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC)
// For loading and deleting expired auctions at startup
- PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH)
+ PREPARE_STATEMENT(CHAR_SEL_EXPIRED_AUCTIONS, "SELECT id, auctioneerguid, itemguid, itemEntry, count, itemowner, buyoutprice, time, buyguid, lastbid, startbid, deposit FROM auctionhouse ah INNER JOIN item_instance ii ON ii.guid = ah.itemguid WHERE ah.time <= ?", CONNECTION_SYNCH)
// LFG Data
PREPARE_STATEMENT(CHAR_INS_LFG_DATA, "INSERT INTO lfg_data (guid, dungeon, state) VALUES (?, ?, ?)", CONNECTION_ASYNC)
@@ -420,7 +406,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_SEL_CHAR_GUID_NAME_BY_ACC, "SELECT guid, name FROM characters WHERE account = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_POOL_QUEST_SAVE, "SELECT quest_id FROM pool_quest_save WHERE pool_id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHARACTER_AT_LOGIN, "SELECT at_login FROM characters WHERE guid = ?", CONNECTION_SYNCH);
- PREPARE_STATEMENT(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN, "SELECT class, level, at_login FROM characters WHERE guid = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN, "SELECT class, level, at_login, knownTitles FROM characters WHERE guid = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(CHAR_SEL_CHAR_AT_LOGIN_TITLES, "SELECT at_login, knownTitles FROM characters WHERE guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_INSTANCE, "SELECT data, completedEncounters FROM instance WHERE map = ? AND id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_PET_SPELL_LIST, "SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet WHERE character_pet.owner = ? AND character_pet.id = pet_spell.guid AND character_pet.id <> ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_SEL_CHAR_PET, "SELECT id FROM character_pet WHERE owner = ? AND id <> ?", CONNECTION_SYNCH);
@@ -497,8 +484,11 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE, "UPDATE item_instance ii, character_inventory ci SET ii.itemEntry = ? WHERE ii.itemEntry = ? AND ci.guid = ? AND ci.item = ii.guid", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL_BY_SPELL, "DELETE FROM character_spell WHERE spell = ? AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE, "UPDATE character_spell SET spell = ? where spell = ? AND guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_SEL_CHAR_REP_BY_FACTION, "SELECT standing FROM character_reputation WHERE faction = ? AND guid = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(CHAR_DEL_CHAR_REP_BY_FACTION, "DELETE FROM character_reputation WHERE faction = ? AND guid = ?", CONNECTION_ASYNC);
- PREPARE_STATEMENT(CHAR_UPD_CHAR_REP_FACTION_CHANGE, "UPDATE character_reputation SET faction = ? where faction = ? AND guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPD_CHAR_REP_FACTION_CHANGE, "UPDATE character_reputation SET faction = ?, standing = ? WHERE faction = ? AND guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE, "UPDATE characters SET knownTitles = ? WHERE guid = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_RES_CHAR_TITLES_FACTION_CHANGE, "UPDATE characters SET chosenTitle = 0 WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_SPELL_COOLDOWN, "DELETE FROM character_spell_cooldown WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHARACTER, "DELETE FROM characters WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_ACTION, "DELETE FROM character_action WHERE guid = ?", CONNECTION_ASYNC);
@@ -549,4 +539,10 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_INS_CHAR_TALENT, "INSERT INTO character_talent (guid, spell, spec) VALUES (?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, "DELETE FROM character_action WHERE spec<>? AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT, "SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, curhappiness, abdata, savetime, CreatedBySpell, PetType FROM character_pet WHERE owner = ? AND slot = ?", CONNECTION_SYNCH);
+
+ // Calendar
+ PREPARE_STATEMENT(CHAR_REP_CALENDAR_EVENT, "REPLACE INTO calendar_events (id, creator, title, description, type, dungeon, eventtime, flags, time2) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_CALENDAR_EVENT, "DELETE FROM calendar_events WHERE id = ?", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_REP_CALENDAR_INVITE, "REPLACE INTO calendar_invites (id, event, invitee, sender, status, statustime, rank, text) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(CHAR_DEL_CALENDAR_INVITE, "DELETE FROM calendar_invites WHERE id = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index e1530f36e44..181161978df 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -74,9 +74,11 @@ enum CharacterDatabaseStatements
CHAR_SEL_CHAR_POSITION,
CHAR_DEL_QUEST_STATUS_DAILY,
CHAR_DEL_QUEST_STATUS_WEEKLY,
+ CHAR_DEL_QUEST_STATUS_MONTHLY,
CHAR_DEL_QUEST_STATUS_SEASONAL,
CHAR_DEL_QUEST_STATUS_DAILY_CHAR,
CHAR_DEL_QUEST_STATUS_WEEKLY_CHAR,
+ CHAR_DEL_QUEST_STATUS_MONTHLY_CHAR,
CHAR_DEL_QUEST_STATUS_SEASONAL_CHAR,
CHAR_DEL_BATTLEGROUND_RANDOM,
CHAR_INS_BATTLEGROUND_RANDOM,
@@ -89,9 +91,11 @@ enum CharacterDatabaseStatements
CHAR_SEL_CHARACTER_QUESTSTATUS,
CHAR_SEL_CHARACTER_DAILYQUESTSTATUS,
CHAR_SEL_CHARACTER_WEEKLYQUESTSTATUS,
+ CHAR_SEL_CHARACTER_MONTHLYQUESTSTATUS,
CHAR_SEL_CHARACTER_SEASONALQUESTSTATUS,
CHAR_INS_CHARACTER_DAILYQUESTSTATUS,
CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS,
+ CHAR_INS_CHARACTER_MONTHLYQUESTSTATUS,
CHAR_INS_CHARACTER_SEASONALQUESTSTATUS,
CHAR_SEL_CHARACTER_REPUTATION,
CHAR_SEL_CHARACTER_INVENTORY,
@@ -157,7 +161,7 @@ enum CharacterDatabaseStatements
CHAR_SEL_CHARACTER_COUNT,
CHAR_UPD_NAME,
CHAR_DEL_DECLINED_NAME,
- CHAR_SEL_ACCOUNT_NAME_BY_GUID,
+ CHAR_SEL_CHARACTER_DATA_BY_GUID,
CHAR_INS_GUILD,
CHAR_DEL_GUILD,
@@ -173,9 +177,7 @@ enum CharacterDatabaseStatements
CHAR_INS_GUILD_BANK_ITEM,
CHAR_DEL_GUILD_BANK_ITEM,
CHAR_DEL_GUILD_BANK_ITEMS,
- CHAR_INS_GUILD_BANK_RIGHT_DEFAULT,
CHAR_INS_GUILD_BANK_RIGHT,
- CHAR_DEL_GUILD_BANK_RIGHT,
CHAR_DEL_GUILD_BANK_RIGHTS,
CHAR_DEL_GUILD_BANK_RIGHTS_FOR_RANK,
CHAR_INS_GUILD_BANK_EVENTLOG,
@@ -196,29 +198,10 @@ enum CharacterDatabaseStatements
CHAR_UPD_GUILD_BANK_TAB_INFO,
CHAR_UPD_GUILD_BANK_MONEY,
CHAR_UPD_GUILD_BANK_EVENTLOG_TAB,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_MONEY,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_MONEY,
- CHAR_UPD_GUILD_RANK_BANK_RESET_TIME,
CHAR_UPD_GUILD_RANK_BANK_MONEY,
CHAR_UPD_GUILD_BANK_TAB_TEXT,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS0,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS1,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS2,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS3,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS4,
- CHAR_UPD_GUILD_MEMBER_BANK_TIME_REM_SLOTS5,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS0,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS1,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS2,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS3,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS4,
- CHAR_UPD_GUILD_MEMBER_BANK_REM_SLOTS5,
- CHAR_UPD_GUILD_RANK_BANK_TIME0,
- CHAR_UPD_GUILD_RANK_BANK_TIME1,
- CHAR_UPD_GUILD_RANK_BANK_TIME2,
- CHAR_UPD_GUILD_RANK_BANK_TIME3,
- CHAR_UPD_GUILD_RANK_BANK_TIME4,
- CHAR_UPD_GUILD_RANK_BANK_TIME5,
+ CHAR_INS_GUILD_MEMBER_WITHDRAW,
+ CHAR_DEL_GUILD_MEMBER_WITHDRAW,
CHAR_SEL_CHAR_DATA_FOR_GUILD,
CHAR_SEL_CHANNEL,
@@ -384,6 +367,7 @@ enum CharacterDatabaseStatements
CHAR_SEL_POOL_QUEST_SAVE,
CHAR_SEL_CHARACTER_AT_LOGIN,
CHAR_SEL_CHAR_CLASS_LVL_AT_LOGIN,
+ CHAR_SEL_CHAR_AT_LOGIN_TITLES,
CHAR_SEL_INSTANCE,
CHAR_SEL_PET_SPELL_LIST,
CHAR_SEL_CHAR_PET,
@@ -460,8 +444,11 @@ enum CharacterDatabaseStatements
CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE,
CHAR_DEL_CHAR_SPELL_BY_SPELL,
CHAR_UPD_CHAR_SPELL_FACTION_CHANGE,
+ CHAR_SEL_CHAR_REP_BY_FACTION,
CHAR_DEL_CHAR_REP_BY_FACTION,
CHAR_UPD_CHAR_REP_FACTION_CHANGE,
+ CHAR_UPD_CHAR_TITLES_FACTION_CHANGE,
+ CHAR_RES_CHAR_TITLES_FACTION_CHANGE,
CHAR_DEL_CHAR_SPELL_COOLDOWN,
CHAR_DEL_CHARACTER,
CHAR_DEL_CHAR_ACTION,
@@ -513,7 +500,12 @@ enum CharacterDatabaseStatements
CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC,
CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT,
- MAX_CHARACTERDATABASE_STATEMENTS,
+ CHAR_REP_CALENDAR_EVENT,
+ CHAR_DEL_CALENDAR_EVENT,
+ CHAR_REP_CALENDAR_INVITE,
+ CHAR_DEL_CALENDAR_INVITE,
+
+ MAX_CHARACTERDATABASE_STATEMENTS
};
#endif
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp
index 028d927a720..31d9f5ec1f6 100755..100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp
@@ -59,7 +59,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(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);
PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
- PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h
index 7c2a94eec94..b4f6713d118 100755..100644
--- a/src/server/shared/Database/Implementation/LoginDatabase.h
+++ b/src/server/shared/Database/Implementation/LoginDatabase.h
@@ -108,7 +108,7 @@ enum LoginDatabaseStatements
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
LOGIN_DEL_ACCOUNT,
- MAX_LOGINDATABASE_STATEMENTS,
+ MAX_LOGINDATABASE_STATEMENTS
};
#endif
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index e3455891909..c491852b1bd 100755..100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
- PREPARE_STATEMENT(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, 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);
+ PREPARE_STATEMENT(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);
PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(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);
PREPARE_STATEMENT(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
@@ -88,4 +88,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, phaseMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
+ PREPARE_STATEMENT(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH);
+ PREPARE_STATEMENT(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC);
}
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h
index 0580cecec7e..195d2ea8da5 100755..100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.h
+++ b/src/server/shared/Database/Implementation/WorldDatabase.h
@@ -109,8 +109,11 @@ enum WorldDatabaseStatements
WORLD_DEL_GAME_EVENT_CREATURE,
WORLD_DEL_GAME_EVENT_MODEL_EQUIP,
WORLD_INS_GAMEOBJECT,
+ WORLD_SEL_DISABLES,
+ WORLD_INS_DISABLES,
+ WORLD_DEL_DISABLES,
- MAX_WORLDDATABASE_STATEMENTS,
+ MAX_WORLDDATABASE_STATEMENTS
};
#endif
diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp
index 7fb4a4f7025..c6d2a165ca2 100755..100644
--- a/src/server/shared/Database/MySQLConnection.cpp
+++ b/src/server/shared/Database/MySQLConnection.cpp
@@ -22,6 +22,8 @@
#include <winsock2.h>
#endif
#include <mysql.h>
+#include <mysqld_error.h>
+#include <errmsg.h>
#include "MySQLConnection.h"
#include "MySQLThreading.h"
@@ -79,7 +81,7 @@ bool MySQLConnection::Open()
mysqlInit = mysql_init(NULL);
if (!mysqlInit)
{
- sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
+ sLog->outError(LOG_FILTER_SQL, "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
return false;
}
@@ -123,13 +125,13 @@ bool MySQLConnection::Open()
{
if (!m_reconnecting)
{
- sLog->outSQLDriver("MySQL client library: %s", mysql_get_client_info());
- sLog->outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
+ 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->outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
+ sLog->outInfo(LOG_FILTER_SQL, "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
}
- sLog->outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str());
+ sLog->outInfo(LOG_FILTER_SQL, "Connected to MySQL database at %s", m_connectionInfo.host.c_str());
mysql_autocommit(m_Mysql, 1);
// set connection properties to UTF8 to properly handle locales for different
@@ -139,7 +141,7 @@ bool MySQLConnection::Open()
}
else
{
- sLog->outError("Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
+ sLog->outError(LOG_FILTER_SQL, "Could not connect to MySQL database at %s: %s\n", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
mysql_close(mysqlInit);
return false;
}
@@ -159,26 +161,22 @@ bool MySQLConnection::Execute(const char* sql)
return false;
{
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_query(m_Mysql, sql))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL: %s", sql);
- sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
+ sLog->outInfo(LOG_FILTER_SQL, "SQL: %s", sql);
+ sLog->outError(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(sql); // Try again
return false;
}
- else if (sLog->GetSQLDriverQueryLogging())
- {
- sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
- }
+ else
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
}
return true;
@@ -201,14 +199,12 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT();
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(stmt); // Try again
@@ -220,7 +216,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
if (mysql_stmt_execute(msql_STMT))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(stmt); // Try again
@@ -229,8 +225,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
return false;
}
- if (sLog->GetSQLDriverQueryLogging())
- sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
m_mStmt->ClearParameters();
return true;
@@ -254,14 +249,12 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT();
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(stmt, pResult, pRowCount, pFieldCount); // Try again
@@ -273,7 +266,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
if (mysql_stmt_execute(msql_STMT))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s",
+ sLog->outError(LOG_FILTER_SQL, "SQL(p): %s\n [ERROR]: [%u] %s",
m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
@@ -283,8 +276,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES **pResult, uint6
return false;
}
- if (sLog->GetSQLDriverQueryLogging())
- sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
m_mStmt->ClearParameters();
@@ -319,25 +311,21 @@ bool MySQLConnection::_Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD *
return false;
{
- uint32 _s = 0;
- if (sLog->GetSQLDriverQueryLogging())
- _s = getMSTime();
+ uint32 _s = getMSTime();
if (mysql_query(m_Mysql, sql))
{
uint32 lErrno = mysql_errno(m_Mysql);
- sLog->outSQLDriver("SQL: %s", sql);
- sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
+ sLog->outInfo(LOG_FILTER_SQL, "SQL: %s", sql);
+ sLog->outError(LOG_FILTER_SQL, "[%u] %s", lErrno, mysql_error(m_Mysql));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again
return false;
}
- else if (sLog->GetSQLDriverQueryLogging())
- {
- sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
- }
+ else
+ sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
*pResult = mysql_store_result(m_Mysql);
*pRowCount = mysql_affected_rows(m_Mysql);
@@ -393,7 +381,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
ASSERT(stmt);
if (!Execute(stmt))
{
- sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
+ sLog->outWarn(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size());
RollbackTransaction();
return false;
}
@@ -405,7 +393,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
ASSERT(sql);
if (!Execute(sql))
{
- sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
+ sLog->outWarn(LOG_FILTER_SQL, "Transaction aborted. %u queries not executed.", (uint32)queries.size());
RollbackTransaction();
return false;
}
@@ -428,7 +416,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index)
ASSERT(index < m_stmts.size());
MySQLPreparedStatement* ret = m_stmts[index];
if (!ret)
- sLog->outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.",
+ sLog->outError(LOG_FILTER_SQL, "Could not fetch prepared statement %u on database `%s`, connection type: %s.",
index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
return ret;
@@ -449,19 +437,19 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection
return;
}
- MYSQL_STMT * stmt = mysql_stmt_init(m_Mysql);
+ MYSQL_STMT* stmt = mysql_stmt_init(m_Mysql);
if (!stmt)
{
- sLog->outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
- sLog->outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
+ sLog->outError(LOG_FILTER_SQL, "In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
+ sLog->outError(LOG_FILTER_SQL, "%s", mysql_error(m_Mysql));
m_prepareError = true;
}
else
{
if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql))))
{
- sLog->outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
- sLog->outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt));
+ sLog->outError(LOG_FILTER_SQL, "In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
+ sLog->outError(LOG_FILTER_SQL, "%s", mysql_stmt_error(stmt));
mysql_stmt_close(stmt);
m_prepareError = true;
}
@@ -493,19 +481,19 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
{
switch (errNo)
{
- case 2006: // "MySQL server has gone away"
- case 2013: // "Lost connection to MySQL server during query"
- case 2048: // "Invalid connection handle"
- case 2055: // "Lost connection to MySQL server at '%s', system error: %d"
+ case CR_SERVER_GONE_ERROR:
+ case CR_SERVER_LOST:
+ case CR_INVALID_CONN_HANDLE:
+ case CR_SERVER_LOST_EXTENDED:
{
m_reconnecting = true;
uint64 oldThreadId = mysql_thread_id(GetHandle());
mysql_close(GetHandle());
if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements....
{
- sLog->outSQLDriver("Connection to the MySQL server is active.");
+ sLog->outInfo(LOG_FILTER_SQL, "Connection to the MySQL server is active.");
if (oldThreadId != mysql_thread_id(GetHandle()))
- sLog->outSQLDriver("Successfully reconnected to %s @%s:%s (%s).",
+ sLog->outInfo(LOG_FILTER_SQL, "Successfully reconnected to %s @%s:%s (%s).",
m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(),
(m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
@@ -518,21 +506,27 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
return _HandleMySQLErrno(lErrno); // Call self (recursive)
}
- case 1213: // "Deadlock found when trying to get lock; try restarting transaction"
+ case ER_LOCK_DEADLOCK:
return false; // Implemented in TransactionTask::Execute and DatabaseWorkerPool<T>::DirectCommitTransaction
// Query related errors - skip query
- case 1058: // "Column count doesn't match value count"
- case 1062: // "Duplicate entry '%s' for key '%d'"
+ case ER_WRONG_VALUE_COUNT:
+ case ER_DUP_ENTRY:
return false;
// Outdated table or database structure - terminate core
- case 1054: // "Unknown column '%s' in '%s'"
- case 1146: // "Table '%s' doesn't exist"
- WPFatal(!errNo, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
+ case ER_BAD_FIELD_ERROR:
+ case ER_NO_SUCH_TABLE:
+ sLog->outError(LOG_FILTER_SQL, "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
+ ACE_OS::sleep(10);
+ std::abort();
+ return false;
+ case ER_PARSE_ERROR:
+ sLog->outError(LOG_FILTER_SQL, "Error while parsing SQL. Core fix required.");
+ ACE_OS::sleep(10);
+ std::abort();
return false;
-
default:
- sLog->outSQLDriver("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
+ sLog->outError(LOG_FILTER_SQL, "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
return false;
}
}
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index c05c4e62c96..b0b79ac0a33 100755..100644
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -33,7 +33,7 @@ enum ConnectionFlags
{
CONNECTION_ASYNC = 0x1,
CONNECTION_SYNCH = 0x2,
- CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNCH,
+ CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNCH
};
struct MySQLConnectionInfo
@@ -41,7 +41,7 @@ struct MySQLConnectionInfo
MySQLConnectionInfo() {}
MySQLConnectionInfo(const std::string& infoString)
{
- Tokens tokens(infoString, ';');
+ Tokenizer tokens(infoString, ';');
if (tokens.size() != 5)
return;
diff --git a/src/server/shared/Database/MySQLThreading.h b/src/server/shared/Database/MySQLThreading.h
index 2004ee9826c..038ec4ee794 100755..100644
--- a/src/server/shared/Database/MySQLThreading.h
+++ b/src/server/shared/Database/MySQLThreading.h
@@ -33,7 +33,7 @@ class MySQL
static void Thread_Init()
{
mysql_thread_init();
- sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] initializing MySQL thread.",
+ sLog->outWarn(LOG_FILTER_SQL, "Core thread with ID ["UI64FMTD"] initializing MySQL thread.",
(uint64)ACE_Based::Thread::currentId());
}
@@ -44,7 +44,7 @@ class MySQL
static void Thread_End()
{
mysql_thread_end();
- sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] shutting down MySQL thread.",
+ sLog->outWarn(LOG_FILTER_SQL, "Core thread with ID ["UI64FMTD"] shutting down MySQL thread.",
(uint64)ACE_Based::Thread::currentId());
}
diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp
index 58aa2bd3aa0..21aef0f1834 100755..100644
--- a/src/server/shared/Database/PreparedStatement.cpp
+++ b/src/server/shared/Database/PreparedStatement.cpp
@@ -78,7 +78,7 @@ void PreparedStatement::BindParameters()
}
#ifdef _DEBUG
if (i < m_stmt->m_paramCount)
- sLog->outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
+ sLog->outWarn(LOG_FILTER_SQL, "[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
#endif
}
@@ -237,7 +237,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index)
return false;
if (m_paramsSet[index])
- sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
+ sLog->outWarn(LOG_FILTER_SQL, "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
return true;
}
@@ -440,6 +440,7 @@ bool PreparedStatementTask::Execute()
PreparedResultSet* result = m_conn->Query(m_stmt);
if (!result || !result->GetRowCount())
{
+ delete result;
m_result.set(PreparedQueryResult(NULL));
return false;
}
diff --git a/src/server/shared/Database/PreparedStatement.h b/src/server/shared/Database/PreparedStatement.h
index 11ece3e3032..90ea435d1f9 100755..100644
--- a/src/server/shared/Database/PreparedStatement.h
+++ b/src/server/shared/Database/PreparedStatement.h
@@ -21,6 +21,10 @@
#include "SQLOperation.h"
#include <ace/Future.h>
+#ifdef __APPLE__
+#undef TYPE_BOOL
+#endif
+
//- Union for data buffer (upper-level bind -> queue -> lower-level bind)
union PreparedStatementDataUnion
{
@@ -157,4 +161,4 @@ class PreparedStatementTask : public SQLOperation
bool m_has_result;
PreparedQueryResultFuture m_result;
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp
index a3602531205..ed228c74667 100755..100644
--- a/src/server/shared/Database/QueryHolder.cpp
+++ b/src/server/shared/Database/QueryHolder.cpp
@@ -24,7 +24,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char *sql)
{
if (m_queries.size() <= index)
{
- sLog->outError("Query index (%zu) out of range (size: %u) for query: %s", index, (uint32)m_queries.size(), sql);
+ sLog->outError(LOG_FILTER_SQL, "Query index (%u) out of range (size: %u) for query: %s", uint32(index), (uint32)m_queries.size(), sql);
return false;
}
@@ -44,7 +44,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
{
if (!format)
{
- sLog->outError("Query (index: %zu) is empty.", index);
+ sLog->outError(LOG_FILTER_SQL, "Query (index: %u) is empty.", uint32(index));
return false;
}
@@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char *format, ...)
if (res == -1)
{
- sLog->outError("SQL Query truncated (and not execute) for format: %s", format);
+ sLog->outError(LOG_FILTER_SQL, "SQL Query truncated (and not execute) for format: %s", format);
return false;
}
@@ -67,7 +67,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt)
{
if (m_queries.size() <= index)
{
- sLog->outError("Query index (%zu) out of range (size: %u) for prepared statement", index, (uint32)m_queries.size());
+ sLog->outError(LOG_FILTER_SQL, "Query index (%u) out of range (size: %u) for prepared statement", uint32(index), (uint32)m_queries.size());
return false;
}
@@ -116,6 +116,12 @@ PreparedQueryResult SQLQueryHolder::GetPreparedResult(size_t index)
void SQLQueryHolder::SetResult(size_t index, ResultSet* result)
{
+ if (result && !result->GetRowCount())
+ {
+ delete result;
+ result = NULL;
+ }
+
/// store the result in the holder
if (index < m_queries.size())
m_queries[index].second.qresult = result;
@@ -123,6 +129,12 @@ void SQLQueryHolder::SetResult(size_t index, ResultSet* result)
void SQLQueryHolder::SetPreparedResult(size_t index, PreparedResultSet* result)
{
+ if (result && !result->GetRowCount())
+ {
+ delete result;
+ result = NULL;
+ }
+
/// store the result in the holder
if (index < m_queries.size())
m_queries[index].second.presult = result;
diff --git a/src/server/shared/Database/QueryHolder.h b/src/server/shared/Database/QueryHolder.h
index 86b3b5955bd..86b3b5955bd 100755..100644
--- a/src/server/shared/Database/QueryHolder.h
+++ b/src/server/shared/Database/QueryHolder.h
diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp
index 95034387089..cb21c088d00 100755..100644
--- a/src/server/shared/Database/QueryResult.cpp
+++ b/src/server/shared/Database/QueryResult.cpp
@@ -59,7 +59,7 @@ m_length(NULL)
//- This is where we store the (entire) resultset
if (mysql_stmt_store_result(m_stmt))
{
- sLog->outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
+ sLog->outWarn(LOG_FILTER_SQL, "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
return;
}
@@ -86,7 +86,7 @@ m_length(NULL)
//- This is where we bind the bind the buffer to the statement
if (mysql_stmt_bind_result(m_stmt, m_rBind))
{
- sLog->outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
+ sLog->outWarn(LOG_FILTER_SQL, "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
delete[] m_rBind;
delete[] m_isNull;
delete[] m_length;
diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h
index e32b16555bc..be7fa7b649c 100755..100644
--- a/src/server/shared/Database/QueryResult.h
+++ b/src/server/shared/Database/QueryResult.h
@@ -23,7 +23,6 @@
#include <ace/Thread_Mutex.h>
#include "Field.h"
-#include "Log.h"
#ifdef _WIN32
#include <winsock2.h>
diff --git a/src/server/shared/Database/SQLOperation.h b/src/server/shared/Database/SQLOperation.h
index b911c1c92aa..401535e39f7 100755..100644
--- a/src/server/shared/Database/SQLOperation.h
+++ b/src/server/shared/Database/SQLOperation.h
@@ -37,7 +37,7 @@ union SQLElementUnion
enum SQLElementDataType
{
SQL_ELEMENT_RAW,
- SQL_ELEMENT_PREPARED,
+ SQL_ELEMENT_PREPARED
};
//- The element
diff --git a/src/server/shared/Database/Transaction.cpp b/src/server/shared/Database/Transaction.cpp
index 5aecda87797..5aecda87797 100755..100644
--- a/src/server/shared/Database/Transaction.cpp
+++ b/src/server/shared/Database/Transaction.cpp
diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h
index 805d48f76cf..805d48f76cf 100755..100644
--- a/src/server/shared/Database/Transaction.h
+++ b/src/server/shared/Database/Transaction.h
diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h
index 48a8bda32ed..6ce3d926f4c 100755..100644
--- a/src/server/shared/Debugging/Errors.h
+++ b/src/server/shared/Debugging/Errors.h
@@ -24,10 +24,10 @@
#include <ace/Stack_Trace.h>
#include <ace/OS_NS_unistd.h>
-#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError("\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } }
-#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError("%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } }
-#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } }
-#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError("\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } }
+#define WPAssert(assertion) { if (!(assertion)) { ACE_Stack_Trace st; sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__, __FUNCTION__, #assertion, st.c_str()); *((volatile int*)NULL) = 0; } }
+#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } }
+#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } }
+#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } }
#define ASSERT WPAssert
#endif
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index febc5ef3573..96a115f8057 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -409,11 +409,12 @@ void WheatyExceptionReport::printTracesForAllThreads()
CONTEXT context;
context.ContextFlags = 0xffffffff;
HANDLE threadHandle = OpenThread(THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION, false, te32.th32ThreadID);
- if (threadHandle && GetThreadContext(threadHandle, &context))
+ if (threadHandle)
{
- WriteStackDetails(&context, false, threadHandle);
+ if (GetThreadContext(threadHandle, &context))
+ WriteStackDetails(&context, false, threadHandle);
+ CloseHandle(threadHandle);
}
- CloseHandle(threadHandle);
}
} while (Thread32Next(hThreadSnap, &te32));
@@ -521,7 +522,7 @@ PEXCEPTION_POINTERS pExceptionInfo)
_tprintf(_T("Global Variables\r\n"));
SymEnumSymbols(GetCurrentProcess(),
- (DWORD64)GetModuleHandle(szFaultingModule),
+ (UINT_PTR)GetModuleHandle(szFaultingModule),
0, EnumerateSymbolsCallback, 0);
// #endif // X86 Only!
@@ -989,7 +990,7 @@ PVOID pAddress)
if (!IsBadStringPtr(*(PSTR*)pAddress, 32))
{
pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%.31s\"",
- *(PDWORD)pAddress);
+ *(PSTR*)pAddress);
}
else
pszCurrBuffer += sprintf(pszCurrBuffer, " = %X",
diff --git a/src/server/shared/Define.h b/src/server/shared/Define.h
index bb3bab75e87..0f7c2163b7e 100755..100644
--- a/src/server/shared/Define.h
+++ b/src/server/shared/Define.h
@@ -19,12 +19,12 @@
#ifndef TRINITY_DEFINE_H
#define TRINITY_DEFINE_H
-#include <sys/types.h>
+#include "CompilerDefs.h"
#include <ace/Basic_Types.h>
#include <ace/ACE_export.h>
-#include "CompilerDefs.h"
+#include <cstddef>
#define TRINITY_LITTLEENDIAN 0
#define TRINITY_BIGENDIAN 1
@@ -70,6 +70,14 @@
# define ATTR_DEPRECATED
#endif //COMPILER == COMPILER_GNU
+#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER
+#define UI64LIT(N) ACE_UINT64_LITERAL(N)
+
+#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER
+#define SI64LIT(N) ACE_INT64_LITERAL(N)
+
+#define SIZEFMTD ACE_SIZE_T_FORMAT_SPECIFIER
+
typedef ACE_INT64 int64;
typedef ACE_INT32 int32;
typedef ACE_INT16 int16;
diff --git a/src/server/shared/Dynamic/FactoryHolder.h b/src/server/shared/Dynamic/FactoryHolder.h
index 830e6d8b67d..830e6d8b67d 100755..100644
--- a/src/server/shared/Dynamic/FactoryHolder.h
+++ b/src/server/shared/Dynamic/FactoryHolder.h
diff --git a/src/server/shared/Dynamic/HashNamespace.h b/src/server/shared/Dynamic/HashNamespace.h
new file mode 100644
index 00000000000..c7b5a817b76
--- /dev/null
+++ b/src/server/shared/Dynamic/HashNamespace.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITY_HASH_NAMESPACE_H
+#define TRINITY_HASH_NAMESPACE_H
+
+#include "Define.h"
+
+#if COMPILER_HAS_CPP11_SUPPORT
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif defined(_STLPORT_VERSION)
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
+# define HASH_NAMESPACE_START namespace std { namespace tr1 {
+# define HASH_NAMESPACE_END } }
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
+# define HASH_NAMESPACE_START namespace stdext {
+# define HASH_NAMESPACE_END }
+
+#if !_HAS_TRADITIONAL_STL
+#ifndef HASH_NAMESPACE
+#define HASH_NAMESPACE
+#else
+
+// can be not used by some platforms, so provide fake forward
+HASH_NAMESPACE_START
+
+template<class K>
+class hash
+{
+public:
+ size_t operator() (K const&);
+};
+
+HASH_NAMESPACE_END
+
+#endif
+#endif
+
+#elif COMPILER == COMPILER_INTEL
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# define HASH_NAMESPACE_START namespace std { namespace tr1 {
+# define HASH_NAMESPACE_END } }
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# define HASH_NAMESPACE_START namespace __gnu_cxx {
+# define HASH_NAMESPACE_END }
+
+#include <ext/hash_fun.h>
+#include <string>
+
+HASH_NAMESPACE_START
+
+template<>
+class hash<unsigned long long>
+{
+public:
+ size_t operator()(const unsigned long long &__x) const { return (size_t)__x; }
+};
+
+template<typename T>
+class hash<T *>
+{
+public:
+ size_t operator()(T * const &__x) const { return (size_t)__x; }
+};
+
+template<> struct hash<std::string>
+{
+ size_t operator()(const std::string &__x) const
+ {
+ return hash<char const *>()(__x.c_str());
+ }
+};
+
+HASH_NAMESPACE_END
+
+#else
+# define HASH_NAMESPACE_START namespace std {
+# define HASH_NAMESPACE_END }
+#endif
+
+#if COMPILER != COMPILER_MICROSOFT
+
+// Visual Studio use non standard hash calculation function, so provide fake forward for other
+HASH_NAMESPACE_START
+
+template<class K>
+size_t hash_value(K const&);
+
+HASH_NAMESPACE_END
+
+#endif
+
+#endif
diff --git a/src/server/shared/Dynamic/LinkedList.h b/src/server/shared/Dynamic/LinkedList.h
index 29cbeb2e66c..3969e22aa14 100755..100644
--- a/src/server/shared/Dynamic/LinkedList.h
+++ b/src/server/shared/Dynamic/LinkedList.h
@@ -19,7 +19,8 @@
#ifndef _LINKEDLIST
#define _LINKEDLIST
-#include "Common.h"
+#include "Define.h"
+#include <iterator>
//============================================
class LinkedListHead;
@@ -32,7 +33,7 @@ class LinkedListElement
LinkedListElement* iNext;
LinkedListElement* iPrev;
public:
- LinkedListElement() { iNext = NULL; iPrev = NULL; }
+ LinkedListElement(): iNext(NULL), iPrev(NULL) {}
~LinkedListElement() { delink(); }
bool hasNext() const { return(iNext && iNext->iNext != NULL); }
@@ -83,13 +84,12 @@ class LinkedListHead
LinkedListElement iLast;
uint32 iSize;
public:
- LinkedListHead()
+ LinkedListHead(): iSize(0)
{
// create empty list
iFirst.iNext = &iLast;
iLast.iPrev = &iFirst;
- iSize = 0;
}
bool isEmpty() const { return(!iFirst.iNext->isInList()); }
@@ -153,13 +153,14 @@ class LinkedListHead
Iterator& operator=(Iterator const &_Right)
{
- return (*this) = _Right._Ptr;
+ _Ptr = _Right._Ptr;
+ return *this;
}
Iterator& operator=(const_pointer const &_Right)
{
- _Ptr = (pointer)_Right;
- return (*this);
+ _Ptr = pointer(_Right);
+ return *this;
}
reference operator*()
@@ -242,4 +243,3 @@ class LinkedListHead
//============================================
#endif
-
diff --git a/src/server/shared/Dynamic/LinkedReference/RefManager.h b/src/server/shared/Dynamic/LinkedReference/RefManager.h
index 1c6e6956dbd..1c6e6956dbd 100755..100644
--- a/src/server/shared/Dynamic/LinkedReference/RefManager.h
+++ b/src/server/shared/Dynamic/LinkedReference/RefManager.h
diff --git a/src/server/shared/Dynamic/LinkedReference/Reference.h b/src/server/shared/Dynamic/LinkedReference/Reference.h
index d4c607470cc..22921b075fe 100755..100644
--- a/src/server/shared/Dynamic/LinkedReference/Reference.h
+++ b/src/server/shared/Dynamic/LinkedReference/Reference.h
@@ -20,6 +20,7 @@
#define _REFERENCE_H
#include "Dynamic/LinkedList.h"
+#include <assert.h>
//=====================================================
@@ -57,13 +58,21 @@ template <class TO, class FROM> class Reference : public LinkedListElement
// We don't need the reference anymore. Call comes from the refFrom object
// Tell our refTo object, that the link is cut
- void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; }
+ void unlink()
+ {
+ targetObjectDestroyLink();
+ delink();
+ iRefTo = NULL;
+ iRefFrom = NULL;
+ }
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object
// Tell our refFrom object, that the link is cut
void invalidate() // the iRefFrom MUST remain!!
{
- sourceObjectDestroyLink(); delink(); iRefTo = NULL;
+ sourceObjectDestroyLink();
+ delink();
+ iRefTo = NULL;
}
bool isValid() const // Only check the iRefTo
@@ -89,4 +98,3 @@ template <class TO, class FROM> class Reference : public LinkedListElement
//=====================================================
#endif
-
diff --git a/src/server/shared/Dynamic/ObjectRegistry.h b/src/server/shared/Dynamic/ObjectRegistry.h
index ca481671796..bb3227514a7 100755..100644
--- a/src/server/shared/Dynamic/ObjectRegistry.h
+++ b/src/server/shared/Dynamic/ObjectRegistry.h
@@ -101,7 +101,6 @@ class ObjectRegistry
}
private:
RegistryMapType i_registeredObjects;
-
};
-#endif
+#endif
diff --git a/src/server/shared/Dynamic/TypeContainer.h b/src/server/shared/Dynamic/TypeContainer.h
index 67789d8ff42..67789d8ff42 100755..100644
--- a/src/server/shared/Dynamic/TypeContainer.h
+++ b/src/server/shared/Dynamic/TypeContainer.h
diff --git a/src/server/shared/Dynamic/TypeContainerFunctions.h b/src/server/shared/Dynamic/TypeContainerFunctions.h
index 19ebfb3adfc..5011ec1c1be 100755..100644
--- a/src/server/shared/Dynamic/TypeContainerFunctions.h
+++ b/src/server/shared/Dynamic/TypeContainerFunctions.h
@@ -36,7 +36,7 @@ namespace Trinity
template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE* /*fake*/)
{
return elements._element.getSize();
- };
+ }
template<class SPECIFIC_TYPE> size_t Count(const ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE* /*fake*/)
{
@@ -64,7 +64,7 @@ namespace Trinity
//elements._element[hdl] = obj;
obj->AddToGrid(elements._element);
return obj;
- };
+ }
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
{
diff --git a/src/server/shared/Dynamic/TypeContainerVisitor.h b/src/server/shared/Dynamic/TypeContainerVisitor.h
index beddb31f343..155989f15f6 100755..100644
--- a/src/server/shared/Dynamic/TypeContainerVisitor.h
+++ b/src/server/shared/Dynamic/TypeContainerVisitor.h
@@ -35,7 +35,7 @@ template<class T, class Y> class TypeContainerVisitor;
template<class VISITOR, class TYPE_CONTAINER> void VisitorHelper(VISITOR &v, TYPE_CONTAINER &c)
{
v.Visit(c);
-};
+}
// terminate condition for container list
template<class VISITOR> void VisitorHelper(VISITOR &v, ContainerList<TypeNull> &c)
diff --git a/src/server/shared/Dynamic/TypeList.h b/src/server/shared/Dynamic/TypeList.h
index 4967ab0fbc0..4967ab0fbc0 100755..100644
--- a/src/server/shared/Dynamic/TypeList.h
+++ b/src/server/shared/Dynamic/TypeList.h
diff --git a/src/server/shared/Dynamic/UnorderedMap.h b/src/server/shared/Dynamic/UnorderedMap.h
index 5e7b48f9b7b..5d485efa89b 100755..100644
--- a/src/server/shared/Dynamic/UnorderedMap.h
+++ b/src/server/shared/Dynamic/UnorderedMap.h
@@ -19,55 +19,54 @@
#ifndef TRINITY_UNORDERED_MAP_H
#define TRINITY_UNORDERED_MAP_H
-#include "CompilerDefs.h"
-#include "Define.h"
+#include "HashNamespace.h"
-#if COMPILER == COMPILER_INTEL
-#include <ext/hash_map>
-#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#include <tr1/unordered_map>
-#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3
-#include <ext/hash_map>
-#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1 // VC9.0 and later
-#include <unordered_map>
+#if COMPILER_HAS_CPP11_SUPPORT
+# include <unordered_map>
+#elif COMPILER == COMPILER_INTEL
+# include <ext/hash_map>
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# include <unordered_map>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# include <tr1/unordered_map>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# include <ext/hash_map>
+#elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later
+# include <unordered_map>
#else
-#include <hash_map>
+# include <hash_map>
#endif
#ifdef _STLPORT_VERSION
-#define UNORDERED_MAP std::hash_map
-using std::hash_map;
+# define UNORDERED_MAP std::hash_map
+# define UNORDERED_MULTIMAP std::hash_multimap
+#elif COMPILER_HAS_CPP11_SUPPORT
+# define UNORDERED_MAP std::unordered_map
+# define UNORDERED_MULTIMAP std::unordered_multimap
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
+# define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MULTIMAP std::tr1::unordered_multimap
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
-#define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MULTIMAP std::tr1::unordered_multimap
#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
-#define UNORDERED_MAP stdext::hash_map
-using stdext::hash_map;
-#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
-#define UNORDERED_MAP std::tr1::unordered_map
-#elif (COMPILER == COMPILER_GNU && __GNUC__ >= 3) || COMPILER == COMPILER_INTEL
-#define UNORDERED_MAP __gnu_cxx::hash_map
-
-namespace __gnu_cxx
-{
- template<> struct hash<unsigned long long>
- {
- size_t operator()(const unsigned long long &__x) const { return (size_t)__x; }
- };
- template<typename T> struct hash<T *>
- {
- size_t operator()(T * const &__x) const { return (size_t)__x; }
- };
- template<> struct hash<std::string>
- {
- size_t operator()(const std::string &__x) const
- {
- return hash<const char *>()(__x.c_str());
- }
- };
-};
-
+# define UNORDERED_MAP stdext::hash_map
+# define UNORDERED_MULTIMAP stdext::hash_multimap
+#elif COMPILER == COMPILER_INTEL
+# define UNORDERED_MAP std::hash_map
+# define UNORDERED_MULTIMAP std::hash_multimap
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# define UNORDERED_MAP std::unordered_map
+# define UNORDERED_MULTIMAP std::unordered_multimap
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# define UNORDERED_MAP std::tr1::unordered_map
+# define UNORDERED_MULTIMAP std::tr1::unordered_multimap
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# define UNORDERED_MAP __gnu_cxx::hash_map
+# define UNORDERED_MULTIMAP __gnu_cxx::hash_multimap
#else
-#define UNORDERED_MAP std::hash_map
-using std::hash_map;
+# define UNORDERED_MAP std::hash_map
+# define UNORDERED_MULTIMAP std::hash_multimap
#endif
+
#endif
diff --git a/src/server/shared/Dynamic/UnorderedSet.h b/src/server/shared/Dynamic/UnorderedSet.h
new file mode 100644
index 00000000000..8c8d7c0d5dc
--- /dev/null
+++ b/src/server/shared/Dynamic/UnorderedSet.h
@@ -0,0 +1,66 @@
+/*
+* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation; either version 2 of the License, or (at your
+* option) any later version.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+* more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef TRINITY_UNORDERED_SET_H
+#define TRINITY_UNORDERED_SET_H
+
+#include "HashNamespace.h"
+
+#if COMPILER_HAS_CPP11_SUPPORT
+# include <unordered_set>
+#elif COMPILER == COMPILER_INTEL
+# include <ext/hash_set>
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# include <unordered_set>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# include <tr1/unordered_set>
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# include <ext/hash_set>
+#elif COMPILER == COMPILER_MICROSOFT && ((_MSC_VER >= 1500 && _HAS_TR1) || _MSC_VER >= 1700) // VC9.0 SP1 and later
+# include <unordered_set>
+#else
+# include <hash_set>
+#endif
+
+#ifdef _STLPORT_VERSION
+# define UNORDERED_SET std::hash_set
+using std::hash_set;
+#elif COMPILER_HAS_CPP11_SUPPORT
+# define UNORDERED_SET std::unordered_set
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1600 // VS100
+# define UNORDERED_SET std::tr1::unordered_set
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1500 && _HAS_TR1
+# define UNORDERED_SET std::tr1::unordered_set
+#elif COMPILER == COMPILER_MICROSOFT && _MSC_VER >= 1300
+# define UNORDERED_SET stdext::hash_set
+using stdext::hash_set;
+#elif COMPILER == COMPILER_INTEL
+# define UNORDERED_SET std::hash_set
+using std::hash_set;
+#elif COMPILER == COMPILER_GNU && defined(__clang__) && defined(_LIBCPP_VERSION)
+# define UNORDERED_SET std::unordered_set
+#elif COMPILER == COMPILER_GNU && GCC_VERSION > 40200
+# define UNORDERED_SET std::tr1::unordered_set
+#elif COMPILER == COMPILER_GNU && GCC_VERSION >= 30000
+# define UNORDERED_SET __gnu_cxx::hash_set
+#else
+# define UNORDERED_SET std::hash_set
+using std::hash_set;
+#endif
+
+#endif
diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp
new file mode 100644
index 00000000000..0bfcc8abbd2
--- /dev/null
+++ b/src/server/shared/Logging/Appender.cpp
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2008-2012 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 "Appender.h"
+#include "Common.h"
+
+std::string LogMessage::getTimeStr(time_t time)
+{
+ tm* aTm = localtime(&time);
+ char buf[20];
+ snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec);
+ return std::string(buf);
+}
+
+std::string LogMessage::getTimeStr()
+{
+ return getTimeStr(mtime);
+}
+
+Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */):
+id(_id), name(_name), type(_type), level(_level), flags(_flags)
+{
+}
+
+Appender::~Appender()
+{
+}
+
+uint8 Appender::getId() const
+{
+ return id;
+}
+
+std::string const& Appender::getName() const
+{
+ return name;
+}
+
+AppenderType Appender::getType() const
+{
+ return type;
+}
+
+LogLevel Appender::getLogLevel() const
+{
+ return level;
+}
+
+AppenderFlags Appender::getFlags() const
+{
+ return flags;
+}
+
+void Appender::setLogLevel(LogLevel _level)
+{
+ level = _level;
+}
+
+void Appender::write(LogMessage& message)
+{
+ if (!level || level > message.level)
+ {
+ //fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe
+ return;
+ }
+
+ message.prefix.clear();
+ if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP)
+ message.prefix.append(message.getTimeStr().c_str());
+
+ if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
+ {
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ char text[MAX_QUERY_LEN];
+ snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level));
+ message.prefix.append(text);
+ }
+
+ if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
+ {
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ char text[MAX_QUERY_LEN];
+ snprintf(text, MAX_QUERY_LEN, "[%s]", Appender::getLogFilterTypeString(message.type));
+ message.prefix.append(text);
+ }
+
+ if (!message.prefix.empty())
+ message.prefix.push_back(' ');
+
+ _write(message);
+}
+
+const char* Appender::getLogLevelString(LogLevel level)
+{
+ switch (level)
+ {
+ case LOG_LEVEL_FATAL:
+ return "FATAL";
+ case LOG_LEVEL_ERROR:
+ return "ERROR";
+ case LOG_LEVEL_WARN:
+ return "WARN";
+ case LOG_LEVEL_INFO:
+ return "INFO";
+ case LOG_LEVEL_DEBUG:
+ return "DEBUG";
+ case LOG_LEVEL_TRACE:
+ return "TRACE";
+ default:
+ return "DISABLED";
+ }
+}
+
+char const* Appender::getLogFilterTypeString(LogFilterType type)
+{
+ switch (type)
+ {
+ case LOG_FILTER_GENERAL:
+ return "GENERAL";
+ case LOG_FILTER_UNITS:
+ return "UNITS";
+ case LOG_FILTER_PETS:
+ return "PETS";
+ case LOG_FILTER_VEHICLES:
+ return "VEHICLES";
+ case LOG_FILTER_TSCR:
+ return "TSCR";
+ case LOG_FILTER_DATABASE_AI:
+ return "DATABASE_AI";
+ case LOG_FILTER_MAPSCRIPTS:
+ return "MAPSCRIPTS";
+ case LOG_FILTER_NETWORKIO:
+ return "NETWORKIO";
+ case LOG_FILTER_SPELLS_AURAS:
+ return "SPELLS_AURAS";
+ case LOG_FILTER_ACHIEVEMENTSYS:
+ return "ACHIEVEMENTSYS";
+ case LOG_FILTER_CONDITIONSYS:
+ return "CONDITIONSYS";
+ case LOG_FILTER_POOLSYS:
+ return "POOLSYS";
+ case LOG_FILTER_AUCTIONHOUSE:
+ return "AUCTIONHOUSE";
+ case LOG_FILTER_BATTLEGROUND:
+ return "BATTLEGROUND";
+ case LOG_FILTER_OUTDOORPVP:
+ return "OUTDOORPVP";
+ case LOG_FILTER_CHATSYS:
+ return "CHATSYS";
+ case LOG_FILTER_LFG:
+ return "LFG";
+ case LOG_FILTER_MAPS:
+ return "MAPS";
+ case LOG_FILTER_PLAYER:
+ return "PLAYER";
+ case LOG_FILTER_PLAYER_LOADING:
+ return "PLAYER LOADING";
+ case LOG_FILTER_PLAYER_ITEMS:
+ return "PLAYER ITEMS";
+ case LOG_FILTER_PLAYER_SKILLS:
+ return "PLAYER SKILLS";
+ case LOG_FILTER_PLAYER_CHATLOG:
+ return "PLAYER CHATLOG";
+ case LOG_FILTER_LOOT:
+ return "LOOT";
+ case LOG_FILTER_GUILD:
+ return "GUILD";
+ case LOG_FILTER_TRANSPORTS:
+ return "TRANSPORTS";
+ case LOG_FILTER_SQL:
+ return "SQL";
+ case LOG_FILTER_GMCOMMAND:
+ return "GMCOMMAND";
+ case LOG_FILTER_REMOTECOMMAND:
+ return "REMOTECOMMAND";
+ case LOG_FILTER_WARDEN:
+ return "WARDEN";
+ case LOG_FILTER_AUTHSERVER:
+ return "AUTHSERVER";
+ case LOG_FILTER_WORLDSERVER:
+ return "WORLDSERVER";
+ case LOG_FILTER_GAMEEVENTS:
+ return "GAMEEVENTS";
+ case LOG_FILTER_CALENDAR:
+ return "CALENDAR";
+ case LOG_FILTER_CHARACTER:
+ return "CHARACTER";
+ case LOG_FILTER_ARENAS:
+ return "ARENAS";
+ case LOG_FILTER_SQL_DRIVER:
+ return "SQL DRIVER";
+ case LOG_FILTER_SQL_DEV:
+ return "SQL DEV";
+ case LOG_FILTER_PLAYER_DUMP:
+ return "PLAYER DUMP";
+ case LOG_FILTER_BATTLEFIELD:
+ return "BATTLEFIELD";
+ case LOG_FILTER_SERVER_LOADING:
+ return "SERVER LOADING";
+ case LOG_FILTER_OPCODES:
+ return "OPCODE";
+ case LOG_FILTER_SOAP:
+ return "SOAP";
+ default:
+ break;
+ }
+ return "???";
+}
diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h
new file mode 100644
index 00000000000..89d0016ce2b
--- /dev/null
+++ b/src/server/shared/Logging/Appender.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef APPENDER_H
+#define APPENDER_H
+
+#include "Define.h"
+#include <time.h>
+#include <string>
+#include <map>
+
+enum LogFilterType
+{
+ LOG_FILTER_GENERAL = 0, // This one should only be used inside Log.cpp
+ LOG_FILTER_UNITS = 1, // Anything related to units that doesn't fit in other categories. ie. creature formations
+ LOG_FILTER_PETS = 2,
+ LOG_FILTER_VEHICLES = 3,
+ LOG_FILTER_TSCR = 4, // C++ AI, instance scripts, etc.
+ LOG_FILTER_DATABASE_AI = 5, // SmartAI, EventAI, Creature* * AI
+ LOG_FILTER_MAPSCRIPTS = 6,
+ LOG_FILTER_NETWORKIO = 7,
+ LOG_FILTER_SPELLS_AURAS = 8,
+ LOG_FILTER_ACHIEVEMENTSYS = 9,
+ LOG_FILTER_CONDITIONSYS = 10,
+ LOG_FILTER_POOLSYS = 11,
+ LOG_FILTER_AUCTIONHOUSE = 12,
+ LOG_FILTER_BATTLEGROUND = 13,
+ LOG_FILTER_OUTDOORPVP = 14,
+ LOG_FILTER_CHATSYS = 15,
+ LOG_FILTER_LFG = 16,
+ LOG_FILTER_MAPS = 17,
+ LOG_FILTER_PLAYER = 18, // Any player log that does not fit in other player filters
+ LOG_FILTER_PLAYER_LOADING = 19, // Debug output from Player::_Load functions
+ LOG_FILTER_PLAYER_ITEMS = 20,
+ LOG_FILTER_PLAYER_SKILLS = 21,
+ LOG_FILTER_PLAYER_CHATLOG = 22,
+ LOG_FILTER_LOOT = 23,
+ LOG_FILTER_GUILD = 24,
+ LOG_FILTER_TRANSPORTS = 25,
+ LOG_FILTER_SQL = 26,
+ LOG_FILTER_GMCOMMAND = 27,
+ LOG_FILTER_REMOTECOMMAND = 28,
+ LOG_FILTER_WARDEN = 29,
+ LOG_FILTER_AUTHSERVER = 30,
+ LOG_FILTER_WORLDSERVER = 31,
+ LOG_FILTER_GAMEEVENTS = 32,
+ LOG_FILTER_CALENDAR = 33,
+ LOG_FILTER_CHARACTER = 34,
+ LOG_FILTER_ARENAS = 35,
+ LOG_FILTER_SQL_DRIVER = 36,
+ LOG_FILTER_SQL_DEV = 37,
+ LOG_FILTER_PLAYER_DUMP = 38,
+ LOG_FILTER_BATTLEFIELD = 39,
+ LOG_FILTER_SERVER_LOADING = 40,
+ LOG_FILTER_OPCODES = 41,
+ LOG_FILTER_SOAP = 42
+};
+
+const uint8 MaxLogFilter = 43;
+
+// Values assigned have their equivalent in enum ACE_Log_Priority
+enum LogLevel
+{
+ LOG_LEVEL_DISABLED = 0,
+ LOG_LEVEL_TRACE = 1,
+ LOG_LEVEL_DEBUG = 2,
+ LOG_LEVEL_INFO = 3,
+ LOG_LEVEL_WARN = 4,
+ LOG_LEVEL_ERROR = 5,
+ LOG_LEVEL_FATAL = 6
+};
+
+const uint8 MaxLogLevels = 6;
+
+enum AppenderType
+{
+ APPENDER_NONE,
+ APPENDER_CONSOLE,
+ APPENDER_FILE,
+ APPENDER_DB
+};
+
+enum AppenderFlags
+{
+ APPENDER_FLAGS_NONE = 0x00,
+ APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01,
+ APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02,
+ APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04,
+ APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender
+ APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender
+};
+
+struct LogMessage
+{
+ LogMessage(LogLevel _level, LogFilterType _type, std::string _text)
+ : level(_level)
+ , type(_type)
+ , text(_text)
+ {
+ mtime = time(NULL);
+ }
+
+ static std::string getTimeStr(time_t time);
+ std::string getTimeStr();
+
+ LogLevel level;
+ LogFilterType type;
+ std::string text;
+ std::string prefix;
+ std::string param1;
+ time_t mtime;
+};
+
+class Appender
+{
+ public:
+ Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE);
+ virtual ~Appender();
+
+ uint8 getId() const;
+ std::string const& getName() const;
+ AppenderType getType() const;
+ LogLevel getLogLevel() const;
+ AppenderFlags getFlags() const;
+
+ void setLogLevel(LogLevel);
+ void write(LogMessage& message);
+ static const char* getLogLevelString(LogLevel level);
+ static const char* getLogFilterTypeString(LogFilterType type);
+
+ private:
+ virtual void _write(LogMessage& /*message*/) = 0;
+
+ uint8 id;
+ std::string name;
+ AppenderType type;
+ LogLevel level;
+ AppenderFlags flags;
+};
+
+typedef std::map<uint8, Appender*> AppenderMap;
+
+#endif
diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp
new file mode 100644
index 00000000000..be6dc6c807f
--- /dev/null
+++ b/src/server/shared/Logging/AppenderConsole.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2008-2012 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 "AppenderConsole.h"
+#include "Config.h"
+#include "Util.h"
+
+#include <sstream>
+
+AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags):
+Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false)
+{
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ _colors[i] = ColorTypes(MaxColors);
+}
+
+void AppenderConsole::InitColors(std::string const& str)
+{
+ if (str.empty())
+ {
+ _colored = false;
+ return;
+ }
+
+ int color[MaxLogLevels];
+
+ std::istringstream ss(str);
+
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ {
+ ss >> color[i];
+
+ if (!ss)
+ return;
+
+ if (color[i] < 0 || color[i] >= MaxColors)
+ return;
+ }
+
+ for (uint8 i = 0; i < MaxLogLevels; ++i)
+ _colors[i] = ColorTypes(color[i]);
+
+ _colored = true;
+}
+
+void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
+{
+ #if PLATFORM == PLATFORM_WINDOWS
+ static WORD WinColorFG[MaxColors] =
+ {
+ 0, // BLACK
+ FOREGROUND_RED, // RED
+ FOREGROUND_GREEN, // GREEN
+ FOREGROUND_RED | FOREGROUND_GREEN, // BROWN
+ FOREGROUND_BLUE, // BLUE
+ FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA
+ FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE
+ // YELLOW
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
+ // RED_BOLD
+ FOREGROUND_RED | FOREGROUND_INTENSITY,
+ // GREEN_BOLD
+ FOREGROUND_GREEN | FOREGROUND_INTENSITY,
+ FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD
+ // MAGENTA_BOLD
+ FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
+ // CYAN_BOLD
+ FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
+ // WHITE_BOLD
+ FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
+ };
+
+ HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
+ SetConsoleTextAttribute(hConsole, WinColorFG[color]);
+ #else
+ enum ANSITextAttr
+ {
+ TA_NORMAL = 0,
+ TA_BOLD = 1,
+ TA_BLINK = 5,
+ TA_REVERSE = 7
+ };
+
+ enum ANSIFgTextAttr
+ {
+ FG_BLACK = 30,
+ FG_RED,
+ FG_GREEN,
+ FG_BROWN,
+ FG_BLUE,
+ FG_MAGENTA,
+ FG_CYAN,
+ FG_WHITE,
+ FG_YELLOW
+ };
+
+ enum ANSIBgTextAttr
+ {
+ BG_BLACK = 40,
+ BG_RED,
+ BG_GREEN,
+ BG_BROWN,
+ BG_BLUE,
+ BG_MAGENTA,
+ BG_CYAN,
+ BG_WHITE
+ };
+
+ static uint8 UnixColorFG[MaxColors] =
+ {
+ FG_BLACK, // BLACK
+ FG_RED, // RED
+ FG_GREEN, // GREEN
+ FG_BROWN, // BROWN
+ FG_BLUE, // BLUE
+ FG_MAGENTA, // MAGENTA
+ FG_CYAN, // CYAN
+ FG_WHITE, // WHITE
+ FG_YELLOW, // YELLOW
+ FG_RED, // LRED
+ FG_GREEN, // LGREEN
+ FG_BLUE, // LBLUE
+ FG_MAGENTA, // LMAGENTA
+ FG_CYAN, // LCYAN
+ FG_WHITE // LWHITE
+ };
+
+ fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < MaxColors ? ";1" : ""));
+ #endif
+}
+
+void AppenderConsole::ResetColor(bool stdout_stream)
+{
+ #if PLATFORM == PLATFORM_WINDOWS
+ HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
+ SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
+ #else
+ fprintf((stdout_stream ? stdout : stderr), "\x1b[0m");
+ #endif
+}
+
+void AppenderConsole::_write(LogMessage& message)
+{
+ bool stdout_stream = message.level == LOG_LEVEL_ERROR || message.level == LOG_LEVEL_FATAL;
+
+ if (_colored)
+ {
+ uint8 index;
+ switch (message.level)
+ {
+ case LOG_LEVEL_TRACE:
+ index = 5;
+ break;
+ case LOG_LEVEL_DEBUG:
+ index = 4;
+ break;
+ case LOG_LEVEL_INFO:
+ index = 3;
+ break;
+ case LOG_LEVEL_WARN:
+ index = 2;
+ break;
+ case LOG_LEVEL_FATAL:
+ index = 0;
+ break;
+ case LOG_LEVEL_ERROR: // No break on purpose
+ default:
+ index = 1;
+ break;
+ }
+
+ SetColor(stdout_stream, _colors[index]);
+ utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str());
+ ResetColor(stdout_stream);
+ }
+ else
+ utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str());
+}
diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h
new file mode 100644
index 00000000000..ad7d9543cdb
--- /dev/null
+++ b/src/server/shared/Logging/AppenderConsole.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef APPENDERCONSOLE_H
+#define APPENDERCONSOLE_H
+
+#include "Appender.h"
+#include <string>
+
+enum ColorTypes
+{
+ BLACK,
+ RED,
+ GREEN,
+ BROWN,
+ BLUE,
+ MAGENTA,
+ CYAN,
+ GREY,
+ YELLOW,
+ LRED,
+ LGREEN,
+ LBLUE,
+ LMAGENTA,
+ LCYAN,
+ WHITE
+};
+
+const uint8 MaxColors = uint8(WHITE) + 1;
+
+class AppenderConsole: public Appender
+{
+ public:
+ AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags);
+ void InitColors(const std::string& init_str);
+
+ private:
+ void SetColor(bool stdout_stream, ColorTypes color);
+ void ResetColor(bool stdout_stream);
+ void _write(LogMessage& message);
+ bool _colored;
+ ColorTypes _colors[MaxLogLevels];
+};
+
+#endif
diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp
new file mode 100644
index 00000000000..d85a4db9f7a
--- /dev/null
+++ b/src/server/shared/Logging/AppenderDB.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008-2012 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 "AppenderDB.h"
+#include "Database/DatabaseEnv.h"
+
+AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId):
+Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false)
+{
+}
+
+AppenderDB::~AppenderDB()
+{
+}
+
+void AppenderDB::_write(LogMessage& message)
+{
+ if (!enable)
+ return;
+ switch (message.type)
+ {
+ case LOG_FILTER_SQL:
+ case LOG_FILTER_SQL_DRIVER:
+ case LOG_FILTER_SQL_DEV:
+ break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type
+ default:
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
+ stmt->setUInt64(0, message.mtime);
+ stmt->setUInt32(1, realm);
+ stmt->setUInt8(2, message.type);
+ stmt->setUInt8(3, message.level);
+ stmt->setString(4, message.text);
+ LoginDatabase.Execute(stmt);
+ break;
+ }
+}
+
+void AppenderDB::setEnable(bool _enable)
+{
+ enable = _enable;
+}
diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h
new file mode 100644
index 00000000000..4399195b181
--- /dev/null
+++ b/src/server/shared/Logging/AppenderDB.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef APPENDERDB_H
+#define APPENDERDB_H
+
+#include "Appender.h"
+
+class AppenderDB: public Appender
+{
+ public:
+ AppenderDB(uint8 _id, std::string const& _name, LogLevel level, uint8 realmId);
+ ~AppenderDB();
+ void setEnable(bool enable);
+
+ private:
+ uint8 realm;
+ bool enable;
+ void _write(LogMessage& message);
+};
+
+#endif
diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp
new file mode 100644
index 00000000000..67adff39aae
--- /dev/null
+++ b/src/server/shared/Logging/AppenderFile.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2008-2012 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 "AppenderFile.h"
+#include "Common.h"
+
+AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags)
+ : Appender(id, name, APPENDER_FILE, level, _flags)
+ , filename(_filename)
+ , logDir(_logDir)
+ , mode(_mode)
+{
+ dynamicName = std::string::npos != filename.find("%s");
+ backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP;
+
+ logfile = !dynamicName ? OpenFile(_filename, _mode, backup) : NULL;
+}
+
+AppenderFile::~AppenderFile()
+{
+ if (logfile)
+ {
+ fclose(logfile);
+ logfile = NULL;
+ }
+}
+
+void AppenderFile::_write(LogMessage& message)
+{
+ if (dynamicName)
+ {
+ char namebuf[TRINITY_PATH_MAX];
+ snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1.c_str());
+ logfile = OpenFile(namebuf, mode, backup);
+ }
+
+ if (logfile)
+ {
+ fprintf(logfile, "%s%s", message.prefix.c_str(), message.text.c_str());
+ fflush(logfile);
+
+ if (dynamicName)
+ {
+ fclose(logfile);
+ logfile = NULL;
+ }
+ }
+}
+
+FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup)
+{
+ if (mode == "w" && backup)
+ {
+ std::string newName(filename);
+ newName.push_back('.');
+ newName.append(LogMessage::getTimeStr(time(NULL)));
+ rename(filename.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore
+ }
+ return fopen((logDir + filename).c_str(), mode.c_str());
+}
diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h
new file mode 100644
index 00000000000..e9cb858f625
--- /dev/null
+++ b/src/server/shared/Logging/AppenderFile.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef APPENDERFILE_H
+#define APPENDERFILE_H
+
+#include "Appender.h"
+
+class AppenderFile: public Appender
+{
+ public:
+ AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags);
+ ~AppenderFile();
+ FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup);
+
+ private:
+ void _write(LogMessage& message);
+ FILE* logfile;
+ std::string filename;
+ std::string logDir;
+ std::string mode;
+ bool dynamicName;
+ bool backup;
+};
+
+#endif
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index 79eab053d08..d8914ac8ee0 100755..100644
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,343 +16,277 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "Log.h"
-#include "Configuration/Config.h"
+#include "Common.h"
+#include "Config.h"
#include "Util.h"
+#include "AppenderConsole.h"
+#include "AppenderFile.h"
+#include "AppenderDB.h"
+#include "LogOperation.h"
-#include "Implementation/LoginDatabase.h" // For logging
-extern LoginDatabaseWorkerPool LoginDatabase;
-
-#include <stdarg.h>
-#include <stdio.h>
+#include <cstdarg>
+#include <cstdio>
+#include <sstream>
-Log::Log() :
- raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
- dberLogfile(NULL), chatLogfile(NULL), arenaLogFile(NULL), sqlLogFile(NULL), sqlDevLogFile(NULL), wardenLogFile(NULL),
- m_gmlog_per_account(false), m_enableLogDBLater(false),
- m_enableLogDB(false), m_colored(false)
+Log::Log() : worker(NULL)
{
- Initialize();
+ SetRealmID(0);
+ m_logsTimestamp = "_" + GetTimestampStr();
+ LoadFromConfig();
}
Log::~Log()
{
- if (logfile != NULL)
- fclose(logfile);
- logfile = NULL;
-
- if (gmLogfile != NULL)
- fclose(gmLogfile);
- gmLogfile = NULL;
-
- if (charLogfile != NULL)
- fclose(charLogfile);
- charLogfile = NULL;
-
- if (dberLogfile != NULL)
- fclose(dberLogfile);
- dberLogfile = NULL;
-
- if (raLogfile != NULL)
- fclose(raLogfile);
- raLogfile = NULL;
-
- if (chatLogfile != NULL)
- fclose(chatLogfile);
- chatLogfile = NULL;
-
- if (arenaLogFile != NULL)
- fclose(arenaLogFile);
- arenaLogFile = NULL;
-
- if (sqlLogFile != NULL)
- fclose(sqlLogFile);
- sqlLogFile = NULL;
-
- if (sqlDevLogFile != NULL)
- fclose(sqlDevLogFile);
- sqlDevLogFile = NULL;
+ Close();
+}
- if (wardenLogFile != NULL)
- fclose(wardenLogFile);
- wardenLogFile = NULL;
+uint8 Log::NextAppenderId()
+{
+ return AppenderId++;
}
-void Log::SetLogLevel(char *Level)
+int32 GetConfigIntDefault(std::string base, const char* name, int32 value)
{
- int32 NewLevel = atoi((char*)Level);
- if (NewLevel < 0)
- NewLevel = 0;
- m_logLevel = NewLevel;
+ base.append(name);
+ return ConfigMgr::GetIntDefault(base.c_str(), value);
+}
- outString("LogLevel is %u", m_logLevel);
+std::string GetConfigStringDefault(std::string base, const char* name, const char* value)
+{
+ base.append(name);
+ return ConfigMgr::GetStringDefault(base.c_str(), value);
}
-void Log::SetLogFileLevel(char *Level)
+// Returns default logger if the requested logger is not found
+Logger* Log::GetLoggerByType(LogFilterType filter)
{
- int32 NewLevel = atoi((char*)Level);
- if (NewLevel < 0)
- NewLevel = 0;
- m_logFileLevel = NewLevel;
+ LoggerMap::iterator it = loggers.begin();
+ while (it != loggers.end() && it->second.getType() != filter)
+ ++it;
- outString("LogFileLevel is %u", m_logFileLevel);
+ return it == loggers.end() ? &(loggers[0]) : &(it->second);
}
-void Log::SetDBLogLevel(char *Level)
+Appender* Log::GetAppenderByName(std::string const& name)
{
- int32 NewLevel = atoi((char*)Level);
- if (NewLevel < 0)
- NewLevel = 0;
- m_dbLogLevel = NewLevel;
+ AppenderMap::iterator it = appenders.begin();
+ while (it != appenders.end() && it->second && it->second->getName() != name)
+ ++it;
- outString("DBLogLevel is %u", m_dbLogLevel);
+ return it == appenders.end() ? NULL : it->second;
}
-void Log::Initialize()
+void Log::CreateAppenderFromConfig(const char* name)
{
- /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs
- m_dbChar = ConfigMgr::GetBoolDefault("LogDB.Char", false);
- m_dbRA = ConfigMgr::GetBoolDefault("LogDB.RA", false);
- m_dbGM = ConfigMgr::GetBoolDefault("LogDB.GM", false);
- m_dbChat = ConfigMgr::GetBoolDefault("LogDB.Chat", false);
+ if (!name || *name == '\0')
+ return;
- /// Realm must be 0 by default
- SetRealmID(0);
+ // Format=type,level,flags,optional1,optional2
+ // if type = File. optional1 = file and option2 = mode
+ // if type = Console. optional1 = Color
+ std::string options = "Appender.";
+ options.append(name);
+ options = ConfigMgr::GetStringDefault(options.c_str(), "");
+ Tokenizer tokens(options, ',');
+ Tokenizer::const_iterator iter = tokens.begin();
- /// Common log files data
- m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
- if (!m_logsDir.empty())
- if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
- m_logsDir.push_back('/');
+ if (tokens.size() < 2)
+ {
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str());
+ return;
+ }
- m_logsTimestamp = "_" + GetTimestampStr();
+ AppenderFlags flags = APPENDER_FLAGS_NONE;
+ AppenderType type = AppenderType(atoi(*iter));
+ ++iter;
+ LogLevel level = LogLevel(atoi(*iter));
+ if (level > LOG_LEVEL_FATAL)
+ {
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name);
+ return;
+ }
- /// Open specific log files
- logfile = openLogFile("LogFile", "LogTimestamp", "w");
- InitColors(ConfigMgr::GetStringDefault("LogColors", ""));
+ if (++iter != tokens.end())
+ flags = AppenderFlags(atoi(*iter));
- m_gmlog_per_account = ConfigMgr::GetBoolDefault("GmLogPerAccount", false);
- if (!m_gmlog_per_account)
- gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a");
- else
+ switch (type)
{
- // GM log settings for per account case
- m_gmlog_filename_format = ConfigMgr::GetStringDefault("GMLogFile", "");
- if (!m_gmlog_filename_format.empty())
+ case APPENDER_CONSOLE:
+ {
+ AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags);
+ appenders[appender->getId()] = appender;
+ if (++iter != tokens.end())
+ appender->InitColors(*iter);
+ //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe
+ break;
+ }
+ case APPENDER_FILE:
{
- bool m_gmlog_timestamp = ConfigMgr::GetBoolDefault("GmLogTimestamp", false);
+ std::string filename;
+ std::string mode = "a";
- size_t dot_pos = m_gmlog_filename_format.find_last_of('.');
- if (dot_pos!=m_gmlog_filename_format.npos)
+ if (++iter == tokens.end())
{
- if (m_gmlog_timestamp)
- m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp);
-
- m_gmlog_filename_format.insert(dot_pos, "_#%u");
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name);
+ return;
}
- else
- {
- m_gmlog_filename_format += "_#%u";
- if (m_gmlog_timestamp)
- m_gmlog_filename_format += m_logsTimestamp;
+ filename = *iter;
+
+ if (++iter != tokens.end())
+ mode = *iter;
+
+ if (flags & APPENDER_FLAGS_USE_TIMESTAMP)
+ {
+ size_t dot_pos = filename.find_last_of(".");
+ if (dot_pos != filename.npos)
+ filename.insert(dot_pos, m_logsTimestamp);
+ else
+ filename += m_logsTimestamp;
}
- m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
+ uint8 id = NextAppenderId();
+ appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags);
+ //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe
+ break;
}
- }
-
- charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a");
- dberLogfile = openLogFile("DBErrorLogFile", NULL, "a");
- raLogfile = openLogFile("RaLogFile", NULL, "a");
- chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
- arenaLogFile = openLogFile("ArenaLogFile", NULL, "a");
- sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a");
- sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a");
- wardenLogFile = openLogFile("Warden.LogFile",NULL,"a");
-
- // Main log file settings
- m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL);
- m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL);
- m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL);
- m_sqlDriverQueryLogging = ConfigMgr::GetBoolDefault("SQLDriverQueryLogging", false);
-
- m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE));
-
- // Char log settings
- m_charLog_Dump = ConfigMgr::GetBoolDefault("CharLogDump", false);
- m_charLog_Dump_Separate = ConfigMgr::GetBoolDefault("CharLogDump.Separate", false);
- if (m_charLog_Dump_Separate)
- {
- m_dumpsDir = ConfigMgr::GetStringDefault("CharLogDump.SeparateDir", "");
- if (!m_dumpsDir.empty())
- if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
- m_dumpsDir.push_back('/');
+ case APPENDER_DB:
+ {
+ uint8 id = NextAppenderId();
+ appenders[id] = new AppenderDB(id, name, level, realm);
+ break;
+ }
+ default:
+ fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name);
+ break;
}
}
-void Log::ReloadConfig()
+void Log::CreateLoggerFromConfig(const char* name)
{
- m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL);
- m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL);
- m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL);
+ if (!name || *name == '\0')
+ return;
- m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE));
-}
+ LogLevel level = LOG_LEVEL_DISABLED;
+ int32 type = -1;
-FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode)
-{
- std::string logfn=ConfigMgr::GetStringDefault(configFileName, "");
- if (logfn.empty())
- return NULL;
+ std::string options = "Logger.";
+ options.append(name);
+ options = ConfigMgr::GetStringDefault(options.c_str(), "");
- if (configTimeStampFlag && ConfigMgr::GetBoolDefault(configTimeStampFlag, false))
+ if (options.empty())
{
- size_t dot_pos = logfn.find_last_of(".");
- if (dot_pos!=logfn.npos)
- logfn.insert(dot_pos, m_logsTimestamp);
- else
- logfn += m_logsTimestamp;
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name);
+ return;
}
- return fopen((m_logsDir+logfn).c_str(), mode);
-}
+ Tokenizer tokens(options, ',');
+ Tokenizer::const_iterator iter = tokens.begin();
-FILE* Log::openGmlogPerAccount(uint32 account)
-{
- if (m_gmlog_filename_format.empty())
- return NULL;
+ if (tokens.size() != 3)
+ {
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name, options.c_str());
+ return;
+ }
- char namebuf[TRINITY_PATH_MAX];
- snprintf(namebuf, TRINITY_PATH_MAX, m_gmlog_filename_format.c_str(), account);
- return fopen(namebuf, "a");
-}
+ type = atoi(*iter);
+ if (type > MaxLogFilter)
+ {
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name);
+ return;
+ }
-void Log::outTimestamp(FILE* file)
-{
- time_t t = time(NULL);
- tm* aTm = localtime(&t);
- // YYYY year
- // MM month (2 digits 01-12)
- // DD day (2 digits 01-31)
- // HH hour (2 digits 00-23)
- // MM minutes (2 digits 00-59)
- // SS seconds (2 digits 00-59)
- fprintf(file, "%-4d-%02d-%02d %02d:%02d:%02d ", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec);
-}
+ Logger& logger = loggers[type];
+ if (!logger.getName().empty())
+ {
+ fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name);
+ return;
+ }
-void Log::InitColors(const std::string& str)
-{
- if (str.empty())
+ ++iter;
+ level = LogLevel(atoi(*iter));
+ if (level > LOG_LEVEL_FATAL)
{
- m_colored = false;
+ fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name);
return;
}
- int color[4];
+ logger.Create(name, LogFilterType(type), level);
+ //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe
- std::istringstream ss(str);
+ ++iter;
+ std::istringstream ss(*iter);
+ std::string str;
- for (uint8 i = 0; i < LogLevels; ++i)
+ ss >> str;
+ while (ss)
{
- ss >> color[i];
-
- if (!ss)
- return;
-
- if (color[i] < 0 || color[i] >= Colors)
- return;
+ if (Appender* appender = GetAppenderByName(str))
+ {
+ logger.addAppender(appender->getId(), appender);
+ //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name); // DEBUG - RemoveMe
+ }
+ else
+ fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name);
+ ss >> str;
}
+}
- for (uint8 i = 0; i < LogLevels; ++i)
- m_colors[i] = ColorTypes(color[i]);
+void Log::ReadAppendersFromConfig()
+{
+ std::istringstream ss(ConfigMgr::GetStringDefault("Appenders", ""));
+ std::string name;
- m_colored = true;
+ do
+ {
+ ss >> name;
+ CreateAppenderFromConfig(name.c_str());
+ name = "";
+ }
+ while (ss);
}
-void Log::SetColor(bool stdout_stream, ColorTypes color)
+void Log::ReadLoggersFromConfig()
{
- #if PLATFORM == PLATFORM_WINDOWS
- static WORD WinColorFG[Colors] =
- {
- 0, // BLACK
- FOREGROUND_RED, // RED
- FOREGROUND_GREEN, // GREEN
- FOREGROUND_RED | FOREGROUND_GREEN, // BROWN
- FOREGROUND_BLUE, // BLUE
- FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA
- FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE
- // YELLOW
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
- // RED_BOLD
- FOREGROUND_RED | FOREGROUND_INTENSITY,
- // GREEN_BOLD
- FOREGROUND_GREEN | FOREGROUND_INTENSITY,
- FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD
- // MAGENTA_BOLD
- FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- // CYAN_BOLD
- FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
- // WHITE_BOLD
- FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
- };
-
- HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE );
- SetConsoleTextAttribute(hConsole, WinColorFG[color]);
- #else
- enum ANSITextAttr
- {
- TA_NORMAL=0,
- TA_BOLD=1,
- TA_BLINK=5,
- TA_REVERSE=7
- };
+ std::istringstream ss(ConfigMgr::GetStringDefault("Loggers", ""));
+ std::string name;
- enum ANSIFgTextAttr
+ do
{
- FG_BLACK=30, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE,
- FG_MAGENTA, FG_CYAN, FG_WHITE, FG_YELLOW
- };
+ ss >> name;
+ CreateLoggerFromConfig(name.c_str());
+ name = "";
+ }
+ while (ss);
- enum ANSIBgTextAttr
- {
- BG_BLACK=40, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE,
- BG_MAGENTA, BG_CYAN, BG_WHITE
- };
+ // root logger must exist. Marking as disabled as its not configured
+ if (loggers.find(LOG_FILTER_GENERAL) == loggers.end())
+ loggers[LOG_FILTER_GENERAL].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED);
+}
- static uint8 UnixColorFG[Colors] =
- {
- FG_BLACK, // BLACK
- FG_RED, // RED
- FG_GREEN, // GREEN
- FG_BROWN, // BROWN
- FG_BLUE, // BLUE
- FG_MAGENTA, // MAGENTA
- FG_CYAN, // CYAN
- FG_WHITE, // WHITE
- FG_YELLOW, // YELLOW
- FG_RED, // LRED
- FG_GREEN, // LGREEN
- FG_BLUE, // LBLUE
- FG_MAGENTA, // LMAGENTA
- FG_CYAN, // LCYAN
- FG_WHITE // LWHITE
- };
-
- fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < Colors ? ";1" : ""));
- #endif
+void Log::EnableDBAppenders()
+{
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ if (it->second && it->second->getType() == APPENDER_DB)
+ ((AppenderDB *)it->second)->setEnable(true);
}
-void Log::ResetColor(bool stdout_stream)
+void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list argptr)
{
- #if PLATFORM == PLATFORM_WINDOWS
- HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE );
- SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED );
- #else
- fprintf(( stdout_stream ? stdout : stderr ), "\x1b[0m");
- #endif
+ char text[MAX_QUERY_LEN];
+ vsnprintf(text, MAX_QUERY_LEN, str, argptr);
+ write(new LogMessage(level, filter, text));
+}
+
+void Log::write(LogMessage* msg)
+{
+ if (worker)
+ {
+ msg->text.append("\n");
+ Logger* logger = GetLoggerByType(msg->type);
+ worker->enqueue(new LogOperation(logger, msg));
+ }
}
std::string Log::GetTimestampStr()
@@ -370,710 +304,192 @@ std::string Log::GetTimestampStr()
return std::string(buf);
}
-void Log::outDB(LogTypes type, const char * str)
-{
- if (!str || type >= MAX_LOG_TYPES)
- return;
-
- std::string logStr(str);
- if (logStr.empty())
- return;
-
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
-
- stmt->setInt32(0, realm);
- stmt->setUInt8(1, uint8(type));
- stmt->setString(2, logStr);
-
- LoginDatabase.Execute(stmt);
-}
-
-void Log::outString(const char * str, ...)
+bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */)
{
- if (!str)
- return;
-
- if (m_enableLogDB)
- {
- // we don't want empty strings in the DB
- std::string s(str);
- if (s.empty() || s == " ")
- return;
-
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_STRING, nnew_str);
- va_end(ap2);
- }
-
- if (m_colored)
- SetColor(true, m_colors[LOGL_NORMAL]);
-
- va_list ap;
-
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
-
- printf("\n");
- if (logfile)
- {
- outTimestamp(logfile);
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- fprintf(logfile, "\n");
- va_end(ap);
-
- fflush(logfile);
- }
- fflush(stdout);
-}
+ LogLevel newLevel = LogLevel(atoi(newLevelc));
+ if (newLevel < 0)
+ return false;
-void Log::outString()
-{
- printf("\n");
- if (logfile)
+ if (isLogger)
{
- outTimestamp(logfile);
- fprintf(logfile, "\n");
- fflush(logfile);
- }
- fflush(stdout);
-}
+ LoggerMap::iterator it = loggers.begin();
+ while (it != loggers.end() && it->second.getName() != name)
+ ++it;
-void Log::outCrash(const char * err, ...)
-{
- if (!err)
- return;
+ if (it == loggers.end())
+ return false;
- if (m_enableLogDB)
- {
- va_list ap2;
- va_start(ap2, err);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2);
- outDB(LOG_TYPE_CRASH, nnew_str);
- va_end(ap2);
+ it->second.setLogLevel(newLevel);
}
-
- if (m_colored)
- SetColor(false, LRED);
-
- va_list ap;
-
- va_start(ap, err);
- vutf8printf(stderr, err, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(false);
-
- fprintf(stderr, "\n");
- if (logfile)
+ else
{
- outTimestamp(logfile);
- fprintf(logfile, "CRASH ALERT: ");
+ Appender* appender = GetAppenderByName(name);
+ if (!appender)
+ return false;
- va_start(ap, err);
- vfprintf(logfile, err, ap);
- va_end(ap);
-
- fprintf(logfile, "\n");
- fflush(logfile);
+ appender->setLogLevel(newLevel);
}
- fflush(stderr);
+ return true;
}
-void Log::outError(const char * err, ...)
+bool Log::ShouldLog(LogFilterType type, LogLevel level) const
{
- if (!err)
- return;
-
- if (m_enableLogDB)
- {
- va_list ap2;
- va_start(ap2, err);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2);
- outDB(LOG_TYPE_ERROR, nnew_str);
- va_end(ap2);
- }
-
- if (m_colored)
- SetColor(false, LRED);
-
- va_list ap;
-
- va_start(ap, err);
- vutf8printf(stderr, err, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(false);
-
- fprintf( stderr, "\n");
- if (logfile)
+ LoggerMap::const_iterator it = loggers.find(type);
+ if (it != loggers.end())
{
- outTimestamp(logfile);
- fprintf(logfile, "ERROR: ");
-
- va_start(ap, err);
- vfprintf(logfile, err, ap);
- va_end(ap);
-
- fprintf(logfile, "\n");
- fflush(logfile);
+ LogLevel loggerLevel = it->second.getLogLevel();
+ return loggerLevel && loggerLevel <= level;
}
- fflush(stderr);
-}
-void Log::outArena(const char * str, ...)
-{
- if (!str)
- return;
+ if (type != LOG_FILTER_GENERAL)
+ return ShouldLog(LOG_FILTER_GENERAL, level);
- if (arenaLogFile)
- {
- va_list ap;
- outTimestamp(arenaLogFile);
- va_start(ap, str);
- vfprintf(arenaLogFile, str, ap);
- fprintf(arenaLogFile, "\n");
- va_end(ap);
- fflush(arenaLogFile);
- }
+ return false;
}
-void Log::outSQLDriver(const char* str, ...)
+void Log::outTrace(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_TRACE))
return;
va_list ap;
va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- printf("\n");
-
- if (sqlLogFile)
- {
- outTimestamp(sqlLogFile);
- va_list apSQL;
- va_start(apSQL, str);
- vfprintf(sqlLogFile, str, apSQL);
- va_end(apSQL);
+ vlog(filter, LOG_LEVEL_TRACE, str, ap);
- fprintf(sqlLogFile, "\n");
- fflush(sqlLogFile);
- }
-
- fflush(stdout);
+ va_end(ap);
}
-void Log::outErrorDb(const char * err, ...)
+void Log::outDebug(LogFilterType filter, const char * str, ...)
{
- if (!err)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_DEBUG))
return;
- if (m_colored)
- SetColor(false, LRED);
-
va_list ap;
+ va_start(ap, str);
- va_start(ap, err);
- vutf8printf(stderr, err, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(false);
-
- fprintf( stderr, "\n" );
-
- if (logfile)
- {
- outTimestamp(logfile);
- fprintf(logfile, "ERROR: " );
-
- va_start(ap, err);
- vfprintf(logfile, err, ap);
- va_end(ap);
-
- fprintf(logfile, "\n" );
- fflush(logfile);
- }
-
- if (dberLogfile)
- {
- outTimestamp(dberLogfile);
- va_start(ap, err);
- vfprintf(dberLogfile, err, ap);
- va_end(ap);
+ vlog(filter, LOG_LEVEL_DEBUG, str, ap);
- fprintf(dberLogfile, "\n" );
- fflush(dberLogfile);
- }
- fflush(stderr);
+ va_end(ap);
}
-void Log::outBasic(const char * str, ...)
+void Log::outInfo(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_INFO))
return;
- if (m_enableLogDB && m_dbLogLevel > LOGL_NORMAL)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_BASIC, nnew_str);
- va_end(ap2);
- }
-
- if (m_logLevel > LOGL_NORMAL)
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_BASIC]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
+ va_list ap;
+ va_start(ap, str);
- printf("\n");
+ vlog(filter, LOG_LEVEL_INFO, str, ap);
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- fprintf(logfile, "\n" );
- va_end(ap2);
- fflush(logfile);
- }
- }
- fflush(stdout);
+ va_end(ap);
}
-void Log::outDetail(const char * str, ...)
+void Log::outWarn(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_WARN))
return;
- if (m_enableLogDB && m_dbLogLevel > LOGL_BASIC)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_DETAIL, nnew_str);
- va_end(ap2);
- }
-
- if (m_logLevel > LOGL_BASIC)
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_DETAIL]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
+ va_list ap;
+ va_start(ap, str);
- printf("\n");
+ vlog(filter, LOG_LEVEL_WARN, str, ap);
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
-
- fprintf(logfile, "\n");
- fflush(logfile);
- }
- }
-
- fflush(stdout);
+ va_end(ap);
}
-void Log::outDebugInLine(const char * str, ...)
+void Log::outError(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_ERROR))
return;
- if (m_logLevel > LOGL_DETAIL)
- {
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
+ va_list ap;
+ va_start(ap, str);
- //if (m_colored)
- // ResetColor(true);
+ vlog(filter, LOG_LEVEL_ERROR, str, ap);
- if (logfile)
- {
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
- }
- }
+ va_end(ap);
}
-void Log::outSQLDev(const char* str, ...)
+void Log::outFatal(LogFilterType filter, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(filter, LOG_LEVEL_FATAL))
return;
va_list ap;
va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- printf("\n");
- if (sqlDevLogFile)
- {
- va_list ap2;
- va_start(ap2, str);
- vfprintf(sqlDevLogFile, str, ap2);
- va_end(ap2);
-
- fprintf(sqlDevLogFile, "\n");
- fflush(sqlDevLogFile);
- }
+ vlog(filter, LOG_LEVEL_FATAL, str, ap);
- fflush(stdout);
+ va_end(ap);
}
-void Log::outDebug(DebugLogFilters f, const char * str, ...)
+void Log::outCharDump(char const* str, uint32 accountId, uint32 guid, char const* name)
{
- if (!(m_DebugLogMask & f))
- return;
-
- if (!str)
+ if (!str || !ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO))
return;
- if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_DEBUG, nnew_str);
- va_end(ap2);
- }
-
- if ( m_logLevel > LOGL_DETAIL )
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_DEBUG]);
+ std::ostringstream ss;
+ ss << "== START DUMP == (account: " << accountId << " guid: " << guid << " name: " << name
+ << ")\n" << str << "\n== END DUMP ==\n";
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
+ LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, ss.str());
+ std::ostringstream param;
+ param << guid << '_' << name;
- if (m_colored)
- ResetColor(true);
+ msg->param1 = param.str();
- printf( "\n" );
-
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
-
- fprintf(logfile, "\n" );
- fflush(logfile);
- }
- }
- fflush(stdout);
+ write(msg);
}
-void Log::outStaticDebug(const char * str, ...)
-{
- if (!str)
- return;
-
- if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_DEBUG, nnew_str);
- va_end(ap2);
- }
-
- if ( m_logLevel > LOGL_DETAIL )
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_DEBUG]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
-
- printf( "\n" );
-
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- va_end(ap2);
-
- fprintf(logfile, "\n" );
- fflush(logfile);
- }
- }
- fflush(stdout);
-}
-
-void Log::outStringInLine(const char * str, ...)
+void Log::outCommand(uint32 account, const char * str, ...)
{
- if (!str)
+ if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO))
return;
va_list ap;
-
va_start(ap, str);
- vutf8printf(stdout, str, &ap);
+ char text[MAX_QUERY_LEN];
+ vsnprintf(text, MAX_QUERY_LEN, str, ap);
va_end(ap);
- if (logfile)
- {
- va_start(ap, str);
- vfprintf(logfile, str, ap);
- va_end(ap);
- }
-}
-
-void Log::outCommand(uint32 account, const char * str, ...)
-{
- if (!str)
- return;
-
- // TODO: support accountid
- if (m_enableLogDB && m_dbGM)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_GM, nnew_str);
- va_end(ap2);
- }
-
- if (m_logLevel > LOGL_NORMAL)
- {
- if (m_colored)
- SetColor(true, m_colors[LOGL_BASIC]);
-
- va_list ap;
- va_start(ap, str);
- vutf8printf(stdout, str, &ap);
- va_end(ap);
-
- if (m_colored)
- ResetColor(true);
-
- printf("\n");
-
- if (logfile)
- {
- outTimestamp(logfile);
- va_list ap2;
- va_start(ap2, str);
- vfprintf(logfile, str, ap2);
- fprintf(logfile, "\n" );
- va_end(ap2);
- fflush(logfile);
- }
- }
-
- if (m_gmlog_per_account)
- {
- if (FILE* per_file = openGmlogPerAccount (account))
- {
- outTimestamp(per_file);
- va_list ap;
- va_start(ap, str);
- vfprintf(per_file, str, ap);
- fprintf(per_file, "\n" );
- va_end(ap);
- fclose(per_file);
- }
- }
- else if (gmLogfile)
- {
- outTimestamp(gmLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(gmLogfile, str, ap);
- fprintf(gmLogfile, "\n" );
- va_end(ap);
- fflush(gmLogfile);
- }
-
- fflush(stdout);
-}
-
-void Log::outChar(const char * str, ...)
-{
- if (!str)
- return;
-
- if (m_enableLogDB && m_dbChar)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_CHAR, nnew_str);
- va_end(ap2);
- }
+ LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text);
- if (charLogfile)
- {
- outTimestamp(charLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(charLogfile, str, ap);
- fprintf(charLogfile, "\n" );
- va_end(ap);
- fflush(charLogfile);
- }
-}
+ std::ostringstream ss;
+ ss << account;
+ msg->param1 = ss.str();
-void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name)
-{
- FILE* file = NULL;
- if (m_charLog_Dump_Separate)
- {
- char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0
- snprintf(fileName, 29, "%d_%s.log", guid, name);
- std::string sFileName(m_dumpsDir);
- sFileName.append(fileName);
- file = fopen((m_logsDir + sFileName).c_str(), "w");
- }
- else
- file = charLogfile;
- if (file)
- {
- fprintf(file, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n",
- account_id, guid, name, str);
- fflush(file);
- if (m_charLog_Dump_Separate)
- fclose(file);
- }
+ write(msg);
}
-void Log::outRemote(const char * str, ...)
+void Log::SetRealmID(uint32 id)
{
- if (!str)
- return;
-
- if (m_enableLogDB && m_dbRA)
- {
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_RA, nnew_str);
- va_end(ap2);
- }
-
- if (raLogfile)
- {
- outTimestamp(raLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(raLogfile, str, ap);
- fprintf(raLogfile, "\n" );
- va_end(ap);
- fflush(raLogfile);
- }
+ realm = id;
}
-void Log::outChat(const char * str, ...)
+void Log::Close()
{
- if (!str)
- return;
-
- if (m_enableLogDB && m_dbChat)
+ delete worker;
+ worker = NULL;
+ loggers.clear();
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
{
- va_list ap2;
- va_start(ap2, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2);
- outDB(LOG_TYPE_CHAT, nnew_str);
- va_end(ap2);
- }
-
- if (chatLogfile)
- {
- outTimestamp(chatLogfile);
- va_list ap;
- va_start(ap, str);
- vfprintf(chatLogfile, str, ap);
- fprintf(chatLogfile, "\n" );
- fflush(chatLogfile);
- va_end(ap);
+ delete it->second;
+ it->second = NULL;
}
+ appenders.clear();
}
-void Log::outErrorST(const char * str, ...)
+void Log::LoadFromConfig()
{
- va_list ap;
- va_start(ap, str);
- char nnew_str[MAX_QUERY_LEN];
- vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap);
- va_end(ap);
-
- ACE_Stack_Trace st;
- outError("%s [Stacktrace: %s]", nnew_str, st.c_str());
-}
-
-void Log::outWarden(const char * str, ...)
-{
- if (!str)
- return;
-
- if (wardenLogFile)
- {
- outTimestamp(wardenLogFile);
- va_list ap;
- va_start(ap, str);
- vfprintf(wardenLogFile, str, ap);
- fprintf(wardenLogFile, "\n" );
- fflush(wardenLogFile);
- va_end(ap);
- }
+ Close();
+ worker = new LogWorker();
+ AppenderId = 0;
+ m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
+ if (!m_logsDir.empty())
+ if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
+ m_logsDir.push_back('/');
+ ReadAppendersFromConfig();
+ ReadLoggersFromConfig();
}
diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h
index 296c13d86c9..b66e774b527 100755..100644
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -19,196 +19,69 @@
#ifndef TRINITYCORE_LOG_H
#define TRINITYCORE_LOG_H
-#include "Common.h"
-#include <ace/Singleton.h>
-
-class Config;
-
-enum DebugLogFilters
-{
- LOG_FILTER_NONE = 0x00000000,
- LOG_FILTER_UNITS = 0x00000001, // Anything related to units that doesn't fit in other categories. ie. creature formations
- LOG_FILTER_PETS = 0x00000002,
- LOG_FILTER_VEHICLES = 0x00000004,
- LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc.
- LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI
- LOG_FILTER_MAPSCRIPTS = 0x00000020,
- LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related
- LOG_FILTER_SPELLS_AURAS = 0x00000080,
- LOG_FILTER_ACHIEVEMENTSYS = 0x00000100,
- LOG_FILTER_CONDITIONSYS = 0x00000200,
- LOG_FILTER_POOLSYS = 0x00000400,
- LOG_FILTER_AUCTIONHOUSE = 0x00000800,
- LOG_FILTER_BATTLEGROUND = 0x00001000, // Anything related to arena's and battlegrounds
- LOG_FILTER_OUTDOORPVP = 0x00002000,
- LOG_FILTER_CHATSYS = 0x00004000,
- LOG_FILTER_LFG = 0x00008000,
- LOG_FILTER_MAPS = 0x00010000, // Maps, instances, grids, cells, visibility
- LOG_FILTER_PLAYER_LOADING = 0x00020000, // Debug output from Player::_Load functions
- LOG_FILTER_PLAYER_ITEMS = 0x00040000, // Anything item related
- LOG_FILTER_PLAYER_SKILLS = 0x00080000, // Skills related
- LOG_FILTER_LOOT = 0x00100000, // Loot related
- LOG_FILTER_GUILD = 0x00200000, // Guild related
- LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related
- LOG_FILTER_WARDEN = 0x00800000, // Warden related
-};
-
-enum LogTypes
-{
- LOG_TYPE_STRING = 0,
- LOG_TYPE_ERROR = 1,
- LOG_TYPE_BASIC = 2,
- LOG_TYPE_DETAIL = 3,
- LOG_TYPE_DEBUG = 4,
- LOG_TYPE_CHAR = 5,
- LOG_TYPE_WORLD = 6,
- LOG_TYPE_RA = 7,
- LOG_TYPE_GM = 8,
- LOG_TYPE_CRASH = 9,
- LOG_TYPE_CHAT = 10,
- MAX_LOG_TYPES
-};
-
-enum LogLevel
-{
- LOGL_NORMAL = 0,
- LOGL_BASIC,
- LOGL_DETAIL,
- LOGL_DEBUG
-};
-
-const int LogLevels = int(LOGL_DEBUG)+1;
+#include "Define.h"
+#include "Appender.h"
+#include "LogWorker.h"
+#include "Logger.h"
-enum ColorTypes
-{
- BLACK,
- RED,
- GREEN,
- BROWN,
- BLUE,
- MAGENTA,
- CYAN,
- GREY,
- YELLOW,
- LRED,
- LGREEN,
- LBLUE,
- LMAGENTA,
- LCYAN,
- WHITE
-};
+#include <ace/Singleton.h>
-const int Colors = int(WHITE)+1;
+#include <string>
+#include <set>
class Log
{
friend class ACE_Singleton<Log, ACE_Thread_Mutex>;
+ typedef std::map<uint8, Logger> LoggerMap;
+
private:
Log();
~Log();
public:
- void Initialize();
-
- void ReloadConfig();
-
- void InitColors(const std::string& init_str);
- void SetColor(bool stdout_stream, ColorTypes color);
- void ResetColor(bool stdout_stream);
-
- void outErrorST(const char * err, ...) ATTR_PRINTF(2, 3);
- void outDB(LogTypes type, const char * str);
- void outString(const char * str, ...) ATTR_PRINTF(2, 3);
- void outString();
- void outStringInLine(const char * str, ...) ATTR_PRINTF(2, 3);
- void outError(const char * err, ...) ATTR_PRINTF(2, 3);
- void outCrash(const char * err, ...) ATTR_PRINTF(2, 3);
- void outBasic(const char * str, ...) ATTR_PRINTF(2, 3);
- void outDetail(const char * str, ...) ATTR_PRINTF(2, 3);
- void outSQLDev(const char * str, ...) ATTR_PRINTF(2, 3);
- void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4);
- void outStaticDebug(const char * str, ...) ATTR_PRINTF(2, 3);
- void outDebugInLine(const char * str, ...) ATTR_PRINTF(2, 3);
- void outErrorDb(const char * str, ...) ATTR_PRINTF(2, 3);
- void outChar(const char * str, ...) ATTR_PRINTF(2, 3);
- void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4);
- void outRemote(const char * str, ...) ATTR_PRINTF(2, 3);
- void outChat(const char * str, ...) ATTR_PRINTF(2, 3);
- void outArena(const char * str, ...) ATTR_PRINTF(2, 3);
- void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3);
- void outWarden(const char * str, ...) ATTR_PRINTF(2, 3);
- void outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name);
-
- static void outTimestamp(FILE* file);
+ void LoadFromConfig();
+ void Close();
+ bool ShouldLog(LogFilterType type, LogLevel level) const;
+ bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true);
+
+ void outTrace(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outDebug(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outInfo(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outWarn(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outError(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+ void outFatal(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4);
+
+ void EnableDBAppenders();
+ void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4);
+ void outCharDump(char const* str, uint32 account_id, uint32 guid, char const* name);
static std::string GetTimestampStr();
- void SetLogLevel(char * Level);
- void SetLogFileLevel(char * Level);
- void SetDBLogLevel(char * Level);
- void SetSQLDriverQueryLogging(bool newStatus) { m_sqlDriverQueryLogging = newStatus; }
- void SetRealmID(uint32 id) { realm = id; }
-
- bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
- bool IsOutCharDump() const { return m_charLog_Dump; }
+ void SetRealmID(uint32 id);
- bool GetLogDB() const { return m_enableLogDB; }
- bool GetLogDBLater() const { return m_enableLogDBLater; }
- void SetLogDB(bool enable) { m_enableLogDB = enable; }
- void SetLogDBLater(bool value) { m_enableLogDBLater = value; }
- bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; }
private:
- FILE* openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode);
- FILE* openGmlogPerAccount(uint32 account);
-
- FILE* raLogfile;
- FILE* logfile;
- FILE* gmLogfile;
- FILE* charLogfile;
- FILE* dberLogfile;
- FILE* chatLogfile;
- FILE* arenaLogFile;
- FILE* sqlLogFile;
- FILE* sqlDevLogFile;
- FILE* wardenLogFile;
-
- // cache values for after initilization use (like gm log per account case)
+ void vlog(LogFilterType f, LogLevel level, char const* str, va_list argptr);
+ void write(LogMessage* msg);
+
+ Logger* GetLoggerByType(LogFilterType filter);
+ Appender* GetAppenderByName(std::string const& name);
+ uint8 NextAppenderId();
+ void CreateAppenderFromConfig(const char* name);
+ void CreateLoggerFromConfig(const char* name);
+ void ReadAppendersFromConfig();
+ void ReadLoggersFromConfig();
+
+ AppenderMap appenders;
+ LoggerMap loggers;
+ uint8 AppenderId;
+
std::string m_logsDir;
std::string m_logsTimestamp;
- // gm log control
- bool m_gmlog_per_account;
- std::string m_gmlog_filename_format;
-
- bool m_enableLogDBLater;
- bool m_enableLogDB;
uint32 realm;
-
- // log coloring
- bool m_colored;
- ColorTypes m_colors[4];
-
- // log levels:
- // false: errors only, true: full query logging
- bool m_sqlDriverQueryLogging;
-
- // log levels:
- // 0 minimum/string, 1 basic/error, 2 detail, 3 full/debug
- uint8 m_dbLogLevel;
- uint8 m_logLevel;
- uint8 m_logFileLevel;
- bool m_dbChar;
- bool m_dbRA;
- bool m_dbGM;
- bool m_dbChat;
- bool m_charLog_Dump;
- bool m_charLog_Dump_Separate;
- std::string m_dumpsDir;
-
- DebugLogFilters m_DebugLogMask;
+ LogWorker* worker;
};
#define sLog ACE_Singleton<Log, ACE_Thread_Mutex>::instance()
#endif
-
diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp
new file mode 100644
index 00000000000..b36dd3a8b1e
--- /dev/null
+++ b/src/server/shared/Logging/LogOperation.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2008-2012 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 "LogOperation.h"
+#include "Logger.h"
+
+LogOperation::~LogOperation()
+{
+ delete msg;
+}
+
+int LogOperation::call()
+{
+ if (logger && msg)
+ logger->write(*msg);
+ return 0;
+}
diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h
new file mode 100644
index 00000000000..d872670d756
--- /dev/null
+++ b/src/server/shared/Logging/LogOperation.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef LOGOPERATION_H
+#define LOGOPERATION_H
+
+class Logger;
+struct LogMessage;
+
+class LogOperation
+{
+ public:
+ LogOperation(Logger* _logger, LogMessage* _msg)
+ : logger(_logger)
+ , msg(_msg)
+ { }
+
+ ~LogOperation();
+
+ int call();
+
+ protected:
+ Logger *logger;
+ LogMessage *msg;
+};
+
+#endif
diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp
new file mode 100644
index 00000000000..a12faaf224c
--- /dev/null
+++ b/src/server/shared/Logging/LogWorker.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008-2012 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 "LogWorker.h"
+
+LogWorker::LogWorker()
+ : m_queue(HIGH_WATERMARK, LOW_WATERMARK)
+{
+ ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1);
+}
+
+LogWorker::~LogWorker()
+{
+ m_queue.deactivate();
+ wait();
+}
+
+int LogWorker::enqueue(LogOperation* op)
+{
+ return m_queue.enqueue(op);
+}
+
+int LogWorker::svc()
+{
+ while (1)
+ {
+ LogOperation* request;
+ if (m_queue.dequeue(request) == -1)
+ break;
+
+ request->call();
+ delete request;
+ }
+
+ return 0;
+}
diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h
new file mode 100644
index 00000000000..ea1744f9790
--- /dev/null
+++ b/src/server/shared/Logging/LogWorker.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef LOGWORKER_H
+#define LOGWORKER_H
+
+#include "LogOperation.h"
+
+#include <ace/Task.h>
+#include <ace/Activation_Queue.h>
+
+class LogWorker: protected ACE_Task_Base
+{
+ public:
+ LogWorker();
+ ~LogWorker();
+
+ typedef ACE_Message_Queue_Ex<LogOperation, ACE_MT_SYNCH> LogMessageQueueType;
+
+ enum
+ {
+ HIGH_WATERMARK = 8 * 1024 * 1024,
+ LOW_WATERMARK = 8 * 1024 * 1024
+ };
+
+ int enqueue(LogOperation *op);
+
+ private:
+ virtual int svc();
+ LogMessageQueueType m_queue;
+};
+
+#endif
diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp
new file mode 100644
index 00000000000..10276eb3acb
--- /dev/null
+++ b/src/server/shared/Logging/Logger.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2008-2012 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 "Logger.h"
+
+Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED)
+{
+}
+
+void Logger::Create(std::string const& _name, LogFilterType _type, LogLevel _level)
+{
+ name = _name;
+ type = _type;
+ level = _level;
+}
+
+Logger::~Logger()
+{
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ it->second = NULL;
+ appenders.clear();
+}
+
+std::string const& Logger::getName() const
+{
+ return name;
+}
+
+LogFilterType Logger::getType() const
+{
+ return type;
+}
+
+LogLevel Logger::getLogLevel() const
+{
+ return level;
+}
+
+void Logger::addAppender(uint8 id, Appender* appender)
+{
+ appenders[id] = appender;
+}
+
+void Logger::delAppender(uint8 id)
+{
+ AppenderMap::iterator it = appenders.find(id);
+ if (it != appenders.end())
+ {
+ it->second = NULL;
+ appenders.erase(it);
+ }
+}
+
+void Logger::setLogLevel(LogLevel _level)
+{
+ level = _level;
+}
+
+void Logger::write(LogMessage& message)
+{
+ if (!level || level > message.level || message.text.empty())
+ {
+ //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), messge.level, message.text.c_str(), .message.level); // DEBUG - RemoveMe
+ return;
+ }
+
+ for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it)
+ if (it->second)
+ it->second->write(message);
+}
diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h
new file mode 100644
index 00000000000..9d13f08620f
--- /dev/null
+++ b/src/server/shared/Logging/Logger.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008-2012 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/>.
+ */
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include "Appender.h"
+
+class Logger
+{
+ public:
+ Logger();
+ ~Logger();
+
+ void Create(std::string const& name, LogFilterType type, LogLevel level);
+ void addAppender(uint8 type, Appender *);
+ void delAppender(uint8 type);
+
+ std::string const& getName() const;
+ LogFilterType getType() const;
+ LogLevel getLogLevel() const;
+ void setLogLevel(LogLevel level);
+ void write(LogMessage& message);
+
+ private:
+ std::string name;
+ LogFilterType type;
+ LogLevel level;
+ AppenderMap appenders;
+};
+
+#endif
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 4fac31a9ac6..c03c1a4572a 100755..100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -50,8 +50,10 @@ class ByteBufferPositionException : public ByteBufferException
protected:
void PrintError() const
{
- sLog->outError("Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD") " ,
- (_add ? "put" : "get"), ValueSize, Pos, Size);
+ ACE_Stack_Trace trace;
+
+ sLog->outError(LOG_FILTER_NETWORKIO, "Attempted to %s value with size: "SIZEFMTD" in ByteBuffer (pos: " SIZEFMTD " size: "SIZEFMTD")\n[Stacktrace: %s]" ,
+ (_add ? "put" : "get"), ValueSize, Pos, Size, trace.c_str());
}
private:
@@ -70,8 +72,10 @@ class ByteBufferSourceException : public ByteBufferException
protected:
void PrintError() const
{
- sLog->outError("Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")",
- (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size);
+ ACE_Stack_Trace trace;
+
+ sLog->outError(LOG_FILTER_NETWORKIO, "Attempted to put a %s in ByteBuffer (pos: "SIZEFMTD" size: "SIZEFMTD")\n[Stacktrace: %s]",
+ (ValueSize > 0 ? "NULL-pointer" : "zero-sized value"), Pos, Size, trace.c_str());
}
};
@@ -355,6 +359,28 @@ class ByteBuffer
}
}
+ uint32 ReadPackedTime()
+ {
+ uint32 packedDate = read<uint32>();
+ tm lt;
+ memset(&lt, 0, sizeof(lt));
+
+ lt.tm_min = packedDate & 0x3F;
+ lt.tm_hour = (packedDate >> 6) & 0x1F;
+ //lt.tm_wday = (packedDate >> 11) & 7;
+ lt.tm_mday = ((packedDate >> 14) & 0x3F) + 1;
+ lt.tm_mon = (packedDate >> 20) & 0xF;
+ lt.tm_year = ((packedDate >> 24) & 0x1F) + 100;
+
+ return uint32(mktime(&lt) + timezone);
+ }
+
+ ByteBuffer& ReadPackedTime(uint32& time)
+ {
+ time = ReadPackedTime();
+ return *this;
+ }
+
const uint8 *contents() const { return &_storage[0]; }
size_t size() const { return _storage.size(); }
@@ -434,6 +460,12 @@ class ByteBuffer
append(packGUID, size);
}
+ void AppendPackedTime(time_t time)
+ {
+ tm* lt = localtime(&time);
+ append<uint32>((lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min);
+ }
+
void put(size_t pos, const uint8 *src, size_t cnt)
{
if (pos + cnt > size())
@@ -447,79 +479,65 @@ class ByteBuffer
void print_storage() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() );
+ std::ostringstream o;
+ o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
- sLog->outDebugInLine("%u - ", read<uint8>(i) );
- sLog->outDebug(LOG_FILTER_NETWORKIO, " ");
+ o << read<uint8>(i) << " - ";
+ o << " ";
+
+ sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void textlike() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() );
+ std::ostringstream o;
+ o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
- sLog->outDebugInLine("%c", read<uint8>(i) );
- sLog->outDebug(LOG_FILTER_NETWORKIO, " ");
+ {
+ char buf[1];
+ snprintf(buf, 1, "%c", read<uint8>(i));
+ o << buf;
+ }
+ o << " ";
+ sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
void hexlike() const
{
- if (!sLog->IsOutDebug()) // optimize disabled debug output
+ if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output
return;
uint32 j = 1, k = 1;
- sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() );
+
+ std::ostringstream o;
+ o << "STORAGE_SIZE: " << size();
for (uint32 i = 0; i < size(); ++i)
{
+ char buf[3];
+ snprintf(buf, 1, "%2X ", read<uint8>(i));
if ((i == (j * 8)) && ((i != (k * 16))))
{
- if (read<uint8>(i) < 0x10)
- {
- sLog->outDebugInLine("| 0%X ", read<uint8>(i) );
- }
- else
- {
- sLog->outDebugInLine("| %X ", read<uint8>(i) );
- }
+ o << "| ";
++j;
}
else if (i == (k * 16))
{
- if (read<uint8>(i) < 0x10)
- {
- sLog->outDebugInLine("\n");
-
- sLog->outDebugInLine("0%X ", read<uint8>(i) );
- }
- else
- {
- sLog->outDebugInLine("\n");
-
- sLog->outDebugInLine("%X ", read<uint8>(i) );
- }
-
+ o << "\n";
++k;
++j;
}
- else
- {
- if (read<uint8>(i) < 0x10)
- {
- sLog->outDebugInLine("0%X ", read<uint8>(i) );
- }
- else
- {
- sLog->outDebugInLine("%X ", read<uint8>(i) );
- }
- }
+
+ o << buf;
}
- sLog->outDebugInLine("\n");
+ o << " ";
+ sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", o.str().c_str());
}
protected:
diff --git a/src/server/shared/Packets/WorldPacket.h b/src/server/shared/Packets/WorldPacket.h
index 7ab95bc496d..7ab95bc496d 100755..100644
--- a/src/server/shared/Packets/WorldPacket.h
+++ b/src/server/shared/Packets/WorldPacket.h
diff --git a/src/server/shared/SystemConfig.h b/src/server/shared/SystemConfig.h
index 2431ebb7165..2431ebb7165 100755..100644
--- a/src/server/shared/SystemConfig.h
+++ b/src/server/shared/SystemConfig.h
diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h
index 3e1e7ac692f..3e1e7ac692f 100755..100644
--- a/src/server/shared/Threading/Callback.h
+++ b/src/server/shared/Threading/Callback.h
diff --git a/src/server/shared/Threading/DelayExecutor.cpp b/src/server/shared/Threading/DelayExecutor.cpp
index cfc4987387f..685e86e2a2f 100644
--- a/src/server/shared/Threading/DelayExecutor.cpp
+++ b/src/server/shared/Threading/DelayExecutor.cpp
@@ -59,7 +59,7 @@ int DelayExecutor::svc()
return 0;
}
-int DelayExecutor::activate(int num_threads, ACE_Method_Request* pre_svc_hook, ACE_Method_Request* post_svc_hook)
+int DelayExecutor::start(int num_threads, ACE_Method_Request* pre_svc_hook, ACE_Method_Request* post_svc_hook)
{
if (activated())
return -1;
diff --git a/src/server/shared/Threading/DelayExecutor.h b/src/server/shared/Threading/DelayExecutor.h
index 664d8ca78a2..5eaaacdb98b 100644
--- a/src/server/shared/Threading/DelayExecutor.h
+++ b/src/server/shared/Threading/DelayExecutor.h
@@ -16,7 +16,7 @@ class DelayExecutor : protected ACE_Task_Base
int execute(ACE_Method_Request* new_req);
- int activate(int num_threads = 1, ACE_Method_Request* pre_svc_hook = NULL, ACE_Method_Request* post_svc_hook = NULL);
+ int start(int num_threads = 1, ACE_Method_Request* pre_svc_hook = NULL, ACE_Method_Request* post_svc_hook = NULL);
int deactivate();
diff --git a/src/server/shared/Threading/LockedQueue.h b/src/server/shared/Threading/LockedQueue.h
index 7f78dc07db8..7f78dc07db8 100755..100644
--- a/src/server/shared/Threading/LockedQueue.h
+++ b/src/server/shared/Threading/LockedQueue.h
diff --git a/src/server/shared/Threading/Threading.cpp b/src/server/shared/Threading/Threading.cpp
index f31db8fbdcd..f31db8fbdcd 100755..100644
--- a/src/server/shared/Threading/Threading.cpp
+++ b/src/server/shared/Threading/Threading.cpp
diff --git a/src/server/shared/Threading/Threading.h b/src/server/shared/Threading/Threading.h
index 8b10e223828..7cc74574873 100755..100644
--- a/src/server/shared/Threading/Threading.h
+++ b/src/server/shared/Threading/Threading.h
@@ -51,7 +51,7 @@ namespace ACE_Based
Normal,
High,
Highest,
- Realtime,
+ Realtime
};
#define MAXPRIORITYNUM (Realtime + 1)
diff --git a/src/server/shared/Utilities/ByteConverter.h b/src/server/shared/Utilities/ByteConverter.h
index d0790acadd3..05e8b8cc959 100755..100644
--- a/src/server/shared/Utilities/ByteConverter.h
+++ b/src/server/shared/Utilities/ByteConverter.h
@@ -24,12 +24,12 @@
*/
#include "Define.h"
-#include<algorithm>
+#include <algorithm>
namespace ByteConverter
{
template<size_t T>
- inline void convert(char *val)
+ inline void convert(char *val)
{
std::swap(*val, *(val + T - 1));
convert<T - 2>(val + 1);
diff --git a/src/server/shared/Utilities/EventProcessor.cpp b/src/server/shared/Utilities/EventProcessor.cpp
index b4f67471323..b4f67471323 100755..100644
--- a/src/server/shared/Utilities/EventProcessor.cpp
+++ b/src/server/shared/Utilities/EventProcessor.cpp
diff --git a/src/server/shared/Utilities/EventProcessor.h b/src/server/shared/Utilities/EventProcessor.h
index 149ca9a4098..0f1a7c15216 100755..100644
--- a/src/server/shared/Utilities/EventProcessor.h
+++ b/src/server/shared/Utilities/EventProcessor.h
@@ -21,7 +21,7 @@
#include "Define.h"
-#include<map>
+#include <map>
// Note. All times are in milliseconds here.
@@ -29,9 +29,7 @@ class BasicEvent
{
public:
BasicEvent() { to_Abort = false; }
- virtual ~BasicEvent() // override destructor to perform some actions on event removal
- {
- };
+ virtual ~BasicEvent() {} // override destructor to perform some actions on event removal
// this method executes when the event is triggered
// return false if event does not want to be deleted
@@ -68,4 +66,3 @@ class EventProcessor
bool m_aborting;
};
#endif
-
diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp
index f2887a4d1bd..390b1a35010 100755..100644
--- a/src/server/shared/Utilities/ServiceWin32.cpp
+++ b/src/server/shared/Utilities/ServiceWin32.cpp
@@ -52,8 +52,6 @@ typedef WINADVAPI BOOL (WINAPI *CSD_T)(SC_HANDLE, DWORD, LPCVOID);
bool WinServiceInstall()
{
- CSD_T ChangeService_Config2;
- HMODULE advapi32;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
if (serviceControlManager)
@@ -79,7 +77,7 @@ bool WinServiceInstall()
0); // no password
if (service)
{
- advapi32 = GetModuleHandle("ADVAPI32.DLL");
+ HMODULE advapi32 = GetModuleHandle("ADVAPI32.DLL");
if (!advapi32)
{
CloseServiceHandle(service);
@@ -87,7 +85,7 @@ bool WinServiceInstall()
return false;
}
- ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
+ CSD_T ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
if (!ChangeService_Config2)
{
CloseServiceHandle(service);
@@ -257,7 +255,7 @@ bool WinServiceRun()
if (!StartServiceCtrlDispatcher(serviceTable))
{
- sLog->outError("StartService Failed. Error [%u]", ::GetLastError());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "StartService Failed. Error [%u]", ::GetLastError());
return false;
}
return true;
diff --git a/src/server/shared/Utilities/ServiceWin32.h b/src/server/shared/Utilities/ServiceWin32.h
index f810a0e5624..f810a0e5624 100755..100644
--- a/src/server/shared/Utilities/ServiceWin32.h
+++ b/src/server/shared/Utilities/ServiceWin32.h
diff --git a/src/server/shared/Utilities/SignalHandler.h b/src/server/shared/Utilities/SignalHandler.h
index a478c1f58d9..a478c1f58d9 100755..100644
--- a/src/server/shared/Utilities/SignalHandler.h
+++ b/src/server/shared/Utilities/SignalHandler.h
diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h
index 4d3f02f6688..4d3f02f6688 100755..100644
--- a/src/server/shared/Utilities/Timer.h
+++ b/src/server/shared/Utilities/Timer.h
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 7bedf9690ca..407d0704619 100755..100644
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -16,8 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <iostream>
#include "Util.h"
+#include "Common.h"
#include "utf8.h"
#include "SFMT.h"
#include <ace/TSS_T.h>
@@ -28,16 +28,19 @@ static SFMTRandTSS sfmtRand;
int32 irand(int32 min, int32 max)
{
+ assert(max >= min);
return int32(sfmtRand->IRandom(min, max));
}
uint32 urand(uint32 min, uint32 max)
{
+ assert(max >= min);
return sfmtRand->URandom(min, max);
}
float frand(float min, float max)
{
+ assert(max >= min);
return float(sfmtRand->Random() * (max - min) + min);
}
@@ -56,13 +59,13 @@ double rand_chance(void)
return sfmtRand->Random() * 100.0;
}
-Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
+Tokenizer::Tokenizer(const std::string &src, const char sep, uint32 vectorReserve)
{
m_str = new char[src.length() + 1];
memcpy(m_str, src.c_str(), src.length() + 1);
if (vectorReserve)
- reserve(vectorReserve);
+ m_storage.reserve(vectorReserve);
char* posold = m_str;
char* posnew = m_str;
@@ -71,17 +74,17 @@ Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
{
if (*posnew == sep)
{
- push_back(posold);
+ m_storage.push_back(posold);
posold = posnew + 1;
- *posnew = 0x00;
+ *posnew = '\0';
}
- else if (*posnew == 0x00)
+ else if (*posnew == '\0')
{
// Hack like, but the old code accepted these kind of broken strings,
// so changing it would break other things
if (posold != posnew)
- push_back(posold);
+ m_storage.push_back(posold);
break;
}
@@ -92,7 +95,7 @@ Tokens::Tokens(const std::string &src, const char sep, uint32 vectorReserve)
void stripLineInvisibleChars(std::string &str)
{
- static std::string invChars = " \t\7\n";
+ static std::string const invChars = " \t\7\n";
size_t wpos = 0;
@@ -147,6 +150,37 @@ std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
return ss.str();
}
+int32 MoneyStringToMoney(const std::string& moneyString)
+{
+ int32 money = 0;
+
+ if (!(std::count(moneyString.begin(), moneyString.end(), 'g') == 1 ||
+ std::count(moneyString.begin(), moneyString.end(), 's') == 1 ||
+ std::count(moneyString.begin(), moneyString.end(), 'c') == 1))
+ return 0; // Bad format
+
+ Tokenizer tokens(moneyString, ' ');
+ for (Tokenizer::const_iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
+ {
+ std::string tokenString(*itr);
+ uint32 gCount = std::count(tokenString.begin(), tokenString.end(), 'g');
+ uint32 sCount = std::count(tokenString.begin(), tokenString.end(), 's');
+ uint32 cCount = std::count(tokenString.begin(), tokenString.end(), 'c');
+ if (gCount + sCount + cCount != 1)
+ return 0;
+
+ uint32 amount = atoi(*itr);
+ if (gCount == 1)
+ money += amount * 100 * 100;
+ else if (sCount == 1)
+ money += amount * 100;
+ else if (cCount == 1)
+ money += amount;
+ }
+
+ return money;
+}
+
uint32 TimeStringToSecs(const std::string& timestring)
{
uint32 secs = 0;
@@ -217,7 +251,7 @@ uint32 CreatePIDFile(const std::string& filename)
pid_t pid = getpid();
#endif
- fprintf(pid_file, "%d", pid );
+ fprintf(pid_file, "%u", pid );
fclose(pid_file);
return (uint32)pid;
@@ -471,32 +505,24 @@ void vutf8printf(FILE* out, const char *str, va_list* ap)
#endif
}
-void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result)
+std::string ByteArrayToHexStr(uint8 const* bytes, uint32 arrayLen, bool reverse /* = false */)
{
- std::ostringstream ss;
- for (uint32 i=0; i<arrayLen; ++i)
+ int32 init = 0;
+ int32 end = arrayLen;
+ int8 op = 1;
+
+ if (reverse)
{
- for (uint8 j=0; j<2; ++j)
- {
- unsigned char nibble = 0x0F & (bytes[i]>>((1-j)*4));
- char encodedNibble;
- if (nibble < 0x0A)
- encodedNibble = '0'+nibble;
- else
- encodedNibble = 'A'+nibble-0x0A;
- ss << encodedNibble;
- }
+ init = arrayLen - 1;
+ end = -1;
+ op = -1;
}
- result = ss.str();
-}
-std::string ByteArrayToHexStr(uint8* bytes, uint32 length)
-{
std::ostringstream ss;
- for (uint32 i = 0; i < length; ++i)
+ for (int32 i = init; i != end; i += op)
{
char buffer[4];
- sprintf(buffer, "%02X ", bytes[i]);
+ sprintf(buffer, "%02X", bytes[i]);
ss << buffer;
}
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index 196882dc2a0..f46fc991cc7 100755..100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -19,10 +19,12 @@
#ifndef _UTIL_H
#define _UTIL_H
-#include "Common.h"
-#include "Containers.h"
+#include "Define.h"
+
+#include <algorithm>
#include <string>
#include <vector>
+#include <list>
// Searcher for map of structs
template<typename T, class S> struct Finder
@@ -34,48 +36,66 @@ template<typename T, class S> struct Finder
bool operator()(const std::pair<int, S> &obj) { return obj.second.*idMember_ == val_; }
};
-struct Tokens: public std::vector<char*>
+class Tokenizer
{
- Tokens(const std::string &src, const char sep, uint32 vectorReserve = 0);
- ~Tokens() { delete[] m_str; }
+public:
+ typedef std::vector<char const *> StorageType;
+
+ typedef StorageType::size_type size_type;
+
+ typedef StorageType::const_iterator const_iterator;
+ typedef StorageType::reference reference;
+ typedef StorageType::const_reference const_reference;
+
+public:
+ Tokenizer(const std::string &src, char const sep, uint32 vectorReserve = 0);
+ ~Tokenizer() { delete[] m_str; }
+
+ const_iterator begin() const { return m_storage.begin(); }
+ const_iterator end() const { return m_storage.end(); }
+ size_type size() const { return m_storage.size(); }
+
+ reference operator [] (size_type i) { return m_storage[i]; }
+ const_reference operator [] (size_type i) const { return m_storage[i]; }
+
+private:
char* m_str;
+ StorageType m_storage;
};
void stripLineInvisibleChars(std::string &src);
+int32 MoneyStringToMoney(const std::string& moneyString);
+
std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hoursOnly = false);
uint32 TimeStringToSecs(const std::string& timestring);
std::string TimeToTimestampStr(time_t t);
-inline uint32 secsToTimeBitFields(time_t secs)
-{
- tm* lt = localtime(&secs);
- return (lt->tm_year - 100) << 24 | lt->tm_mon << 20 | (lt->tm_mday - 1) << 14 | lt->tm_wday << 11 | lt->tm_hour << 6 | lt->tm_min;
-}
-
/* Return a random number in the range min..max; (max-min) must be smaller than 32768. */
- int32 irand(int32 min, int32 max);
+int32 irand(int32 min, int32 max);
/* Return a random number in the range min..max (inclusive). For reliable results, the difference
* between max and min should be less than RAND32_MAX. */
- uint32 urand(uint32 min, uint32 max);
+uint32 urand(uint32 min, uint32 max);
/* Return a random number in the range 0 .. RAND32_MAX. */
- int32 rand32();
+int32 rand32();
- /* Return a random number in the range min..max */
- float frand(float min, float max);
+/* Return a random number in the range min..max */
+float frand(float min, float max);
/* Return a random double from 0.0 to 1.0 (exclusive). Floats support only 7 valid decimal digits.
* A double supports up to 15 valid decimal digits and is used internally (RAND32_MAX has 10 digits).
- * With an FPU, there is usually no difference in performance between float and double. */
- double rand_norm(void);
+ * With an FPU, there is usually no difference in performance between float and double.
+*/
+double rand_norm(void);
/* Return a random double from 0.0 to 99.9999999999999. Floats support only 7 valid decimal digits.
* A double supports up to 15 valid decimal digits and is used internally (RAND32_MAX has 10 digits).
- * With an FPU, there is usually no difference in performance between float and double. */
- double rand_chance(void);
+ * With an FPU, there is usually no difference in performance between float and double.
+*/
+double rand_chance(void);
/* Return true if a random roll fits in the specified chance (range 0-100). */
inline bool roll_chance_f(float chance)
@@ -89,22 +109,6 @@ inline bool roll_chance_i(int chance)
return chance > irand(0, 99);
}
-inline void ApplyModUInt32Var(uint32& var, int32 val, bool apply)
-{
- int32 cur = var;
- cur += (apply ? val : -val);
- if (cur < 0)
- cur = 0;
- var = cur;
-}
-
-inline void ApplyModFloatVar(float& var, float val, bool apply)
-{
- var += (apply ? val : -val);
- if (var < 0)
- var = 0;
-}
-
inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
{
if (val == -100.0f) // prevent set var to zero
@@ -113,58 +117,22 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
}
// Percentage calculation
-template <class T>
-inline T CalculatePctF(T base, float pct)
+template <class T, class U>
+inline T CalculatePct(T base, U pct)
{
- return T(base * pct / 100.0f);
+ return T(base * static_cast<float>(pct) / 100.0f);
}
-template <class T>
-inline T CalculatePctN(T base, int32 pct)
+template <class T, class U>
+inline T AddPct(T &base, U pct)
{
- return T(base * float(pct) / 100.0f);
+ return base += CalculatePct(base, pct);
}
-template <class T>
-inline T CalculatePctU(T base, uint32 pct)
+template <class T, class U>
+inline T ApplyPct(T &base, U pct)
{
- return T(base * float(pct) / 100.0f);
-}
-
-template <class T>
-inline T AddPctF(T& base, float pct)
-{
- return base += CalculatePctF(base, pct);
-}
-
-template <class T>
-inline T AddPctN(T& base, int32 pct)
-{
- return base += CalculatePctN(base, pct);
-}
-
-template <class T>
-inline T AddPctU(T& base, uint32 pct)
-{
- return base += CalculatePctU(base, pct);
-}
-
-template <class T>
-inline T ApplyPctF(T& base, float pct)
-{
- return base = CalculatePctF(base, pct);
-}
-
-template <class T>
-inline T ApplyPctN(T& base, int32 pct)
-{
- return base = CalculatePctN(base, pct);
-}
-
-template <class T>
-inline T ApplyPctU(T& base, uint32 pct)
-{
- return base = CalculatePctU(base, pct);
+ return base = CalculatePct(base, pct);
}
template <class T>
@@ -377,8 +345,7 @@ void vutf8printf(FILE* out, const char *str, va_list* ap);
bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(const std::string& filename);
-void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result);
-std::string ByteArrayToHexStr(uint8* bytes, uint32 length);
+std::string ByteArrayToHexStr(uint8 const* bytes, uint32 length, bool reverse = false);
#endif
//handler for operations on large flags
@@ -426,231 +393,140 @@ class flag96
{
private:
uint32 part[3];
+
public:
- flag96(uint32 p1=0, uint32 p2=0, uint32 p3=0)
+ flag96(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0)
{
- part[0]=p1;
- part[1]=p2;
- part[2]=p3;
+ part[0] = p1;
+ part[1] = p2;
+ part[2] = p3;
}
flag96(uint64 p1, uint32 p2)
{
- part[0]=PAIR64_LOPART(p1);
- part[1]=PAIR64_HIPART(p1);
- part[2]=p2;
+ part[0] = PAIR64_LOPART(p1);
+ part[1] = PAIR64_HIPART(p1);
+ part[2] = p2;
}
- inline bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
- {
- return (
- part[0]==p1 &&
- part[1]==p2 &&
- part[2]==p3);
- };
-
- inline bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
+ inline bool IsEqual(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
{
- return (
- part[0]&p1 ||
- part[1]&p2 ||
- part[2]&p3);
- };
+ return (part[0] == p1 && part[1] == p2 && part[2] == p3);
+ }
- inline void Set(uint32 p1=0, uint32 p2=0, uint32 p3=0)
+ inline bool HasFlag(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0) const
{
- part[0]=p1;
- part[1]=p2;
- part[2]=p3;
- };
+ return (part[0] & p1 || part[1] & p2 || part[2] & p3);
+ }
- template<class type>
- inline bool operator < (type & right)
+ inline void Set(uint32 p1 = 0, uint32 p2 = 0, uint32 p3 = 0)
{
- for (uint8 i=3; i > 0; --i)
- {
- if (part[i-1]<right.part[i-1])
- return 1;
- else if (part[i-1]>right.part[i-1])
- return 0;
- }
- return 0;
- };
+ part[0] = p1;
+ part[1] = p2;
+ part[2] = p3;
+ }
- template<class type>
- inline bool operator < (type & right) const
+ inline bool operator <(const flag96 &right) const
{
for (uint8 i = 3; i > 0; --i)
{
- if (part[i-1]<right.part[i-1])
- return 1;
- else if (part[i-1]>right.part[i-1])
- return 0;
- }
- return 0;
- };
-
- template<class type>
- inline bool operator != (type & right)
- {
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
+ if (part[i - 1] < right.part[i - 1])
return true;
+ else if (part[i - 1] > right.part[i - 1])
+ return false;
+ }
return false;
}
- template<class type>
- inline bool operator != (type & right) const
- {
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return true;
- return false;
- };
-
- template<class type>
- inline bool operator == (type & right)
- {
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return false;
- return true;
- };
-
- template<class type>
- inline bool operator == (type & right) const
- {
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return false;
- return true;
- };
-
- template<class type>
- inline void operator = (type & right)
- {
- part[0]=right.part[0];
- part[1]=right.part[1];
- part[2]=right.part[2];
- };
-
- template<class type>
- inline flag96 operator & (type & right)
+ inline bool operator ==(const flag96 &right) const
{
- flag96 ret(part[0] & right.part[0], part[1] & right.part[1], part[2] & right.part[2]);
return
- ret;
- };
- template<class type>
- inline flag96 operator & (type & right) const
- {
- flag96 ret(part[0] & right.part[0], part[1] & right.part[1], part[2] & right.part[2]);
- return
- ret;
- };
-
- template<class type>
- inline void operator &= (type & right)
- {
- *this=*this & right;
- };
+ (
+ part[0] == right.part[0] &&
+ part[1] == right.part[1] &&
+ part[2] == right.part[2]
+ );
+ }
- template<class type>
- inline flag96 operator | (type & right)
+ inline bool operator !=(const flag96 &right) const
{
- flag96 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
- return
- ret;
- };
+ return !this->operator ==(right);
+ }
- template<class type>
- inline flag96 operator | (type & right) const
+ inline flag96 & operator =(const flag96 &right)
{
- flag96 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
- return
- ret;
- };
+ part[0] = right.part[0];
+ part[1] = right.part[1];
+ part[2] = right.part[2];
+ return *this;
+ }
- template<class type>
- inline void operator |= (type & right)
+ inline flag96 operator &(const flag96 &right) const
{
- *this=*this | right;
- };
+ return flag96(part[0] & right.part[0], part[1] & right.part[1],
+ part[2] & right.part[2]);
+ }
- inline void operator ~ ()
+ inline flag96 & operator &=(const flag96 &right)
{
- part[2]=~part[2];
- part[1]=~part[1];
- part[0]=~part[0];
- };
+ part[0] &= right.part[0];
+ part[1] &= right.part[1];
+ part[2] &= right.part[2];
+ return *this;
+ }
- template<class type>
- inline flag96 operator ^ (type & right)
+ inline flag96 operator |(const flag96 &right) const
{
- flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
- return
- ret;
- };
+ return flag96(part[0] | right.part[0], part[1] | right.part[1],
+ part[2] | right.part[2]);
+ }
- template<class type>
- inline flag96 operator ^ (type & right) const
+ inline flag96 & operator |=(const flag96 &right)
{
- flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
- return
- ret;
- };
+ part[0] |= right.part[0];
+ part[1] |= right.part[1];
+ part[2] |= right.part[2];
+ return *this;
+ }
- template<class type>
- inline void operator ^= (type & right)
+ inline flag96 operator ~() const
{
- *this=*this^right;
- };
+ return flag96(~part[0], ~part[1], ~part[2]);
+ }
- inline operator bool() const
+ inline flag96 operator ^(const flag96 &right) const
{
- return(
- part[0] != 0 ||
- part[1] != 0 ||
- part[2] != 0);
- };
+ return flag96(part[0] ^ right.part[0], part[1] ^ right.part[1],
+ part[2] ^ right.part[2]);
+ }
- inline operator bool()
+ inline flag96 & operator ^=(const flag96 &right)
{
- return(
- part[0] != 0 ||
- part[1] != 0 ||
- part[2] != 0);
- };
+ part[0] ^= right.part[0];
+ part[1] ^= right.part[1];
+ part[2] ^= right.part[2];
+ return *this;
+ }
- inline bool operator ! () const
+ inline operator bool() const
{
- return(
- part[0] == 0 &&
- part[1] == 0 &&
- part[2] == 0);
- };
+ return (part[0] != 0 || part[1] != 0 || part[2] != 0);
+ }
- inline bool operator ! ()
+ inline bool operator !() const
{
- return(
- part[0] == 0 &&
- part[1] == 0 &&
- part[2] == 0);
- };
+ return !this->operator bool();
+ }
- inline uint32 & operator[](uint8 el)
+ inline uint32 & operator [](uint8 el)
{
- return (part[el]);
- };
+ return part[el];
+ }
- inline uint32 operator[](uint8 el) const
+ inline const uint32 & operator [](uint8 el) const
{
- return (part[el]);
- };
+ return part[el];
+ }
};
#endif
diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index 0d51f30449e..556edb5a2c7 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -14,15 +14,9 @@ file(GLOB_RECURSE sources_TCSoap TCSoap/*.cpp TCSoap/*.h)
file(GLOB_RECURSE sources_WorldThread WorldThread/*.cpp WorldThread/*.h)
file(GLOB sources_localdir *.cpp *.h)
-if( USE_COREPCH )
- include_directories(${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
-if ( USE_COREPCH AND MSVC )
- set(worldserver_SRCS
- PrecompiledHeaders/worldPCH.cpp
- PrecompiledHeaders/worldPCH.h
- )
+if (USE_COREPCH)
+ set(worldserver_PCH_HDR PrecompiledHeaders/worldPCH.h)
+ set(worldserver_PCH_SRC PrecompiledHeaders/worldPCH.cpp)
endif()
set(worldserver_SRCS
@@ -80,7 +74,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Calendar
${CMAKE_SOURCE_DIR}/src/server/game/Chat
${CMAKE_SOURCE_DIR}/src/server/game/Chat/Channels
- ${CMAKE_SOURCE_DIR}/src/server/game/Chat/Commands
${CMAKE_SOURCE_DIR}/src/server/game/Combat
${CMAKE_SOURCE_DIR}/src/server/game/Conditions
${CMAKE_SOURCE_DIR}/src/server/game/DataStores
@@ -144,17 +137,20 @@ include_directories(
${OPENSSL_INCLUDE_DIR}
)
-set(worldserver_LINK_FLAGS "")
-
-add_executable(worldserver ${worldserver_SRCS})
+add_executable(worldserver
+ ${worldserver_SRCS}
+ ${worldserver_PCH_SRC}
+)
if( NOT WIN32 )
- add_definitions(-D_TRINITY_CORE_CONFIG='"${CONF_DIR}/worldserver.conf"')
+ set_target_properties(worldserver PROPERTIES
+ COMPILE_DEFINITIONS _TRINITY_CORE_CONFIG="${CONF_DIR}/worldserver.conf"
+ )
endif()
add_dependencies(worldserver revision.h)
-if( UNIX )
+if( UNIX AND NOT NOJEM )
set(worldserver_LINK_FLAGS "-pthread -lncurses ${worldserver_LINK_FLAGS}")
endif()
@@ -173,9 +169,7 @@ target_link_libraries(worldserver
${ACE_LIBRARY}
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
- ${OPENSSL_EXTRA_LIBRARIES}
${ZLIB_LIBRARIES}
- ${OSX_LIBS}
)
if( WIN32 )
@@ -195,9 +189,5 @@ endif()
# Generate precompiled header
if( USE_COREPCH )
- if(CMAKE_COMPILER_IS_GNUCXX)
- add_precompiled_header(worldserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/worldPCH.h)
- elseif(MSVC)
- add_native_precompiled_header(worldserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/worldPCH)
- endif()
+ add_cxx_pch(worldserver ${worldserver_PCH_HDR} ${worldserver_PCH_SRC})
endif()
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp
index 699e7cad97c..23eeca11f66 100755..100644
--- a/src/server/worldserver/CommandLine/CliRunnable.cpp
+++ b/src/server/worldserver/CommandLine/CliRunnable.cpp
@@ -135,7 +135,7 @@ int kb_hit_return()
void CliRunnable::run()
{
///- Display the list of available CLI functions then beep
- //sLog->outString("");
+ //sLog->outInfo(LOG_FILTER_WORLDSERVER, "");
#if PLATFORM != PLATFORM_WINDOWS
rl_attempted_completion_function = cli_completion;
rl_event_hook = cli_hook_func;
diff --git a/src/server/worldserver/CommandLine/CliRunnable.h b/src/server/worldserver/CommandLine/CliRunnable.h
index af5691367b3..af5691367b3 100755..100644
--- a/src/server/worldserver/CommandLine/CliRunnable.h
+++ b/src/server/worldserver/CommandLine/CliRunnable.h
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 04820f59355..16fbca2597d 100755..100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -58,7 +58,7 @@ uint32 realmID; ///< Id of the realm
/// Print out the usage string for this program on the console.
void usage(const char *prog)
{
- sLog->outString("Usage: \n %s [<options>]\n"
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r"
#ifdef _WIN32
" Running as service functions:\n\r"
@@ -81,7 +81,7 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError("Runtime-Error: -c option requires an input argument");
+ printf("Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
@@ -97,25 +97,25 @@ extern int main(int argc, char **argv)
{
if (++c >= argc)
{
- sLog->outError("Runtime-Error: -s option requires an input argument");
+ printf("Runtime-Error: -s option requires an input argument");
usage(argv[0]);
return 1;
}
if (strcmp(argv[c], "install") == 0)
{
if (WinServiceInstall())
- sLog->outString("Installing service");
+ printf("Installing service\n");
return 1;
}
else if (strcmp(argv[c], "uninstall") == 0)
{
if (WinServiceUninstall())
- sLog->outString("Uninstalling service");
+ printf("Uninstalling service\n");
return 1;
}
else
{
- sLog->outError("Runtime-Error: unsupported option %s", argv[c]);
+ printf("Runtime-Error: unsupported option %s", argv[c]);
usage(argv[0]);
return 1;
}
@@ -131,14 +131,14 @@ extern int main(int argc, char **argv)
if (!ConfigMgr::Load(cfg_file))
{
- sLog->outError("Invalid or missing configuration file : %s", cfg_file);
- sLog->outError("Verify that the file exists and has \'[worldserver]' written in the top of the file!");
+ printf("Invalid or missing configuration file : %s\n", cfg_file);
+ printf("Verify that the file exists and has \'[worldserver]' written in the top of the file!\n");
return 1;
}
- sLog->outString("Using configuration file %s.", cfg_file);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using configuration file %s.", cfg_file);
- sLog->outString("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
- sLog->outString("Using ACE version: %s", ACE_VERSION);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using ACE version: %s", ACE_VERSION);
///- and run the 'Master'
/// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp
index 03b2859c514..7587a9d1904 100755..100644
--- a/src/server/worldserver/Master.cpp
+++ b/src/server/worldserver/Master.cpp
@@ -84,7 +84,7 @@ public:
{
if (!_delaytime)
return;
- sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting up anti-freeze thread (%u seconds max stuck time)...", _delaytime/1000);
m_loops = 0;
w_loops = 0;
m_lastchange = 0;
@@ -102,11 +102,11 @@ public:
// possible freeze
else if (getMSTimeDiff(w_lastchange, curtime) > _delaytime)
{
- sLog->outError("World Thread hangs, kicking out server!");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "World Thread hangs, kicking out server!");
ASSERT(false);
}
}
- sLog->outString("Anti-freeze thread exiting without problems.");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Anti-freeze thread exiting without problems.");
}
};
@@ -124,18 +124,18 @@ int Master::Run()
BigNumber seed1;
seed1.SetRand(16 * 8);
- sLog->outString("%s (worldserver-daemon)", _FULLVERSION);
- sLog->outString("<Ctrl-C> to stop.\n");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon)", _FULLVERSION);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "<Ctrl-C> to stop.\n");
- sLog->outString(" ______ __");
- sLog->outString("/\\__ _\\ __ __/\\ \\__");
- sLog->outString("\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
- sLog->outString(" \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
- sLog->outString(" \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
- sLog->outString(" \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
- sLog->outString(" \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
- sLog->outString(" C O R E /\\___/");
- sLog->outString("http://TrinityCore.org \\/__/\n");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " ______ __");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "/\\__ _\\ __ __/\\ \\__");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\, _\\ __ __");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, " C O R E /\\___/");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "http://TrinityCore.org \\/__/\n");
/// worldserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
@@ -144,11 +144,11 @@ int Master::Run()
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
- sLog->outError("Cannot create PID file %s.\n", pidfile.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
- sLog->outString("Daemon PID: %u\n", pid);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Daemon PID: %u\n", pid);
}
///- Start the databases
@@ -161,13 +161,13 @@ int Master::Run()
///- Initialize the World
sWorld->SetInitialWorldSettings();
- // Initialise the signal handlers
+ ///- Initialize the signal handlers
WorldServerSignalHandler SignalINT, SignalTERM;
#ifdef _WIN32
WorldServerSignalHandler SignalBREAK;
#endif /* _WIN32 */
- // Register worldserver's signal handlers
+ ///- Register worldserver's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
@@ -210,17 +210,16 @@ int Master::Run()
if (!curAff)
{
- sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
}
else
{
if (SetProcessAffinityMask(hProcess, curAff))
- sLog->outString("Using processors (bitmask, hex): %x", curAff);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff);
else
- sLog->outError("Can't set used processors (hex): %x", curAff);
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff);
}
}
- sLog->outString("");
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
@@ -229,10 +228,9 @@ int Master::Run()
if (Prio)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
- sLog->outString("worldserver process priority class set to HIGH");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "worldserver process priority class set to HIGH");
else
- sLog->outError("Can't set worldserver process priority class.");
- sLog->outString("");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set worldserver process priority class.");
}
}
#endif
@@ -242,7 +240,7 @@ int Master::Run()
if (ConfigMgr::GetBoolDefault("SOAP.Enabled", false))
{
TCSoapRunnable* runnable = new TCSoapRunnable();
- runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), ConfigMgr::GetIntDefault("SOAP.Port", 7878));
+ runnable->setListenArguments(ConfigMgr::GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(ConfigMgr::GetIntDefault("SOAP.Port", 7878)));
soap_thread = new ACE_Based::Thread(runnable);
}
@@ -250,7 +248,7 @@ int Master::Run()
if (uint32 freeze_delay = ConfigMgr::GetIntDefault("MaxCoreStuckTime", 0))
{
FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable();
- fdr->SetDelayTime(freeze_delay*1000);
+ fdr->SetDelayTime(freeze_delay * 1000);
ACE_Based::Thread freeze_thread(fdr);
freeze_thread.setPriority(ACE_Based::Highest);
}
@@ -259,9 +257,9 @@ int Master::Run()
uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD);
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
- if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str ()) == -1)
+ if (sWorldSocketMgr->StartNetwork(wsport, bind_ip.c_str()) == -1)
{
- sLog->outError("Failed to start network");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Failed to start network");
World::StopNow(ERROR_EXIT_CODE);
// go down and shutdown the server
}
@@ -269,7 +267,7 @@ int Master::Run()
// set server online (allow connecting now)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
- sLog->outString("%s (worldserver-daemon) ready...", _FULLVERSION);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon) ready...", _FULLVERSION);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
@@ -291,7 +289,7 @@ int Master::Run()
_StopDB();
- sLog->outString("Halting process...");
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Halting process...");
if (cliThread)
{
@@ -356,21 +354,20 @@ bool Master::_StartDB()
{
MySQL::Library_Init();
- sLog->SetLogDB(false);
std::string dbstring;
uint8 async_threads, synch_threads;
dbstring = ConfigMgr::GetStringDefault("WorldDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("World database not specified in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "World database not specified in configuration file");
return false;
}
async_threads = ConfigMgr::GetIntDefault("WorldDatabase.WorkerThreads", 1);
if (async_threads < 1 || async_threads > 32)
{
- sLog->outError("World database: invalid number of worker threads specified. "
+ sLog->outError(LOG_FILTER_WORLDSERVER, "World database: invalid number of worker threads specified. "
"Please pick a value between 1 and 32.");
return false;
}
@@ -379,7 +376,7 @@ bool Master::_StartDB()
///- Initialise the world database
if (!WorldDatabase.Open(dbstring, async_threads, synch_threads))
{
- sLog->outError("Cannot connect to world database %s", dbstring.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to world database %s", dbstring.c_str());
return false;
}
@@ -387,14 +384,14 @@ bool Master::_StartDB()
dbstring = ConfigMgr::GetStringDefault("CharacterDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("Character database not specified in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Character database not specified in configuration file");
return false;
}
async_threads = ConfigMgr::GetIntDefault("CharacterDatabase.WorkerThreads", 1);
if (async_threads < 1 || async_threads > 32)
{
- sLog->outError("Character database: invalid number of worker threads specified. "
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Character database: invalid number of worker threads specified. "
"Please pick a value between 1 and 32.");
return false;
}
@@ -404,7 +401,7 @@ bool Master::_StartDB()
///- Initialise the Character database
if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads))
{
- sLog->outError("Cannot connect to Character database %s", dbstring.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to Character database %s", dbstring.c_str());
return false;
}
@@ -412,14 +409,14 @@ bool Master::_StartDB()
dbstring = ConfigMgr::GetStringDefault("LoginDatabaseInfo", "");
if (dbstring.empty())
{
- sLog->outError("Login database not specified in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Login database not specified in configuration file");
return false;
}
async_threads = ConfigMgr::GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (async_threads < 1 || async_threads > 32)
{
- sLog->outError("Login database: invalid number of worker threads specified. "
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Login database: invalid number of worker threads specified. "
"Please pick a value between 1 and 32.");
return false;
}
@@ -428,7 +425,7 @@ bool Master::_StartDB()
///- Initialise the login database
if (!LoginDatabase.Open(dbstring, async_threads, synch_threads))
{
- sLog->outError("Cannot connect to login database %s", dbstring.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot connect to login database %s", dbstring.c_str());
return false;
}
@@ -436,14 +433,11 @@ bool Master::_StartDB()
realmID = ConfigMgr::GetIntDefault("RealmID", 0);
if (!realmID)
{
- sLog->outError("Realm ID not defined in configuration file");
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Realm ID not defined in configuration file");
return false;
}
- sLog->outString("Realm running as realm ID %d", realmID);
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Realm running as realm ID %d", realmID);
- ///- Initialize the DB logging system
- sLog->SetLogDBLater(ConfigMgr::GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
- sLog->SetLogDB(false);
sLog->SetRealmID(realmID);
///- Clean the database before starting
@@ -454,7 +448,7 @@ bool Master::_StartDB()
sWorld->LoadDBVersion();
- sLog->outString("Using World DB: %s", sWorld->GetDBVersion());
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using World DB: %s", sWorld->GetDBVersion());
return true;
}
diff --git a/src/server/worldserver/Master.h b/src/server/worldserver/Master.h
index 548cd02c64a..548cd02c64a 100755..100644
--- a/src/server/worldserver/Master.h
+++ b/src/server/worldserver/Master.h
diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp
index 3f5d7bde736..7a1fff51afd 100644
--- a/src/server/worldserver/RemoteAccess/RARunnable.cpp
+++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp
@@ -67,11 +67,11 @@ void RARunnable::run()
if (acceptor.open(listen_addr, m_Reactor) == -1)
{
- sLog->outError("Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
+ sLog->outError(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
return;
}
- sLog->outString("Starting Trinity RA on port %d on %s", raport, stringip.c_str());
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raport, stringip.c_str());
while (!World::IsStopped())
{
@@ -82,5 +82,5 @@ void RARunnable::run()
break;
}
- sLog->outStaticDebug("Trinity RA thread exiting");
+ sLog->outDebug(LOG_FILTER_WORLDSERVER, "Trinity RA thread exiting");
}
diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp
index ebc7c7624d9..18c90aa5ba5 100755..100644
--- a/src/server/worldserver/RemoteAccess/RASocket.cpp
+++ b/src/server/worldserver/RemoteAccess/RASocket.cpp
@@ -45,18 +45,18 @@ int RASocket::open(void *)
if (peer().get_remote_addr(remote_addr) == -1)
{
- sLog->outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
+ sLog->outError(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
return -1;
}
- sLog->outRemote("Incoming connection from %s", remote_addr.get_host_addr());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr());
return activate();
}
int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask)
{
- sLog->outRemote("Closing connection");
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Closing connection");
peer().close_reader();
wait();
destroy();
@@ -122,7 +122,7 @@ int RASocket::recv_line(std::string& out_line)
if (recv_line(message_block) == -1)
{
- sLog->outRemote("Recv error %s", ACE_OS::strerror(errno));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Recv error %s", ACE_OS::strerror(errno));
return -1;
}
@@ -136,7 +136,7 @@ int RASocket::process_command(const std::string& command)
if (command.length() == 0)
return 0;
- sLog->outRemote("Got command: %s", command.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Got command: %s", command.c_str());
// handle quit, exit and logout commands to terminate connection
if (command == "quit" || command == "exit" || command == "logout") {
@@ -186,7 +186,7 @@ int RASocket::check_access_level(const std::string& user)
if (!result)
{
- sLog->outRemote("User %s does not exist in database", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str());
return -1;
}
@@ -194,12 +194,12 @@ int RASocket::check_access_level(const std::string& user)
if (fields[1].GetUInt8() < _minLevel)
{
- sLog->outRemote("User %s has no privilege to login", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str());
return -1;
}
else if (fields[2].GetInt32() != -1)
{
- sLog->outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
return -1;
}
@@ -225,7 +225,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass)
if (!result)
{
- sLog->outRemote("Wrong password for user: %s", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str());
return -1;
}
@@ -248,7 +248,7 @@ int RASocket::authenticate()
if (recv_line(pass) == -1)
return -1;
- sLog->outRemote("Login attempt for user: %s", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str());
if (check_access_level(user) == -1)
return -1;
@@ -256,7 +256,7 @@ int RASocket::authenticate()
if (check_password(user, pass) == -1)
return -1;
- sLog->outRemote("User login: %s", user.c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str());
return 0;
}
@@ -290,7 +290,7 @@ int RASocket::subnegotiate()
if (n >= 1024)
{
- sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n));
return -1;
}
@@ -324,7 +324,7 @@ int RASocket::subnegotiate()
uint8 param = buf[++i];
ss << uint32(param);
- sLog->outRemote(ss.str().c_str());
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, ss.str().c_str());
}
++i;
}
@@ -385,7 +385,7 @@ void RASocket::zprint(void* callbackArg, const char * szText)
if (socket->putq(mb, const_cast<ACE_Time_Value*>(&ACE_Time_Value::zero)) == -1)
{
- sLog->outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
mb->release();
}
}
@@ -406,7 +406,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/)
if (socket->putq(mb) == -1)
{
// getting here is bad, command can't be marked as complete
- sLog->outRemote("Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
+ sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
mb->release();
}
}
diff --git a/src/server/worldserver/RemoteAccess/RASocket.h b/src/server/worldserver/RemoteAccess/RASocket.h
index 450245a0ff4..450245a0ff4 100755..100644
--- a/src/server/worldserver/RemoteAccess/RASocket.h
+++ b/src/server/worldserver/RemoteAccess/RASocket.h
diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp
index 26b28b25fbb..40b35df9aee 100755..100644
--- a/src/server/worldserver/TCSoap/TCSoap.cpp
+++ b/src/server/worldserver/TCSoap/TCSoap.cpp
@@ -32,18 +32,18 @@ void TCSoapRunnable::run()
soap.send_timeout = 5;
if (!soap_valid_socket(soap_bind(&soap, m_host.c_str(), m_port, 100)))
{
- sLog->outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
+ sLog->outError(LOG_FILTER_SOAP, "Couldn't bind to %s:%d", m_host.c_str(), m_port);
exit(-1);
}
- sLog->outString("TCSoap: bound to http://%s:%d", m_host.c_str(), m_port);
+ sLog->outInfo(LOG_FILTER_SOAP, "Bound to http://%s:%d", m_host.c_str(), m_port);
while (!World::IsStopped())
{
if (!soap_valid_socket(soap_accept(&soap)))
continue; // ran into an accept timeout
- sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
+ sLog->outDebug(LOG_FILTER_SOAP, "Accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
struct soap* thread_soap = soap_copy(&soap);// make a safe copy
ACE_Message_Block* mb = new ACE_Message_Block(sizeof(struct soap*));
@@ -78,33 +78,33 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
// security check
if (!soap->userid || !soap->passwd)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: Client didn't provide login information");
+ sLog->outDebug(LOG_FILTER_SOAP, "Client didn't provide login information");
return 401;
}
uint32 accountId = AccountMgr::GetId(soap->userid);
if (!accountId)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: Client used invalid username '%s'", soap->userid);
+ sLog->outDebug(LOG_FILTER_SOAP, "Client used invalid username '%s'", soap->userid);
return 401;
}
if (!AccountMgr::CheckPassword(accountId, soap->passwd))
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: invalid password for account '%s'", soap->userid);
+ sLog->outDebug(LOG_FILTER_SOAP, "Invalid password for account '%s'", soap->userid);
return 401;
}
if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR)
{
- sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: %s's gmlevel is too low", soap->userid);
+ sLog->outDebug(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");
- sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: got command '%s'", command);
+ sLog->outDebug(LOG_FILTER_SOAP, "Got command '%s'", command);
SOAPCommand connection;
// commands are executed in the world thread. We have to wait for them to be completed
@@ -119,7 +119,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
int acc = connection.pendingCommands.acquire();
if (acc)
{
- sLog->outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
+ sLog->outError(LOG_FILTER_SOAP, "Error while acquiring lock, acc = %i, errno = %u", acc, errno);
}
// alright, command finished
diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h
index 285adaaaf4b..51ffb3a91c8 100755..100644
--- a/src/server/worldserver/TCSoap/TCSoap.h
+++ b/src/server/worldserver/TCSoap/TCSoap.h
@@ -51,7 +51,7 @@ class SOAPCommand
{
public:
SOAPCommand():
- pendingCommands(0, USYNC_THREAD, "pendingCommands")
+ pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false)
{
}
diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp
index 42cfaae41ec..42cfaae41ec 100755..100644
--- a/src/server/worldserver/WorldThread/WorldRunnable.cpp
+++ b/src/server/worldserver/WorldThread/WorldRunnable.cpp
diff --git a/src/server/worldserver/WorldThread/WorldRunnable.h b/src/server/worldserver/WorldThread/WorldRunnable.h
index 31ae51f064d..31ae51f064d 100755..100644
--- a/src/server/worldserver/WorldThread/WorldRunnable.h
+++ b/src/server/worldserver/WorldThread/WorldRunnable.h
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index cc4c4a555c2..fafc1362cad 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -20,11 +20,13 @@
# SERVER RATES
# AUTO BROADCAST
# BATTLEGROUND CONFIG
+# BATTLEFIELD CONFIG
# ARENA CONFIG
# NETWORK CONFIG
# CONSOLE AND REMOTE ACCESS
# CHARACTER DELETE OPTIONS
# CUSTOM SERVER OPTIONS
+# LOGGING SYSTEM SETTINGS
#
###################################################################################################
@@ -48,7 +50,7 @@
#
# RealmID
# Description: ID of the Realm using this config.
-# Important: RealmID must match the realmlist inside the realmd database.
+# Important: RealmID must match the realmlist inside the auth database.
# Default: 1
RealmID = 1
@@ -173,7 +175,7 @@ Compression = 1
# PlayerLimit
# Description: Maximum number of players in the world. Excluding Mods, GMs and Admins.
# Important: If you want to block players and only allow Mods, GMs or Admins to join the
-# server, use the DB field "realmd.realmlist.allowedSecurityLevel".
+# server, use the DB field "auth.realmlist.allowedSecurityLevel".
# Default: 100 - (Enabled)
# 1+ - (Enabled)
# 0 - (Disabled, No limit)
@@ -398,91 +400,12 @@ PersistentCharacterCleanFlags = 0
#
# PidFile
# Description: World daemon PID file
-# Example: "./worldd.pid" - (Enabled)
-# Default: "" - (Disabled)
+# Example: "./world.pid" - (Enabled)
+# Default: "" - (Disabled)
PidFile = ""
#
-# LogLevel
-# Description: Server console level of logging
-# Default: 1 - (Basic)
-# 0 - (Minimum)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogLevel = 1
-
-#
-# LogFile
-# Description: Log file for main server log.
-# Default: "Server.log" - (Enabled)
-# "" - (Disabled)
-
-LogFile = "Server.log"
-
-#
-# LogTimestamp
-# Description: Append timestamp to the server log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogTimestamp = 0
-
-#
-# LogFileLevel
-# Description: Server file level of logging
-# Default: 0 - (Minimum)
-# 1 - (Basic)
-# 2 - (Detail)
-# 3 - (Full/Debug)
-
-LogFileLevel = 0
-
-#
-# Debug Log Mask
-# Description: Bitmask that determines which debug log output (level 3)
-# will be logged.
-# Possible flags:
-# 1 - Anything related to units that doesn't fit in other
-# categories.
-# 2 - Anything related to pets.
-# 4 - Anything related to vehicles.
-# 8 - Anything related to C++ AI, instance scripts, etc.
-# 16 - Anything related to DB AI, such as SAI, EAI, CreatureAI
-# 32 - Anything related to DB map scripts
-# 64 - Anything related to network input/output,
-# such as packet handlers and netcode logs
-# 128 - Anything related to the spellsystem and aurasystem
-# 256 - Anything related to the achievement system
-# 512 - Anything related to the condition system
-# 1024 - Anything related to the pool system
-# 2048 - Anything related to the auction house
-# 4096 - Anything related to arena's and battlegrounds
-# 8192 - Anything related to outdoor PVP
-# 16384 - Anything related to the chat system
-# 32768 - Anything related to the LFG system
-# 65536 - Anything related to maps, instances (not scripts),
-# grids, cells, visibility, etc.
-# 131072 - Anything related to player loading from DB
-# (Player::_LoadXXX functions)
-# 262144 - Anything related to items
-# 524288 - Anything related to player skills
-# (do not confuse with spells)
-# 1048576 - Anything related to loot
-# 2097152 - Anything related to guilds
-# 4194304 - Anything related to transports
-# 8388608 - Anything related to Warden anti cheat
-#
-# Simply add the values together to create a bitmask.
-# For more info see enum DebugLogFilters in Log.h
-#
-# Default: 0 (nothing)
-
-DebugLogMask = 0
-
-#
# PacketLogFile
# Description: Binary packet logging file for the world server.
# Filename extension must be .bin to be parsable with WowPacketParser.
@@ -492,231 +415,6 @@ DebugLogMask = 0
PacketLogFile = ""
#
-# DBErrorLogFile
-# Description: Log file for database errors.
-# Default: "DBErrors.log" - (Enabled)
-# "" - (Disabled)
-
-DBErrorLogFile = "DBErrors.log"
-
-#
-# CharLogFile
-# Description: Log file for character operations
-# Default: "Char.log" - (Enabled)
-# "" - (Disabled)
-
-CharLogFile = "Char.log"
-
-#
-# CharLogTimestamp
-# Description: Append timestamp to the character log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-CharLogTimestamp = 0
-
-#
-# CharLogDump
-# Description: Write a character dump in the CharLogFile before deleting it.
-# For restoration, copy character data from log file starting from
-# line == START DUMP == to line == END DUMP == (exclusive)
-# and load it using the "pdump load" command.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-CharLogDump = 0
-
-#
-# CharLogDump.Separate
-# Description: Write character dump to separate files files rather than adding it to the
-# CharLogFile.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-CharLogDump.Separate = 0
-
-#
-# CharLogDump.SeparateDir
-# Description: Write dump files into the sub folder within the log folder.
-# Example: "chardumps" - (Enabled)
-# Default: "" - (Disabled)
-
-CharLogDump.SeparateDir = ""
-
-#
-# GmLogFile
-# Description: Log file for gamemaster commands.
-# Default: "GM.log" - (Enabled)
-# "" - (Disabled)
-
-GmLogFile = "GM.log"
-
-#
-# GmLogTimestamp
-# Description: Append timestamp to the gamemaster log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-GmLogTimestamp = 0
-
-#
-# GmLogPerAccount
-# Description: Create a log file per gamemaster account.
-# Important: Logs not created if GmLogFile is not set.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-GmLogPerAccount = 0
-
-#
-# RaLogFile
-# Description: Log file for Remote Access commands.
-# Default: "RA.log" - (Enabled)
-# "" - (Disabled)
-
-RaLogFile = "RA.log"
-
-#
-# ArenaLogFile
-# Description: Log file for arena fights and arena team creations.
-# Example: "Arena.log" - (Enabled)
-# Default: "" - (Disabled)
-
-ArenaLogFile = ""
-
-#
-# ArenaLog.ExtendedInfo
-# Description: Include extended info to ArenaLogFile for each player after rated arena
-# matches (guid, name, team, IP, healing/damage done, killing blows).
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-ArenaLog.ExtendedInfo = 0
-
-#
-# SQLDeveloperLogFile
-# Description: Log file for core-generated SQL queries/dumps
-# Example: "SQLDev.log" - (Enabled)
-# Default: "" - (Disabled)
-
-SQLDeveloperLogFile = ""
-
-#
-# SQLDriverLogFile
-# Description: Log file for SQL driver events.
-# Example: "SQLDriver.log" - (Enabled)
-# Default: "" - (Disabled)
-
-SQLDriverLogFile = ""
-
-#
-# SQLDriverQueryLogging
-# Description: Log SQL queries to the SQLDriverLogFile and console.
-# Default: 0 - (Disabled, Query errors only)
-# 1 - (Enabled, Full query logging - may have performance impact)
-
-SQLDriverQueryLogging = 0
-
-#
-# LogColors
-# Description: Colors for log messages (Format: "normal basic detail debug").
-# Colors: 0 - Black
-# 1 - Red
-# 2 - Green
-# 3 - Brown
-# 4 - Blue
-# 5 - Magenta
-# 6 - Cyan
-# 7 - Grey
-# 8 - Yellow
-# 9 - Lred
-# 10 - Lgreen
-# 11 - Lblue
-# 12 - Lmagenta
-# 13 - Lcyan
-# 14 - White
-# Example: "13 11 9 5" - (Enabled)
-# Default: "" - (Disabled)
-
-LogColors = ""
-
-#
-# EnableLogDB
-# Description: Write log messages to database (LogDatabaseInfo).
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-EnableLogDB = 0
-
-#
-# DBLogLevel
-# Description: Log level of databases logging.
-# Default: 2 - (Detail)
-# 0 - (Minimum)
-# 1 - (Basic)
-# 3 - (Full/Debug)
-
-DBLogLevel = 2
-
-#
-# LogDB.Char
-# Description: Log character operations to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.Char = 0
-
-#
-# LogDB.GM
-# Description: Log gamemaster commands to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.GM = 0
-
-#
-# LogDB.RA
-# Description: Log remote access events to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.RA = 0
-
-#
-# LogDB.World
-# Description: Log world server packets to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled, May have performance impact)
-
-LogDB.World = 0
-
-#
-# LogDB.Chat
-# Description: Log chat messages to database.
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-LogDB.Chat = 0
-
-
-# ChatLogFile
-# Description: Log file for chat logs.
-# Default: "Chat.log" - (Enabled)
-# "" - (Disabled)
-
-ChatLogFile = "Chat.log"
-
-# ChatLogTimestamp
-# Description: Append timestamp to the chat log file name.
-# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
-# Default: 0 - (Disabled)
-# 1 - (Enabled)
-
-ChatLogTimestamp = 0
-
-#
# ChatLogs.Channel
# Description: Log custom channel chat.
# Default: 0 - (Disabled)
@@ -790,6 +488,7 @@ ChatLogs.Addon = 0
ChatLogs.BattleGround = 0
+# Extended Logging system configuration moved to end of file (on purpose)
#
###################################################################################################
@@ -1277,6 +976,14 @@ Quests.IgnoreAutoComplete = 0
Guild.EventLogRecordsCount = 100
#
+# Guild.ResetHour
+# Description: Hour of the day when the daily cap resets occur.
+# Range: 0-23
+# Default: 6 - (06:00 AM)
+
+Guild.ResetHour = 6
+
+#
# Guild.BankEventLogRecordsCount
# Description: Number of log entries for guild bank events that are stored per guild. Old
# entries will be overwritten if the number of log entries exceed the
@@ -1407,12 +1114,15 @@ Command.LookupMaxResults = 0
AllowTickets = 1
#
-# DungeonFinder.Enable
+# DungeonFinder.OptionsMask
# Description: Dungeon and raid finder system.
-# Default: 1 - (Enabled)
-# 0 - (Disabled)
+# Value is a bitmask consisting of:
+# LFG_OPTION_ENABLE_DUNGEON_FINDER = 1, Enable the dungeon finder browser
+# LFG_OPTION_ENABLE_RAID_BROWSER = 2, Enable the raid browser
+# Default: 1
+
+DungeonFinder.OptionsMask = 1
-DungeonFinder.Enable = 1
#
# DBC.EnforceItemAttributes
@@ -1461,15 +1171,6 @@ Warden.NumMemChecks = 3
Warden.NumOtherChecks = 7
#
-# Warden.LogFile
-# Description: Client check fails will be logged here.
-# Default: "" - (Disabled)
-# "Warden.log" - (Enabled)
-#
-
-Warden.LogFile = ""
-
-#
# Warden.ClientResponseDelay
# Description: Time (in seconds) before client is getting disconnecting for not responding.
# Default: 600 - (10 Minutes)
@@ -1489,7 +1190,7 @@ Warden.ClientCheckHoldOff = 30
#
# Warden.ClientCheckFailAction
# Description: Default action being taken if a client check failed. Actions can be
-# overwritten for each single check via warden_action table in characters
+# overwritten for each single check via warden_action table in characters
# database.
# Default: 0 - (Disabled, Logging only)
# 1 - (Kick)
@@ -1520,6 +1221,14 @@ Warden.BanDuration = 86400
AllowTwoSide.Accounts = 1
#
+# AllowTwoSide.Interaction.Calendar
+# Description: Allow calendar invites between factions.
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+AllowTwoSide.Interaction.Calendar = 0
+
+#
# AllowTwoSide.Interaction.Chat
# Description: Allow say chat between factions.
# Default: 0 - (Disabled)
@@ -2252,9 +1961,9 @@ Rate.MoveSpeed = 1
#
# Rate.InstanceResetTime
-# Description: Multiplier for the rate between global raid/heroic instance resets
-# (dbc value). Higher value increases the time between resets,
-# lower value lowers the time, you need clean instance_reset in
+# Description: Multiplier for the rate between global raid/heroic instance resets
+# (dbc value). Higher value increases the time between resets,
+# lower value lowers the time, you need clean instance_reset in
# characters db in order to let new values work.
# Default: 1
@@ -2496,6 +2205,62 @@ Battleground.Random.ResetHour = 6
###################################################################################################
###################################################################################################
+# BATTLEFIELD CONFIG
+#
+# Wintergrasp.Enable
+# Description: Enable the Wintergrasp battlefield.
+# Default: 0 - (Disabled)
+# 1 - (Enabled, Experimental as of still being in development)
+
+Wintergrasp.Enable = 0
+
+#
+# Wintergrasp.PlayerMax
+# Description: Maximum number of players allowed in Wintergrasp.
+# Default: 100
+
+Wintergrasp.PlayerMax = 100
+
+#
+# Wintergrasp.PlayerMin
+# Description: Minimum number of players required for Wintergrasp.
+# Default: 0
+
+Wintergrasp.PlayerMin = 0
+
+#
+# Wintergrasp.PlayerMinLvl
+# Description: Required character level for the Wintergrasp battle.
+# Default: 77
+
+Wintergrasp.PlayerMinLvl = 77
+
+#
+# Wintergrasp.BattleTimer
+# Description: Time (in minutes) for the Wintergrasp battle to last.
+# Default: 30
+
+Wintergrasp.BattleTimer = 30
+
+#
+# Wintergrasp.NoBattleTimer
+# Description: Time (in minutes) between Wintergrasp battles.
+# Default: 150
+
+Wintergrasp.NoBattleTimer = 150
+
+#
+# Wintergrasp.CrashRestartTimer
+# Description: Time (in minutes) to delay the restart of Wintergrasp if the world server
+# crashed during a running battle.
+# Default: 10
+
+Wintergrasp.CrashRestartTimer = 10
+
+#
+###################################################################################################
+
+###################################################################################################
# ARENA CONFIG
#
# Arena.MaxRatingDifference
@@ -2582,6 +2347,15 @@ Arena.ArenaStartPersonalRating = 0
Arena.ArenaStartMatchmakerRating = 1500
#
+# ArenaLog.ExtendedInfo
+# Description: Include extended info to ArenaLogFile for each player after rated arena
+# matches (guid, name, team, IP, healing/damage done, killing blows).
+# Default: 0 - (Disabled)
+# 1 - (Enabled)
+
+ArenaLog.ExtendedInfo = 0
+
+#
###################################################################################################
###################################################################################################
@@ -2888,3 +2662,175 @@ PlayerDump.DisallowOverwrite = 1
#
###################################################################################################
+
+###################################################################################################
+#
+# LOGGING SYSTEM SETTINGS
+#
+# Appender config values: Given a appender "name"
+# Appender.name
+# Description: Defines 'where to log'
+# Format: Type,LogLevel,Flags,optional1,optional2
+#
+# Type
+# 0 - (None)
+# 1 - (Console)
+# 2 - (File)
+# 3 - (DB)
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# Flags:
+# 0 - None
+# 1 - Prefix Timestamp to the text
+# 2 - Prefix Log Level to the text
+# 4 - Prefix Log Filter type to the text
+# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
+# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
+#
+# Colors (read as optional1 if Type = Console)
+# Format: "fatal error warn info debug trace"
+# 0 - BLACK
+# 1 - RED
+# 2 - GREEN
+# 3 - BROWN
+# 4 - BLUE
+# 5 - MAGENTA
+# 6 - CYAN
+# 7 - GREY
+# 8 - YELLOW
+# 9 - LRED
+# 10 - LGREEN
+# 11 - LBLUE
+# 12 - LMAGENTA
+# 13 - LCYAN
+# 14 - WHITE
+# Example: "13 11 9 5 3 1"
+#
+# File: Name of the file (read as optional1 if Type = File)
+# Allows to use one "%s" to create dynamic files
+#
+# Mode: Mode to open the file (read as optional2 if Type = File)
+# a - (Append)
+# w - (Overwrite)
+#
+
+Appender.Console=1,3,0
+Appender.Server=2,2,0,Server.log,w
+Appender.GM=2,2,0,GM.log
+Appender.DBErrors=2,2,0,DBErrors.log
+Appender.Char=2,2,0,Char.log,w
+Appender.RA=2,2,0,RA.log
+Appender.Warden=2,4,0,Warden.log
+Appender.Chat=2,2,0,Chat.log
+Appender.CharDump=2,2,0,%s.log
+Appender.Arenas=2,2,0,Arena.log
+Appender.SQLDev=2,2,0,SQLDev.log
+Appender.SQLDriver=2,2,0,SQLDriver.log
+
+# Appenders
+# Description: List of Appenders to read from config
+# (Using spaces as separator).
+# Default: "Console Server GM DBErrors Char RA Warden Chat"
+
+Appenders=Console Server GM DBErrors Char RA Warden Chat
+
+# Logger config values: Given a logger "name"
+# Logger.name
+# Description: Defines 'What to log'
+# Format: Type,LogLevel,AppenderList
+# Type
+# 0 - Default. Each type that has no config will
+# rely on this one. Core will create this logger
+# (disabled) if it's not configured
+# 1 - Units that doesn't fit in other categories
+# 2 - Pets
+# 3 - Vehicles
+# 4 - C++ AI, instance scripts, etc.
+# 5 - DB AI, such as SAI, EAI, CreatureAI
+# 6 - DB map scripts
+# 7 - Network input/output,
+# such as packet handlers and netcode logs
+# 8 - Spellsystem and aurasystem
+# 9 - Achievement system
+# 10 - Condition system
+# 11 - Pool system
+# 12 - Auction house
+# 13 - Arena's and battlegrounds
+# 14 - Outdoor PVP
+# 15 - Chat system
+# 16 - LFG system
+# 17 - Maps, instances (not scripts),
+# grids, cells, visibility, etc.
+# 18 - Player that doesn't fit in other categories.
+# 19 - Player loading from DB
+# (Player::_LoadXXX functions)
+# 20 - Items
+# 21 - Player skills (do not confuse with spells)
+# 22 - Player chat logs
+# 23 - loot
+# 24 - guilds
+# 25 - transports
+# 26 - SQL. DB errors
+# 27 - GM Commands
+# 28 - Remote Access Commands
+# 29 - Warden
+# 30 - Authserver
+# 31 - Worldserver
+# 32 - Game Events
+# 33 - Calendar
+# 34 - Character (Exclusive to log login, logout, create, rename)
+# 35 - Arenas
+# 36 - SQL Driver
+# 37 - SQL Dev
+# 38 - Player Dump
+# 39 - Battlefield
+# 40 - Server Loading
+# 41 - Opcodes (just id and name sent / received)
+# 42 - SOAP
+#
+# LogLevel
+# 0 - (Disabled)
+# 1 - (Trace)
+# 2 - (Debug)
+# 3 - (Info)
+# 4 - (Warn)
+# 5 - (Error)
+# 6 - (Fatal)
+#
+# AppenderList: List of appenders linked to logger
+# (Using spaces as separator).
+#
+
+Logger.Root=0,5,Console Server
+Logger.Chat=22,2,Chat
+Logger.DBErrors=26,5,Console Server DBErrors
+Logger.GM=27,3,Console Server GM
+Logger.RA=28,3,RA
+Logger.Warden=29,4,Warden
+Logger.WorldServer=31,3,Console Server
+Logger.Character=34,3,Char
+Logger.Arenas=35,3,Arenas
+Logger.SQLDriver=36,5,SQLDriver
+Logger.SQLDev=37,3,SQLDev
+Logger.CharDump=38,3,CharDump
+Logger.Load=40,3,Console Server
+Logger.Opcodes=41,6,Console Server
+
+#
+# Loggers
+# Description: List of Loggers to read from config
+# (Using spaces as separator).
+# Default: "Root Chat DBErrors GM RA Warden Character Load"
+
+Loggers=Root Chat DBErrors GM RA Warden Character Load WorldServer Opcodes
+
+#
+###################################################################################################
diff --git a/src/server/worldserver/worldserver.rc b/src/server/worldserver/worldserver.rc
index 2f778e599a1..2f778e599a1 100755..100644
--- a/src/server/worldserver/worldserver.rc
+++ b/src/server/worldserver/worldserver.rc
diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt
index bde62c24c70..55a136f6329 100644
--- a/src/tools/map_extractor/CMakeLists.txt
+++ b/src/tools/map_extractor/CMakeLists.txt
@@ -43,5 +43,5 @@ add_dependencies(mapextractor mpq)
if( UNIX )
install(TARGETS mapextractor DESTINATION bin)
elseif( WIN32 )
- install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
+ install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index d64276c6363..d0342717324 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -9,6 +9,7 @@
#include "direct.h"
#else
#include <sys/stat.h>
+#include <unistd.h>
#endif
#include "dbcfile.h"
@@ -900,7 +901,7 @@ void ExtractMapsFromMpq(uint32 build)
printf("Convert map files\n");
for(uint32 z = 0; z < map_count; ++z)
{
- printf("Extract %s (%d/%d) \n", map_ids[z].name, z+1, map_count);
+ printf("Extract %s (%d/%u) \n", map_ids[z].name, z+1, map_count);
// Loadup map grid data
sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
WDT_file wdt;
@@ -980,13 +981,13 @@ void ExtractDBCFiles(int locale, bool basicLocale)
}
// extract DBCs
- int count = 0;
+ uint32 count = 0;
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{
string filename = path;
filename += (iter->c_str() + strlen("DBFilesClient\\"));
- if(ExtractFile(iter->c_str(), filename))
+ if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC files\n\n", count);
diff --git a/src/tools/map_extractor/dbcfile.cpp b/src/tools/map_extractor/dbcfile.cpp
index 927d3d62b7f..c1cab7ddb2f 100644
--- a/src/tools/map_extractor/dbcfile.cpp
+++ b/src/tools/map_extractor/dbcfile.cpp
@@ -3,12 +3,12 @@
#include "dbcfile.h"
#include "mpq_libmpq04.h"
-DBCFile::DBCFile(const std::string &filename):
- filename(filename),
- data(0)
+DBCFile::DBCFile(const std::string& filename):
+ filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
{
}
+
bool DBCFile::open()
{
MPQFile f(filename.c_str());
diff --git a/src/tools/map_extractor/dbcfile.h b/src/tools/map_extractor/dbcfile.h
index aef61df7aaa..6862678a73b 100644
--- a/src/tools/map_extractor/dbcfile.h
+++ b/src/tools/map_extractor/dbcfile.h
@@ -59,8 +59,8 @@ public:
}
private:
Record(DBCFile &file, unsigned char *offset): file(file), offset(offset) {}
- unsigned char *offset;
DBCFile &file;
+ unsigned char *offset;
friend class DBCFile;
friend class DBCFile::Iterator;
diff --git a/src/tools/vmap4_extractor/adtfile.cpp b/src/tools/vmap4_extractor/adtfile.cpp
index a966172a3be..a605118eead 100644
--- a/src/tools/vmap4_extractor/adtfile.cpp
+++ b/src/tools/vmap4_extractor/adtfile.cpp
@@ -26,7 +26,7 @@
#define snprintf _snprintf
#endif
-const char * GetPlainName(const char * FileName)
+char const* GetPlainName(char const* FileName)
{
const char * szTemp;
@@ -35,7 +35,7 @@ const char * GetPlainName(const char * FileName)
return FileName;
}
-char * GetPlainName(char * FileName)
+char* GetPlainName(char* FileName)
{
char * szTemp;
@@ -44,24 +44,21 @@ char * GetPlainName(char * FileName)
return FileName;
}
-void fixnamen(char *name, size_t len)
+void fixnamen(char* name, size_t len)
{
- for (size_t i=0; i<len-3; i++)
+ for (size_t i = 0; i < len-3; i++)
{
- if (i>0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1]))
- {
+ if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i-1]))
name[i] |= 0x20;
- } else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
- {
+ else if ((i == 0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
name[i] &= ~0x20;
- }
}
//extension in lowercase
- for(size_t i=len-3; i<len; i++)
+ for (size_t i = len - 3; i < len; i++)
name[i] |= 0x20;
}
-void fixname2(char *name, size_t len)
+void fixname2(char* name, size_t len)
{
for (size_t i=0; i<len-3; i++)
{
@@ -70,15 +67,15 @@ void fixname2(char *name, size_t len)
}
}
-char * GetExtension(char * FileName)
+char* GetExtension(char* FileName)
{
- char * szTemp;
- if((szTemp = strrchr(FileName, '.')) != NULL)
+ char* szTemp;
+ if (szTemp = strrchr(FileName, '.'))
return szTemp;
return NULL;
}
-ADTFile::ADTFile(char* filename): ADT(filename)
+ADTFile::ADTFile(char* filename): ADT(filename), nWMO(0), nMDX(0), WmoInstansName(NULL), ModelInstansName(NULL)
{
Adtfilename.append(filename);
}
@@ -99,7 +96,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
xMap = TempMapNumber.substr(TempMapNumber.find("_")+1,(TempMapNumber.find_last_of("_")-1) - (TempMapNumber.find("_")));
yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_")+1,(TempMapNumber.length()) - (TempMapNumber.find_last_of("_")));
Adtfilename.erase((Adtfilename.length()-xMap.length()-yMap.length()-2), (xMap.length()+yMap.length()+2));
- string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
+ //string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
//printf("Processing map %s...\n", AdtMapNumber.c_str());
//printf("MapNumber = %s\n", TempMapNumber.c_str());
//printf("xMap = %s\n", xMap.c_str());
@@ -159,18 +156,17 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
{
if (size)
{
- char *buf = new char[size];
+ char* buf = new char[size];
ADT.read(buf, size);
- char *p=buf;
+ char* p=buf;
int q = 0;
WmoInstansName = new string[size];
while (p<buf+size)
{
- string path(p);
- char* s=GetPlainName(p);
- fixnamen(s,strlen(s));
- fixname2(s,strlen(s));
- p=p+strlen(p)+1;
+ char* s = GetPlainName(p);
+ fixnamen(s, strlen(s));
+ fixname2(s, strlen(s));
+ p += strlen(p) + 1;
WmoInstansName[q++] = s;
}
delete[] buf;
diff --git a/src/tools/vmap4_extractor/adtfile.h b/src/tools/vmap4_extractor/adtfile.h
index 08814996f68..3de1dccfacd 100644
--- a/src/tools/vmap4_extractor/adtfile.h
+++ b/src/tools/vmap4_extractor/adtfile.h
@@ -109,6 +109,11 @@ struct MapChunkHeader
class ADTFile
{
+private:
+ //size_t mcnk_offsets[256], mcnk_sizes[256];
+ MPQFile ADT;
+ //mcell Mcell;
+ string Adtfilename;
public:
ADTFile(char* filename);
~ADTFile();
@@ -126,11 +131,6 @@ public:
return Mcell;
}
*/
-private:
- //size_t mcnk_offsets[256], mcnk_sizes[256];
- MPQFile ADT;
- //mcell Mcell;
- string Adtfilename;
};
const char * GetPlainName(const char * FileName);
diff --git a/src/tools/vmap4_extractor/dbcfile.cpp b/src/tools/vmap4_extractor/dbcfile.cpp
index 2474cea5259..a651456d916 100644
--- a/src/tools/vmap4_extractor/dbcfile.cpp
+++ b/src/tools/vmap4_extractor/dbcfile.cpp
@@ -23,9 +23,10 @@
#include <cstdio>
-DBCFile::DBCFile(const std::string &filename) : filename(filename)
+DBCFile::DBCFile(const std::string& filename):
+ filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
{
- data = NULL;
+
}
bool DBCFile::open()
diff --git a/src/tools/vmap4_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp
index e81972f521f..57f9b421dbe 100644
--- a/src/tools/vmap4_extractor/model.cpp
+++ b/src/tools/vmap4_extractor/model.cpp
@@ -26,15 +26,14 @@
Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0)
{
+ memset(&header, 0, sizeof(header));
}
bool Model::open()
{
MPQFile f(filename.c_str());
- ok = !f.isEof();
-
- if (!ok)
+ if (f.isEof())
{
f.close();
// Do not show this error on console to avoid confusion, the extractor can continue working even if some models fail to load
@@ -52,9 +51,7 @@ bool Model::open()
vertices = new Vec3D[header.nBoundingVertices];
f.read(vertices,header.nBoundingVertices*12);
for (uint32 i=0; i<header.nBoundingVertices; i++)
- {
vertices[i] = fixCoordSystem(vertices[i]);
- }
f.seek(0);
f.seekRelative(header.ofsBoundingTriangles);
indices = new uint16[header.nBoundingTriangles];
@@ -73,13 +70,13 @@ bool Model::open()
bool Model::ConvertToVMAPModel(const char * outfilename)
{
int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
- FILE * output=fopen(outfilename,"wb");
- if(!output)
+ FILE* output=fopen(outfilename, "wb");
+ if (!output)
{
printf("Can't create the output file '%s'\n",outfilename);
return false;
}
- fwrite(szRawVMAPMagic,8,1,output);
+ fwrite(szRawVMAPMagic, 8, 1, output);
uint32 nVertices = 0;
nVertices = header.nBoundingVertices;
fwrite(&nVertices, sizeof(int), 1, output);
@@ -101,20 +98,18 @@ bool Model::ConvertToVMAPModel(const char * outfilename)
wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes;
fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nIndexes, sizeof(uint32), 1, output);
- if(nIndexes >0)
- {
+ if (nIndexes >0)
fwrite(indices, sizeof(unsigned short), nIndexes, output);
- }
- fwrite("VERT",4, 1, output);
+
+ fwrite("VERT", 4, 1, output);
wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nVertices, sizeof(int), 1, output);
- if(nVertices >0)
+ if (nVertices >0)
{
for(uint32 vpos=0; vpos <nVertices; ++vpos)
- {
std::swap(vertices[vpos].y, vertices[vpos].z);
- }
+
fwrite(vertices, sizeof(float)*3, nVertices, output);
}
@@ -134,24 +129,24 @@ Vec3D fixCoordSystem2(Vec3D v)
return Vec3D(v.x, v.z, v.y);
}
-ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
+ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
+ : model(NULL), d1(0), w(0.0f)
{
float ff[3];
f.read(&id, 4);
- f.read(ff,12);
- pos = fixCoords(Vec3D(ff[0],ff[1],ff[2]));
- f.read(ff,12);
- rot = Vec3D(ff[0],ff[1],ff[2]);
- f.read(&scale,4);
+ f.read(ff, 12);
+ pos = fixCoords(Vec3D(ff[0], ff[1], ff[2]));
+ f.read(ff, 12);
+ rot = Vec3D(ff[0], ff[1], ff[2]);
+ f.read(&scale, 4);
// scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
sc = scale / 1024.0f;
char tempname[512];
sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName);
- FILE *input;
- input = fopen(tempname, "r+b");
+ FILE* input = fopen(tempname, "r+b");
- if(!input)
+ if (!input)
{
//printf("ModelInstance::ModelInstance couldn't open %s\n", tempname);
return;
@@ -167,7 +162,9 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID,
uint16 adtId = 0;// not used for models
uint32 flags = MOD_M2;
- if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
+ if (tileX == 65 && tileY == 65)
+ flags |= MOD_WORLDSPAWN;
+
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name
fwrite(&mapID, sizeof(uint32), 1, pDirfile);
fwrite(&tileX, sizeof(uint32), 1, pDirfile);
diff --git a/src/tools/vmap4_extractor/model.h b/src/tools/vmap4_extractor/model.h
index a6f4e27583c..bf15d813ce8 100644
--- a/src/tools/vmap4_extractor/model.h
+++ b/src/tools/vmap4_extractor/model.h
@@ -21,33 +21,15 @@
#include "loadlib/loadlib.h"
#include "vec3d.h"
-//#include "mpq.h"
#include "modelheaders.h"
#include <vector>
-class Model;
-class WMOInstance;
class MPQFile;
Vec3D fixCoordSystem(Vec3D v);
class Model
{
-public:
- ModelHeader header;
- uint32 offsBB_vertices, offsBB_indices;
- Vec3D *BB_vertices, *vertices;
- uint16 *BB_indices, *indices;
- size_t nIndices;
-
- bool open();
- bool ConvertToVMAPModel(const char * outfilename);
-
- bool ok;
-
- Model(std::string &filename);
- ~Model() {_unload();}
-
private:
void _unload()
{
@@ -57,21 +39,30 @@ private:
indices = NULL;
}
std::string filename;
- char outfilename;
+public:
+ ModelHeader header;
+ Vec3D* vertices;
+ uint16* indices;
+
+ bool open();
+ bool ConvertToVMAPModel(char const* outfilename);
+
+ Model(std::string& filename);
+ ~Model() { _unload(); }
};
class ModelInstance
{
public:
- Model *model;
+ Model* model;
uint32 id;
Vec3D pos, rot;
unsigned int d1, scale;
- float w,sc;
+ float w, sc;
- ModelInstance() {}
- ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
+ ModelInstance() : model(NULL), id(0), d1(0), scale(0), w(0.0f), sc(0.0f) {}
+ ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
};
diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h
index ed51022de78..89f715e9e87 100644
--- a/src/tools/vmap4_extractor/mpq_libmpq04.h
+++ b/src/tools/vmap4_extractor/mpq_libmpq04.h
@@ -24,7 +24,7 @@ public:
void close();
void GetFileListTo(vector<string>& filelist) {
- uint32 filenum;
+ uint32_t filenum;
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
libmpq__off_t size, transferred;
libmpq__file_unpacked_size(mpq_a, filenum, &size);
@@ -60,8 +60,8 @@ class MPQFile
libmpq__off_t pointer,size;
// disable copying
- MPQFile(const MPQFile &f) {}
- void operator=(const MPQFile &f) {}
+ MPQFile(const MPQFile& /*f*/) {}
+ void operator=(const MPQFile& /*f*/) {}
public:
MPQFile(const char* filename); // filenames are not case sensitive
diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp
index e60a773c6de..186f9c8606e 100644
--- a/src/tools/vmap4_extractor/vmapexport.cpp
+++ b/src/tools/vmap4_extractor/vmapexport.cpp
@@ -159,12 +159,12 @@ bool ExtractSingleWmo(std::string& fname)
int p = 0;
//Select root wmo files
- const char * rchr = strrchr(plain_name, '_');
+ char const* rchr = strrchr(plain_name, '_');
if(rchr != NULL)
{
char cpy[4];
- strncpy((char*)cpy,rchr,4);
- for (int i=0;i < 4; ++i)
+ strncpy((char*)cpy, rchr, 4);
+ for (int i = 0; i < 4; ++i)
{
int m = cpy[i];
if(isdigit(m))
@@ -200,7 +200,7 @@ bool ExtractSingleWmo(std::string& fname)
strcpy(temp, fname.c_str());
temp[fname.length()-4] = 0;
char groupFileName[1024];
- sprintf(groupFileName,"%s_%03d.wmo",temp, i);
+ sprintf(groupFileName, "%s_%03u.wmo", temp, i);
//printf("Trying to open groupfile %s\n",groupFileName);
string s = groupFileName;
@@ -382,9 +382,9 @@ bool processArgv(int argc, char ** argv, const char *versionString)
{
bool result = true;
hasInputPathParam = false;
- bool preciseVectorData = false;
+ preciseVectorData = false;
- for(int i=1; i< argc; ++i)
+ for(int i = 1; i < argc; ++i)
{
if(strcmp("-s",argv[i]) == 0)
{
@@ -447,7 +447,7 @@ int main(int argc, char ** argv)
const char *versionString = "V4.00 2012_02";
// Use command line arguments, when some
- if(!processArgv(argc, argv, versionString))
+ if (!processArgv(argc, argv, versionString))
return 1;
// some simple check if working dir is dirty
@@ -469,8 +469,8 @@ int main(int argc, char ** argv)
printf("Extract %s. Beginning work ....\n",versionString);
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// Create the working directory
- if(mkdir(szWorkDirWmo
-#ifdef __linux__
+ if (mkdir(szWorkDirWmo
+#if defined(__linux__) || defined(__APPLE__)
, 0711
#endif
))
@@ -482,11 +482,11 @@ int main(int argc, char ** argv)
for (size_t i=0; i < archiveNames.size(); ++i)
{
MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());
- if(!gOpenArchives.size() || gOpenArchives.front() != archive)
+ if (gOpenArchives.empty() || gOpenArchives.front() != archive)
delete archive;
}
- if(gOpenArchives.empty())
+ if (gOpenArchives.empty())
{
printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
return 1;
@@ -494,15 +494,15 @@ int main(int argc, char ** argv)
ReadLiquidTypeTableDBC();
// extract data
- if(success)
+ if (success)
success = ExtractWmo();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//map.dbc
- if(success)
+ if (success)
{
DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
- if(!dbc->open())
+ if (!dbc->open())
{
delete dbc;
printf("FATAL ERROR: Map.dbc not found in data file.\n");
@@ -510,7 +510,7 @@ int main(int argc, char ** argv)
}
map_count=dbc->getRecordCount ();
map_ids=new map_id[map_count];
- for(unsigned int x=0;x<map_count;++x)
+ for (unsigned int x=0;x<map_count;++x)
{
map_ids[x].id=dbc->getRecord (x).getUInt(0);
strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
@@ -527,7 +527,7 @@ int main(int argc, char ** argv)
}
printf("\n");
- if(!success)
+ if (!success)
{
printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
getchar();
diff --git a/src/tools/vmap4_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp
index e3ee545db19..7420edfee2e 100644
--- a/src/tools/vmap4_extractor/wdtfile.cpp
+++ b/src/tools/vmap4_extractor/wdtfile.cpp
@@ -30,12 +30,12 @@ char * wdtGetPlainName(char * FileName)
return FileName;
}
-WDTFile::WDTFile(char* file_name, char* file_name1):WDT(file_name)
+WDTFile::WDTFile(char* file_name, char* file_name1) : WDT(file_name), gWmoInstansName(NULL), gnWMO(0)
{
filename.append(file_name1,strlen(file_name1));
}
-bool WDTFile::init(char *map_id, unsigned int mapID)
+bool WDTFile::init(char */*map_id*/, unsigned int mapID)
{
if (WDT.isEof())
{
@@ -78,9 +78,8 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
char *p=buf;
int q = 0;
gWmoInstansName = new string[size];
- while (p<buf+size)
+ while (p < buf + size)
{
- string path(p);
char* s=wdtGetPlainName(p);
fixnamen(s,strlen(s));
p=p+strlen(p)+1;
@@ -89,23 +88,20 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
delete[] buf;
}
}
- else if (!strcmp(fourcc,"MODF"))
+ else if (!strcmp(fourcc, "MODF"))
{
// global wmo instance data
if (size)
{
gnWMO = (int)size / 64;
- string gWMO_mapname;
- string fake_mapname;
- fake_mapname = "65 65 ";
- //gWMO_mapname = fake_mapname + filename;
- gWMO_mapname = fake_mapname + std::string(map_id);
- for (int i=0; i<gnWMO; ++i)
+
+ for (int i = 0; i < gnWMO; ++i)
{
int id;
WDT.read(&id, 4);
- WMOInstance inst(WDT,gWmoInstansName[id].c_str(),mapID, 65, 65, dirfile);
+ WMOInstance inst(WDT,gWmoInstansName[id].c_str(), mapID, 65, 65, dirfile);
}
+
delete[] gWmoInstansName;
}
}
diff --git a/src/tools/vmap4_extractor/wdtfile.h b/src/tools/vmap4_extractor/wdtfile.h
index f3d71c41791..5d6aed8f0bc 100644
--- a/src/tools/vmap4_extractor/wdtfile.h
+++ b/src/tools/vmap4_extractor/wdtfile.h
@@ -10,20 +10,18 @@ class ADTFile;
class WDTFile
{
+private:
+ MPQFile WDT;
+ string filename;
public:
WDTFile(char* file_name, char* file_name1);
~WDTFile(void);
- bool init(char *map_id, unsigned int mapID);
+ bool init(char* map_id, unsigned int mapID);
string* gWmoInstansName;
- int gnWMO, nMaps;
+ int gnWMO;
ADTFile* GetMap(int x, int z);
-
-private:
- MPQFile WDT;
- bool maps[64][64];
- string filename;
};
#endif
diff --git a/src/tools/vmap4_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp
index 6703872111b..0bc749b9bd5 100644
--- a/src/tools/vmap4_extractor/wmo.cpp
+++ b/src/tools/vmap4_extractor/wmo.cpp
@@ -31,8 +31,12 @@
using namespace std;
extern uint16 *LiqType;
-WMORoot::WMORoot(std::string &filename) : filename(filename)
+WMORoot::WMORoot(std::string &filename)
+ : filename(filename), col(0), nTextures(0), nGroups(0), nP(0), nLights(0),
+ nModels(0), nDoodads(0), nDoodadSets(0), RootWMOID(0), liquidType(0)
{
+ memset(bbcorn1, 0, sizeof(bbcorn1));
+ memset(bbcorn2, 0, sizeof(bbcorn2));
}
bool WMORoot::open()
@@ -57,7 +61,7 @@ bool WMORoot::open()
size_t nextpos = f.getPos() + size;
- if (!strcmp(fourcc,"MOHD"))//header
+ if (!strcmp(fourcc,"MOHD")) // header
{
f.read(&nTextures, 4);
f.read(&nGroups, 4);
@@ -68,8 +72,8 @@ bool WMORoot::open()
f.read(&nDoodadSets, 4);
f.read(&col, 4);
f.read(&RootWMOID, 4);
- f.read(bbcorn1,12);
- f.read(bbcorn2,12);
+ f.read(bbcorn1, 12);
+ f.read(bbcorn2, 12);
f.read(&liquidType, 4);
break;
}
@@ -120,15 +124,15 @@ bool WMORoot::open()
return true;
}
-bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile)
+bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile)
{
//printf("Convert RootWmo...\n");
- fwrite(szRawVMAPMagic,1,8,pOutfile);
+ fwrite(szRawVMAPMagic, 1, 8, pOutfile);
unsigned int nVectors = 0;
- fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later
- fwrite(&nGroups,4,1,pOutfile);
- fwrite(&RootWMOID,4,1,pOutfile);
+ fwrite(&nVectors,sizeof(nVectors), 1, pOutfile); // will be filled later
+ fwrite(&nGroups, 4, 1, pOutfile);
+ fwrite(&RootWMOID, 4, 1, pOutfile);
return true;
}
@@ -136,9 +140,13 @@ WMORoot::~WMORoot()
{
}
-WMOGroup::WMOGroup(std::string &filename) : filename(filename),
- MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), hlq(0), LiquEx(0), LiquBytes(0)
+WMOGroup::WMOGroup(const std::string &filename) :
+ filename(filename), MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0),
+ hlq(0), LiquEx(0), LiquBytes(0), groupName(0), descGroupName(0), mogpFlags(0),
+ mopy_size(0), moba_size(0), LiquEx_size(0), nVertices(0), nTriangles(0)
{
+ memset(bbcorn1, 0, sizeof(bbcorn1));
+ memset(bbcorn2, 0, sizeof(bbcorn2));
}
bool WMOGroup::open()
@@ -237,7 +245,7 @@ bool WMOGroup::open()
return true;
}
-int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData)
+int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool preciseVectorData)
{
fwrite(&mogpFlags,sizeof(uint32),1,output);
fwrite(&groupWMOID,sizeof(uint32),1,output);
@@ -246,7 +254,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
fwrite(bbcorn2, sizeof(float), 3, output);
fwrite(&liquflags,sizeof(uint32),1,output);
int nColTriangles = 0;
- if(pPreciseVectorData)
+ if (preciseVectorData)
{
char GRP[] = "GRP ";
fwrite(GRP,1,4,output);
@@ -479,10 +487,9 @@ WMOGroup::~WMOGroup()
delete [] LiquBytes;
}
-WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
+WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
+ : currx(0), curry(0), wmo(NULL), doodadset(0), pos(), indx(0), d3(0)
{
- pos = Vec3D(0,0,0);
-
float ff[3];
f.read(&id, 4);
f.read(ff,12);
diff --git a/src/tools/vmap4_extractor/wmo.h b/src/tools/vmap4_extractor/wmo.h
index d1f7b82f0c6..d0333265851 100644
--- a/src/tools/vmap4_extractor/wmo.h
+++ b/src/tools/vmap4_extractor/wmo.h
@@ -44,20 +44,19 @@ static inline Vec3D fixCoords(const Vec3D &v){ return Vec3D(v.z, v.x, v.y); }
class WMORoot
{
+private:
+ std::string filename;
public:
- uint32 nTextures, nGroups, nP, nLights, nModels, nDoodads, nDoodadSets, RootWMOID, liquidType;
unsigned int col;
+ uint32 nTextures, nGroups, nP, nLights, nModels, nDoodads, nDoodadSets, RootWMOID, liquidType;
float bbcorn1[3];
float bbcorn2[3];
- WMORoot(std::string &filename);
+ WMORoot(std::string& filename);
~WMORoot();
bool open();
- bool ConvertToVMAPRootWmo(FILE *output);
-private:
- std::string filename;
- char outfilename;
+ bool ConvertToVMAPRootWmo(FILE* output);
};
struct WMOLiquidHeader
@@ -78,9 +77,22 @@ struct WMOLiquidVert
class WMOGroup
{
+private:
+ std::string filename;
public:
// MOGP
- int groupName, descGroupName, mogpFlags;
+
+ char* MOPY;
+ uint16* MOVI;
+ uint16* MoviEx;
+ float* MOVT;
+ uint16* MOBA;
+ int* MobaEx;
+ WMOLiquidHeader* hlq;
+ WMOLiquidVert* LiquEx;
+ char* LiquBytes;
+ int groupName, descGroupName;
+ int mogpFlags;
float bbcorn1[3];
float bbcorn2[3];
uint16 moprIdx;
@@ -89,30 +101,17 @@ public:
uint16 nBatchB;
uint32 nBatchC, fogIdx, liquidType, groupWMOID;
- int mopy_size,moba_size;
+ int mopy_size, moba_size;
int LiquEx_size;
unsigned int nVertices; // number when loaded
int nTriangles; // number when loaded
- char *MOPY;
- uint16 *MOVI;
- uint16 *MoviEx;
- float *MOVT;
- uint16 *MOBA;
- int *MobaEx;
- WMOLiquidHeader *hlq;
- WMOLiquidVert *LiquEx;
- char *LiquBytes;
uint32 liquflags;
- WMOGroup(std::string &filename);
+ WMOGroup(std::string const& filename);
~WMOGroup();
bool open();
- int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData);
-
-private:
- std::string filename;
- char outfilename;
+ int ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool preciseVectorData);
};
class WMOInstance
@@ -122,13 +121,13 @@ public:
std::string MapName;
int currx;
int curry;
- WMOGroup *wmo;
+ WMOGroup* wmo;
+ int doodadset;
Vec3D pos;
Vec3D pos2, pos3, rot;
- uint32 indx,id, d2, d3;
- int doodadset;
+ uint32 indx, id, d2, d3;
- WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
+ WMOInstance(MPQFile&f , char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
static void reset();
};