aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README3
-rw-r--r--sql/updates/world/2012_09_18_00_world_creature_template.sql4
-rw-r--r--sql/updates/world/2012_09_18_01_world_creature_template.sql7
-rw-r--r--sql/updates/world/2012_09_19_00_world_dwarfageddon.sql16
-rw-r--r--sql/updates/world/2012_09_19_00_world_reference_loot_template.sql449
-rw-r--r--sql/updates/world/2012_09_20_00_world_creature_loot_template.sql5
-rw-r--r--sql/updates/world/2012_09_22_00_world_utgarde.sql102
-rw-r--r--sql/updates/world/2012_09_22_01_world_i_was_a_lot_of_things.sql32
-rw-r--r--sql/updates/world/2012_09_22_03_world_game_event.sql2
-rw-r--r--sql/updates/world/2012_09_24_00_world_spell_script_names.sql3
-rw-r--r--sql/updates/world/2012_09_24_01_world_spell_script_names.sql3
-rw-r--r--sql/updates/world/2012_09_24_02_world_misc.sql99
-rw-r--r--sql/updates/world/2012_09_24_03_world_misc.sql116
-rw-r--r--sql/updates/world/2012_09_26_00_world_misc.sql798
-rw-r--r--sql/updates/world/2012_09_26_01_world_spell_bonus_data.sql3
-rw-r--r--sql/updates/world/2012_09_27_01_world_custodian_of_time.sql18
-rw-r--r--sql/updates/world/2012_09_28_00_world_creature_model_info.sql1
-rw-r--r--sql/updates/world/2012_09_29_00_world_creature_model_info.sql21
-rw-r--r--sql/updates/world/2012_09_29_01_world_creature_text.sql24
-rw-r--r--sql/updates/world/2012_09_30_00_world_creature_text.sql12
-rw-r--r--sql/updates/world/2012_09_30_01_world_player_factionchange_titles.sql32
-rw-r--r--sql/updates/world/2012_09_30_02_world_creature_text.sql12
-rw-r--r--sql/updates/world/2012_09_30_03_world_creature_text.sql18
-rw-r--r--sql/updates/world/2012_10_02_00_world_oculus.sql80
-rw-r--r--sql/updates/world/2012_10_04_00_world_spelldifficulty_dbc.sql5
-rw-r--r--sql/updates/world/2012_10_04_01_world_script_texts.sql11
-rwxr-xr-xsrc/server/authserver/Main.cpp15
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp2
-rwxr-xr-xsrc/server/game/AI/CoreAI/UnitAI.h3
-rwxr-xr-xsrc/server/game/AI/CreatureAI.cpp7
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp2
-rwxr-xr-xsrc/server/game/Accounts/AccountMgr.cpp7
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp4
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp6
-rw-r--r--src/server/game/Battlefield/Battlefield.h6
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.h6
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp41
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h18
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp273
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.h63
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp557
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.h70
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.cpp233
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundQueue.h13
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAA.cpp75
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAA.h47
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp106
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.h33
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp303
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.h47
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundBE.cpp23
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundBE.h20
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp22
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundDS.h22
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.cpp95
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundEY.h39
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp104
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.h61
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundNA.cpp29
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundNA.h20
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRB.cpp74
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRB.h49
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRL.cpp30
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRL.h20
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRV.cpp20
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundRV.h21
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.cpp5
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundSA.h31
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.cpp222
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.h50
-rwxr-xr-xsrc/server/game/Chat/Channels/Channel.cpp4
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp2
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp3
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.h1
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp4
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp2
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp4
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp4
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp16
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h1
-rwxr-xr-xsrc/server/game/Entities/Item/Item.cpp2
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp48
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp4
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp96
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h13
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp20
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp32
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp415
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h12
-rwxr-xr-xsrc/server/game/Entities/Vehicle/Vehicle.cpp12
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp43
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h2
-rwxr-xr-xsrc/server/game/Handlers/BattleGroundHandler.cpp27
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp101
-rwxr-xr-xsrc/server/game/Handlers/MiscHandler.cpp4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp8
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp4
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvP.cpp2
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp1
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp12
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp40
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp24
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.h2
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp12
-rwxr-xr-xsrc/server/game/Spells/Spell.h4
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp98
-rw-r--r--src/server/game/Spells/SpellInfo.cpp6
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp24
-rwxr-xr-xsrc/server/game/Spells/SpellScript.cpp18
-rwxr-xr-xsrc/server/game/Spells/SpellScript.h17
-rwxr-xr-xsrc/server/game/World/World.cpp3
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp4
-rw-r--r--src/server/scripts/Commands/cs_quest.cpp4
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp8
-rw-r--r--src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp12
-rw-r--r--src/server/scripts/Kalimdor/tanaris.cpp64
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp214
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp54
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp19
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp43
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp12
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp6
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp35
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp2
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp16
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp2
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp16
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp49
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp13
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp83
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp303
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/oculus.h13
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp146
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp8
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp122
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp60
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp31
-rw-r--r--src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp77
-rw-r--r--src/server/scripts/Northrend/borean_tundra.cpp131
-rw-r--r--src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp4
-rw-r--r--src/server/scripts/Outland/boss_doomlord_kazzak.cpp2
-rw-r--r--src/server/scripts/Outland/shadowmoon_valley.cpp91
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp16
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp11
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp2
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp8
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp2
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp106
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp44
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp6
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp2
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp10
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp6
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp6
-rw-r--r--src/server/scripts/World/npcs_special.cpp4
-rwxr-xr-xsrc/server/shared/Common.h8
-rwxr-xr-xsrc/server/shared/CompilerDefs.h10
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp4
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h2
-rwxr-xr-xsrc/server/shared/Database/MySQLConnection.h2
-rwxr-xr-xsrc/server/shared/Define.h12
-rw-r--r--src/server/shared/Dynamic/HashNamespace.h119
-rwxr-xr-xsrc/server/shared/Dynamic/LinkedList.h16
-rwxr-xr-xsrc/server/shared/Dynamic/LinkedReference/Reference.h13
-rwxr-xr-xsrc/server/shared/Dynamic/ObjectRegistry.h3
-rwxr-xr-xsrc/server/shared/Dynamic/UnorderedMap.h83
-rw-r--r--src/server/shared/Dynamic/UnorderedSet.h66
-rwxr-xr-xsrc/server/shared/Logging/Log.cpp19
-rwxr-xr-xsrc/server/shared/Utilities/ByteConverter.h4
-rwxr-xr-xsrc/server/shared/Utilities/EventProcessor.h7
-rwxr-xr-xsrc/server/shared/Utilities/Util.cpp44
-rwxr-xr-xsrc/server/shared/Utilities/Util.h347
175 files changed, 5623 insertions, 2930 deletions
diff --git a/README b/README
index f2ae18f6cf5..9f2f9483b81 100644
--- a/README
+++ b/README
@@ -38,9 +38,6 @@ https://github.com/TrinityCore/TrinityCore
For further information on the TrinityCore project, please visit our
project website at http://www.TrinityCore.org
-To get nightly builds of the master branch of TrinityCore, please visit
-http://www.TrinityCore.net
-
Documentation including installation instructions can be found inside
the doc directory.
diff --git a/sql/updates/world/2012_09_18_00_world_creature_template.sql b/sql/updates/world/2012_09_18_00_world_creature_template.sql
new file mode 100644
index 00000000000..5ead9430d60
--- /dev/null
+++ b/sql/updates/world/2012_09_18_00_world_creature_template.sql
@@ -0,0 +1,4 @@
+UPDATE `creature_template` SET `unit_flags2`=0 WHERE `entry`=33109; -- Salvaged Demolisher
+UPDATE `creature_template` SET `unit_flags2`=2049 WHERE `entry`=33063; -- Wrecked Siege Engine
+UPDATE `creature_template` SET `unit_flags2`=1 WHERE `entry`=33059; -- Wrecked Demolisher
+UPDATE `creature_template` SET `unit_flags2`=0 WHERE `entry`=33167; -- Salvaged Demolisher Mechanic Seat
diff --git a/sql/updates/world/2012_09_18_01_world_creature_template.sql b/sql/updates/world/2012_09_18_01_world_creature_template.sql
new file mode 100644
index 00000000000..4e31e7f6f68
--- /dev/null
+++ b/sql/updates/world/2012_09_18_01_world_creature_template.sql
@@ -0,0 +1,7 @@
+-- Razorscale
+UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (33186,33724);
+
+DELETE FROM `creature_template_addon` WHERE `entry` IN (33186,33724);
+INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES
+(33186, 0, 0x3000000, 0x1, ''),
+(33724, 0, 0x3000000, 0x1, '');
diff --git a/sql/updates/world/2012_09_19_00_world_dwarfageddon.sql b/sql/updates/world/2012_09_19_00_world_dwarfageddon.sql
new file mode 100644
index 00000000000..1eda383b67d
--- /dev/null
+++ b/sql/updates/world/2012_09_19_00_world_dwarfageddon.sql
@@ -0,0 +1,16 @@
+-- Edit the required spell credit markers for Dwarfageddon (10/25 player) achievements
+UPDATE `spell_dbc` SET `attributes`=0x00800100,`DmgMultiplier1`=0, `DmgMultiplier2`=0, `DmgMultiplier3`=0,`RangeIndex`=12 WHERE `ID`=65387; -- (SPELL_ATTR0_HIDE_IN_COMBAT_LOG, SPELL_ATTR0_CASTABLE_WHILE_DEAD)
+-- Edit SAI support for Dwarfageddon (10 and 25 player) achievement /required changes since attribute castable_while_dead is not working/
+SET @Defender := 33236;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=@Defender AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@Defender,0,0,0,25,0,100,0,0,0,0,0,42,0,1,0,0,0,0,1,0,0,0,0,0,0,0,'Steelforged Defender - On reset - Set Invincibility for 1%'),
+(@Defender,0,1,2,2,0,100,0,1,1,0,0,11,65387,0,0,0,0,0,1,0,0,0,0,0,0,0,'Steelforged Defender - Health Percentage (1%) - Cast spell for achievement credit'),
+(@Defender,0,2,0,61,0,100,0,0,0,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Steelforged Defender - Linked with previous event - Die'),
+(@Defender,0,3,0,0,0,100,0,0,2500,9000,12000,11,62845,0,0,0,0,0,2,0,0,0,0,0,0,0,'Steelforged Defender - IC - Hamstring'),
+(@Defender,0,4,0,0,0,100,0,0,2600,13000,14000,11,50370,0,0,0,0,0,2,0,0,0,0,0,0,0,'Steelforged Defender - IC - Cast Sunder armor'),
+(@Defender,0,5,0,0,0,100,0,500,4000,4500,9000,11,57780,0,0,0,0,0,2,0,0,0,0,0,0,0,'Steelforged Defender - IC - Cast Lightening Bolt');
+-- Add conditions to prevent lag and for the sake of logic
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (65387);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,1,65387,0,1,31,0,4,0,0,0,0,'','Steelforged Defender kill credit for achievement can hit only players');
diff --git a/sql/updates/world/2012_09_19_00_world_reference_loot_template.sql b/sql/updates/world/2012_09_19_00_world_reference_loot_template.sql
new file mode 100644
index 00000000000..7db30ede52b
--- /dev/null
+++ b/sql/updates/world/2012_09_19_00_world_reference_loot_template.sql
@@ -0,0 +1,449 @@
+-- Changes To VOA Loot
+-- Update gold drops for bosses
+-- Archavon 10 & 25
+UPDATE `creature_template` SET `mingold`=1700000,`maxgold`=1800000 WHERE `entry` IN (31125,31722);
+-- Emalon & koralon 10 & 25
+UPDATE `creature_template` SET `mingold`=1800000,`maxgold`=1900000 WHERE `entry` IN (33993,33994,35013,35360);
+-- Toravon 10 & 25
+UPDATE `creature_template` SET `mingold`=1900000,`maxgold`=2000000 WHERE `entry` IN (38433,38462);
+-- Combine PVP and PVE ref templates so loot has chance to be all pvp or all pve not one of each
+-- Revome deadly items other than chest lega and hands from Archavon 25 loot
+-- Toravon 25 drops 3 items
+SET @ARCHAVON10 = 34209;
+SET @ARCHAVON25 = 34216;
+SET @EMALON10 = 34208;
+SET @EMALON25 = 34215;
+SET @TORAVON10 = 34206;
+SET @TORAVON25 = 34207;
+SET @KORALON10 = 34204;
+SET @KORALON25 = 34205;
+-- Create Reference loot template for @ARCHAVON25 T7(25) & Deadly Chest,Legs,Hands
+DELETE FROM `reference_loot_template` WHERE `entry` IN (@ARCHAVON25,@KORALON25,@EMALON25);
+INSERT INTO `reference_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(@ARCHAVON25,40550,0,1,1,1,1), -- Valorous Scourgeborne Battleplate
+(@ARCHAVON25,40552,0,1,1,1,1), -- Valorous Scourgeborne Gauntlets
+(@ARCHAVON25,40556,0,1,1,1,1), -- Valorous Scourgeborne Legplates
+(@ARCHAVON25,40559,0,1,1,1,1), -- Valorous Scourgeborne Chestguard
+(@ARCHAVON25,40563,0,1,1,1,1), -- Valorous Scourgeborne Handguards
+(@ARCHAVON25,40567,0,1,1,1,1), -- Valorous Scourgeborne Legguards
+(@ARCHAVON25,40463,0,1,1,1,1), -- Valorous Dreamwalker Robe
+(@ARCHAVON25,40460,0,1,1,1,1), -- Valorous Dreamwalker Handguards
+(@ARCHAVON25,40462,0,1,1,1,1), -- Valorous Dreamwalker Leggings
+(@ARCHAVON25,40503,0,1,1,1,1), -- Valorous Cryptstalker Tunic
+(@ARCHAVON25,40504,0,1,1,1,1), -- Valorous Cryptstalker Handguards
+(@ARCHAVON25,40506,0,1,1,1,1), -- Valorous Cryptstalker Legguards
+(@ARCHAVON25,40418,0,1,1,1,1), -- Valorous Frostfire Robe
+(@ARCHAVON25,40415,0,1,1,1,1), -- Valorous Frostfire Gloves
+(@ARCHAVON25,40417,0,1,1,1,1), -- Valorous Frostfire Leggings
+(@ARCHAVON25,40569,0,1,1,1,1), -- Valorous Redemption Tunic
+(@ARCHAVON25,40570,0,1,1,1,1), -- Valorous Redemption Gloves
+(@ARCHAVON25,40572,0,1,1,1,1), -- Valorous Redemption Greaves
+(@ARCHAVON25,40579,0,1,1,1,1), -- Valorous Redemption Breastplate
+(@ARCHAVON25,40580,0,1,1,1,1), -- Valorous Redemption Handguards
+(@ARCHAVON25,40583,0,1,1,1,1), -- Valorous Redemption Legguards
+(@ARCHAVON25,40574,0,1,1,1,1), -- Valorous Redemption Chestpiece
+(@ARCHAVON25,40575,0,1,1,1,1), -- Valorous Redemption Gauntlets
+(@ARCHAVON25,40577,0,1,1,1,1), -- Valorous Redemption Legplates
+(@ARCHAVON25,40449,0,1,1,1,1), -- Valorous Robe of Faith
+(@ARCHAVON25,40445,0,1,1,1,1), -- Valorous Gloves of Faith
+(@ARCHAVON25,40448,0,1,1,1,1), -- Valorous Leggings of Faith
+(@ARCHAVON25,40458,0,1,1,1,1), -- Valorous Raiments of Faith
+(@ARCHAVON25,40454,0,1,1,1,1), -- Valorous Handwraps of Faith
+(@ARCHAVON25,40457,0,1,1,1,1), -- Valorous Pants of Faith
+(@ARCHAVON25,40495,0,1,1,1,1), -- Valorous Bonescythe Breastplate
+(@ARCHAVON25,40496,0,1,1,1,1), -- Valorous Bonescythe Gauntlets
+(@ARCHAVON25,40500,0,1,1,1,1), -- Valorous Bonescythe Legplates
+(@ARCHAVON25,40514,0,1,1,1,1), -- Valorous Earthshatter Hauberk
+(@ARCHAVON25,40515,0,1,1,1,1), -- Valorous Earthshatter Gloves
+(@ARCHAVON25,40517,0,1,1,1,1), -- Valorous Earthshatter Kilt
+(@ARCHAVON25,40523,0,1,1,1,1), -- Valorous Earthshatter Chestguard
+(@ARCHAVON25,40520,0,1,1,1,1), -- Valorous Earthshatter Grips
+(@ARCHAVON25,40522,0,1,1,1,1), -- Valorous Earthshatter War-Kilt
+(@ARCHAVON25,40508,0,1,1,1,1), -- Valorous Earthshatter Tunic
+(@ARCHAVON25,40509,0,1,1,1,1), -- Valorous Earthshatter Handguards
+(@ARCHAVON25,40512,0,1,1,1,1), -- Valorous Earthshatter Legguards
+(@ARCHAVON25,40423,0,1,1,1,1), -- Valorous Plagueheart Robe
+(@ARCHAVON25,40420,0,1,1,1,1), -- Valorous Plagueheart Gloves
+(@ARCHAVON25,40422,0,1,1,1,1), -- Valorous Plagueheart Leggings
+(@ARCHAVON25,40525,0,1,1,1,1), -- Valorous Dreadnaught Battleplate
+(@ARCHAVON25,40527,0,1,1,1,1), -- Valorous Dreadnaught Gauntlets
+(@ARCHAVON25,40529,0,1,1,1,1), -- Valorous Dreadnaught Legplates
+(@ARCHAVON25,40544,0,1,1,1,1), -- Valorous Dreadnaught Breastplate
+(@ARCHAVON25,40545,0,1,1,1,1), -- Valorous Dreadnaught Handguards
+(@ARCHAVON25,40547,0,1,1,1,1), -- Valorous Dreadnaught Legguards
+(@ARCHAVON25,40469,0,1,1,1,1), -- Valorous Dreamwalker Vestments
+(@ARCHAVON25,40466,0,1,1,1,1), -- Valorous Dreamwalker Gloves
+(@ARCHAVON25,40468,0,1,1,1,1), -- Valorous Dreamwalker Trousers
+(@ARCHAVON25,40471,0,1,1,1,1), -- Valorous Dreamwalker Raiments
+(@ARCHAVON25,40472,0,1,1,1,1), -- Valorous Dreamwalker Handgrips
+(@ARCHAVON25,40493,0,1,1,1,1), -- Valorous Dreamwalker Legguards
+(@ARCHAVON25,40786,0,1,1,1,1), -- Deadly Gladiator's Plate Chestpiece
+(@ARCHAVON25,41951,0,1,1,1,1), -- Deadly Gladiator's Silk Raiment
+(@ARCHAVON25,41997,0,1,1,1,1), -- Deadly Gladiator's Felweave Raiment
+(@ARCHAVON25,41649,0,1,1,1,1), -- Deadly Gladiator's Leather Tunic
+(@ARCHAVON25,40784,0,1,1,1,1), -- Deadly Gladiator's Dreadplate Chestpiece
+(@ARCHAVON25,41086,0,1,1,1,1), -- Deadly Gladiator's Chain Armor
+(@ARCHAVON25,41920,0,1,1,1,1), -- Deadly Gladiator's Satin Robe
+(@ARCHAVON25,40785,0,1,1,1,1), -- Deadly Gladiator's Scaled Chestpiece
+(@ARCHAVON25,41660,0,1,1,1,1), -- Deadly Gladiator's Dragonhide Robes
+(@ARCHAVON25,41858,0,1,1,1,1), -- Deadly Gladiator's Mooncloth Robe
+(@ARCHAVON25,40905,0,1,1,1,1), -- Deadly Gladiator's Ornamented Chestguard
+(@ARCHAVON25,40990,0,1,1,1,1), -- Deadly Gladiator's Ringmail Armor
+(@ARCHAVON25,41315,0,1,1,1,1), -- Deadly Gladiator's Wyrmhide Robes
+(@ARCHAVON25,41309,0,1,1,1,1), -- Deadly Gladiator's Kodohide Robes
+(@ARCHAVON25,41080,0,1,1,1,1), -- Deadly Gladiator's Linked Armor
+(@ARCHAVON25,40991,0,1,1,1,1), -- Deadly Gladiator's Mail Armor
+(@ARCHAVON25,40926,0,1,1,1,1), -- Deadly Gladiator's Ornamented Gloves
+(@ARCHAVON25,40938,0,1,1,1,1), -- Deadly Gladiator's Ornamented Legplates
+(@ARCHAVON25,40846,0,1,1,1,1), -- Deadly Gladiator's Scaled Legguards
+(@ARCHAVON25,41863,0,1,1,1,1), -- Deadly Gladiator's Mooncloth Leggings
+(@ARCHAVON25,41926,0,1,1,1,1), -- Deadly Gladiator's Satin Leggings
+(@ARCHAVON25,41873,0,1,1,1,1), -- Deadly Gladiator's Mooncloth Gloves
+(@ARCHAVON25,41032,0,1,1,1,1), -- Deadly Gladiator's Mail Leggings
+(@ARCHAVON25,41006,0,1,1,1,1), -- Deadly Gladiator's Mail Gauntlets
+(@ARCHAVON25,41198,0,1,1,1,1), -- Deadly Gladiator's Linked Leggings
+(@ARCHAVON25,41666,0,1,1,1,1), -- Deadly Gladiator's Dragonhide Legguards
+(@ARCHAVON25,41772,0,1,1,1,1), -- Deadly Gladiator's Dragonhide Gloves
+(@ARCHAVON25,41000,0,1,1,1,1), -- Deadly Gladiator's Ringmail Gauntlets
+(@ARCHAVON25,41136,0,1,1,1,1), -- Deadly Gladiator's Linked Gauntlets
+(@ARCHAVON25,41286,0,1,1,1,1), -- Deadly Gladiator's Kodohide Gloves
+(@ARCHAVON25,40805,0,1,1,1,1), -- Deadly Gladiator's Scaled Gauntlets
+(@ARCHAVON25,41939,0,1,1,1,1), -- Deadly Gladiator's Satin Gloves
+(@ARCHAVON25,41297,0,1,1,1,1), -- Deadly Gladiator's Kodohide Legguards
+(@ARCHAVON25,41026,0,1,1,1,1), -- Deadly Gladiator's Ringmail Leggings
+(@ARCHAVON25,41958,0,1,1,1,1), -- Deadly Gladiator's Silk Trousers
+(@ARCHAVON25,41970,0,1,1,1,1), -- Deadly Gladiator's Silk Handguards
+(@ARCHAVON25,40844,0,1,1,1,1), -- Deadly Gladiator's Plate Legguards
+(@ARCHAVON25,41303,0,1,1,1,1), -- Deadly Gladiator's Wyrmhide Legguards
+(@ARCHAVON25,41292,0,1,1,1,1), -- Deadly Gladiator's Wyrmhide Gloves
+(@ARCHAVON25,42004,0,1,1,1,1), -- Deadly Gladiator's Felweave Trousers
+(@ARCHAVON25,41142,0,1,1,1,1), -- Deadly Gladiator's Chain Gauntlets
+(@ARCHAVON25,40845,0,1,1,1,1), -- Deadly Gladiator's Dreadplate Legguards
+(@ARCHAVON25,40804,0,1,1,1,1), -- Deadly Gladiator's Plate Gauntlets
+(@ARCHAVON25,42016,0,1,1,1,1), -- Deadly Gladiator's Felweave Handguards
+(@ARCHAVON25,40806,0,1,1,1,1), -- Deadly Gladiator's Dreadplate Gauntlets
+(@ARCHAVON25,41654,0,1,1,1,1), -- Deadly Gladiator's Leather Legguards
+(@ARCHAVON25,41766,0,1,1,1,1), -- Deadly Gladiator's Leather Gloves
+(@ARCHAVON25,41204,0,1,1,1,1), -- Deadly Gladiator's Chain Leggings
+-- Create Ref for Emalon 25 furious PVP + T8(25) (chest,hands,legs)
+(@EMALON25,41640,0,1,1,1,1), -- Furious Gladiator's Armwraps of Dominance
+(@EMALON25,41625,0,1,1,1,1), -- Furious Gladiator's Armwraps of Salvation
+(@EMALON25,41840,0,1,1,1,1), -- Furious Gladiator's Armwraps of Triumph
+(@EMALON25,42116,0,1,1,1,1), -- Furious Gladiator's Band of Dominance
+(@EMALON25,42117,0,1,1,1,1), -- Furious Gladiator's Band of Triumph
+(@EMALON25,41630,0,1,1,1,1), -- Furious Gladiator's Belt of Dominance
+(@EMALON25,41617,0,1,1,1,1), -- Furious Gladiator's Belt of Salvation
+(@EMALON25,41832,0,1,1,1,1), -- Furious Gladiator's Belt of Triumph
+(@EMALON25,41635,0,1,1,1,1), -- Furious Gladiator's Boots of Dominance
+(@EMALON25,41621,0,1,1,1,1), -- Furious Gladiator's Boots of Salvation
+(@EMALON25,41836,0,1,1,1,1), -- Furious Gladiator's Boots of Triumph
+(@EMALON25,40983,0,1,1,1,1), -- Furious Gladiator's Bracers of Salvation
+(@EMALON25,40889,0,1,1,1,1), -- Furious Gladiator's Bracers of Triumph
+(@EMALON25,41143,0,1,1,1,1), -- Furious Gladiator's Chain Gauntlets
+(@EMALON25,41205,0,1,1,1,1), -- Furious Gladiator's Chain Leggings
+(@EMALON25,42071,0,1,1,1,1), -- Furious Gladiator's Cloak of Ascendancy
+(@EMALON25,42073,0,1,1,1,1), -- Furious Gladiator's Cloak of Deliverance
+(@EMALON25,42069,0,1,1,1,1), -- Furious Gladiator's Cloak of Dominance
+(@EMALON25,42072,0,1,1,1,1), -- Furious Gladiator's Cloak of Salvation
+(@EMALON25,42070,0,1,1,1,1), -- Furious Gladiator's Cloak of Subjugation
+(@EMALON25,42074,0,1,1,1,1), -- Furious Gladiator's Cloak of Triumph
+(@EMALON25,42075,0,1,1,1,1), -- Furious Gladiator's Cloak of Victory
+(@EMALON25,41898,0,1,1,1,1), -- Furious Gladiator's Cord of Dominance
+(@EMALON25,41881,0,1,1,1,1), -- Furious Gladiator's Cord of Salvation
+(@EMALON25,41909,0,1,1,1,1), -- Furious Gladiator's Cuffs of Dominance
+(@EMALON25,41893,0,1,1,1,1), -- Furious Gladiator's Cuffs of Salvation
+(@EMALON25,41773,0,1,1,1,1), -- Furious Gladiator's Dragonhide Gloves
+(@EMALON25,41667,0,1,1,1,1), -- Furious Gladiator's Dragonhide Legguards
+(@EMALON25,40809,0,1,1,1,1), -- Furious Gladiator's Dreadplate Gauntlets
+(@EMALON25,42017,0,1,1,1,1), -- Furious Gladiator's Felweave Handguards
+(@EMALON25,42005,0,1,1,1,1), -- Furious Gladiator's Felweave Trousers
+(@EMALON25,40976,0,1,1,1,1), -- Furious Gladiator's Girdle of Salvation
+(@EMALON25,40881,0,1,1,1,1), -- Furious Gladiator's Girdle of Triumph
+(@EMALON25,40977,0,1,1,1,1), -- Furious Gladiator's Greaves of Salvation
+(@EMALON25,40882,0,1,1,1,1), -- Furious Gladiator's Greaves of Triumph
+(@EMALON25,41287,0,1,1,1,1), -- Furious Gladiator's Kodohide Gloves
+(@EMALON25,41298,0,1,1,1,1), -- Furious Gladiator's Kodohide Legguards
+(@EMALON25,41767,0,1,1,1,1), -- Furious Gladiator's Leather Gloves
+(@EMALON25,41655,0,1,1,1,1), -- Furious Gladiator's Leather Legguards
+(@EMALON25,41137,0,1,1,1,1), -- Furious Gladiator's Linked Gauntlets
+(@EMALON25,41199,0,1,1,1,1), -- Furious Gladiator's Linked Leggings
+(@EMALON25,41007,0,1,1,1,1), -- Furious Gladiator's Mail Gauntlets
+(@EMALON25,41033,0,1,1,1,1), -- Furious Gladiator's Mail Leggings
+(@EMALON25,41874,0,1,1,1,1), -- Furious Gladiator's Mooncloth Gloves
+(@EMALON25,41864,0,1,1,1,1), -- Furious Gladiator's Mooncloth Leggings
+(@EMALON25,40927,0,1,1,1,1), -- Furious Gladiator's Ornamented Gloves
+(@EMALON25,40939,0,1,1,1,1), -- Furious Gladiator's Ornamented Legplates
+(@EMALON25,42037,0,1,1,1,1), -- Furious Gladiator's Pendant of Ascendancy
+(@EMALON25,42039,0,1,1,1,1), -- Furious Gladiator's Pendant of Deliverance
+(@EMALON25,42036,0,1,1,1,1), -- Furious Gladiator's Pendant of Dominance
+(@EMALON25,42040,0,1,1,1,1), -- Furious Gladiator's Pendant of Salvation
+(@EMALON25,42038,0,1,1,1,1), -- Furious Gladiator's Pendant of Subjugation
+(@EMALON25,46373,0,1,1,1,1), -- Furious Gladiator's Pendant of Sundering
+(@EMALON25,42034,0,1,1,1,1), -- Furious Gladiator's Pendant of Triumph
+(@EMALON25,42035,0,1,1,1,1), -- Furious Gladiator's Pendant of Victory
+(@EMALON25,40807,0,1,1,1,1), -- Furious Gladiator's Plate Gauntlets
+(@EMALON25,40847,0,1,1,1,1), -- Furious Gladiator's Plate Legguards
+(@EMALON25,41001,0,1,1,1,1), -- Furious Gladiator's Ringmail Gauntlets
+(@EMALON25,41027,0,1,1,1,1), -- Furious Gladiator's Ringmail Leggings
+(@EMALON25,41075,0,1,1,1,1), -- Furious Gladiator's Sabatons of Dominance
+(@EMALON25,41055,0,1,1,1,1), -- Furious Gladiator's Sabatons of Salvation
+(@EMALON25,41230,0,1,1,1,1), -- Furious Gladiator's Sabatons of Triumph
+(@EMALON25,41940,0,1,1,1,1), -- Furious Gladiator's Satin Gloves
+(@EMALON25,41927,0,1,1,1,1), -- Furious Gladiator's Satin Leggings
+(@EMALON25,40808,0,1,1,1,1), -- Furious Gladiator's Scaled Gauntlets
+(@EMALON25,40849,0,1,1,1,1), -- Furious Gladiator's Scaled Legguards
+(@EMALON25,41971,0,1,1,1,1), -- Furious Gladiator's Silk Handguards
+(@EMALON25,41959,0,1,1,1,1), -- Furious Gladiator's Silk Trousers
+(@EMALON25,41903,0,1,1,1,1), -- Furious Gladiator's Slippers of Dominance
+(@EMALON25,41885,0,1,1,1,1), -- Furious Gladiator's Slippers of Salvation
+(@EMALON25,41070,0,1,1,1,1), -- Furious Gladiator's Waistguard of Dominance
+(@EMALON25,41051,0,1,1,1,1), -- Furious Gladiator's Waistguard of Salvation
+(@EMALON25,41235,0,1,1,1,1), -- Furious Gladiator's Waistguard of Triumph
+(@EMALON25,41065,0,1,1,1,1), -- Furious Gladiator's Wristguards of Dominance
+(@EMALON25,41060,0,1,1,1,1), -- Furious Gladiator's Wristguards of Salvation
+(@EMALON25,41225,0,1,1,1,1), -- Furious Gladiator's Wristguards of Triumph
+(@EMALON25,41293,0,1,1,1,1), -- Furious Gladiator's Wyrmhide Gloves
+(@EMALON25,41304,0,1,1,1,1), -- Furious Gladiator's Wyrmhide Legguards
+(@EMALON25,40811,0,1,1,1,1), -- Furious Gladiator's Girdle of Triumph
+(@EMALON25,46155,0,1,1,1,1), -- Conqueror's Aegis Gauntlets
+(@EMALON25,46179,0,1,1,1,1), -- Conqueror's Aegis Gloves
+(@EMALON25,46181,0,1,1,1,1), -- Conqueror's Aegis Greaves
+(@EMALON25,46174,0,1,1,1,1), -- Conqueror's Aegis Handguards
+(@EMALON25,46176,0,1,1,1,1), -- Conqueror's Aegis Legguards
+(@EMALON25,46153,0,1,1,1,1), -- Conqueror's Aegis Legplates
+(@EMALON25,46113,0,1,1,1,1), -- Conqueror's Darkruned Gauntlets
+(@EMALON25,46119,0,1,1,1,1), -- Conqueror's Darkruned Handguards
+(@EMALON25,46121,0,1,1,1,1), -- Conqueror's Darkruned Legguards
+(@EMALON25,46116,0,1,1,1,1), -- Conqueror's Darkruned Legplates
+(@EMALON25,46135,0,1,1,1,1), -- Conqueror's Deathbringer Gloves
+(@EMALON25,46139,0,1,1,1,1), -- Conqueror's Deathbringer Leggings
+(@EMALON25,46188,0,1,1,1,1), -- Conqueror's Gloves of Sanctification
+(@EMALON25,46163,0,1,1,1,1), -- Conqueror's Handwraps of Sanctification
+(@EMALON25,46132,0,1,1,1,1), -- Conqueror's Kirin Tor Gauntlets
+(@EMALON25,46133,0,1,1,1,1), -- Conqueror's Kirin Tor Leggings
+(@EMALON25,46195,0,1,1,1,1), -- Conqueror's Leggings of Sanctification
+(@EMALON25,46189,0,1,1,1,1), -- Conqueror's Nightsong Gloves
+(@EMALON25,46158,0,1,1,1,1), -- Conqueror's Nightsong Handgrips
+(@EMALON25,46183,0,1,1,1,1), -- Conqueror's Nightsong Handguards
+(@EMALON25,46185,0,1,1,1,1), -- Conqueror's Nightsong Leggings
+(@EMALON25,46160,0,1,1,1,1), -- Conqueror's Nightsong Legguards
+(@EMALON25,46192,0,1,1,1,1), -- Conqueror's Nightsong Trousers
+(@EMALON25,46170,0,1,1,1,1), -- Conqueror's Pants of Sanctification
+(@EMALON25,46142,0,1,1,1,1), -- Conqueror's Scourgestalker Handguards
+(@EMALON25,46144,0,1,1,1,1), -- Conqueror's Scourgestalker Legguards
+(@EMALON25,46148,0,1,1,1,1), -- Conqueror's Siegebreaker Gauntlets
+(@EMALON25,46164,0,1,1,1,1), -- Conqueror's Siegebreaker Handguards
+(@EMALON25,46169,0,1,1,1,1), -- Conqueror's Siegebreaker Legguards
+(@EMALON25,46150,0,1,1,1,1), -- Conqueror's Siegebreaker Legplates
+(@EMALON25,46124,0,1,1,1,1), -- Conqueror's Terrorblade Gauntlets
+(@EMALON25,46126,0,1,1,1,1), -- Conqueror's Terrorblade Legplates
+(@EMALON25,46207,0,1,1,1,1), -- Conqueror's Worldbreaker Gloves
+(@EMALON25,46200,0,1,1,1,1), -- Conqueror's Worldbreaker Grips
+(@EMALON25,46199,0,1,1,1,1), -- Conqueror's Worldbreaker Handguards
+(@EMALON25,46210,0,1,1,1,1), -- Conqueror's Worldbreaker Kilt
+(@EMALON25,46202,0,1,1,1,1), -- Conqueror's Worldbreaker Legguards
+(@EMALON25,46208,0,1,1,1,1), -- Conqueror's Worldbreaker War-Kilt
+-- Create Ref for koralon 25 relentless + T9.5 (hands,legs)
+(@KORALON25,41641,0,1,1,1,1), -- Relentless Gladiator's Armwraps of Dominance
+(@KORALON25,41626,0,1,1,1,1), -- Relentless Gladiator's Armwraps of Salvation
+(@KORALON25,41841,0,1,1,1,1), -- Relentless Gladiator's Armwraps of Triumph
+(@KORALON25,42118,0,1,1,1,1), -- Relentless Gladiator's Band of Ascendancy
+(@KORALON25,42119,0,1,1,1,1), -- Relentless Gladiator's Band of Victory
+(@KORALON25,41631,0,1,1,1,1), -- Relentless Gladiator's Belt of Dominance
+(@KORALON25,41618,0,1,1,1,1), -- Relentless Gladiator's Belt of Salvation
+(@KORALON25,41833,0,1,1,1,1), -- Relentless Gladiator's Belt of Triumph
+(@KORALON25,41636,0,1,1,1,1), -- Relentless Gladiator's Boots of Dominance
+(@KORALON25,41622,0,1,1,1,1), -- Relentless Gladiator's Boots of Salvation
+(@KORALON25,41837,0,1,1,1,1), -- Relentless Gladiator's Boots of Triumph
+(@KORALON25,40984,0,1,1,1,1), -- Relentless Gladiator's Bracers of Salvation
+(@KORALON25,40890,0,1,1,1,1), -- Relentless Gladiator's Bracers of Triumph
+(@KORALON25,41144,0,1,1,1,1), -- Relentless Gladiator's Chain Gauntlets
+(@KORALON25,41206,0,1,1,1,1), -- Relentless Gladiator's Chain Leggings
+(@KORALON25,42078,0,1,1,1,1), -- Relentless Gladiator's Cloak of Ascendancy
+(@KORALON25,42080,0,1,1,1,1), -- Relentless Gladiator's Cloak of Deliverance
+(@KORALON25,42076,0,1,1,1,1), -- Relentless Gladiator's Cloak of Dominance
+(@KORALON25,42079,0,1,1,1,1), -- Relentless Gladiator's Cloak of Salvation
+(@KORALON25,42077,0,1,1,1,1), -- Relentless Gladiator's Cloak of Subjugation
+(@KORALON25,42081,0,1,1,1,1), -- Relentless Gladiator's Cloak of Triumph
+(@KORALON25,42082,0,1,1,1,1), -- Relentless Gladiator's Cloak of Victory
+(@KORALON25,41899,0,1,1,1,1), -- Relentless Gladiator's Cord of Dominance
+(@KORALON25,41882,0,1,1,1,1), -- Relentless Gladiator's Cord of Salvation
+(@KORALON25,41910,0,1,1,1,1), -- Relentless Gladiator's Cuffs of Dominance
+(@KORALON25,41894,0,1,1,1,1), -- Relentless Gladiator's Cuffs of Salvation
+(@KORALON25,41774,0,1,1,1,1), -- Relentless Gladiator's Dragonhide Gloves
+(@KORALON25,41668,0,1,1,1,1), -- Relentless Gladiator's Dragonhide Legguards
+(@KORALON25,40851,0,1,1,1,1), -- Relentless Gladiator's Dreadplate Legguards
+(@KORALON25,42018,0,1,1,1,1), -- Relentless Gladiator's Felweave Handguards
+(@KORALON25,42006,0,1,1,1,1), -- Relentless Gladiator's Felweave Trousers
+(@KORALON25,40978,0,1,1,1,1), -- Relentless Gladiator's Girdle of Salvation
+(@KORALON25,40883,0,1,1,1,1), -- Relentless Gladiator's Girdle of Triumph
+(@KORALON25,40979,0,1,1,1,1), -- Relentless Gladiator's Greaves of Salvation
+(@KORALON25,40884,0,1,1,1,1), -- Relentless Gladiator's Greaves of Triumph
+(@KORALON25,41288,0,1,1,1,1), -- Relentless Gladiator's Kodohide Gloves
+(@KORALON25,41299,0,1,1,1,1), -- Relentless Gladiator's Kodohide Legguards
+(@KORALON25,41768,0,1,1,1,1), -- Relentless Gladiator's Leather Gloves
+(@KORALON25,41656,0,1,1,1,1), -- Relentless Gladiator's Leather Legguards
+(@KORALON25,41138,0,1,1,1,1), -- Relentless Gladiator's Linked Gauntlets
+(@KORALON25,41200,0,1,1,1,1), -- Relentless Gladiator's Linked Leggings
+(@KORALON25,41008,0,1,1,1,1), -- Relentless Gladiator's Mail Gauntlets
+(@KORALON25,41034,0,1,1,1,1), -- Relentless Gladiator's Mail Leggings
+(@KORALON25,41875,0,1,1,1,1), -- Relentless Gladiator's Mooncloth Gloves
+(@KORALON25,41865,0,1,1,1,1), -- Relentless Gladiator's Mooncloth Leggings
+(@KORALON25,40928,0,1,1,1,1), -- Relentless Gladiator's Ornamented Gloves
+(@KORALON25,40940,0,1,1,1,1), -- Relentless Gladiator's Ornamented Legplates
+(@KORALON25,42044,0,1,1,1,1), -- Relentless Gladiator's Pendant of Ascendancy
+(@KORALON25,42046,0,1,1,1,1), -- Relentless Gladiator's Pendant of Deliverance
+(@KORALON25,42043,0,1,1,1,1), -- Relentless Gladiator's Pendant of Dominance
+(@KORALON25,42047,0,1,1,1,1), -- Relentless Gladiator's Pendant of Salvation
+(@KORALON25,42045,0,1,1,1,1), -- Relentless Gladiator's Pendant of Subjugation
+(@KORALON25,46374,0,1,1,1,1), -- Relentless Gladiator's Pendant of Sundering
+(@KORALON25,42041,0,1,1,1,1), -- Relentless Gladiator's Pendant of Triumph
+(@KORALON25,42042,0,1,1,1,1), -- Relentless Gladiator's Pendant of Victory
+(@KORALON25,40810,0,1,1,1,1), -- Relentless Gladiator's Plate Gauntlets
+(@KORALON25,40850,0,1,1,1,1), -- Relentless Gladiator's Plate Legguards
+(@KORALON25,41002,0,1,1,1,1), -- Relentless Gladiator's Ringmail Gauntlets
+(@KORALON25,41028,0,1,1,1,1), -- Relentless Gladiator's Ringmail Leggings
+(@KORALON25,41076,0,1,1,1,1), -- Relentless Gladiator's Sabatons of Dominance
+(@KORALON25,41056,0,1,1,1,1), -- Relentless Gladiator's Sabatons of Salvation
+(@KORALON25,41231,0,1,1,1,1), -- Relentless Gladiator's Sabatons of Triumph
+(@KORALON25,41941,0,1,1,1,1), -- Relentless Gladiator's Satin Gloves
+(@KORALON25,41928,0,1,1,1,1), -- Relentless Gladiator's Satin Leggings
+(@KORALON25,40812,0,1,1,1,1), -- Relentless Gladiator's Scaled Gauntlets
+(@KORALON25,40852,0,1,1,1,1), -- Relentless Gladiator's Scaled Legguards
+(@KORALON25,41972,0,1,1,1,1), -- Relentless Gladiator's Silk Handguards
+(@KORALON25,41960,0,1,1,1,1), -- Relentless Gladiator's Silk Trousers
+(@KORALON25,41904,0,1,1,1,1), -- Relentless Gladiator's Treads of Dominance
+(@KORALON25,41886,0,1,1,1,1), -- Relentless Gladiator's Treads of Salvation
+(@KORALON25,41071,0,1,1,1,1), -- Relentless Gladiator's Waistguard of Dominance
+(@KORALON25,41052,0,1,1,1,1), -- Relentless Gladiator's Waistguard of Salvation
+(@KORALON25,41236,0,1,1,1,1), -- Relentless Gladiator's Waistguard of Triumph
+(@KORALON25,41066,0,1,1,1,1), -- Relentless Gladiator's Wristguards of Dominance
+(@KORALON25,41061,0,1,1,1,1), -- Relentless Gladiator's Wristguards of Salvation
+(@KORALON25,41226,0,1,1,1,1), -- Relentless Gladiator's Wristguards of Triumph
+(@KORALON25,41294,0,1,1,1,1), -- Relentless Gladiator's Wyrmhide Gloves
+(@KORALON25,41305,0,1,1,1,1), -- Relentless Gladiator's Wyrmhide Legguards
+(@KORALON25,48094,0,1,1,1,1), -- Zabra's Pants of Triumph
+(@KORALON25,48064,0,1,1,1,1), -- Zabra's Leggings of Triumph
+(@KORALON25,48096,0,1,1,1,1), -- Zabra's Handwraps of Triumph
+(@KORALON25,48066,0,1,1,1,1), -- Zabra's Gloves of Triumph
+(@KORALON25,48271,0,1,1,1,1), -- Windrunner's Legguards of Triumph
+(@KORALON25,48273,0,1,1,1,1), -- Windrunner's Handguards of Triumph
+(@KORALON25,48362,0,1,1,1,1), -- Thrall's War-Kilt of Triumph
+(@KORALON25,48303,0,1,1,1,1), -- Thrall's Legguards of Triumph
+(@KORALON25,48332,0,1,1,1,1), -- Thrall's Kilt of Triumph
+(@KORALON25,48301,0,1,1,1,1), -- Thrall's Handguards of Triumph
+(@KORALON25,48364,0,1,1,1,1), -- Thrall's Grips of Triumph
+(@KORALON25,48334,0,1,1,1,1), -- Thrall's Gloves of Triumph
+(@KORALON25,47770,0,1,1,1,1), -- Sunstrider's Leggings of Triumph
+(@KORALON25,47772,0,1,1,1,1), -- Sunstrider's Gauntlets of Triumph
+(@KORALON25,48180,0,1,1,1,1), -- Runetotem's Trousers of Triumph
+(@KORALON25,48195,0,1,1,1,1), -- Runetotem's Legguards of Triumph
+(@KORALON25,48150,0,1,1,1,1), -- Runetotem's Leggings of Triumph
+(@KORALON25,48152,0,1,1,1,1), -- Runetotem's Handguards of Triumph
+(@KORALON25,48193,0,1,1,1,1), -- Runetotem's Handgrips of Triumph
+(@KORALON25,48182,0,1,1,1,1), -- Runetotem's Gloves of Triumph
+(@KORALON25,48623,0,1,1,1,1), -- Liadrin's Legplates of Triumph
+(@KORALON25,48660,0,1,1,1,1), -- Liadrin's Legguards of Triumph
+(@KORALON25,48658,0,1,1,1,1), -- Liadrin's Handguards of Triumph
+(@KORALON25,48591,0,1,1,1,1), -- Liadrin's Greaves of Triumph
+(@KORALON25,48593,0,1,1,1,1), -- Liadrin's Gloves of Triumph
+(@KORALON25,48625,0,1,1,1,1), -- Liadrin's Gauntlets of Triumph
+(@KORALON25,48497,0,1,1,1,1), -- Koltira's Legplates of Triumph
+(@KORALON25,48554,0,1,1,1,1), -- Koltira's Legguards of Triumph
+(@KORALON25,48556,0,1,1,1,1), -- Koltira's Handguards of Triumph
+(@KORALON25,48499,0,1,1,1,1), -- Koltira's Gauntlets of Triumph
+(@KORALON25,48394,0,1,1,1,1), -- Hellscream's Legplates of Triumph
+(@KORALON25,48464,0,1,1,1,1), -- Hellscream's Legguards of Triumph
+(@KORALON25,48462,0,1,1,1,1), -- Hellscream's Handguards of Triumph
+(@KORALON25,48392,0,1,1,1,1), -- Hellscream's Gauntlets of Triumph
+(@KORALON25,47805,0,1,1,1,1), -- Gul'dan's Leggings of Triumph
+(@KORALON25,47803,0,1,1,1,1), -- Gul'dan's Gloves of Triumph
+(@KORALON25,48239,0,1,1,1,1), -- Garona's Legplates of Triumph
+(@KORALON25,48241,0,1,1,1,1), -- Garona's Gauntlets of Triumph
+(@KORALON25,48379,0,1,2,1,1), -- Wrynn's Legplates of Triumph
+(@KORALON25,48446,0,1,2,1,1), -- Wrynn's Legguards of Triumph
+(@KORALON25,48452,0,1,2,1,1), -- Wrynn's Handguards of Triumph
+(@KORALON25,48377,0,1,2,1,1), -- Wrynn's Gauntlets of Triumph
+(@KORALON25,48258,0,1,2,1,1), -- Windrunner's Legguards of Triumph
+(@KORALON25,48256,0,1,2,1,1), -- Windrunner's Handguards of Triumph
+(@KORALON25,48079,0,1,2,1,1), -- Velen's Pants of Triumph
+(@KORALON25,48077,0,1,2,1,1), -- Velen's Handwraps of Triumph
+(@KORALON25,47983,0,1,2,1,1), -- Velen's Gloves of Triumph
+(@KORALON25,48226,0,1,2,1,1), -- VanCleef's Legplates of Triumph
+(@KORALON25,48224,0,1,2,1,1), -- VanCleef's Gauntlets of Triumph
+(@KORALON25,48610,0,1,2,1,1), -- Turalyon's Legplates of Triumph
+(@KORALON25,48638,0,1,2,1,1), -- Turalyon's Legguards of Triumph
+(@KORALON25,48640,0,1,2,1,1), -- Turalyon's Handguards of Triumph
+(@KORALON25,48578,0,1,2,1,1), -- Turalyon's Greaves of Triumph
+(@KORALON25,48576,0,1,2,1,1), -- Turalyon's Gloves of Triumph
+(@KORALON25,48608,0,1,2,1,1), -- Turalyon's Gauntlets of Triumph
+(@KORALON25,48484,0,1,2,1,1), -- Thassarian's Legplates of Triumph
+(@KORALON25,48541,0,1,2,1,1), -- Thassarian's Legguards of Triumph
+(@KORALON25,48539,0,1,2,1,1), -- Thassarian's Handguards of Triumph
+(@KORALON25,48482,0,1,2,1,1), -- Thassarian's Gauntlets of Triumph
+(@KORALON25,48349,0,1,2,1,1), -- Nobundo's War-Kilt of Triumph
+(@KORALON25,48288,0,1,2,1,1), -- Nobundo's Legguards of Triumph
+(@KORALON25,48319,0,1,2,1,1), -- Nobundo's Kilt of Triumph
+(@KORALON25,48286,0,1,2,1,1), -- Nobundo's Handguards of Triumph
+(@KORALON25,48347,0,1,2,1,1), -- Nobundo's Grips of Triumph
+(@KORALON25,48317,0,1,2,1,1), -- Nobundo's Gloves of Triumph
+(@KORALON25,48165,0,1,2,1,1), -- Malfurion's Trousers of Triumph
+(@KORALON25,48210,0,1,2,1,1), -- Malfurion's Legguards of Triumph
+(@KORALON25,48135,0,1,2,1,1), -- Malfurion's Leggings of Triumph
+(@KORALON25,48133,0,1,2,1,1), -- Malfurion's Handguards of Triumph
+(@KORALON25,48212,0,1,2,1,1), -- Malfurion's Handgrips of Triumph
+(@KORALON25,48163,0,1,2,1,1), -- Malfurion's Gloves of Triumph
+(@KORALON25,47755,0,1,2,1,1), -- Khadgar's Leggings of Triumph
+(@KORALON25,47753,0,1,2,1,1), -- Khadgar's Gauntlets of Triumph
+(@KORALON25,47780,0,1,2,1,1), -- Kel'Thuzad's Leggings of Triumph
+(@KORALON25,47782,0,1,2,1,1), -- Kel'Thuzad's Gloves of Triumph
+(@KORALON25,47985,0,1,2,1,1); -- Velen's Leggings of Triumph
+-- Merge PVP and PVE items to one ref
+UPDATE `reference_loot_template` SET `entry`=@TORAVON25 WHERE `entry`=34214; -- 25 Toravon
+UPDATE `reference_loot_template` SET `entry`=@TORAVON10 WHERE `entry`=34213; -- 10 Toravon
+UPDATE `reference_loot_template` SET `entry`=@ARCHAVON10 WHERE `entry`=34210; -- 10 Archavon
+UPDATE `reference_loot_template` SET `entry`=@EMALON10 WHERE `entry`=34211; -- 10 Emalon
+UPDATE `reference_loot_template` SET `entry`=@KORALON10 WHERE `entry`=34212; -- 10 Koralon
+-- Assign to cratures
+SET @Tora10 =38433;
+SET @Tora25 =38462;
+SET @Arch10 =31125;
+SET @Arch25 =31722;
+SET @Emal10 =33993;
+SET @Emal25 =33994;
+SET @Kora10 =35013;
+SET @Kora25 =35360;
+DELETE FROM `creature_loot_template` WHERE `entry`IN (@Tora10,@Tora25,@Arch10,@Arch25,@Emal10,@Emal25,@Kora10,@Kora25);
+INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+-- Update loot template for Toravon 10
+(@Tora10,47241,100,1,0,2,2), -- Emblem of triumph
+(@Tora10,1,100,1,0,-@TORAVON10,2), -- Gear(Relentless PVP,T10 PVE)
+(@Tora10,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Toravon 25 to drop 3 items
+(@Tora25,49426,100,1,0,2,2), -- Emblem of frost
+(@Tora25,1,100,1,0,-@TORAVON25,3), -- Gear(Wrathful PVP,T10.5 PVE)
+(@Tora25,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Archavon 10
+(@Arch10,47241,100,1,0,2,2), -- Emblem of triumph
+(@Arch10,1,100,1,0,-@ARCHAVON10,2), -- Gear(Hate PVP,T7 PVE)
+(@Arch10,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Archavon 25
+(@Arch25,47241,100,1,0,2,2), -- Emblem of triumph
+(@Arch25,1,100,1,0,-@ARCHAVON25,4), -- Gear(Deadly PVP,T7(25) PVE)
+(@Arch25,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Emalon 10
+(@Emal10,47241,100,1,0,2,2), -- Emblem of triumph
+(@Emal10,1,100,1,0,-@EMALON10,2), -- Gear(Deadly PVP,T8 PVE)
+(@Emal10,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Emalon 25
+(@Emal25,47241,100,1,0,2,2), -- Emblem of triumph
+(@Emal25,1,100,1,0,-@EMALON25,4), -- Gear(Deadly PVP,T8(25) PVE)
+(@Emal25,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Koralon 10
+(@Kora10,47241,100,1,0,2,2), -- Emblem of triumph
+(@Kora10,1,100,1,0,-@KORALON10,2), -- Gear(Furious PVP,T9 PVE)
+(@Kora10,2,1,1,0,-34203,1), -- Mount
+-- Update loot template for Koralon 25
+(@Kora25,47241,100,1,0,2,2), -- Emblem of triumph
+(@Kora25,1,100,1,0,-@KORALON25,4), -- Gear(Relentless PVP,T9.5 PVE)
+(@Kora25,2,1,1,0,-34203,1); -- Mount
diff --git a/sql/updates/world/2012_09_20_00_world_creature_loot_template.sql b/sql/updates/world/2012_09_20_00_world_creature_loot_template.sql
new file mode 100644
index 00000000000..8463b064bf9
--- /dev/null
+++ b/sql/updates/world/2012_09_20_00_world_creature_loot_template.sql
@@ -0,0 +1,5 @@
+SET @exists = (SELECT 1 FROM `creature_loot_template` WHERE `entry`=100002);
+DELETE FROM `creature_loot_template` WHERE `entry`=100002 AND @exists = 1;
+DELETE FROM `creature_loot_template` WHERE `mincountOrRef`=-35069 AND @exists = 1;
+INSERT INTO `creature_loot_template`(`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) SELECT `entry`,1,100,1,0,-35069,2 FROM `creature_template` WHERE `lootid` = 100002 AND @exists = 1; -- 2 selection from reference
+UPDATE `creature_template` SET `lootid`=`entry` WHERE `lootid` = 100002 AND @exists = 1;
diff --git a/sql/updates/world/2012_09_22_00_world_utgarde.sql b/sql/updates/world/2012_09_22_00_world_utgarde.sql
new file mode 100644
index 00000000000..83cc227f9cd
--- /dev/null
+++ b/sql/updates/world/2012_09_22_00_world_utgarde.sql
@@ -0,0 +1,102 @@
+-- Frenzied geist
+DELETE FROM `creature_loot_template` WHERE `entry`=31671;
+-- Savage worg
+DELETE FROM `creature_loot_template` WHERE `entry`=31678 AND `item` IN(39211,39212,33454);
+INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `mincountOrRef`, `maxcount`) VALUES
+(31678,39211,70,3,5),
+(31678,39212,16,2,4),
+(31678,33454, 3,1,1);
+
+-- Keleseth
+UPDATE `creature_template` SET `mechanic_immune_mask`=617289692 WHERE `entry` IN(23953,30748);
+-- Tunneling ghoul
+DELETE FROM `creature_loot_template` WHERE `entry`=31681;
+-- Dalronn heartsplitter
+UPDATE `creature_template` SET `mindmg`=380,`maxdmg`=580,`attackpower`=0,`dmg_multiplier`=10 WHERE `entry`=31660;
+-- Frenzied geist
+UPDATE `creature_template` SET `lootid`=28419 WHERE `entry`=31671;
+UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=28419;
+-- Skarvald the constructor - On level 81 health fits/is blizzlike, depending on wowhead his level range is 72 - 81
+UPDATE `creature_template` SET `minlevel`=81,`maxlevel`=81 WHERE `entry`=31679;
+-- Tunneling ghoul
+UPDATE `creature_template` SET `lootid`=24084 WHERE `entry`=31681;
+-- Dragonflayer runecaster
+UPDATE `creature_template` SET `ScriptName`='',`AIName`='SmartAI' WHERE `entry`=23960;
+-- Dragonflayer strategist
+UPDATE `creature_template` SET `minlevel`=80,`maxlevel`=80,`unit_flags`=`unit_flags`|131072 WHERE `entry`=32246;
+-- Ingvar and undead Ingvar
+UPDATE `creature_template` SET `mindmg`=650,`maxdmg`=900,`attackpower`=200, `dmg_multiplier`=10 WHERE `entry` IN(31673,31674);
+UPDATE `creature_template` SET `mechanic_immune_mask`=`mechanic_immune_mask`|1 WHERE `entry` IN(23954,31673,23980,31674);
+-- Throw axe dummy
+UPDATE `creature_template` SET `unit_flags`=2|131072|33554432, `flags_extra`=`flags_extra`|2, `equipment_id`=720 WHERE `entry` IN(23997,31835);
+-- Throw axe target
+UPDATE `creature_template` SET `unit_flags`=2|4|256|512, `faction_A`=35, `faction_H`=35, `flags_extra`=`flags_extra`|128 WHERE `entry`=23996;
+
+-- Dragonflayer runecaster
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=23960;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=23960 AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`, `id`, `event_type`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `target_type`, `target_param2`, `comment`) VALUES
+(23960,1,0,2,5000,7000,14000,17000,11,42740,11,30,'Dragonflayer Runecaster - In combat - Cast Njords Rune of Protection'),
+(23960,2,0,4,5000,7000,14000,17000,11,59616,11,30,'Dragonflayer Runecaster - In combat - Cast Njords Rune of Protection'),
+(23960,3,0,2,1000,2000,15000,18000,11,54965, 1, 0,'Dragonflayer Runecaster - In combat - Cast Bolthorns Rune of Flame'),
+(23960,4,0,4,1000,2000,15000,18000,11,59617, 1, 0,'Dragonflayer Runecaster - In combat - Cast Bolthorns Rune of Flame');
+
+-- Frenzied geist
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=28419;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=28419 AND `source_type`=0;
+INSERT INTO `smart_scripts`(`entryorguid`,`event_type`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`target_type`,`comment`) VALUES
+(28419,0,5000,5000,30000,30000,11,40414,5,'Frenzied geist - In combat - Cast Fixate');
+
+-- Difficulty data for spells used in utgarde keep
+DELETE FROM `spelldifficulty_dbc` WHERE `id` IN(42669,42708,42750,42723,42729,43667,42702) OR `spellid0` IN(42669,42708,42750,42723,42729,43667,42702);
+INSERT INTO `spelldifficulty_dbc`(`id`,`spellid0`,`spellid1`) VALUES
+(42669,42669,59706), -- Smash
+(42708,42708,59708), -- Staggering Roar
+(42750,42750,59719), -- Throw Axe
+(42723,42723,59709), -- Dark Smash
+(42729,42729,59734), -- Dreadful Roar
+(43667,43667,59389), -- Shadow Bolt
+(42702,42702,59397); -- Decrepify
+
+-- Ticking Time Bomb, Fixate
+DELETE FROM `spell_script_names` WHERE `spell_id` IN(59686,40414);
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(59686,'spell_ticking_time_bomb'),
+(40414,'spell_fixate');
+
+-- Proto-drake striders
+UPDATE `creature` SET `position_x`=212.429,`position_y`=-127.793,`position_z`=256.101,`MovementType`=2 WHERE `guid`=125914;
+UPDATE `creature` SET `position_x`=211.854,`position_y`=-112.602,`position_z`=262.188,`MovementType`=2 WHERE `guid`=125915;
+UPDATE `creature` SET `position_x`=211.024,`position_y`=-100.299,`position_z`=266.201,`MovementType`=2 WHERE `guid`=125920;
+UPDATE `creature` SET `position_x`=213.777,`position_y`=-140.709,`position_z`=251.048,`MovementType`=2 WHERE `guid`=125922;
+UPDATE `creature` SET `position_x`=252.247,`position_y`=-350.532,`position_z`=185.813,`MovementType`=2 WHERE `guid`=125934;
+UPDATE `creature` SET `position_x`=243.964,`position_y`=-194.833,`position_z`=227.126,`MovementType`=2 WHERE `guid`=125936;
+UPDATE `creature` SET `position_x`=221.534,`position_y`=-239.809,`position_z`=196.459,`MovementType`=2 WHERE `guid`=125937;
+UPDATE `creature` SET `position_x`=238.382,`position_y`=-353.086,`position_z`=188.785,`MovementType`=2 WHERE `guid`=125940;
+
+-- Waypoint assignments
+DELETE FROM `creature_addon` WHERE `guid` IN (125940,125934,125915,125920,125914,125936,125937,125922);
+INSERT INTO `creature_addon`(`guid`,`path_id`,`mount`,`bytes1`,`bytes2`,`auras`) VALUES
+(125914,1259140,22657,50331648,1,'54775'),
+(125915,1259150,22657,50331648,1,'54775'),
+(125920,1259200,22657,50331648,1,'54775'),
+(125922,1259220,22657,50331648,1,'54775'),
+(125934,1259340,22657,50331648,1,'54775'),
+(125936,1259360,22657,50331648,1,'54775'),
+(125937,1259370,22657,50331648,1,'54775'),
+(125940,1259400,22657,50331648,1,'54775');
+
+-- Waypoint data
+DELETE FROM `waypoint_data` WHERE `id` IN (1259400,1259340,1259150,1259200,1259140,1259360,1259370,1259220);
+INSERT INTO `waypoint_data`(`id`,`point`,`position_x`,`position_y`,`position_z`) VALUES
+(1259400,1,211.864,-352.629,196.144),
+(1259340,1,271.911,-318.506,185.049),
+(1259150,1,265.478,-199.246,186.812),
+(1259200,1,346.765,-99.2527,220.519),
+(1259140,1,295.597,-181.162,207.374),
+(1259360,1,271.68,-194.911,220.248),
+(1259370,1,238.947,-255.704,191.639),
+(1259220,1,149.42,-247.696,194.145);
+
+INSERT INTO `waypoint_data`(`id`,`point`,`position_x`,`position_y`,`position_z`)
+SELECT `guid`*10,2,`position_x`,`position_y`,`position_z` FROM `creature` WHERE `guid` IN (125940,125934,125915,125920,125914,125936,125937,125922);
diff --git a/sql/updates/world/2012_09_22_01_world_i_was_a_lot_of_things.sql b/sql/updates/world/2012_09_22_01_world_i_was_a_lot_of_things.sql
new file mode 100644
index 00000000000..1682d9f699b
--- /dev/null
+++ b/sql/updates/world/2012_09_22_01_world_i_was_a_lot_of_things.sql
@@ -0,0 +1,32 @@
+-- Quest: I was a lot of things
+UPDATE `creature_template` SET `AIName`='',`ScriptName`='npc_shadowmoon_tuber_node',`flags_extra`=`flags_extra`|128 WHERE `entry`=21347;
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=36652;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES
+(13,1,36652,31,3,21347,'Tuber Whistle targets Shadowmoon Valley Tuber Node');
+
+UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=21195;
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=21195;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=21195 AND `source_type`=0;
+INSERT INTO `smart_scripts`(`entryorguid`,`id`,`link`,`event_type`,`event_param2`,`action_type`,`action_param1`,`action_param2`,`target_type`,`target_param1`,`target_param2`,`comment`) VALUES
+(21195,1,0,34,1,24,0,0, 1, 0,0, 'Domesticated Felboar - Movementinform - Evade (Required for core script npc_shadowmoon_tuber_node)'),
+(21195,2,0,34,1,45,1,1,11,21347,5, 'Domesticated Felboar - Movementinform - Set data (Required for core script npc_shadowmoon_tuber_node)');
+
+SET @TRIGGER_GUID = 77821; -- 10
+SET @BOAR_GUID = 77832; -- 8
+
+DELETE FROM `creature` WHERE `id`=21347 OR `guid` BETWEEN @TRIGGER_GUID AND @TRIGGER_GUID + 9;
+SET @TRIGGER_GUID = @TRIGGER_GUID - 1;
+INSERT INTO `creature`(`guid`,`id`,`map`,`phaseMask`,`position_x`,`position_y`,`position_z`)
+SELECT (SELECT @TRIGGER_GUID:=@TRIGGER_GUID+1),21347,`map`,3,`position_x`,`position_y`,`position_z` FROM `gameobject` WHERE `id`=184701 LIMIT 10;
+
+DELETE FROM `creature` WHERE (`id`=21195 AND `map`=530) OR `guid` BETWEEN @BOAR_GUID AND @BOAR_GUID + 7;
+INSERT INTO `creature`(`guid`,`id`,`map`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`curhealth`,`MovementType`) VALUES
+(@BOAR_GUID ,21195,530,-2506.78,1190.22,55.9496,4.15084,300,5,6116,1),
+(@BOAR_GUID+1,21195,530,-2486.92,1326.49,64.4239,5.31872,300,5,6116,1),
+(@BOAR_GUID+2,21195,530,-2476.05,1284.68,48.0809,1.20087,300,5,5914,1),
+(@BOAR_GUID+3,21195,530,-2476.74,1228.44,40.4087,3.72907,300,5,5914,1),
+(@BOAR_GUID+4,21195,530,-2549.03,1162.94,78.8947,1.48754,300,5,6116,1),
+(@BOAR_GUID+5,21195,530,-2553.91,1186.80,78.5604,1.17575,300,5,6116,1),
+(@BOAR_GUID+6,21195,530,-2694.88,1495.00,19.2922,2.33106,300,5,5914,1),
+(@BOAR_GUID+7,21195,530,-2706.26,1538.41,16.6343,1.96146,300,5,5914,1);
diff --git a/sql/updates/world/2012_09_22_03_world_game_event.sql b/sql/updates/world/2012_09_22_03_world_game_event.sql
new file mode 100644
index 00000000000..5e05ba03898
--- /dev/null
+++ b/sql/updates/world/2012_09_22_03_world_game_event.sql
@@ -0,0 +1,2 @@
+-- Brewfest (372) duration fix by nelegalno
+UPDATE `game_event` SET `length` = 21600 WHERE `eventEntry` = 24;
diff --git a/sql/updates/world/2012_09_24_00_world_spell_script_names.sql b/sql/updates/world/2012_09_24_00_world_spell_script_names.sql
new file mode 100644
index 00000000000..611325d4b11
--- /dev/null
+++ b/sql/updates/world/2012_09_24_00_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `spell_id`=6940;
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(6940, 'spell_pal_hand_of_sacrifice');
diff --git a/sql/updates/world/2012_09_24_01_world_spell_script_names.sql b/sql/updates/world/2012_09_24_01_world_spell_script_names.sql
new file mode 100644
index 00000000000..e14b6833a09
--- /dev/null
+++ b/sql/updates/world/2012_09_24_01_world_spell_script_names.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_script_names` WHERE `spell_id`=64205;
+INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
+(64205, 'spell_pal_divine_sacrifice');
diff --git a/sql/updates/world/2012_09_24_02_world_misc.sql b/sql/updates/world/2012_09_24_02_world_misc.sql
new file mode 100644
index 00000000000..bd97308d7c6
--- /dev/null
+++ b/sql/updates/world/2012_09_24_02_world_misc.sql
@@ -0,0 +1,99 @@
+-- Bring Down the Warbringer! (10603) quest fix by nelegalno Closes #7840
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=-100 WHERE `entry`=21287 AND `item`=30689; -- Razuun's Orders http://old.wowhead.com/item=30689
+
+-- The Only Prescription (8620) quest fix by nelegalno
+-- Closes #6653 (was changed to reopened but currently treated by github as closed)
+-- Closes #7085
+
+-- Chapter I:
+-- Move Doctor Weavil on top of the bed
+UPDATE `creature` SET `position_z` = 34.5277 WHERE `guid`=18614;
+
+-- Chapter II:
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=6 WHERE (`entry`=8716 AND `item`=21104);
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=10 WHERE (`entry`=8717 AND `item`=21104);
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=4 WHERE (`entry`=12396 AND `item`=21104);
+
+-- Chapter III:
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=6 WHERE (`entry`=7461 AND `item`=21105);
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=6 WHERE (`entry`=7463 AND `item`=21105);
+
+-- Chapter IV, V and VII:
+DELETE FROM `gameobject` WHERE (`guid`=45065); -- Remove duplicate of GUID=4596
+DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (6668,6669,6670) AND `id`=0;
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+-- source: https://github.com/TrinityCore/TrinityCore/issues/6653#issuecomment-6956847 ( thanks frostmourne ) + http://thottbot.com/item=21107#comments:id=885246 + http://thottbot.com/item=21106#comments:id=1159575
+(6668,0,0,'<Take this book for the good of Azeroth!>',1,1,0,0,0,0,NULL),
+(6669,0,0,'<Take this book for the good of Azeroth!>',1,1,0,0,0,0,NULL),
+(6670,0,0,'<Take this book for the good of Azeroth!>',1,1,0,0,0,0,NULL);
+
+UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry` IN (180665,180666,180667);
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (180665,180666,180667) AND `source_type`=1;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(180665,1,0,1,62,0,100,0,6669,0,0,0,56,21107,1,0,0,0,0,7,0,0,0,0,0,0,0,'Draconic for Dummies - take book for quest - The Only Prescription'),
+(180665,1,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Draconic for Dummies - close gossip'),
+(180666,1,0,1,62,0,100,0,6670,0,0,0,56,21106,1,0,0,0,0,7,0,0,0,0,0,0,0,'Draconic for Dummies - take book for quest - The Only Prescription'),
+(180666,1,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Draconic for Dummies - close gossip'),
+(180667,1,0,1,62,0,100,0,6668,0,0,0,56,21109,1,0,0,0,0,7,0,0,0,0,0,0,0,'Draconic for Dummies - take book for quest - The Only Prescription'),
+(180667,1,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Draconic for Dummies - close gossip');
+
+-- Chapter VI:
+-- Chapter VIII:
+DELETE FROM `creature_loot_template` WHERE `entry`=10184 AND `item`=21108;
+DELETE FROM `creature_loot_template` WHERE `entry`=11502 AND `item`=21110;
+INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(10184,21108,100,1,0,1,1),
+(11502,21110,100,1,0,1,1);
+
+-- Conditions
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (6668,6669,6670);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=15552 AND `SourceEntry`=21130 AND `ConditionTypeOrReference`=8 AND `ConditionValue1`=8606;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=15552 AND `SourceEntry`=21103 AND `ConditionTypeOrReference`=9 AND `ConditionValue1`=8620;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=10184 AND `SourceEntry`=21108 AND `ConditionTypeOrReference`=9 AND `ConditionValue1`=8620;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=11502 AND `SourceEntry`=21110 AND `ConditionTypeOrReference`=9 AND `ConditionValue1`=8620;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(1,15552,21130,0,0,8,0,8606,0,0,0,0,'','Diary of Weavil will drop only when a player have Decoy! (8606) quest rewarded'),
+(1,15552,21103,0,0,9,0,8620,0,0,0,0,'','Draconic for Dummies Chapter I will drop only when a player have The Only Prescription (8620) in their quest log'),
+(1,10184,21108,0,0,9,0,8620,0,0,0,0,'','Draconic for Dummies Chapter VI will drop only when a player have The Only Prescription (8620) in their quest log'),
+(1,11502,21110,0,0,9,0,8620,0,0,0,0,'','Draconic for Dummies Chapter VIII will drop only when a player have The Only Prescription (8620) in their quest log'),
+(15,6668,0,0,0,9,0,8620,0,0,0,0,'',"Show gossip only if player have taken The Only Prescription (8620) quest"),
+(15,6668,0,0,0,2,0,21109,1,1,1,0,'',"Show gossip only if player doesn't have the item"),
+(15,6669,0,0,0,9,0,8620,0,0,0,0,'',"Show gossip only if player have taken The Only Prescription (8620) quest"),
+(15,6669,0,0,0,2,0,21107,1,1,1,0,'',"Show gossip only if player doesn't have the item"),
+(15,6670,0,0,0,9,0,8620,0,0,0,0,'',"Show gossip only if player have taken The Only Prescription (8620) quest"),
+(15,6670,0,0,0,2,0,21106,1,1,1,0,'',"Show gossip only if player doesn't have the item");
+
+-- Replace placeholder GO by correct GO and remove placeholder GO quest Thwart the Dark Conclave (10808) by aokromes closes #6773
+UPDATE `gameobject` SET `id`=184750 WHERE `guid`=99983;
+DELETE FROM `gameobject_template` WHERE `entry`=300121;
+
+-- Blending In (11633) quest fix by nelegalno closes #5980 closes #1004
+-- Move Spire of Blood Scouted trigger to floor level so it's not outside LoS
+UPDATE `creature` SET `position_z` = 131.750 WHERE `guid` = 85206;
+
+-- Cloak of shadow should not provide immunity to Flare Closes #7856
+DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=31224 AND `spell_effect`=-1543 AND `type`=2;
+
+-- Nergeld (30403) partial npc fix by nelegalno
+-- Fix conditions
+UPDATE `conditions` SET `ConditionValue1`=4595 WHERE `SourceTypeOrReferenceId`=16 AND `SourceEntry`=30403;
+-- NPC Spells
+UPDATE `creature_template` SET `spell1` = 56746, `spell2` = 56748, `spell3` = 56747, `spell4` = 60540 WHERE `entry` = 30403;
+
+-- Fix Brann's Communicator Closes #5835 author gecko32
+DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=61122 AND `spell_effect`=55038;
+INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES
+(61122, 55038, 0, 'Contact Brann');
+
+-- Fix Black Bruise proc Scaling author Vincent-Michael Closes #7040
+-- Fix Warlock Death Coil SP Coeff. Closes #3584
+DELETE FROM `spell_bonus_data` WHERE `entry` IN (6489,71878,71879);
+INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES
+(6489,0.2143,0,0,0,'Spell Power Coeff for Death Coil'),
+(71878,0,0,0,0,'Item - Black Bruise: Heroic Necrotic Touch Proc'),
+(71879,0,0,0,0,'Item - Black Bruise: Necrotic Touch Proc');
+
+-- Fix proc for Elemental Focus author Warpten Closes #7769
+DELETE FROM `spell_proc_event` WHERE `entry`=16164;
+INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES
+(16164, 0x1C, 0x0B, 0x98101417, 0x80043000, 0x00002004, 0x00010000, 0x00000002, 0, 100, 0); \ No newline at end of file
diff --git a/sql/updates/world/2012_09_24_03_world_misc.sql b/sql/updates/world/2012_09_24_03_world_misc.sql
new file mode 100644
index 00000000000..a043ff60fc5
--- /dev/null
+++ b/sql/updates/world/2012_09_24_03_world_misc.sql
@@ -0,0 +1,116 @@
+-- Molten Core + Ruins of Ahn'Qiraj + Blackwing Lair + Zul'Gurub + Temple of Ahn'Qiraj Boss Respawn Fix author armano2 closes #5883
+UPDATE `creature` SET `spawntimesecs` = 604800 WHERE `Id` IN (12118,11982,12259,12057,12264,12056,11988,12098);
+UPDATE `creature` SET `spawntimesecs` = 259200 WHERE `Id` IN (15348,15341,15340,15370,15369,15339);
+
+-- Fix Fertile Spores Drop Chance authore exodius Closes #7727
+UPDATE `creature_loot_template` SET `ChanceOrQuestChance`= 35 WHERE `item`=24449;
+
+-- Fix quest Gammothra the tormentor author gacko Closes #7770
+UPDATE `creature_template` SET `minlevel`=71,`maxlevel`=71,`faction_A`=14,`faction_H`=14 WHERE `entry`=25790;
+UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=25789;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=25789 AND `source_type`=0;
+DELETE FROM `creature_ai_scripts` WHERE `creature_id`=25789;
+INSERT INTO `smart_scripts`(`entryorguid`,`event_type`,`event_param1`,`action_type`,`action_param1`,`target_type`,`comment`) VALUES
+(25789,8,46012,36,25790,1,'Gammothra the Tormentor - On spell hit - Update entry to Weakened Gammothra');
+
+-- Disable Unfinished Gordok Business (1318) replaced with Disable Unfinished Gordok Business (7703) fix by nelegalno Closes #7819
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry`=1318;
+INSERT INTO `disables` (`sourceType`, `entry`, `flags`, `params_0`, `params_1`, `comment`) VALUES
+(1,1318,0,'','','Unfinished Gordok Business replaced by 7703');
+
+-- Fix Plague Siphon ability (74074) in Lich King encounter in instance Icecrown Citadel, may only target LK (36597) author elron103 Closes #7729
+DELETE FROM `conditions` WHERE `SourceEntry` = 74074 AND `SourceTypeOrReferenceId` = 13;
+INSERT INTO `conditions` (SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorTextId, ScriptName, Comment) VALUES
+(13, 1, 74074, 0, 0, 31, 0, 3, 36597, 0, 0, 0, '', 'Plague Siphon may only target The Lich King');
+
+-- Gurubashi Arena Grand Master (396) achievement fix by nelegalno Closes #7699
+-- Short John Mithril (14508) gossip
+UPDATE `creature_template` SET `gossip_menu_id` = 5921 WHERE `entry` = 14508;
+DELETE FROM `gossip_menu` WHERE `entry`=5921 AND `text_id`=7074;
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES(5921,7074);
+-- Arena Master (18706) loot fix
+UPDATE `item_template` SET `flagsCustom`=flagsCustom|2 WHERE `entry`=18706;
+-- Arena Grandmaster (7838) quest is repeatable (players can get 2x Arena Grand Master trinkets)
+-- https://www.youtube.com/watch?v=fkJ3vrwC4q4&feature=player_detailpage#t=170s
+UPDATE `quest_template` SET `SpecialFlags` = 1 WHERE `Id` = 7838;
+
+-- Update DisenchantID's to proper values for items from Satchel of Helpful Goods (51999) author Exodius Closes #7572
+UPDATE `item_template` SET `DisenchantID`=41 WHERE `entry` IN (51964, 51968, 51978, 51994);
+
+-- X Marks... Your Doom! (11166) quest fix by nelegalno Closes #7528
+-- For some reason the script doesn't trigger if `flags_extra` = 128 is set
+UPDATE `creature_template` SET `unit_flags` = 33554432, `flags_extra` = 0 WHERE `entry` = 23815;
+
+-- Whitebark's Memory (10166) fix despawn timer author nelegalno Closes #7521
+-- TODO: Find fix for one-shot kill by high level players
+UPDATE `smart_scripts` SET `event_param1`=60000, `event_param2`=60000, `event_param3`=60000, `event_param4`=60000, `comment`="Whitebark's Spirit - after 60sec OOC - despawn" WHERE `entryorguid`=19456 AND `id`=5;
+
+-- Armor of Darkness (12979) conditions fix by nelegalno Closes #7506
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=29380 AND `SourceEntry`=42203;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(1,29380,42203,0,0,9,0,12978,0,0,0,0,'',"Dark Armor Plate drops if Facing the Storm taken"),
+(1,29380,42203,0,1,8,0,12978,0,0,0,0,'',"Dark Armor Plate drops if Facing the Storm rewarded"),
+(1,29380,42203,0,1,8,0,12979,0,0,1,0,'',"Dark Armor Plate drops if Armor of Darkness isn't rewarded");
+
+-- Remove duplicate of Swirling Maelstrom (180669) GO author nelegalno Closes #7498
+UPDATE `gameobject` SET `id` = 180669 WHERE `guid` = 99900;
+DELETE FROM `gameobject_template` WHERE `entry`=300057;
+
+-- The Scepter of the Shifting Sands quest chain fix by nelegalno based on http://www.wowwiki.com/The_Scepter_of_the_Shifting_Sands_quest_chain Closes #7473
+-- What Tomorrow Brings > Only One May Rise
+UPDATE `quest_template` SET `NextQuestIdChain` = 8288 WHERE `Id` = 8286;
+-- A Pawn on the Eternal Board > The Charge of the Dragonflights
+UPDATE `quest_template` SET `NextQuestIdChain` = 8555 WHERE `Id` = 8519;
+-- The Nightmare's Corruption > The Nightmare Manifests
+UPDATE `quest_template` SET `NextQuestIdChain` = 8736 WHERE `Id` = 8735;
+-- Azuregos's Magical Ledger > Translating the Ledger
+UPDATE `quest_template` SET `NextQuestIdChain` = 8576 WHERE `Id` = 8575;
+
+-- Hive'Zora Scout Report (8534), Hive'Regal Scout Report (8738) and Hive'Ashi Scout Report (8739) quests fix by Raszagal (Inspired by Justiciar's fix drom #3311)
+-- TODO: Get sniffs for gossip_menu_option placeholder texts
+-- Closes #3311 and Closes #7453
+
+SET @GOSSIP1 := 6690; -- need confirmation
+SET @GOSSIP2 := 6691; -- need confirmation
+SET @GOSSIP3 := 6692; -- need confirmation
+SET @NPC1 := 15609;
+SET @NPC2 := 15610;
+SET @NPC3 := 15611;
+
+-- Update Cenarion Scout Landion's, Azenel's, & Jalia's gossip_menu and AI
+UPDATE `creature_template` SET `gossip_menu_id`=@GOSSIP1 WHERE `entry`=@NPC1;
+UPDATE `creature_template` SET `gossip_menu_id`=@GOSSIP2 WHERE `entry`=@NPC2;
+UPDATE `creature_template` SET `gossip_menu_id`=@GOSSIP3 WHERE `entry`=@NPC3;
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@NPC1,@NPC2,@NPC3);
+-- Gossips
+DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP1 AND `text_id`=8063;
+DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP2 AND `text_id`=8064;
+DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP3 AND `text_id`=8065;
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
+(@GOSSIP1,8063),
+(@GOSSIP2,8064),
+(@GOSSIP3,8065);
+-- Gossip Options
+DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (@GOSSIP1,@GOSSIP2,@GOSSIP3);
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(@GOSSIP1,0,0,"May I have your report?",1,1,0,0,0,0,''), -- placeholder untill sniffed
+(@GOSSIP2,0,0,"May I have your report?",1,1,0,0,0,0,''), -- placeholder untill sniffed
+(@GOSSIP3,0,0,"May I have your report?",1,1,0,0,0,0,''); -- placeholder untill sniffed
+-- Conditions
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (@GOSSIP1,@GOSSIP2,@GOSSIP3);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,@GOSSIP1,0,0,0,2,0,21160,1,0,1,0,'',"Show gossip only if player dosn't have Hive'Regal Scout Report"),
+(15,@GOSSIP1,0,0,0,9,0,8738,0,0,0,0,'',"Show gossip only if Hive'Regal Scout Report quest has been taken"),
+(15,@GOSSIP2,0,0,0,2,0,21158,1,0,1,0,'',"Show gossip only if player dosn't have Hive'Zora Scout Report"),
+(15,@GOSSIP2,0,0,0,9,0,8534,0,0,0,0,'',"Show gossip only if Hive'Zora Scout Report quest has been taken"),
+(15,@GOSSIP3,0,0,0,2,0,21161,1,0,1,0,'',"Show gossip only if player dosn't have Hive'Ashi Scout Report"),
+(15,@GOSSIP3,0,0,0,9,0,8739,0,0,0,0,'',"Show gossip only if Hive'Ashi Scout Report quest has been taken");
+-- Scripts
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC1,@NPC2,@NPC3) AND source_type=0;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC1,0,0,1,62,0,100,0,@GOSSIP1,0,0,0,11,25847,1,0,0,0,0,7,0,0,0,0,0,0,0,"Cenarion Scout Landion - on gossip option select - cast Create Hive'Regal Scout Report"),
+(@NPC1,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Cenarion Scout Landion - Link - close gossip"),
+(@NPC2,0,0,1,62,0,100,0,@GOSSIP2,0,0,0,11,25843,1,0,0,0,0,7,0,0,0,0,0,0,0,"Cenarion Scout Azenel - on gossip option select - cast Create Hive'Zora Scout Report"),
+(@NPC2,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Cenarion Scout Azenel - Link - close gossip"),
+(@NPC3,0,0,1,62,0,100,0,@GOSSIP3,0,0,0,11,25845,1,0,0,0,0,7,0,0,0,0,0,0,0,"Cenarion Scout Jalia - on gossip option select - ast Create Hive'Ashi Scout Report"),
+(@NPC3,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Cenarion Scout Jalia - Link - close gossip");
diff --git a/sql/updates/world/2012_09_26_00_world_misc.sql b/sql/updates/world/2012_09_26_00_world_misc.sql
new file mode 100644
index 00000000000..f7b65b94935
--- /dev/null
+++ b/sql/updates/world/2012_09_26_00_world_misc.sql
@@ -0,0 +1,798 @@
+-- Scripted Npc Infiltrator Marksen (Zombie Form 7293) From Sniff author expecto Closes #6910
+UPDATE creature_template SET AIName = 'SmartAI', `spell1` = 7293 WHERE entry = 5416;
+DELETE FROM `smart_scripts` WHERE (`entryorguid`=5416 AND `source_type`=0);
+INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
+(5416, 0, 0, 0, 1, 0, 100, 0, 5000, 5000, 10000, 12000, 11, 7293, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Infiltrator Marksen - Cast Zombie Form');
+
+-- Wildlord Antelarion (22127) gossip fix by nelegalno
+-- Thanks to @Aokromes for the sniff and @malcrom for all the help
+-- Closes #4444 and #5985
+
+UPDATE `creature_template` SET `gossip_menu_id`=8523 WHERE `entry`=22127;
+
+-- Gossip insert from sniff
+DELETE FROM `gossip_menu` WHERE `entry`=8523;
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (8523,10657);
+
+-- Gossip option sfiffed by Aokromes
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=8523;
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(8523,0,0,"The Felsworn Gas Mask was destroyed, do you have another one?",1,1,0,0,0,0,'');
+
+-- Gossip option conditions
+DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId`=15 AND `SourceGroup`=8523);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+-- Felsworn Gas Mask quest taken
+(15,8523,0,0,0,2,0,31366,1,0,1,0,'',"Show gossip only if player doesnt have Felsworn Gas Mask"),
+(15,8523,0,0,0,9,0,10819,0,0,0,0,'',"Show gossip if Felsworn Gas Mask quest taken"),
+-- Felsworn Gas Mask quest rewarded and You're Fired! quest not rewarded
+(15,8523,0,0,1,2,0,31366,1,0,1,0,'',"Show gossip only if player doesnt have Felsworn Gas Mask"),
+(15,8523,0,0,1,8,0,10819,0,0,0,0,'',"Show gossip if Felsworn Gas Mask quest rewarded"),
+(15,8523,0,0,1,8,0,10821,0,0,1,0,'',"Hide gossip when You're Fired! quest rewarded");
+
+-- Spell conditions
+DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId`=17 AND `SourceEntry`=38448);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(17,0,38448,0,0,3,0,31366,0,0,0,0,'',"Felsworn Gas Mask spell only if the mask is equiped");
+
+-- SAI for Wildlord Antelarion
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=22127;
+DELETE FROM `smart_scripts` WHERE (`entryorguid`=22127 AND `source_type`=0);
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(22127,0,0,1,62,0,100,0,8523,0,0,0,11,39101,0,0,0,0,0,7,0,0,0,0,0,0,0,"Wildlord Antelarion - On Gossip option select - Cast Create Felsword Gas Mask"),
+(22127,0,1,2,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,"Wildlord Antelarion - On Gossip option select - Close Gossip"),
+(22127,0,2,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Wildlord Antelarion - On Gossip option select - Say 0");
+
+-- NPC talk text insert from sniff
+DELETE FROM `creature_text` WHERE `entry` IN (22127) AND `groupid` IN (0);
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(22127,0,0,"It's a good thing I was able to make duplicates of the Felsworn Gas Mask.",12,0,100,1,0,0,"Wildlord Antelarion");
+
+-- A Plague Upon Thee (5902, 5904) quest fix by Svannon and nelegalno Closes #7700
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=4362;
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(4362,0,0,'Put the barrel of termites on this box.',1,1,0,0,0,0,''),
+(4362,1,0,'Put the barrel of termites on this box.',1,1,0,0,0,0,'');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4362;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,4362,0,0,0,28,0,5902,0,0,0,0,'','Only Show Gossip if A Plauge Upon Thee 2 is done (Horde)'),
+(15,4362,1,0,1,28,0,5904,0,0,0,0,'','Only Show Gossip if A Plauge Upon Thee 2 is done (Ally)'),
+-- Allows you to pickup quest if server crashes
+(15,4362,0,0,2, 8,0,5902,0,0,0,0,'','Only Show Gossip if A Plauge Upon Thee 2 is rewarded (Horde)'),
+(15,4362,0,0,2,28,0,6390,0,0,1,0,'','Only Show Gossip if A Plauge Upon Thee 3 is not taken (Horde)'),
+(15,4362,0,0,2, 8,0,6390,0,0,1,0,'','Only Show Gossip if A Plauge Upon Thee 3 is not rewarded (Horde)'),
+(15,4362,1,0,3, 8,0,5904,0,0,0,0,'','Only Show Gossip if A Plauge Upon Thee 2 is rewarded (Ally)'),
+(15,4362,1,0,3,28,0,6389,0,0,1,0,'','Only Show Gossip if A Plauge Upon Thee 3 is not taken (Ally)'),
+(15,4362,1,0,3, 8,0,6389,0,0,1,0,'','Only Show Gossip if A Plauge Upon Thee 3 is not rewarded (Ally)');
+
+UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=177490;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=177490 AND `source_type`=1;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(177490,1,0,1,62,0,100,0,4362,0,0,0,50,177491,60000,0,0,0,0,8,0,0,0,2449.614014,-1662.360352,104.370209,104.370209,'Temp Spawn Termite Barrel'),
+(177490,1,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Close Gossip'),
+(177490,1,2,1,62,0,100,0,4362,1,0,0,50,177491,60000,0,0,0,0,8,0,0,0,2449.614014,-1662.360352,104.370209,104.370209,'Temp Spawn Termite Barrel');
+
+
+-- Sanguine Hibiscus spawns by aokromes Closes #6985
+SET @OGUID = 11504; -- Set by TDB
+DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID+0 AND @OGUID+12;
+INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES
+(@OGUID+0, 183385, 546, 3, 1, 80.50446, -70.98401, -2.75813, -1.518436, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+1, 183385, 546, 3, 1, 144.8807, -69.80858, 27.43485, 0.9948372, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+2, 183385, 546, 3, 1, 52.38583, -188.3249, -4.27433, -2.478367, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+3, 183385, 546, 3, 1, 57.51215, -228.6515, -4.474028, -1.919862, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+4, 183385, 546, 3, 1, 1.739941, -246.5631, -4.533222, -1.099556, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+5, 183385, 546, 3, 1, -98.4295, -312.3992, -3.895051, -1.204277, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+6, 183385, 546, 3, 1, -151.6738, -308.3728, -4.809014, 1.658062, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+7, 183385, 546, 3, 1, 22.0234, -339.9811, 29.18158, 1.239183, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+8, 183385, 546, 3, 1, 74.19567, -402.8985, 33.69212, 1.745327, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+9, 183385, 546, 3, 1, 105.351, -295.466, 32.22884, -2.094393, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+10, 183385, 546, 3, 1, 257.2508, -263.9068, 24.64264, -2.007128, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+11, 183385, 546, 3, 1, 246.2179, -232.5182, 25.95434, 1.466076, 0, 0, 0, 1, 7200, 255, 1), -- 183385 (Area: 0)
+(@OGUID+12, 183385, 546, 3, 1, 295.0749, -124.0022, 29.71378, 0.1745321, 0, 0, 0, 1, 7200, 255, 1); -- 183385 (Area: 0)
+
+-- fix loot of Savage Cave Beast Closes #7874
+DELETE FROM `creature_loot_template` WHERE `entry` = 31470;
+INSERT INTO `creature_loot_template`
+SELECT 31470, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount` FROM `creature_loot_template` WHERE `entry` = 30329;
+
+-- partially revert commit 0deaa521bcae3ab9004529473aceadee134f3a68 author Elron103 Closes #7580
+DELETE FROM `disables` WHERE `sourceType`=1 AND `entry` IN (9713,9926,11087,11115,11116,11353,11518,12186,12187,12494,12845,13807,14185,14186,14187,24808,24809,24810,24811,25238);
+
+-- Add conditions for spell In the Maws of Old the God author trista Closes #1664
+SET @ThrowFragments := 64184; -- The spell "In the Maws of Old the God" that you throw at Yogg-Saron while he is casting Deafening Roar.
+SET @DeafeningRoar := 64189; -- The scream that Yogg-Saron makes in 3rd phase of 25 man with 0-3 Guardians alive.
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=@ThrowFragments;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition` ,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(17,0,@ThrowFragments,0,0,1,0,@DeafeningRoar,1,0,0,0,'','In the Maws of the Old God can be casted only under the effect of Deafening Roar'),
+(17,0,@ThrowFragments,0,0,31,1,3,33288,0,0,0,'','In the Maws of the Old God can target only Yogg-Saron');
+
+-- Fixes Equip Display on King Varian Wrynn author warriorpoetex Closes #6646
+UPDATE `creature_equip_template` SET `itemEntry1`=45899, `itemEntry2`=0 WHERE `entry`=1643;
+-- Template updates for creature 29611 (King Varian Wrynn)
+-- Model data 28127 (creature 29611 (King Varian Wrynn))
+UPDATE `creature_model_info` SET `bounding_radius`=0.3875,`combat_reach`=1.25,`gender`=0 WHERE `modelid`=28127; -- King Varian Wrynn
+-- Addon data for creature 29611 (King Varian Wrynn)
+DELETE FROM `creature_template_addon` WHERE `entry`=29611;
+INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(29611,0,0,257,0, NULL); -- King Varian Wrynn
+
+-- fix Crashin' Thrashin' Racer author nelegalno Closes #4363
+UPDATE `creature_template` SET `spell1` = 49297 WHERE `entry` IN (27664,40281);
+
+-- Gossip sent from League of Arathor Emissary 14991 if player too low for Arathi Basin author malcorm and pitcrawler Closes #6874
+-- Gossip sent from Donal Osgood <Arathi Basin Battlemaster> 857 if player too low for Arathi Basin
+-- Gossip for Huntress Kima, Eldrin, Herbalist Pomeroy, Lisbeth Schneider, Warg Deepwater, Donald Rabonne, Gremlock Pilsnor, Apprentice Kryten, Bulrug, Ranshalla, Jaron Stoneshaper, Aurora Skycaller, Spirit of the Vale, Farseer Nobundo, Temper
+
+UPDATE `creature_template` SET `gossip_menu_id`=7377 WHERE `entry`=17204;
+UPDATE `creature_template` SET `gossip_menu_id`=6471 WHERE `entry`=857;
+UPDATE `creature_template` SET `gossip_menu_id`=7695 WHERE `entry`=18416;
+UPDATE `creature_template` SET `gossip_menu_id`=4261 WHERE `entry`=1103;
+UPDATE `creature_template` SET `gossip_menu_id`=7691 WHERE `entry`=1218;
+UPDATE `creature_template` SET `gossip_menu_id`=685 WHERE `entry`=1299;
+UPDATE `creature_template` SET `gossip_menu_id`=5665 WHERE `entry`=1683;
+UPDATE `creature_template` SET `gossip_menu_id`=5665 WHERE `entry`=2367;
+UPDATE `creature_template` SET `gossip_menu_id`=5853 WHERE `entry`=1699;
+UPDATE `creature_template` SET `gossip_menu_id`=2601 WHERE `entry`=2788;
+UPDATE `creature_template` SET `gossip_menu_id`=9821 WHERE `entry`=10054;
+UPDATE `creature_template` SET `gossip_menu_id`=3131 WHERE `entry`=10300;
+UPDATE `creature_template` SET `gossip_menu_id`=3761 WHERE `entry`=10301;
+UPDATE `creature_template` SET `gossip_menu_id`=4743 WHERE `entry`=10304;
+UPDATE `creature_template` SET `gossip_menu_id`=7376 WHERE `entry`=17087;
+UPDATE `creature_template` SET `gossip_menu_id`=7378 WHERE `entry`=17205;
+
+DELETE FROM `gossip_menu` WHERE `entry`=6504 AND `text_id`=7699;
+DELETE FROM `gossip_menu` WHERE `entry`=6471 AND `text_id`=7642;
+DELETE FROM `gossip_menu` WHERE `entry`=7695 AND `text_id`=9389;
+DELETE FROM `gossip_menu` WHERE `entry`=4261 AND `text_id`=5413;
+DELETE FROM `gossip_menu` WHERE `entry`=7691 AND `text_id`=9385;
+DELETE FROM `gossip_menu` WHERE `entry`=685 AND `text_id`=1235;
+DELETE FROM `gossip_menu` WHERE `entry`=5853 AND `text_id`=7016;
+DELETE FROM `gossip_menu` WHERE `entry`=2601 AND `text_id` IN (3293,3294);
+DELETE FROM `gossip_menu` WHERE `entry`=7376 AND `text_id` IN (8826,8827);
+DELETE FROM `gossip_menu` WHERE `entry`=7377 AND `text_id` IN (8828,8829);
+DELETE FROM `gossip_menu` WHERE `entry`=7378 AND `text_id`=8832;
+
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
+(2601,3293),
+(2601,3294),
+(6504,7699),
+(6471,7642),
+(7695,9389),
+(4261,5413),
+(7691,9385),
+(685,1235),
+(5853,7016),
+(7376,8826),
+(7376,8827),
+(7377,8828),
+(7377,8829),
+(7378,8832);
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (4261,6471) AND `id` = 0;
+DELETE FROM `gossip_menu_option` WHERE `menu_id`=4743 AND `id` IN (0,1);
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(4261,0,3, 'Train me.',5,16,0,0,0,0, ''),
+(6471,0,9, 'I would like to go to the battleground.',12,1048576,0,0,0,0, ''),
+(4743,0,0, 'Where can I get Enchanted Thorium?',1,1,0,0,0,0, ''),
+(4743,1,0, 'Where can I find Crystal Restore?',1,1,0,0,0,0, '');
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=3131 AND `SourceEntry`=4788;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=4743 AND `SourceEntry` IN (5816,5817);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=7376 AND `SourceEntry`=8827;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=4743 AND `SourceEntry` IN (0,1);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=4743 AND `SourceEntry` IN (5816,5817,5795);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=6471 AND `SourceEntry`=7642;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=6504 AND `SourceEntry`=7699;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=6471 AND `SourceEntry`=0;
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=5665 AND `SourceEntry` IN (6960,6961);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=5853 AND `SourceEntry`=7021;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(14,6471,7642,0,0,27,0,20,2,0,0,0,'','Donal Osgood <Arathi Basin Battlemaster> - Show different gossip if player level is below 20'),
+(14,6504,7699,0,0,27,0,20,2,0,0,0,'','League of Arathor Emissary - Show different gossip if player level is below 20'),
+(15,6471,0,0,0,27,0,20,3,0,0,0,'','Donal Osgood <Arathi Basin Battlemaster> - Show gossip option only if player level is at least 20'),
+(14,5665,6960,0,0,7,0,356,225,0,0,0,'','Show different gossip if player has fishing skill 225'),
+(14,5665,6961,0,0,7,0,356,225,0,1,0,'','Show gossip if player has not fishing skill 225'),
+(14,5853,7021,0,0,7,0,185,1,0,0,0,'','Show different gossip if player has cooking profession'),
+(14,3131,4788,0,0,8,0,979,0,0,0,0,'','Show different gossip if player has completed quest 979'),
+(14,4743,5816,0,0,28,0,5245,0,0,0,0,'','Show different gossip if player has quest 5245 objectives complete'),
+(14,4743,5817,0,0,8,0,5245,0,0,0,0,'','Show different gossip if player has completed quest 5245'),
+(14,4743,5795,0,0,8,0,5247,0,0,0,0,'','Show different gossip if player has completed quest 5247'),
+(14,7376,8827,0,0,8,0,9450,0,0,1,0,'','Show different gossip if player has not completed quest 9450'),
+(15,4743,0,0,0,9,0,5247,0,0,0,0,'','Show gossip option only if player has taken quest 5247 but not complete'),
+(15,4743,1,0,0,9,0,5247,0,0,0,0,'','Show gossip option only if player has taken quest 5247 but not complete');
+
+
+-- Flesh Eating Worms should not have loot author exodius Closes #7144
+UPDATE `creature_template` SET `lootid`=0 WHERE `entry`=2462;
+-- Remove loot template for Entry 2462.
+-- Flesh Eating Worms should not have loot and ID is not related to any other creature
+DELETE FROM `creature_loot_template` WHERE `entry`=2462 and `item` IN (785,2450,2452,2453,2772,2835,2838,3369);
+
+-- Wailing Winds (30450) loot fix by nelegalno Closes #6382
+DELETE FROM `creature_loot_template` WHERE (`entry`=30450);
+INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES
+(30450, 26001, 3, 1, 1, -26001, 1),
+(30450, 26002, 3, 1, 1, -26002, 1),
+(30450, 26012, 1, 1, 1, -26012, 1),
+(30450, 26013, 1, 1, 1, -26013, 1),
+(30450, 26014, 1, 1, 1, -26014, 1),
+(30450, 26015, 1, 1, 1, -26015, 1),
+(30450, 45912, 0.1, 1, 0, 1, 1),
+(30450, 39512, 80, 1, 0, 1, 1),
+(30450, 37702, 25, 1, 0, 1, 2),
+(30450, 39513, 20, 1, 0, 1, 1);
+
+-- Daio the Decrepit (14463) gossip fix by nelegalno Closes #7376
+UPDATE `creature_template` SET `gossip_menu_id` = 5824 WHERE `entry` = 14463;
+DELETE FROM `gossip_menu` WHERE `entry`=5824 AND `text_id`=6995;
+INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES (5824,6995);
+
+-- Set pickpocketloot data for Skeletal Reavers author trista Closes #7366
+SET @SREAVER := 32467;
+UPDATE `creature_template` SET `pickpocketloot`=`entry` WHERE `entry`=@SREAVER;
+DELETE FROM `pickpocketing_loot_template` WHERE `entry`=@SREAVER;
+INSERT INTO `pickpocketing_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
+(@SREAVER,35947,0.7,1,0,1,1), -- Sparkling Frostcap
+(@SREAVER,33447,0.7,1,0,1,1), -- Runic Healing Potion
+(@SREAVER,38269,1.4,1,0,1,1), -- Soggy Handkerchief
+(@SREAVER,43575,1.6,1,0,1,1); -- Reinforced Junkbox
+
+-- Bone Gryphon (29414) NPC needed for No Fly Zone (12815) quest by Vincent-Michael Closes #7355
+SET @ENTRY := 29414; -- Bone Gryphon
+
+UPDATE `creature_template` SET `spell5`=0, `InhabitType` = 5 WHERE `entry` = @ENTRY;
+DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
+INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(@ENTRY,0,0,0x3000000,0x1,0,'54422 54476');
+
+-- Remove hardcored old model at creature for Rull Snowhoof author aokromes Closes #7261
+UPDATE `creature` SET `modelid`=0 WHERE `guid`=32333;
+
+-- Fix NPC Lhara, from Darkmoon Faire author Mick3y16 Closes #6998
+-- Fixes Artic Fur (90 minutes)
+UPDATE `npc_vendor` SET `incrtime`=9000 WHERE `entry`=14846 AND `item`=44128;
+-- Fixes the LK Gems (60 minutes)
+UPDATE `npc_vendor` SET `incrtime`=3600 WHERE `entry`=14846 AND `ExtendedCost`=2484;
+-- Fixes the BC Gems (60 minutes)
+UPDATE `npc_vendor` SET `incrtime`=3600 WHERE `entry`=14846 AND `item` IN (23441,23440,23439,23438,23437,23436);
+-- Fixes Black Lotus (30 minutes)
+UPDATE `npc_vendor` SET `incrtime`=1800 WHERE `entry`=14846 AND `item`=13468;
+-- Fixes The Rest (15 minutes)
+UPDATE `npc_vendor` SET `incrtime`=900 WHERE `entry`=14846 AND `item` IN (36906,36905,36904,36903,36901,33568,25708,36907,36908,38425,37921,37705,37704,37703,37702,37701,37700,25707,21887,22572,22573,22574,22575,22576,22577,22578,4304,8170,2319,4234);
+
+-- The Masters Terrace (9645) quest fix by nelegalno Closes #6855
+UPDATE `creature_template` SET `InhabitType` = 4 WHERE `entry` = 17652;
+
+DELETE FROM `event_scripts` WHERE `id`=10951;
+INSERT INTO `event_scripts` (`id`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES
+(10951,0,10,17651,300000,0,-11161,-1923.2,91.4737,2.89811);
+
+-- Zeppelin: <The Purple Princess> author malcom Closes #6664
+UPDATE `creature_transport` SET `emote`=173 WHERE `transport_entry`=176495 AND `npc_entry`=25101; -- Crewman Cutpipe
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=176495 AND `npc_entry`=25102; -- Crewman Spinshaft
+UPDATE `creature_transport` SET `emote`=173 WHERE `transport_entry`=176495 AND `npc_entry`=25103; -- Crewman Boltshine
+UPDATE `creature_model_info` SET `modelid_other_gender`=0 WHERE `modelid`=4083; -- Watcher Umjin should only have a male model
+UPDATE `creature_model_info` SET `modelid_other_gender`=0 WHERE `modelid`=4084; -- Watcher Du'una should only have a female model
+DELETE FROM `creature_template_addon` WHERE `entry`=25107;
+INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(25107,0,0,3,1,0, ''); -- STATE_SLEEP
+-- Zeppelin: <Iron Eagle>
+UPDATE `creature_model_info` SET `modelid_other_gender`=0 WHERE `modelid`=4259; -- Grunt Umgor should only have a male model
+UPDATE `creature_transport` SET `TransOffsetX`=-10.3057, `TransOffsetY`=-12.10524, `TransOffsetZ`=-16.96907, `TransOffsetO`=5.927236 WHERE `transport_entry`=175080 AND`npc_entry`=24926; -- Chief Officer Brassbolt
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=175080 AND `npc_entry`=24931; -- Crewman Fastwrench
+DELETE FROM `creature_transport` WHERE `transport_entry`=175080 AND `npc_entry` IN (24927,24929,24930);
+INSERT INTO `creature_transport` (`guid`,`transport_entry`,`npc_entry`,`TransOffsetX`,`TransOffsetY`,`TransOffsetZ`,`TransOffsetO`,`emote`) VALUES
+(3,175080,24927,-1.874165,-7.847112,-23.68718,3.385939,0), -- Navigator Sparksizzle
+(4,175080,24929,9.083008,-4.964111,-23.59211,1.594056,133), -- Crewman Crosswire
+(5,175080,24930,-17.0083,-7.874878,-15.18782,3.141593,133); -- Crewman Gazzlegear
+-- Zeppelin: <The Cloudkisser>
+-- Deleting some NPCs that are double spawned out of the zeppelin. They are already spawned by `creature_transport` table
+DELETE FROM `creature` WHERE `guid` IN (
+116702, -- Crewman Coilspan
+116703, -- Crewman Coilspan
+117715, -- Deathguard Hicks
+117750 ); -- Sky-Captain Cryoflight
+UPDATE `creature_transport` SET `npc_entry`=31715 WHERE `guid`=3 AND `transport_entry`=181689; -- Deathguard Hicks
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=181689 AND `npc_entry`=31704; -- Crewman Spinwheel
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=181689 AND `npc_entry`=31705; -- Crewman Coilspan
+UPDATE `creature_transport` SET `emote`=133, `TransOffsetO`=4.64346 WHERE `transport_entry`=181689 AND`npc_entry`=31706; -- Crewman Stembolt
+DELETE FROM `creature_transport` WHERE `transport_entry`=181689 AND `npc_entry`=25075; -- Zeppelin Controls
+INSERT INTO `creature_transport` (`guid`,`transport_entry`,`npc_entry`,`TransOffsetX`,`TransOffsetY`,`TransOffsetZ`,`TransOffsetO`,`emote`) VALUES
+(7,181689,25075,4.362147,-2.254167,-23.59002,4.712389,0); -- Zeppelin Controls
+UPDATE `creature_template` SET `exp`=2 WHERE `entry`=31708; -- Deathguard Barth
+-- Zeppelin: <The Mighty Wind>
+UPDATE `creature_model_info` SET `gender`=0, `modelid_other_gender`=0 WHERE `modelid`=4601; -- Grunt Gritch should only have a male model
+UPDATE `creature_model_info` SET `gender`=1, `modelid_other_gender`=0 WHERE `modelid`=4602; -- Grunt Grikee should only have a female model
+UPDATE `creature_transport` SET `TransOffsetO`=1.16964 WHERE `transport_entry`=186238 AND `npc_entry`=31726; -- Grunt Gritch orientation
+UPDATE `creature_transport` SET `TransOffsetO`=5.47991 WHERE `transport_entry`=186238 AND `npc_entry`=31727; -- Grunt Grikee orientation
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=186238 AND `npc_entry`=31720; -- Crewman Shubbscoop
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=186238 AND `npc_entry`=31723; -- Crewman Barrowswizzle
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=186238 AND `npc_entry`=31724; -- Crewman Paltertop
+-- Zeppelin: <The Thundercaller>
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=164871 AND `npc_entry`=25071; -- Crewman Rusthammer
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=164871 AND `npc_entry`=25072; -- Crewman Quickfix
+UPDATE `creature_transport` SET `emote`=133 WHERE `transport_entry`=164871 AND `npc_entry`=25074; -- Crewman Sparkfly
+DELETE FROM `creature_transport` WHERE `transport_entry`=164871 AND `npc_entry`=25077; -- Sky-Captain Cloudkicker
+INSERT INTO `creature_transport` (`guid`,`transport_entry`,`npc_entry`,`TransOffsetX`,`TransOffsetY`,`TransOffsetZ`,`TransOffsetO`,`emote`) VALUES
+(18,164871,25077,-19.68856,-8.170582,-14.37648,3.176499,0); -- Sky-Captain Cloudkicker
+-- Zeppelin: <The Zephyr>
+UPDATE `creature_transport` SET `emote`=173 WHERE `transport_entry`=190549 AND `npc_entry`=34719;
+
+-- Fix flight masters around the Dark Portal in Outland (16.11.2011) by SignFinder ( https://github.com/TrinityCore/TrinityCore/issues/2596#issuecomment-4450115 ) Closes #6401
+
+-- Vlagga Freyfeather SAI
+SET @NPC := 18930;
+SET @GOSSIP_VLAGGA := 7938;
+SET @SPELL_STAIR_OF_DESTINY_THRALLMAR := 34924;
+DELETE FROM `creature_ai_scripts` WHERE `creature_id` =@NPC;
+UPDATE `creature_template` SET `AIName`= "SmartAI" WHERE `entry` =@NPC;
+DELETE FROM `smart_scripts` WHERE `entryorguid` =@NPC;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC,0,0,0,62,0,100,0,@GOSSIP_VLAGGA,1,0,0,11,@SPELL_STAIR_OF_DESTINY_THRALLMAR,2,0,0,0,0,7,0,0,0,0,0,0,0,"Vlagga Freyfeather - On Gossip Select - Cast Stair of Destiny to Thrallmar"),
+(@NPC,0,1,2,4,0,100,0,0,0,0,0,12,9297,4,30000,0,0,0,1,0,0,0,0,0,0,0,"Vlagga Freyfeather - On Aggro - Summon Enraged Wyvern"),
+(@NPC,0,2,3,61,0,100,0,0,0,0,0,12,9297,4,30000,0,0,0,1,0,0,0,0,0,0,0,"Vlagga Freyfeather - On Aggro - Summon Enraged Wyvern"),
+(@NPC,0,3,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Vlagga Freyfeather - On Aggro - Say Line 0");
+
+-- Amish Wildhammer SAI
+SET @NPC := 18931;
+SET @GOSSIP_AMISH := 7939;
+SET @SPELL_STAIR_OF_DESTINY_HONOR_HOLD := 34907;
+DELETE FROM `creature_ai_scripts` WHERE `creature_id` =@NPC;
+UPDATE `creature_template` SET `AIName`= "SmartAI" WHERE `entry` =@NPC;
+DELETE FROM `smart_scripts` WHERE `entryorguid` =@NPC;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@NPC,0,0,0,62,0,100,0,@GOSSIP_AMISH,1,0,0,11,@SPELL_STAIR_OF_DESTINY_HONOR_HOLD,2,0,0,0,0,7,0,0,0,0,0,0,0,"Amish Wildhammer - On Gossip Select - Cast Stair of Destiny to Honor Hold"),
+(@NPC,0,1,2,4,0,100,0,0,0,0,0,12,9526,4,30000,0,0,0,1,0,0,0,0,0,0,0,"Amish Wildhammer - On Aggro - Summon Enraged Gryphon"),
+(@NPC,0,2,3,61,0,100,0,0,0,0,0,12,9526,4,30000,0,0,0,1,0,0,0,0,0,0,0,"Amish Wildhammer - On Aggro - Summon Enraged Gryphon"),
+(@NPC,0,3,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Amish Wildhammer - On Aggro - Say Line 0");
+
+-- Gossip inserts
+DELETE FROM `gossip_menu` WHERE `entry`=@GOSSIP_AMISH;
+DELETE FROM `npc_text` WHERE `ID` IN (9935,9991);
+INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (@GOSSIP_AMISH,10052);
+DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (@GOSSIP_AMISH,@GOSSIP_VLAGGA);
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES
+(@GOSSIP_AMISH,0,2,"Show me where I can fly.",4,8192,0,0,0,0,''),
+(@GOSSIP_AMISH,1,2,"Send me to Honor Hold!",4,8192,0,0,0,0,''),
+(@GOSSIP_VLAGGA,0,2,"Show me where I can fly.",4,8192,0,0,0,0,''),
+(@GOSSIP_VLAGGA,1,2,"Send me to Thrallmar!",4,8192,0,0,0,0,'');
+
+-- Gossip conditions
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (@GOSSIP_AMISH,@GOSSIP_VLAGGA);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(15,@GOSSIP_AMISH,0,0,0,8,10140,0,0,0,'',"Show gossip option 0 if player has rewarded quest Journey to Honor Hold"),
+(15,@GOSSIP_AMISH,1,0,0,28,10140,0,0,0,'',"Show gossip option 1 if player has complete quest Journey to Honor Hold"),
+(15,@GOSSIP_VLAGGA,0,0,0,8,10289,0,0,0,'',"Show gossip option 0 if player has rewarded quest Journey to Thrallmar"),
+(15,@GOSSIP_VLAGGA,1,0,0,28,10289,0,0,0,'',"Show gossip option 1 if player has complete quest Journey to Thrallmar");
+
+-- fix dedication of honor movie playback. author trista and vincent-michael. Closes #5754
+SET @MEMORIAL := 202443;
+SET @Script := 20244300;
+UPDATE `gameobject_template` SET AIName = 'SmartGameObjectAI' WHERE entry = @MEMORIAL;
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@MEMORIAL);
+DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid`=@Script;
+INSERT INTO `smart_scripts` VALUES
+(@MEMORIAL,1,0,0,62,0,100,0,11431,0,0,0,80,@Script,0,0,0,0,0,1,0,0,0,0,0,0,0,'Memorial - On gossip select - Run Script'),
+(@Script,9,0,0,0,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Actionlist - On action 0 - Close gossip'),
+(@Script,9,1,0,0,0,100,0,0,0,0,0,68,16,0,0,0,0,0,7,0,0,0,0,0,0,0,'Actionlist - On action 1 - Startmovie');
+SET @OGUID := 342;
+
+DELETE FROM `gameobject` WHERE `id`=@MEMORIAL;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@OGUID,@MEMORIAL,571,1,1,5804.526,638.5417,647.6481,2.460913,0,0,0,1,120,255,1); -- Dedication of Honor
+
+-- Add immune to interrupt for hodir & ignis AUTHOR gecko32 Closes #5617
+UPDATE `creature_template` SET `mechanic_immune_mask` = `mechanic_immune_mask`|1|2|4|8|16|64|256|512|1024|2048|4096|8192|65536|131072|524288|4194304|8388608|33554432|67108864|536870912 WHERE `entry` IN (32845,32846,33118,33190);
+
+-- Leader of the Deranged ID: 11240 - adds spawn and SAI author trista Closes #5556
+SET @GUID := 42567;
+SET @ID := 24048;
+SET @Dynamite := 7978;
+-- Add spawn
+DELETE FROM `creature` WHERE `id`=@ID;
+INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `currentwaypoint`, `MovementType`) VALUES
+(@GUID, @ID, 571, 1, 3, 1742.082764, -3339.336426, 79.993713, 2.515936, 120, 20, 0, 1);
+-- Add simple SAI for Squeeg Idolhunter
+UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry`=@ID;
+DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ID;
+INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
+(@ID,0,1,0,0,0,100,0,2000,6000,12000,15000,11,@Dynamite,0,0,0,0,0,2,0,0,0,0,0,0,0,'Combat - Throw Dynamite');
+
+-- Gnomish Army Knife Resurrection (54732) is restricted to Grand Master Engineers (51306) author mweinelt Closes #5415
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 17 AND `SourceEntry` = 54732 LIMIT 1;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(17, 0, 54732, 0, 0, 25, 0, 51306, 0, 0, 0, 0, '', 'Only Grand-Masters in Engineering can use the Gnomish Army Knife to resurrect players.');
+
+-- Add Pint-Sized Pink Pachyderm to Brewfest vendors author Exodius Closes #4907
+SET @PINT := 46707; -- Pint-Sized Pink Pachyderm
+DELETE FROM `npc_vendor` WHERE `item`=@PINT;
+INSERT INTO `npc_vendor` (`entry`,`slot`,`item`,`maxcount`,`incrtime`,`ExtendedCost`) VALUES
+(23710,0,@PINT,0,0,2275), -- Vendor Belbi Quikswitch
+(24495,0,@PINT,0,0,2275), -- Vendor Blix Fixwidget
+(27478,0,@PINT,0,0,2275), -- Vendor Larkin Thunderbrew
+(27489,0,@PINT,0,0,2275); -- Vendor Rayma
+
+-- Kalu'ak Fishing Derby start time fix ( http://old.wowhead.com/event=424 ) author neglanalgo Closes #4743 Closes #4717
+UPDATE `game_event` SET `start_time` = '2012-01-07 14:00:00' WHERE `eventEntry` = 64;
+UPDATE `game_event` SET `start_time` = '2012-01-07 13:00:00' WHERE `eventEntry` = 63;
+
+-- Stranglethorn Fishing Extravaganza start time fix ( http://old.wowhead.com/event=301 )
+UPDATE `game_event` SET `start_time` = '2012-01-01 14:00:00' WHERE `eventEntry` IN (15, 62);
+UPDATE `game_event` SET `start_time` = '2012-01-01 00:00:00', `length` = 1440 WHERE `eventEntry` = 14; -- Grinkle and Barrus should appear before the event starts (1440=24h, currently set to 27h from event start)
+
+-- [QUEST] All Along The Watchtowers author valcorb and kaelima Closes #4637
+SET @GUID := 5282;
+SET @ENTRY := 300030;
+SET @NEWENTRY := 176095;
+UPDATE `gameobject_template` SET `entry`=@NEWENTRY WHERE `entry`=@ENTRY;
+DELETE FROM `gameobject` WHERE `id` IN (@ENTRY,@NEWENTRY) OR `guid` BETWEEN @GUID+0 AND @GUID+3;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@GUID ,@NEWENTRY,0,1,1,1308.24 ,-1303.41 ,64.3047 ,4.15194,0,0,0.875091,-0.483959,300,0,1),
+(@GUID+1,@NEWENTRY,0,1,1,1473.977,-1409.814,67.76421,5.60571,0,0,0.332297,-0.943175,300,0,1),
+(@GUID+2,@NEWENTRY,0,1,1,1560.28 ,-1485.03 ,68.3929 ,1.36456,0,0,0.630563, 0.776138,300,0,1),
+(@GUID+3,@NEWENTRY,0,1,1,1327.56 ,-1581.53 ,61.7238 ,3.42781,0,0,0.989778,-0.14262 ,300,0,1);
+
+-- [NPC] Fix behaviour of Scarlet Peasant author Valcorb Closes #3925
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=28557;
+DELETE FROM `smart_scripts` WHERE `entryorguid`=28557 AND `source_type`=0;
+INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`)
+VALUES
+(28557, 0, 0, 0, 2, 0, 20, 1, 0, 20, 1, 1, 1, 0, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'At 0-20% hp- say text'),
+(28557, 0, 1, 0, 2, 0, 20, 1, 0, 20, 1, 1, 1, 1, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'At 0-20% hp- say text'),
+(28557, 0, 2, 0, 2, 0, 20, 1, 0, 20, 1, 1, 1, 2, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'At 0-20% hp- say text'),
+(28557, 0, 3, 0, 2, 0, 20, 1, 0, 20, 1, 1, 1, 3, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'At 0-20% hp- say text'),
+(28557, 0, 4, 0, 2, 0, 20, 1, 0, 20, 1, 1, 1, 4, 10, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'At 0-20% hp- say text');
+
+DELETE FROM `creature_text` WHERE `entry`=28557 AND `probability`=100;
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`)
+VALUES
+(28557, 0, 0, 'Ungh! I ... I think I pooped...', 12, 0, 100, 0, 0, 0, 'Scarlet Peasant'),
+(28557, 0, 1, 'I... I have a sick grandmother at home... I--I''m all she''s got.', 12, 0, 100, 0, 0, 0, 'Scarlet Peasant'),
+(28557, 0, 2, 'I picked the wrong week to quit drinkin''!', 12, 0, 100, 0, 0, 0, 'Scarlet Peasant'),
+(28557, 0, 3, 'I''ve got five kids lady, they''ll die without me!', 12, 0, 100, 0, 0, 0, 'Scarlet Peasant'),
+(28557, 0, 4, 'You don''t have to do this! Nobody has to die!', 12, 0, 100, 0, 0, 0, 'Scarlet Peasant');
+
+-- Cast Terrified! when Citizen of New Avalon enters combat author Valcorb Closes #3734
+UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (28941,28942);
+DELETE FROM `smart_scripts` WHERE `entryorguid` IN (28941, 28942);
+INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
+(28941, 0, 0, 0, 4, 0, 100, 0, 0, 0, 0, 0, 11, 52716, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Citizen of New Avalon 1 - if enter combat - fear'),
+(28942, 0, 0, 0, 4, 0, 100, 0, 0, 0, 0, 0, 11, 52716, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Citizen of New Avalon 2 - if enter combat - fear');
+
+-- Credit fix for stinking up southshore 1657 author Norfik Closes #3552
+DELETE FROM `event_scripts` WHERE `id`=9417;
+INSERT INTO `event_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES
+(9417, 3, 8, 15415, 0, 0, 0, 0, 0, 0);
+
+-- Alexstrasza and Korialstrasz author vlomax Closes #7746
+SET @PHASE := 2;
+SET @GGUID := 76055;
+-- Plants & flames
+DELETE FROM `gameobject` WHERE `id` BETWEEN 193196 AND 193198 OR `id` BETWEEN 193220 AND 193386 OR `id` BETWEEN 193388 AND 193393 OR `id` BETWEEN 193396 AND 193399 OR `guid` BETWEEN @GGUID AND @GGUID+181;
+INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES
+(@GGUID+0,193196, 571, 1, @PHASE, 4840.929, 1494.97, 209.6041, 2.103119, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+1,193197, 571, 1, @PHASE, 4875.424, 1486.991, 209.5768, 2.120576, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+2,193198, 571, 1, @PHASE, 4875.969, 1487.23, 209.6242, 5.707228, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+3,193220, 571, 1, @PHASE, 4901.706, 1501.568, 214.8973, 0.0005237369, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+4,193221, 571, 1, @PHASE, 4899.952, 1499.167, 214.9082, 5.41925, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+5,193223, 571, 1, @PHASE, 4867.679, 1501.424, 209.7898, 0.969179, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+6,193225, 571, 1, @PHASE, 4869.894, 1498.136, 209.9754, 2.077466, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+7,193229, 571, 1, @PHASE, 4899.046, 1500.026, 213.7757, 4.281601, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+8,193222, 571, 1, @PHASE, 4867.967, 1505.212, 209.1965, 1.82941, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+9,193224, 571, 1, @PHASE, 4867.233, 1510.344, 210.8179, 2.48454, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+10,193228, 571, 1, @PHASE, 4867.919, 1513.521, 211.374, 4.224219, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+11,193227, 571, 1, @PHASE, 4872.966, 1514.59, 212.3312, 4.885982, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+12,193226, 571, 1, @PHASE, 4868.827, 1515.047, 210.5834, 1.567609, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+13,193230, 571, 1, @PHASE, 4875.33, 1483.97, 209.321, 1.099933, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+14,193231, 571, 1, @PHASE, 4875.167, 1482.726, 209.5813, 3.899255, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+15,193232, 571, 1, @PHASE, 4873.677, 1479.37, 209.2619, 6.044956, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+16,193233, 571, 1, @PHASE, 4878.027, 1483.453, 209.3674, 3.726801, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+17,193234, 571, 1, @PHASE, 4874.569, 1482.123, 209.5809, 5.821372, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+18,193235, 571, 1, @PHASE, 4874.725, 1480.063, 209.5809, 3.477762, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+19,193236, 571, 1, @PHASE, 4877.155, 1482.281, 209.5077, 6.219547, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+20,193237, 571, 1, @PHASE, 4879.968, 1484.747, 209.8505, 4.501981, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+21,193238, 571, 1, @PHASE, 4876.323, 1484.97, 208.3138, 2.230834, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+22,193239, 571, 1, @PHASE, 4877.1, 1484.656, 209.1863, 2.269449, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+23,193240, 571, 1, @PHASE, 4871.932, 1485.224, 209.3937, 1.457871, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+24,193241, 571, 1, @PHASE, 4868.574, 1498.977, 210.52, 0.1396255, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+25,193242, 571, 1, @PHASE, 4868.924, 1496.627, 210.149, 3.220151, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+26,193243, 571, 1, @PHASE, 4866.884, 1497.613, 209.2193, 5.581869, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+27,193244, 571, 1, @PHASE, 4870.409, 1485.929, 208.8148, 2.012669, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+28,193245, 571, 1, @PHASE, 4873.674, 1463.747, 209.9446, 1.692968, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+29,193246, 571, 1, @PHASE, 4867.43, 1463.248, 208.1823, 3.382769, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+30,193247, 571, 1, @PHASE, 4870.533, 1463.094, 209.2539, 2.985031, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+31,193248, 571, 1, @PHASE, 4872.965, 1463.778, 208.817, 0.3284273, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+32,193249, 571, 1, @PHASE, 4866.135, 1454.382, 209.254, 2.906489, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+33,193250, 571, 1, @PHASE, 4863.497, 1511.99, 211.0073, 5.427976, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+34,193251, 571, 1, @PHASE, 4862.127, 1509.542, 210.2737, 4.765272, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+35,193252, 571, 1, @PHASE, 4865.178, 1507.217, 210.3379, 5.044526, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+36,193253, 571, 1, @PHASE, 4853.508, 1504.255, 209.7053, 1.998924, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+37,193254, 571, 1, @PHASE, 4849.161, 1504.778, 210.4205, 4.066619, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+38,193255, 571, 1, @PHASE, 4835.896, 1488.719, 209.5815, 3.416903, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+39,193256, 571, 1, @PHASE, 4841.354, 1482.227, 209.5805, 1.850049, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+40,193257, 571, 1, @PHASE, 4841.196, 1489.903, 209.5813, 5.725396, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+41,193258, 571, 1, @PHASE, 4840.608, 1484.361, 209.5813, 2.016231, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+42,193259, 571, 1, @PHASE, 4839.124, 1486.542, 209.2619, 1.978337, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+43,193260, 571, 1, @PHASE, 4843.821, 1489.113, 209.283, 5.184155, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+44,193261, 571, 1, @PHASE, 4842.286, 1483.191, 209.5809, 0.3759405, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+45,193262, 571, 1, @PHASE, 4845.386, 1486.806, 209.4725, 1.254085, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+46,193263, 571, 1, @PHASE, 4835.046, 1490.908, 209.2909, 1.831047, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+47,193264, 571, 1, @PHASE, 4838.369, 1493.165, 209.3897, 2.568887, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+48,193265, 571, 1, @PHASE, 4842.897, 1491.009, 209.5809, 5.959332, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+49,193266, 571, 1, @PHASE, 4844.97, 1489.892, 209.3359, 3.932379, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+50,193267, 571, 1, @PHASE, 4847.749, 1488.823, 209.301, 5.789437, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+51,193268, 571, 1, @PHASE, 4841.975, 1486.234, 209.4944, 5.791942, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+52,193269, 571, 1, @PHASE, 4844.339, 1484.116, 209.4908, 3.889533, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+53,193270, 571, 1, @PHASE, 4840.96, 1481.422, 209.4966, 4.98909, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+54,193271, 571, 1, @PHASE, 4844.502, 1486.135, 209.3802, 1.443149, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+55,193272, 571, 1, @PHASE, 4836.853, 1488.425, 209.4966, 3.060501, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+56,193273, 571, 1, @PHASE, 4844.616, 1493.514, 209.3608, 3.11481, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+57,193274, 571, 1, @PHASE, 4847.851, 1486.434, 209.3608, 1.151302, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+58,193275, 571, 1, @PHASE, 4841.349, 1488.082, 208.3138, 3.749274, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+59,193276, 571, 1, @PHASE, 4842.697, 1487.741, 209.3854, 3.587177, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+60,193277, 571, 1, @PHASE, 4847.485, 1488.835, 207.9903, 0.485505, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+61,193278, 571, 1, @PHASE, 4856.974, 1498.668, 210.0112, 5.593781, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+62,193279, 571, 1, @PHASE, 4860.162, 1499.833, 209.4969, 5.515764, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+63,193280, 571, 1, @PHASE, 4862.285, 1462.604, 209.3651, 4.037887, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+64,193281, 571, 1, @PHASE, 4862.758, 1457.965, 209.9445, 0.4537852, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+65,193282, 571, 1, @PHASE, 4859.121, 1463.345, 209.3854, 5.777565, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+66,193283, 571, 1, @PHASE, 4861.292, 1455.554, 209.3854, 5.742657, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+67,193284, 571, 1, @PHASE, 4865.374, 1460.495, 209.1164, 0.3146807, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+68,193285, 571, 1, @PHASE, 4865.479, 1453.684, 209.7114, 5.969027, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+69,193286, 571, 1, @PHASE, 4840.913, 1402.094, 192.9591, 5.131985, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+70,193287, 571, 1, @PHASE, 4837.317, 1400.465, 192.6397, 1.384923, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+71,193288, 571, 1, @PHASE, 4842.942, 1402.059, 192.9587, 5.365919, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+72,193289, 571, 1, @PHASE, 4836.487, 1403.299, 192.8744, 2.467085, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+73,193290, 571, 1, @PHASE, 4840.022, 1400.498, 191.6916, 3.15663, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+74,193291, 571, 1, @PHASE, 4854.309, 1417.488, 193.4538, 2.059487, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+75,193292, 571, 1, @PHASE, 4848.659, 1414.785, 191.6916, 3.749274, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+76,193293, 571, 1, @PHASE, 4852.316, 1415.811, 192.7632, 2.889032, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+77,193394, 571, 1, @PHASE, 4822.109, 1385.169, 190.8455, 0.5934095, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+78,193294, 571, 1, @PHASE, 4856.42, 1416.295, 192.7632, 1.702218, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+79,193395, 571, 1, @PHASE, 4770.155, 1370.927, 176.3797, 2.809977, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+80,193295, 571, 1, @PHASE, 4838.964, 1398.37, 192.9591, 1.928963, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+81,193296, 571, 1, @PHASE, 4842.648, 1399.972, 192.6608, 4.590742, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+82,193297, 571, 1, @PHASE, 4842.655, 1397.182, 192.8535, 0.6606718, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+83,193298, 571, 1, @PHASE, 4844.037, 1399.976, 192.7137, 3.338978, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+84,193299, 571, 1, @PHASE, 4844.027, 1397.335, 192.6788, 4.733513, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+85,193300, 571, 1, @PHASE, 4839.507, 1398.616, 192.8744, 5.198529, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+86,193301, 571, 1, @PHASE, 4840.949, 1399.462, 192.7632, 2.993751, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+87,193302, 571, 1, @PHASE, 4844.576, 1399.304, 191.3681, 5.878576, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+88,193303, 571, 1, @PHASE, 4819.022, 1437.061, 195.9568, 0.7853968, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+89,193304, 571, 1, @PHASE, 4814.786, 1441.675, 193.9325, 2.475178, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+90,193305, 571, 1, @PHASE, 4816.835, 1438.477, 195.4229, 1.614948, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+91,193306, 571, 1, @PHASE, 4818.494, 1434.955, 194.9861, 6.227641, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+92,193307, 571, 1, @PHASE, 4804.619, 1464.389, 193.2142, 0.8726636, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+93,193308, 571, 1, @PHASE, 4802.317, 1465.608, 192.5236, 1.702218, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+94,193309, 571, 1, @PHASE, 4838.382, 1400.665, 192.9736, 0.165805, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+95,193310, 571, 1, @PHASE, 4804.275, 1462.243, 192.1949, 0.03171997, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+96,193311, 571, 1, @PHASE, 4818.627, 1432.585, 195.6188, 0.7931821, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+97,193312, 571, 1, @PHASE, 4818.935, 1434.288, 194.9375, 6.100451, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+98,193313, 571, 1, @PHASE, 4802.595, 1414.417, 193.2174, 5.02655, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+99,193314, 571, 1, @PHASE, 4808.629, 1416.099, 191.6722, 0.4331469, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+100,193315, 571, 1, @PHASE, 4805.602, 1422.391, 192.5222, 3.915716, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+101,193316, 571, 1, @PHASE, 4806.971, 1413.819, 192.5371, 0.8470061, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+102,193317, 571, 1, @PHASE, 4800.958, 1415.844, 192.1961, 4.185608, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+103,193318, 571, 1, @PHASE, 4814.53, 1421.677, 193.837, 4.031712, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+104,193319, 571, 1, @PHASE, 4818.464, 1416.958, 192.3035, 0.1713461, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+105,193320, 571, 1, @PHASE, 4816.804, 1417.587, 192.5431, 2.827954, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+106,193321, 571, 1, @PHASE, 4813.185, 1424.823, 193.4423, 2.793048, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+107,193322, 571, 1, @PHASE, 4810.121, 1419.193, 193.3252, 3.648265, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+108,193323, 571, 1, @PHASE, 4807.363, 1428.156, 193.9222, 3.0194, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+109,193324, 571, 1, @PHASE, 4806.887, 1426.839, 192.9712, 0.3234065, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+110,193325, 571, 1, @PHASE, 4822.01, 1384.936, 193.2164, 4.05789, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+111,193326, 571, 1, @PHASE, 4821.838, 1389.484, 192.8276, 1.342961, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+112,193327, 571, 1, @PHASE, 4826.813, 1380.915, 191.5601, 5.747677, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+113,193328, 571, 1, @PHASE, 4824.364, 1383.818, 192.6317, 4.887444, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+114,193329, 571, 1, @PHASE, 4822.135, 1389.366, 192.6317, 3.831524, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+115,193330, 571, 1, @PHASE, 4823.995, 1380.991, 192.6317, 6.161535, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+116,193331, 571, 1, @PHASE, 4822.26, 1387.094, 192.1949, 3.21697, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+117,193332, 571, 1, @PHASE, 4799.996, 1468.615, 191.452, 2.562449, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+118,193333, 571, 1, @PHASE, 4792.137, 1470.661, 193.0653, 6.161014, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+119,193334, 571, 1, @PHASE, 4794.401, 1474.757, 192.7633, 4.957259, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+120,193335, 571, 1, @PHASE, 4790.183, 1467.854, 192.762, 4.922352, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+121,193336, 571, 1, @PHASE, 4796.58, 1468.24, 192.1685, 5.777565, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+122,193337, 571, 1, @PHASE, 4784.452, 1470.938, 192.9553, 4.127707, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+123,193338, 571, 1, @PHASE, 4784.479, 1470.891, 192.5763, 0.9255483, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+124,193339, 571, 1, @PHASE, 4772.658, 1434.781, 193.2318, 3.691376, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+125,193340, 571, 1, @PHASE, 4774.897, 1439.738, 192.737, 3.725339, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+126,193341, 571, 1, @PHASE, 4775.096, 1434.278, 192.5412, 4.040963, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+127,193342, 571, 1, @PHASE, 4796.264, 1462.712, 192.9666, 6.045015, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+128,193343, 571, 1, @PHASE, 4790.44, 1461.151, 192.981, 5.148722, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+129,193344, 571, 1, @PHASE, 4791.811, 1461.446, 192.6317, 2.452708, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+130,193345, 571, 1, @PHASE, 4796.167, 1458.012, 192.8273, 4.96452, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+131,193346, 571, 1, @PHASE, 4778.761, 1431.167, 191.4696, 5.21535, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+132,193347, 571, 1, @PHASE, 4772.64, 1435.917, 192.8096, 5.940294, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+133,193348, 571, 1, @PHASE, 4774.135, 1431.061, 192.5412, 5.821197, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+134,193349, 571, 1, @PHASE, 4772.312, 1368.96, 179.3861, 0.8115751, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+135,193350, 571, 1, @PHASE, 4768.762, 1368.182, 178.913, 1.444671, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+136,193351, 571, 1, @PHASE, 4768.806, 1368.814, 178.492, 0.1401508, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+137,193352, 571, 1, @PHASE, 4773.032, 1368.717, 178.4498, 6.18401, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+138,193353, 571, 1, @PHASE, 4769.212, 1371.894, 177.5704, 3.96744, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+139,193354, 571, 1, @PHASE, 4753.28, 1340.752, 168.824, 5.942847, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+140,193355, 571, 1, @PHASE, 4755.793, 1348.842, 171.9237, 2.460914, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+141,193356, 571, 1, @PHASE, 4748.543, 1338.941, 166.3824, 5.994266, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+142,193357, 571, 1, @PHASE, 4755.62, 1346.563, 169.7958, 1.349443, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+143,193358, 571, 1, @PHASE, 4753.616, 1343.335, 168.9523, 0.4892147, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+144,193359, 571, 1, @PHASE, 4756.417, 1343.859, 170.2456, 1.763303, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+145,193360, 571, 1, @PHASE, 4751.151, 1340.321, 166.6075, 5.101904, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+146,193361, 571, 1, @PHASE, 4734.48, 1318.531, 157.1364, 1.850571, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+147,193362, 571, 1, @PHASE, 4729.611, 1321.644, 157.5598, 3.769916, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+148,193363, 571, 1, @PHASE, 4730.31, 1318.991, 155.5435, 4.299054, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+149,193364, 571, 1, @PHASE, 4730.522, 1317.274, 156.2261, 2.566151, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+150,193365, 571, 1, @PHASE, 4845.421, 1487.394, 209.5798, 3.621566, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+151,193366, 571, 1, @PHASE, 4873.986, 1482.95, 209.5806, 2.321287, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+152,193367, 571, 1, @PHASE, 4877.768, 1484.813, 209.6253, 0.9861118, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+153,193368, 571, 1, @PHASE, 4843.112, 1399.606, 192.9736, 4.04044, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+154,193369, 571, 1, @PHASE, 4733.987, 1316.142, 156.3821, 4.214973, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+155,193370, 571, 1, @PHASE, 4771.53, 1370.231, 177.6764, 3.473215, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+156,193371, 571, 1, @PHASE, 4747.052, 1371.73, 174.6061, 3.272515, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+157,193372, 571, 1, @PHASE, 4745.647, 1372.851, 180.6194, 0.2879769, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+158,193373, 571, 1, @PHASE, 4748.801, 1370.48, 177.2103, 1.125736, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+159,193374, 571, 1, @PHASE, 4739.766, 1375.458, 175.0408, 5.899213, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+160,193375, 571, 1, @PHASE, 4747.372, 1376.691, 177.1419, 4.241152, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+161,193376, 571, 1, @PHASE, 4729.662, 1338.746, 165.7118, 1.483528, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+162,193377, 571, 1, @PHASE, 4724.683, 1339.089, 165.6361, 0.9512024, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+163,193378, 571, 1, @PHASE, 4722.371, 1315.175, 153.0163, 4.712391, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+164,193379, 571, 1, @PHASE, 4722.186, 1312.745, 151.8177, 2.207837, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+165,193380, 571, 1, @PHASE, 4721.955, 1313.016, 155.3777, 4.267334, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+166,193381, 571, 1, @PHASE, 4828.909, 1364.957, 187.7651, 3.141593, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+167,193382, 571, 1, @PHASE, 4767.654, 1414.143, 182.9588, 3.141593, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+168,193383, 571, 1, @PHASE, 4885.875, 1446.399, 197.2411, 3.141593, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+169,193384, 571, 1, @PHASE, 4967.423, 1382.576, 280.6783, 3.141593, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+170,193385, 571, 1, @PHASE, 4819.641, 1494.38, 197.8983, 3.141593, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+171,193386, 571, 1, @PHASE, 4760.751, 1331.356, 166.7298, 1.483529, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+172,193388, 571, 1, @PHASE, 4841.913, 1491.074, 209.5806, 5.026549, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+173,193389, 571, 1, @PHASE, 4854.66, 1501.157, 209.4814, 2.347464, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+174,193390, 571, 1, @PHASE, 4867.81, 1503.073, 209.8845, 4.398232, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+175,193391, 571, 1, @PHASE, 4806.318, 1418.541, 192.7293, 3.996809, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+176,193392, 571, 1, @PHASE, 4809.103, 1418.015, 192.8921, 1.754055, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+177,193393, 571, 1, @PHASE, 4866.126, 1504.92, 209.6104, 3.586657, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+178,193396, 571, 1, @PHASE, 4794.685, 1457.065, 192.5883, 2.644167, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+179,193397, 571, 1, @PHASE, 4733.944, 1315.556, 156.3676, 5.009097, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+180,193398, 571, 1, @PHASE, 4848.95, 1412.977, 192.9511, 4.468044, 0, 0, 0, 1, 120, 255, 1),
+(@GGUID+181,193399, 571, 1, @PHASE, 4859.428, 1457.759, 209.3438, 3.168109, 0, 0, 0, 1, 120, 255, 1);
+
+-- Corpses
+SET @DGUID := 132088;
+DELETE FROM `creature` WHERE `id` IN (31285,31291,31292,31293,31294,31295,31296,31297,31298,31299,31308,31309,31333,31334) OR `guid` BETWEEN @DGUID+0 AND @DGUID+106;
+INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES
+(@DGUID+0, 31285, 571, 1, @PHASE, 4810.068, 1433.69, 195.6479, 5.305801, 120, 0, 0),
+(@DGUID+1, 31285, 571, 1, @PHASE, 4806.54, 1410.767, 193.0403, 2.216568, 120, 0, 0),
+(@DGUID+2, 31285, 571, 1, @PHASE, 4777.13, 1381.836, 183.996, 4.852015, 120, 0, 0),
+(@DGUID+3, 31285, 571, 1, @PHASE, 4789.429, 1353.953, 179.1624, 0.3490658, 120, 0, 0),
+(@DGUID+4, 31285, 571, 1, @PHASE, 4763.894, 1359.176, 177.5973, 0.1570796, 120, 0, 0),
+(@DGUID+5, 31285, 571, 1, @PHASE, 4774.729, 1312.329, 165.0715, 5.5676, 120, 0, 0),
+(@DGUID+6, 31285, 571, 1, @PHASE, 4756.614, 1313.47, 163.9544, 2.949606, 120, 0, 0),
+(@DGUID+7, 31291, 571, 1, @PHASE, 4978.657, 1384.775, 284.3949, 2.076942, 120, 0, 0),
+(@DGUID+8, 31291, 571, 1, @PHASE, 4984.935, 1394.382, 284.4201, 2.548181, 120, 0, 0),
+(@DGUID+9, 31291, 571, 1, @PHASE, 5000.523, 1401.637, 284.4431, 2.094395, 120, 0, 0),
+(@DGUID+10, 31291, 571, 1, @PHASE, 4990.958, 1400.277, 284.4431, 2.216568, 120, 0, 0),
+(@DGUID+11, 31292, 571, 1, @PHASE, 4877.27, 1396.353, 196.93, 0.3316126, 120, 0, 0),
+(@DGUID+12, 31292, 571, 1, @PHASE, 4891.048, 1415.103, 203.7862, 3.403392, 120, 0, 0),
+(@DGUID+13, 31292, 571, 1, @PHASE, 4854.961, 1403.068, 193.1462, 2.792527, 120, 0, 0),
+(@DGUID+14, 31292, 571, 1, @PHASE, 4806.509, 1352.567, 177.8115, 4.520403, 120, 0, 0),
+(@DGUID+15, 31292, 571, 1, @PHASE, 4903.382, 1452.207, 211.9405, 4.223697, 120, 0, 0),
+(@DGUID+16, 31292, 571, 1, @PHASE, 4869.447, 1468.438, 209.6567, 4.660029, 120, 0, 0),
+(@DGUID+17, 31292, 571, 1, @PHASE, 4865.569, 1475.438, 209.6567, 3.438299, 120, 0, 0),
+(@DGUID+18, 31292, 571, 1, @PHASE, 4850.112, 1476.327, 209.6567, 0.08726646, 120, 0, 0),
+(@DGUID+19, 31292, 571, 1, @PHASE, 4908.861, 1484.187, 216.1365, 5.707227, 120, 0, 0),
+(@DGUID+20, 31292, 571, 1, @PHASE, 4814.862, 1428.201, 195.6479, 4.363323, 120, 0, 0),
+(@DGUID+21, 31292, 571, 1, @PHASE, 4881.099, 1509.474, 212.8491, 3.595378, 120, 0, 0),
+(@DGUID+22, 31292, 571, 1, @PHASE, 4804.274, 1418.215, 193.1435, 2.932153, 120, 0, 0),
+(@DGUID+23, 31292, 571, 1, @PHASE, 4806.403, 1468.882, 193.0345, 3.263766, 120, 0, 0),
+(@DGUID+24, 31292, 571, 1, @PHASE, 4907.143, 1523.7, 219.6291, 0.08726646, 120, 0, 0),
+(@DGUID+25, 31292, 571, 1, @PHASE, 4786.057, 1420.029, 193.0345, 5.288348, 120, 0, 0),
+(@DGUID+26, 31292, 571, 1, @PHASE, 4833.672, 1526.136, 214.1294, 0.06981317, 120, 0, 0),
+(@DGUID+27, 31292, 571, 1, @PHASE, 4917.417, 1531.887, 222.61, 6.178465, 120, 0, 0),
+(@DGUID+28, 31292, 571, 1, @PHASE, 4761.258, 1368.303, 178.9943, 1.466077, 120, 0, 0),
+(@DGUID+29, 31292, 571, 1, @PHASE, 4783.711, 1333.142, 172.5176, 0.8377581, 120, 0, 0),
+(@DGUID+30, 31293, 571, 1, @PHASE, 4806.841, 1393.394, 193.0345, 3.735005, 120, 0, 0),
+(@DGUID+31, 31293, 571, 1, @PHASE, 4841.265, 1541.912, 219.3147, 1.064651, 120, 0, 0),
+(@DGUID+32, 31293, 571, 1, @PHASE, 4837.178, 1389.151, 193.0345, 4.590216, 120, 0, 0),
+(@DGUID+33, 31293, 571, 1, @PHASE, 4859.151, 1419.09, 193.0345, 2.670354, 120, 0, 0),
+(@DGUID+34, 31293, 571, 1, @PHASE, 4823.465, 1391.159, 193.0345, 5.201081, 120, 0, 0),
+(@DGUID+35, 31293, 571, 1, @PHASE, 4856.67, 1389.393, 193.8499, 4.502949, 120, 0, 0),
+(@DGUID+36, 31293, 571, 1, @PHASE, 4876.147, 1402.939, 196.7943, 2.775074, 120, 0, 0),
+(@DGUID+37, 31293, 571, 1, @PHASE, 4873.234, 1453.22, 209.6567, 4.764749, 120, 0, 0),
+(@DGUID+38, 31293, 571, 1, @PHASE, 4824.768, 1425.156, 195.6479, 4.939282, 120, 0, 0),
+(@DGUID+39, 31293, 571, 1, @PHASE, 4846.874, 1446.988, 207.1275, 0.6981317, 120, 0, 0),
+(@DGUID+40, 31293, 571, 1, @PHASE, 4830.034, 1436.004, 197.6899, 0.5235988, 120, 0, 0),
+(@DGUID+41, 31293, 571, 1, @PHASE, 4857.192, 1462.829, 209.6567, 2.75762, 120, 0, 0),
+(@DGUID+42, 31293, 571, 1, @PHASE, 4782.909, 1344.619, 174.218, 5.044002, 120, 0, 0),
+(@DGUID+43, 31293, 571, 1, @PHASE, 4828.281, 1450.926, 202.2973, 1.012291, 120, 0, 0),
+(@DGUID+44, 31293, 571, 1, @PHASE, 4786.116, 1405.732, 193.179, 5.794493, 120, 0, 0),
+(@DGUID+45, 31293, 571, 1, @PHASE, 4779.775, 1390.742, 187.9587, 4.886922, 120, 0, 0),
+(@DGUID+46, 31293, 571, 1, @PHASE, 4792.564, 1435.472, 193.046, 1.658063, 120, 0, 0),
+(@DGUID+47, 31293, 571, 1, @PHASE, 4916.556, 1487.116, 220.1032, 5.305801, 120, 0, 0),
+(@DGUID+48, 31293, 571, 1, @PHASE, 4922.137, 1497.21, 221.5407, 4.380776, 120, 0, 0),
+(@DGUID+49, 31293, 571, 1, @PHASE, 4748.541, 1397.654, 180.7619, 5.550147, 120, 0, 0),
+(@DGUID+50, 31293, 571, 1, @PHASE, 4828.431, 1497.15, 209.6567, 5.375614, 120, 0, 0),
+(@DGUID+51, 31293, 571, 1, @PHASE, 4749.81, 1411.689, 182.592, 3.298672, 120, 0, 0),
+(@DGUID+52, 31293, 571, 1, @PHASE, 4738.797, 1371.466, 175.4915, 2.373648, 120, 0, 0),
+(@DGUID+53, 31293, 571, 1, @PHASE, 4886.754, 1523.797, 215.9392, 5.358161, 120, 0, 0),
+(@DGUID+54, 31293, 571, 1, @PHASE, 4837.775, 1520.019, 212.4781, 0.6806784, 120, 0, 0),
+(@DGUID+55, 31293, 571, 1, @PHASE, 4824.301, 1523.997, 213.3131, 2.827433, 120, 0, 0),
+(@DGUID+56, 31294, 571, 1, @PHASE, 4830.872, 1392.478, 193.0345, 2.687807, 120, 0, 0),
+(@DGUID+57, 31294, 571, 1, @PHASE, 4828.948, 1409.091, 193.2837, 1.064651, 120, 0, 0),
+(@DGUID+58, 31294, 571, 1, @PHASE, 4815.367, 1395.433, 193.0345, 5.532694, 120, 0, 0),
+(@DGUID+59, 31294, 571, 1, @PHASE, 4794.247, 1394.424, 193.1791, 6.038839, 120, 0, 0),
+(@DGUID+60, 31294, 571, 1, @PHASE, 4802.3, 1399.704, 193.0345, 3.351032, 120, 0, 0),
+(@DGUID+61, 31294, 571, 1, @PHASE, 4830.452, 1444.031, 200.6221, 5.410521, 120, 0, 0),
+(@DGUID+62, 31294, 571, 1, @PHASE, 4768.52, 1380.417, 180.6092, 3.717551, 120, 0, 0),
+(@DGUID+63, 31294, 571, 1, @PHASE, 4768.484, 1329.129, 170.6705, 0.2443461, 120, 0, 0),
+(@DGUID+64, 31294, 571, 1, @PHASE, 4793.612, 1318.202, 166.5614, 0.8901179, 120, 0, 0),
+(@DGUID+65, 31294, 571, 1, @PHASE, 4744.752, 1339.035, 165.5099, 5.218534, 120, 0, 0),
+(@DGUID+66, 31295, 571, 1, @PHASE, 4849.039, 1415.038, 193.0345, 4.468043, 120, 0, 0),
+(@DGUID+67, 31295, 571, 1, @PHASE, 4817.007, 1407.061, 193.0441, 3.036873, 120, 0, 0),
+(@DGUID+68, 31295, 571, 1, @PHASE, 4865.909, 1465.047, 209.6567, 3.752458, 120, 0, 0),
+(@DGUID+69, 31295, 571, 1, @PHASE, 4851.484, 1458.09, 209.8327, 2.775074, 120, 0, 0),
+(@DGUID+70, 31295, 571, 1, @PHASE, 4795.949, 1342.791, 173.9115, 1.867502, 120, 0, 0),
+(@DGUID+71, 31295, 571, 1, @PHASE, 4737.459, 1326.971, 160.5632, 3.001966, 120, 0, 0),
+(@DGUID+72, 31296, 571, 1, @PHASE, 4852.959, 1470.127, 209.6567, 0.08726646, 120, 0, 0),
+(@DGUID+73, 31296, 571, 1, @PHASE, 4817.938, 1436.592, 195.6479, 4.555309, 120, 0, 0),
+(@DGUID+74, 31296, 571, 1, @PHASE, 4728.732, 1359.011, 170.9604, 3.403392, 120, 0, 0),
+(@DGUID+75, 31297, 571, 1, @PHASE, 4797.594, 1448.583, 193.0345, 3.525565, 120, 0, 0),
+(@DGUID+76, 31297, 571, 1, @PHASE, 4795.805, 1415.629, 193.0345, 1.134464, 120, 0, 0),
+(@DGUID+77, 31297, 571, 1, @PHASE, 4769.275, 1367.561, 178.9943, 5.934119, 120, 0, 0),
+(@DGUID+78, 31297, 571, 1, @PHASE, 4759.774, 1375.651, 178.9943, 5.044002, 120, 0, 0),
+(@DGUID+79, 31297, 571, 1, @PHASE, 4741.744, 1377.741, 176.0065, 4.729842, 120, 0, 0),
+(@DGUID+80, 31297, 571, 1, @PHASE, 4747.381, 1362.794, 174.5987, 0.8028514, 120, 0, 0),
+(@DGUID+81, 31297, 571, 1, @PHASE, 4713.244, 1322.761, 157.8859, 0.3665192, 120, 0, 0),
+(@DGUID+82, 31298, 571, 1, @PHASE, 4843.441, 1461.766, 209.8327, 0.3665192, 120, 0, 0),
+(@DGUID+83, 31298, 571, 1, @PHASE, 4834.151, 1451.847, 204.5755, 3.054326, 120, 0, 0),
+(@DGUID+84, 31298, 571, 1, @PHASE, 4842.909, 1472.404, 209.6567, 2.129302, 120, 0, 0),
+(@DGUID+85, 31298, 571, 1, @PHASE, 4786.143, 1428.748, 193.0345, 3.490659, 120, 0, 0),
+(@DGUID+86, 31298, 571, 1, @PHASE, 4776.408, 1372.417, 180.5029, 5.72468, 120, 0, 0),
+(@DGUID+87, 31298, 571, 1, @PHASE, 4738.453, 1334.156, 163.0611, 1.43117, 120, 0, 0),
+(@DGUID+88, 31298, 571, 1, @PHASE, 4718.738, 1328.104, 159.9639, 5.410521, 120, 0, 0),
+(@DGUID+89, 31328, 571, 1, @PHASE, 4740.34, 1311.947, 157.4052, 3.352981, 120, 0, 0),
+(@DGUID+90, 31299, 571, 1, @PHASE, 4809.043, 1403.146, 193.0345, 1.780236, 120, 0, 0),
+(@DGUID+91, 31299, 571, 1, @PHASE, 4794.851, 1401.514, 193.1791, 4.223697, 120, 0, 0),
+(@DGUID+92, 31299, 571, 1, @PHASE, 4787.426, 1445.673, 193.0345, 2.9147, 120, 0, 0),
+(@DGUID+93, 31299, 571, 1, @PHASE, 4768.885, 1388.273, 183.4424, 1.466077, 120, 0, 0),
+(@DGUID+94, 31299, 571, 1, @PHASE, 4752.259, 1347.163, 170.3656, 4.677482, 120, 0, 0),
+(@DGUID+95, 31308, 571, 1, @PHASE, 4869.767, 1529.764, 217.0381, 1.727876, 120, 0, 0),
+(@DGUID+96, 31308, 571, 1, @PHASE, 4792.602, 1459.009, 193.0345, 4.904375, 120, 0, 0),
+(@DGUID+97, 31308, 571, 1, @PHASE, 4781.22, 1443.945, 193.0345, 3.996804, 120, 0, 0),
+(@DGUID+98, 31308, 571, 1, @PHASE, 4862.371, 1561.015, 224.5057, 0.1047198, 120, 0, 0),
+(@DGUID+99, 31308, 571, 1, @PHASE, 4883.59, 1474.877, 209.6595, 1.117011, 120, 0, 0),
+(@DGUID+100, 31309, 571, 1, @PHASE, 4836.271, 1413.927, 193.3568, 0.6108652, 120, 0, 0),
+(@DGUID+101, 31309, 571, 1, @PHASE, 4901.72, 1508.318, 216.3484, 5.934119, 120, 0, 0),
+(@DGUID+102, 31309, 571, 1, @PHASE, 4936.82, 1491.539, 226.006, 0.715585, 120, 0, 0),
+(@DGUID+103, 31309, 571, 1, @PHASE, 4862.213, 1552.967, 223.6236, 4.764749, 120, 0, 0),
+(@DGUID+104, 31309, 571, 1, @PHASE, 4894.372, 1462.795, 209.8621, 5.689773, 120, 0, 0),
+(@DGUID+105, 31333, 571, 1, @PHASE, 4855.18, 1472.166, 209.6567, 0.9075712, 120, 0, 0),
+(@DGUID+106, 31334, 571, 1, @PHASE, 4885.178, 1456.164, 209.715, 1.832596, 120, 0, 0);
+
+-- Apply "permanent feign death" to the corpses
+SET @DEAD := 29266;
+DELETE FROM `creature_template_addon` WHERE `entry` IN (31285,31291,31292,31293,31294,31295,31296,31297,31298,31299,31308,31309);
+INSERT INTO `creature_template_addon` (`entry`, `auras`) VALUES
+(31285, @DEAD),(31291, @DEAD),(31292, @DEAD),(31293, @DEAD),
+(31294, @DEAD),(31295, @DEAD),(31296, @DEAD),(31297, @DEAD),
+(31298, @DEAD),(31299, @DEAD),(31308, @DEAD),(31309, @DEAD);
+
+-- spawn Dark Ranger Marrah author vincent-michael Closes #7681
+SET @CGUID:= 42568;
+SET @ENTRY:= 24137; -- Dark Ranger Marrah
+
+DELETE FROM `creature` WHERE `id` = @ENTRY;
+INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES
+(@CGUID, @ENTRY, 574, 3, 1, 183.8515, -76.50119, 15.84287, 3.455082, 7200, 0, 0);
+
+DELETE FROM `creature_template_addon` WHERE `entry` = @ENTRY;
+INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES
+(@ENTRY, 0, 0x20000, 0x1, '34189');
+
+-- fix spawn for A dip in the moonwell Closes #7292
+UPDATE `gameobject` SET `id` = 181825 WHERE `guid` = 16880;
+
+-- Add Loose Soil spawn for quest 299 "Uncovering the Past" author warriotpoetex Closes #6742
+SET @GUID := 344;
+DELETE FROM `gameobject` WHERE `guid`=@GUID;
+INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
+(@GUID,331,0,1,1,-3563.83,-1767.35,79.1001,4.26498,0,0,0.846355,-0.53262,300,0,1);
diff --git a/sql/updates/world/2012_09_26_01_world_spell_bonus_data.sql b/sql/updates/world/2012_09_26_01_world_spell_bonus_data.sql
new file mode 100644
index 00000000000..3aeeb7c6525
--- /dev/null
+++ b/sql/updates/world/2012_09_26_01_world_spell_bonus_data.sql
@@ -0,0 +1,3 @@
+DELETE FROM `spell_bonus_data` WHERE `entry` IN (6489,6789);
+INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES
+(6789,0.2143,0,0,0,'Spell Power Coeff for Death Coil'); \ No newline at end of file
diff --git a/sql/updates/world/2012_09_27_01_world_custodian_of_time.sql b/sql/updates/world/2012_09_27_01_world_custodian_of_time.sql
new file mode 100644
index 00000000000..5396bd3e7f0
--- /dev/null
+++ b/sql/updates/world/2012_09_27_01_world_custodian_of_time.sql
@@ -0,0 +1,18 @@
+-- Custodian of Time's Whispers for quest 10277
+DELETE FROM `script_texts` WHERE `entry` IN (-1000217,-1000218,-1000219,-1000220,-1000221,-1000222,-1000223,-1000224,-1000225,-1000226,-1000227,-1000228,-1000229,-1000230);
+DELETE FROM `creature_text` WHERE `entry`=20129;
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
+(20129,0,0, 'Greetings, $N. I will guide you through the cavern. Please try and keep up.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_1'),
+(20129,1,0, 'We do not know if the Caverns of Time have always been accessible to mortals. Truly, it is impossible to tell as the Timeless One is in perpetual motion, changing our timeways as he sees fit. What you see now may very well not exist tomorrow. You may wake up and have no memory of this place.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_2'),
+(20129,2,0, 'It is strange, I know... Most mortals cannot actually comprehend what they see here, as often, what they see is not anchored within their own perception of reality.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_3'),
+(20129,3,0, 'Follow me, please.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_4'),
+(20129,4,0, 'There are only two truths to be found here: First, that time is chaotic, always in flux, and completely malleable and second, perception does not dictate reality.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_5'),
+(20129,5,0, 'As custodians of time, we watch over and care for Nozdormu''s realm. The master is away at the moment, which means that attempts are being made to dramatically alter time. The master never meddles in the affairs of mortals but instead corrects the alterations made to time by others. He is reactionary in this regard.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_6'),
+(20129,6,0, 'For normal maintenance of time, the Keepers of Time are sufficient caretakers. We are able to deal with most ordinary disturbances. I speak of little things, such as rogue mages changing something in the past to elevate their status or wealth in the present.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_7'),
+(20129,7,0, 'These tunnels that you see are called timeways. They are infinite in number. The ones that currently exist in your reality are what the master has deemed as ''trouble spots.'' These trouble spots may differ completely in theme but they always share a cause. That is, their existence is a result of the same temporal disturbance. Remember that should you venture inside one...',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_8'),
+(20129,8,0, 'This timeway is in great disarray! We have agents inside right now attempting to restore order. What information I have indicates that Thrall''s freedom is in jeopardy. A malevolent organization known as the Infinite Dragonflight is trying to prevent his escape. I fear without outside assistance, all will be lost.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_9'),
+(20129,9,0, 'We have very little information on this timeway. Sa''at has been dispatched and is currently inside. The data we have gathered from his correspondence is that the Infinite Dragonflight are once again attempting to alter time. Could it be that the opening of the Dark Portal is being targeted for sabotage? Let us hope not...',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_10'),
+(20129,10,0, 'This timeway collapsed and reformed. The result was Stratholme of yore. What could possibly be happening inside?',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_11'),
+(20129,11,0, 'The timeways are currently ranked in order from least catastrophic to most catastrophic. Note that they are all classified as catastrophic, meaning that any single one of these timeways collapsing would mean that your world would end. We only classify them in such a way so that the heroes and adventurers that are sent here know which timeway best suits their abilities.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_12'),
+(20129,12,0, 'All we know of this timeway is that it leads to Mount Hyjal. The Infinite Dragonflight have gone to great lengths to prevent our involvement. We know next to nothing, mortal. Soridormi is currently attempting to break through the timeway''s defenses but has thus far been unsuccessful. You might be our only hope of breaking through and resolving the conflict.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_13'),
+(20129,13,0, 'Our time is at an end $N. I would wish you luck, if such a thing existed.',15,0,100,0,0,0, 'WHISPER_CUSTODIAN_14');
diff --git a/sql/updates/world/2012_09_28_00_world_creature_model_info.sql b/sql/updates/world/2012_09_28_00_world_creature_model_info.sql
new file mode 100644
index 00000000000..48134d7bbed
--- /dev/null
+++ b/sql/updates/world/2012_09_28_00_world_creature_model_info.sql
@@ -0,0 +1 @@
+UPDATE `creature_model_info` SET `combat_reach`=10 WHERE `modelid`=28787;
diff --git a/sql/updates/world/2012_09_29_00_world_creature_model_info.sql b/sql/updates/world/2012_09_29_00_world_creature_model_info.sql
new file mode 100644
index 00000000000..0c63a0b2f73
--- /dev/null
+++ b/sql/updates/world/2012_09_29_00_world_creature_model_info.sql
@@ -0,0 +1,21 @@
+-- VoA
+UPDATE `creature_model_info` SET `bounding_radius`=0.3875,`combat_reach`=7.5 WHERE `modelid`=29524; -- Koralon
+UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5 WHERE `modelid`=27108; -- Emalon
+UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=9 WHERE `modelid`=31089; -- Toravon
+UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5 WHERE `modelid`=26967; -- Archavon
+
+-- ToCr
+UPDATE `creature_model_info` SET `bounding_radius`=1.085,`combat_reach`=10.5 WHERE `modelid`=29614; -- Gormok
+UPDATE `creature_model_info` SET `bounding_radius`=1.55,`combat_reach`=5 WHERE `modelid`=29815; -- Acidmaw
+UPDATE `creature_model_info` SET `bounding_radius`=1.24,`combat_reach`=12 WHERE `modelid`=24564; -- Dreadscale
+UPDATE `creature_model_info` SET `bounding_radius`=4,`combat_reach`=14 WHERE `modelid`=21601; -- Icehowl
+UPDATE `creature_model_info` SET `bounding_radius`=1.52778,`combat_reach`=5 WHERE `modelid`=29615; -- Jaraxxus
+UPDATE `creature_model_info` SET `bounding_radius`=1.5,`combat_reach`=9 WHERE `modelid`=29267; -- Eydis Darkbane
+UPDATE `creature_model_info` SET `bounding_radius`=1.5,`combat_reach`=9 WHERE `modelid`=29240; -- Fjola Lightbane
+UPDATE `creature_model_info` SET `bounding_radius`=1.5,`combat_reach`=2.25 WHERE `modelid`=29773; -- Saamul
+UPDATE `creature_model_info` SET `bounding_radius`=0.459,`combat_reach`=2.25 WHERE `modelid`=29774; -- Baelnor Lightbearer
+UPDATE `creature_model_info` SET `bounding_radius`=0.312,`combat_reach`=2.25 WHERE `modelid`=29776; -- Irieth Shadowstep
+UPDATE `creature_model_info` SET `bounding_radius`=0.52785,`combat_reach`=2.5875 WHERE `modelid`=29777; -- Serissa Grimdabbler
+UPDATE `creature_model_info` SET `bounding_radius`=0.312,`combat_reach`=2.25 WHERE `modelid`=29778; -- Brienna Nightfell
+UPDATE `creature_model_info` SET `bounding_radius`=1.5,`combat_reach`=2.25 WHERE `modelid`=29779; -- Shocuul
+UPDATE `creature_model_info` SET `bounding_radius`=0.4511,`combat_reach`=2.6 WHERE `modelid`=29780; -- Melador Valestrider / Erin Misthoof
diff --git a/sql/updates/world/2012_09_29_01_world_creature_text.sql b/sql/updates/world/2012_09_29_01_world_creature_text.sql
new file mode 100644
index 00000000000..8fde66d2e6e
--- /dev/null
+++ b/sql/updates/world/2012_09_29_01_world_creature_text.sql
@@ -0,0 +1,24 @@
+-- Mimiron
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1603259 AND -1603240;
+DELETE FROM `creature_text` WHERE `entry`=33350;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(33350,0,0, 'Oh, my! I wasn''t expecting company! The workshop is such a mess! How embarrassing!',14,0,100,0,0,15611, 'Mimiron SAY_AGGRO'),
+(33350,1,0, 'Now why would you go and do something like that? Didn''t you see the sign that said ''DO NOT PUSH THIS BUTTON!''? How will we finish testing with the self-destruct mechanism active?',14,0,100,0,0,15629, 'Mimiron SAY_HARDMODE_ON'),
+(33350,2,0, 'We haven''t much time, friends! You''re going to help me test out my latest and greatest creation. Now, before you change your minds, remember, that you kind of owe it to me after the mess you made with the XT-002.',14,0,100,0,0,15612, 'Mimiron SAY_MKII_ACTIVATE'),
+(33350,3,0, 'MEDIC!',14,0,100,0,0,15613, 'Mimiron SAY_MKII_SLAY_1'),
+(33350,3,1, 'I can fix that... or, maybe not! Sheesh, what a mess...',14,0,100,0,0,15614, 'Mimiron SAY_MKII_SLAY_2'),
+(33350,4,0, 'WONDERFUL! Positively marvelous results! Hull integrity at 98.9 percent! Barely a dent! Moving right along.',14,0,100,0,0,15615, 'Mimiron SAY_MKII_DEATH'),
+(33350,5,0, 'Behold the VX-001 Anti-personnel Assault Cannon! You might want to take cover.',14,0,100,0,0,15616, 'Mimiron SAY_VX001_ACTIVATE'),
+(33350,6,0, 'Fascinating. I think they call that a "clean kill".',14,0,100,0,0,15617, 'Mimiron SAY_VX001_SLAY_1'),
+(33350,6,1, 'Note to self: Cannon highly effective against flesh.',14,0,100,0,0,15618, 'Mimiron SAY_VX001_SLAY_2'),
+(33350,7,0, 'Thank you, friends! Your efforts have yielded some fantastic data! Now, where did I put- oh, there it is!',14,0,100,0,0,15619, 'Mimiron SAY_VX001_DEATH'),
+(33350,8,0, 'Isn''t it beautiful? I call it the magnificent aerial command unit!',14,0,100,0,0,15620, 'Mimiron SAY_AERIAL_ACTIVATE'),
+(33350,9,0, 'Outplayed!',14,0,100,0,0,15621, 'Mimiron SAY_AERIAL_SLAY_1'),
+(33350,9,1, 'You can do better than that!',14,0,100,0,0,15622, 'Mimiron SAY_AERIAL_SLAY_2'),
+(33350,10,0, 'Preliminary testing phase complete. Now comes the true test!!',14,0,100,0,0,15623, 'Mimiron SAY_AERIAL_DEATH'),
+(33350,11,0, 'Gaze upon its magnificence! Bask in its glorious, um, glory! I present you... V-07-TR-0N!',14,0,100,0,0,15624, 'Mimiron SAY_V07TRON_ACTIVATE'),
+(33350,12,0, 'Prognosis: Negative!',14,0,100,0,0,15625, 'Mimiron SAY_V07TRON_SLAY_1'),
+(33350,12,1, 'You''re not going to get up from that one, friend.',14,0,100,0,0,15626, 'Mimiron SAY_V07TRON_SLAY_2'),
+(33350,13,0, 'It would appear that I''ve made a slight miscalculation. I allowed my mind to be corrupted by the fiend in the prison, overriding my primary directive. All systems seem to be functional now. Clear.',14,0,100,0,0,15627, 'Mimiron SAY_V07TRON_DEATH'),
+(33350,14,0, 'Oh, my! It would seem that we are out of time, my friends!',14,0,100,0,0,15628, 'Mimiron SAY_BERSERK'),
+(33350,15,0, 'Combat matrix enhanced. Behold wonderous rapidity!',14,0,100,0,0,15630, 'Mimiron SAY_YS_HELP');
diff --git a/sql/updates/world/2012_09_30_00_world_creature_text.sql b/sql/updates/world/2012_09_30_00_world_creature_text.sql
new file mode 100644
index 00000000000..e0f9f210d7b
--- /dev/null
+++ b/sql/updates/world/2012_09_30_00_world_creature_text.sql
@@ -0,0 +1,12 @@
+-- AzjolNerub/Ahnkahet/Elder Nadox
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619020 AND -1619014;
+DELETE FROM `creature_text` WHERE `entry`=29309;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(29309,0,0, 'The secrets of the deep shall remain hidden.',14,0,100,0,0,14033, 'SAY_AGGRO'),
+(29309,1,0, 'Sleep now, in the cold dark.',14,0,100,0,0,14036, 'SAY_SLAY_1'),
+(29309,1,1, 'For the Lich King!',14,0,100,0,0,14037, 'SAY_SLAY_2'),
+(29309,1,2, 'Perhaps we will be allies soon.',14,0,100,0,0,14038, 'SAY_SLAY_3'),
+(29309,2,0, 'Master, is my service complete?',14,0,100,0,0,14039, 'SAY_DEATH'),
+(29309,3,0, 'The young must not grow hungry...',14,0,100,0,0,14034, 'SAY_EGG_SAC_1'),
+(29309,3,1, 'Shhhad ak kereeesshh chak-k-k!',14,0,100,0,0,14035, 'SAY_EGG_SAC_2'),
+(29309,4,0, 'An Ahn''kahar Guardian hatches!',16,0,100,0,0,14035, 'EMOTE_HATCHES');
diff --git a/sql/updates/world/2012_09_30_01_world_player_factionchange_titles.sql b/sql/updates/world/2012_09_30_01_world_player_factionchange_titles.sql
new file mode 100644
index 00000000000..99d7fc871d8
--- /dev/null
+++ b/sql/updates/world/2012_09_30_01_world_player_factionchange_titles.sql
@@ -0,0 +1,32 @@
+-- Title converter
+DROP TABLE IF EXISTS `player_factionchange_titles`;
+CREATE TABLE `player_factionchange_titles` (
+ `alliance_id` int(8) NOT NULL,
+ `horde_id` int(8) NOT NULL,
+ PRIMARY KEY (`alliance_id`,`horde_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+DELETE FROM `player_factionchange_titles` WHERE `alliance_id` IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,48,75,113,126,146,147,148,149);
+INSERT INTO `player_factionchange_titles` (`alliance_id`,`horde_id`) VALUES
+(1, 15),
+(2, 16),
+(3, 17),
+(4, 18),
+(5, 19),
+(6, 20),
+(7, 21),
+(8, 22),
+(9, 23),
+(10, 24),
+(11, 25),
+(12, 26),
+(13, 27),
+(14, 28),
+(48, 47),
+(75, 76),
+(113, 153),
+(126, 127),
+(146, 152),
+(147, 154),
+(148, 151),
+(149, 150);
diff --git a/sql/updates/world/2012_09_30_02_world_creature_text.sql b/sql/updates/world/2012_09_30_02_world_creature_text.sql
new file mode 100644
index 00000000000..81e77bcd682
--- /dev/null
+++ b/sql/updates/world/2012_09_30_02_world_creature_text.sql
@@ -0,0 +1,12 @@
+-- AzjolNerub/Ahnkahet/Herald Volazj
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619036 AND -1619030;
+DELETE FROM `creature_text` WHERE `entry`=29311;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(29311,0,0, 'Shgla''yos plahf mh''naus.', 14,0,100,0,0,14043, 'SAY_AGGRO_1'),
+(29311,0,1, 'They who dine on lost souls know only hunger.', 15, 0, 100, 0, 0, 14043, 'SAY_AGGRO_2'),
+(29311,1,0, 'Ywaq puul skshgn: on''ma yeh''glu zuq.', 14,0,100,0,0,14045, 'SAY_SLAY_1'),
+(29311,1,1, 'Ywaq ma phgwa''cul hnakf.',14,0,100,0,0,14046, 'SAY_SLAY_2'),
+(29311,1,2, 'Ywaq maq oou; ywaq maq ssaggh. Ywaq ma shg''fhn.',14,0,100,0,0,14047, 'SAY_SLAY_3'),
+(29311,2,0, 'Iilth vwah, uhn''agth fhssh za.', 14, 0, 100, 0, 0, 14048, 'SAY_DEATH_1'),
+(29311,2,1, 'Where one falls, many shall take its place.', 15, 0, 100, 0, 0, 14048, 'SAY_DEATH_2'),
+(29311,3,0, 'Gul''kafh an''shel. Yoq''al shn ky ywaq nuul.', 14, 0, 100, 0, 0, 14044, 'SAY_PHASE'); \ No newline at end of file
diff --git a/sql/updates/world/2012_09_30_03_world_creature_text.sql b/sql/updates/world/2012_09_30_03_world_creature_text.sql
new file mode 100644
index 00000000000..a591f8cfb7c
--- /dev/null
+++ b/sql/updates/world/2012_09_30_03_world_creature_text.sql
@@ -0,0 +1,18 @@
+-- AzjolNerub/Ahnkahet/Jedoga Shadowseeker
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1619013 AND -1619000;
+DELETE FROM `creature_text` WHERE `entry`=29310;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(29310, 0, 0, 'These are sacred halls! Your intrusion will be met with death!', 14, 0, 100, 0, 0, 14343, 'SAY_AGGRO'),
+(29310, 1, 0, 'Who among you is devoted?', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_1_1'),
+(29310, 1, 1, 'You there! Step forward!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_1_2'),
+(29310, 2, 0, 'Yogg-Saron, grant me your power!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_2_1'),
+(29310, 2, 1, 'Master, a gift for you!', 14, 0, 100, 0, 0, 14343, 'SAY_SACRIFICE_2_2'),
+(29310, 3, 0, 'Glory to Yogg-Saron!', 14, 0, 100, 0, 0, 0, 'SAY_SLAY_1'),
+(29310, 3, 1, 'You are unworthy!', 14, 0, 100, 0, 0, 0, 'SAY_SLAY_2'),
+(29310, 3, 2, 'Get up! You haven''t suffered enough.', 14, 0, 100, 0, 0, 14350, 'SAY_SLAY_3'),
+(29310, 4, 0, 'Do not expect your sacrilege... to go unpunished.', 14, 0, 100, 0, 0, 0, 'SAY_DEATH'),
+(29310, 5, 0, 'The elements themselves will rise up against the civilized world! Only the faithful will be spared!', 14, 0, 100, 0, 0, 14352, 'SAY_PREACHING_1'),
+(29310, 5, 1, 'Immortality can be yours, but only if you pledge yourself fully to Yogg-Saron!', 14, 0, 100, 0, 0, 14353, 'SAY_PREACHING_2'),
+(29310, 5, 2, 'Here, on the very borders of his domain, you will experience power you could have never imagined!', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_3'),
+(29310, 5, 3, 'You have traveled long and risked much to be here! Your devotion shall be rewarded.', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_4'),
+(29310, 5, 4, 'The faithful shall be exalted! But there is more work to be done. We will press on until all of Azeroth lies beneath his shadow!', 14, 0, 100, 0, 0, 0, 'SAY_PREACHING_5');
diff --git a/sql/updates/world/2012_10_02_00_world_oculus.sql b/sql/updates/world/2012_10_02_00_world_oculus.sql
new file mode 100644
index 00000000000..2db8bd8fed1
--- /dev/null
+++ b/sql/updates/world/2012_10_02_00_world_oculus.sql
@@ -0,0 +1,80 @@
+-- Addon data based on sniff fixed by Vincent-Michael
+DELETE FROM `creature_template_addon` WHERE `entry` IN (27692,27755,27756);
+INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
+(27692,0,0,0x3000000,0x1,0,'50296 50325'), -- Emerald Drake
+(27755,0,0,0x3000000,0x1,0,'50296 50325'), -- Amber Drake
+(27756,0,0,0x3000000,0x1,0,'50296 50248 50325'); -- Ruby Drake // Evasive aura should be here from the start
+-- Change InhabitType to prevent drakes falling on summon
+UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (27692,27755,27756);
+-- Change script name for gossip npcs and drakes and set npc_flag to 0, since only after Ist boss is dead, they should acquire gossip flag
+UPDATE `creature_template` SET `npcflag`=2,`ScriptName`='npc_verdisa_beglaristrasz_eternos' WHERE `entry` IN (27657,27658,27659);
+UPDATE `creature_template` SET `spell2`=50240,`spell3`=50253,`spell4`=0 WHERE `entry`=27756; -- Remove Evasive Aura and set Evasive Manouvres since it is an aura always applied, also set Martyr as 3rd
+UPDATE `creature_template` SET `spell6`=53389,`ScriptName`='npc_ruby_emerald_amber_drake' WHERE `entry` IN (27692,27755,27756); -- Add GPS spell for all drakes and script names for drakes
+-- Add spell_script name for Call Ruby/Emerald/Amber Drake spells
+DELETE FROM `spell_script_names` WHERE `spell_id` IN (49462,49345,49461);
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(49462,'spell_call_ruby_emerald_amber_drake'), -- Ruby
+(49345,'spell_call_ruby_emerald_amber_drake'), -- Emerald
+(49461,'spell_call_ruby_emerald_amber_drake'); -- Amber
+-- Remove wrong use of npc_spellclick_spell, the drake should auto do all on summon
+DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (27692,27755,27756);
+-- Add conditions
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (49464,49346,49460,66667,49838);
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry` IN (49840,49592,50328,50341,50232);
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
+(13,1|4,49464,0,0,33,0,1,5,0,0,0,'','Ruby Drake Saddle control vehicle aura can hit only created unit'),
+(13,1|4,49346,0,0,33,0,1,5,0,0,0,'','Emerald Drake Saddle control vehicle aura can hit only created unit'),
+(13,1|4,49460,0,0,33,0,1,5,0,0,0,'','Amber Drake Saddle control vehicle aura can hit only created unit'),
+(13,1|2|4,66667,0,0,33,1,0,0,0,0,0,'','Gear scaling for Oculus drakes can only be casted on self'),
+(17,0,49840,0,1,31,1,3,28236,0,0,0,'','Shock Lance target can be Azure Ring Captain'),
+(17,0,49840,0,2,31,1,3,27638,0,0,0,'','Shock Lance target can be Azure Ring Guardian'),
+(17,0,49840,0,3,31,1,3,28276,0,0,0,'','Shock Lance target can be Greater Lay Whelp'),
+(17,0,49840,0,4,31,1,3,27656,0,0,0,'','Shock Lance target can be Eregos'),
+(13,1,49838,0,1,31,0,3,28236,0,0,0,'','Stop Time can hit Azure Ring Captain'),
+(13,1,49838,0,2,31,0,3,27638,0,0,0,'','Stop Time can hit Azure Ring Guardian'),
+(13,1,49838,0,3,31,0,3,28276,0,0,0,'','Stop Time can hit Greater Lay Whelp'),
+(13,1,49838,0,4,31,0,3,27656,0,0,0,'','Stop Time can hit Eregos'),
+(17,0,49592,0,1,31,1,3,28236,0,0,0,'','Temporal Rift target can be Azure Ring Captain'),
+(17,0,49592,0,2,31,1,3,27638,0,0,0,'','Temporal Rift target can be Azure Ring Guardian'),
+(17,0,49592,0,3,31,1,3,28276,0,0,0,'','Temporal Rift target can be Greater Lay Whelp'),
+(17,0,49592,0,4,31,1,3,27656,0,0,0,'','Temporal Rift target can be Eregos'),
+(17,0,50328,0,1,31,1,3,28236,0,0,0,'','Leeching Poison target can be Azure Ring Captain'),
+(17,0,50328,0,2,31,1,3,27638,0,0,0,'','Leeching Poison target can be Azure Ring Guardian'),
+(17,0,50328,0,3,31,1,3,28276,0,0,0,'','Leeching Poison target can be Greater Lay Whelp'),
+(17,0,50328,0,4,31,1,3,27656,0,0,0,'','Leeching Poison target can be Eregos'),
+(17,0,50341,0,1,31,1,3,28236,0,0,0,'','Touch the Nightmare target can be Azure Ring Captain'),
+(17,0,50341,0,2,31,1,3,27638,0,0,0,'','Touch the Nightmare target can be Azure Ring Guardian'),
+(17,0,50341,0,3,31,1,3,28276,0,0,0,'','Touch the Nightmare target can be Greater Lay Whelp'),
+(17,0,50341,0,4,31,1,3,27656,0,0,0,'','Touch the Nightmare target can be Eregos'),
+(17,0,50232,0,1,31,1,3,28236,0,0,0,'','Searing Wrath target can be Azure Ring Captain'),
+(17,0,50232,0,2,31,1,3,27638,0,0,0,'','Searing Wrath target can be Azure Ring Guardian'),
+(17,0,50232,0,3,31,1,3,28276,0,0,0,'','Searing Wrath target can be Greater Lay Whelp'),
+(17,0,50232,0,4,31,1,3,27656,0,0,0,'','Searing Wrath target can be Eregos');
+-- Add text for Belgaristrasz
+SET @Belgaristrasz := 27658;
+DELETE FROM `creature_text` WHERE `entry`=@Belgaristrasz;
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@Belgaristrasz,0,0,'Thank you for freeing us, mortals. Beware, the blue flight is alerted to your presence. Even now, Malygos sends Varos Cloudstrider and his ring guardians to defend the Oculus. You will need our help to stand a chance.',12,0,100,1,3500,0,'Belgaristrasz - On freed');
+-- Add text for Ruby, Amber and Emerald drakes
+SET @Ruby := 27756;
+SET @Emerald := 27692;
+SET @Amber := 27755;
+DELETE FROM `creature_text` WHERE `entry` IN (@Ruby,@Emerald,@Amber);
+INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
+(@Ruby,0,0,'Ruby Drake flies away.',16,0,100,1,0,2858,'Ruby - On take off'),
+(@Ruby,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Ruby - On welcome'),
+(@Ruby,2,0,'Use Searing Wrath to damage enemies and Evasive Maneuvers if I start taking damage. Remember I need to build up Evasive Charges by taking damage to perform Evasive Maneuvers!',15,0,100,1,0,0,'Ruby - On explaining abilities'),
+(@Ruby,3,0,'Now that I am at my full power I can perform Martyr. You can use it to protect other drakes, but I will take lots of damage, so make sure you''re using Evasive Maneuvers too!',15,0,100,1,0,0,'Ruby - On ultimate ability unlocked'),
+(@Ruby,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Ruby - On below 40%'),
+(@Emerald,0,0,'Emerald Drake flies away.',16,0,100,1,0,2858,'Emerald - On take off'),
+(@Emerald,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Emerald - On welcome'),
+(@Emerald,2,0,'Use Leeching Poison to damage enemies and keep me healed. Touch the Nightmare is very powerful, but it hurts me, so only use it when I have a lot of health!',15,0,100,1,0,0,'Emerald - On explaining abilities'),
+(@Emerald,3,0,'Now that I am at my full power I can perform Dream Funnel. You can use it to heal other drakes, but it drains my health, so make sure you''re using Leeching Poison too!',15,0,100,1,0,0,'Emerald - On ultimate ability unlocked'),
+(@Emerald,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Emerald - On below 40%'),
+(@Amber,0,0,'Amber Drake flies away.',16,0,100,1,0,2858,'Amber - On take off'),
+(@Amber,1,0,'Welcome Friend. Keep your head down and hold on tight!',15,0,100,1,0,0,'Amber - On welcome'),
+(@Amber,2,0,'Use Shock Lance to damage enemies. If we get in trouble, Stop Time to freeze all enemies in place, then hit them with Shock Lance for massive damage!',15,0,100,1,0,0,'Amber - On explaining abilities'),
+(@Amber,3,0,'Now that I am at my full power I can perform Temporal Rift. You can use it to make enemies take extra damage and to get Shock Charges. Save up Shock Charges and then Shock Lance for huge damage!',15,0,100,1,0,0,'Amber - On ultimate ability unlocked'),
+(@Amber,4,0,'I''m badly injured! I can''t take much more of this!',15,0,100,1,0,0,'Amber - On below 40%');
+-- Fix Oculus phasing db side, all listed get changed only on specific isntance data
+UPDATE `creature` SET `phaseMask`=2 WHERE `id` IN (27447,27655,28276,27656);
diff --git a/sql/updates/world/2012_10_04_00_world_spelldifficulty_dbc.sql b/sql/updates/world/2012_10_04_00_world_spelldifficulty_dbc.sql
new file mode 100644
index 00000000000..763bf57fc47
--- /dev/null
+++ b/sql/updates/world/2012_10_04_00_world_spelldifficulty_dbc.sql
@@ -0,0 +1,5 @@
+-- Boss Anubarak Move Heroic Spell in spelldifficulty
+DELETE FROM `spelldifficulty_dbc` WHERE `id` IN (53472,53454);
+INSERT INTO `spelldifficulty_dbc`(`id`,`spellid0`,`spellid1`) VALUES
+(53472,53472,59433), -- Spell Pound
+(53454,53454,59446); -- Spell Impale Damage
diff --git a/sql/updates/world/2012_10_04_01_world_script_texts.sql b/sql/updates/world/2012_10_04_01_world_script_texts.sql
new file mode 100644
index 00000000000..8281d16794e
--- /dev/null
+++ b/sql/updates/world/2012_10_04_01_world_script_texts.sql
@@ -0,0 +1,11 @@
+DELETE FROM `script_texts` WHERE `entry` BETWEEN -1000649 AND -1000641;
+INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`,`sound`,`type`,`language`,`emote`,`comment`) VALUES
+(4979,-1000641,'Hey, thanks.','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0, 'Theramore Guard - SAY_QUEST1'),
+(4979,-1000642,'...receive 50 percent off deserter undergarments? What is this garbage?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST2'),
+(4979,-1000643,'...to establish a fund for the purchase of hair gel? I like my hair the way it is, thanks!','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST3'),
+(4979,-1000644,'...the deserters seek a Theramore where citizens will be free to juggle at all hours of the day? What is this nonsense?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST4'),
+(4979,-1000645,'...to establish the chicken as the official symbol of Theramore?! These guys are nuts!','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST5'),
+(4979,-1000646,"...as a deserter, you'll enjoy activities like tethered swimming and dog grooming? How ridiculous!",'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST6'),
+(4979,-1000647,'This... this is a joke, right?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST7'),
+(4979,-1000648,"I'd never join anything like this. Better keep this, though. It'll come in handy in the privy...",'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST8'),
+(4979,-1000649,'What a bunch of lunatics! You actually believe this stuff?','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',0,0,0,0,'Theramore Guard - SAY_QUEST9');
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index ed0fa9ab06a..011210dd95b 100755
--- 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:
@@ -68,7 +74,7 @@ void usage(const char *prog)
prog);
}
-// Launch the auth server
+/// Launch the auth server
extern int main(int argc, char **argv)
{
// Command line parsing to get the configuration file name
@@ -232,7 +238,7 @@ extern int main(int argc, char **argv)
return 0;
}
-// Initialize connection to the database
+/// Initialize connection to the database
bool StartDB()
{
MySQL::Library_Init();
@@ -270,6 +276,7 @@ bool StartDB()
return true;
}
+/// Close the connection to the database
void StopDB()
{
LoginDatabase.Close();
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 6cb0f90d98e..d8c39925dc6 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -148,7 +148,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/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 119cfd3d35e..89359372355 100755
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -20,8 +20,9 @@
#define TRINITY_UNITAI_H
#include "Define.h"
-#include <list>
#include "Unit.h"
+#include "Containers.h"
+#include <list>
class Unit;
class Player;
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 17cef3ec1a1..e5868117da8 100755
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -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/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index db79925cc7f..32b9f8b5903 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1268,7 +1268,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsSmart())
break;
- CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly ? false : true);
+ CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly ? true : false);
break;
}
case SMART_ACTION_SET_RUN:
diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp
index 8076f800356..b666add74b3 100755
--- a/src/server/game/Accounts/AccountMgr.cpp
+++ b/src/server/game/Accounts/AccountMgr.cpp
@@ -16,8 +16,8 @@
* 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"
@@ -274,10 +274,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/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 93a3378c3c5..b77de70c399 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -376,7 +376,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:
{
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 940f1f8beb7..d580df63700 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -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));
@@ -635,14 +635,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;
}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 480aafbeb42..2ca6a2e3f96 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -211,9 +211,6 @@ class Battlefield : public ZoneScript
/// Call this to init the Battlefield
virtual bool SetupBattlefield() { return true; }
- /// Generate packet which contain all worldstatedata of area
- virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
-
/// Update data of a worldstate to all players present in zone
void SendUpdateWorldState(uint32 field, uint32 value);
@@ -330,7 +327,8 @@ class Battlefield : public ZoneScript
virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
/// Send all worldstate data to all player in zone.
- virtual void SendInitWorldStatesToAll() {};
+ virtual void SendInitWorldStatesToAll() = 0;
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
/// Return if we can use mount in battlefield
bool CanFlyIn() { return !m_isActive; }
diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h
index 4ee37e424fd..1ec1f3b1151 100644
--- a/src/server/game/Battlefield/BattlefieldMgr.h
+++ b/src/server/game/Battlefield/BattlefieldMgr.h
@@ -46,10 +46,10 @@ class BattlefieldMgr
// called when player resurrects
void HandlePlayerResurrects(Player * player, uint32 areaflag);
// return assigned battlefield
- Battlefield *GetBattlefieldToZoneId(uint32 zoneid);
- Battlefield *GetBattlefieldByBattleId(uint32 battleid);
+ Battlefield* GetBattlefieldToZoneId(uint32 zoneid);
+ Battlefield* GetBattlefieldByBattleId(uint32 battleid);
- ZoneScript *GetZoneScript(uint32 zoneId);
+ ZoneScript* GetZoneScript(uint32 zoneId);
void AddZone(uint32 zoneid, Battlefield * handle);
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index 2270bcf7927..de1ee1785d8 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -612,33 +612,26 @@ void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
void BattlefieldWG::OnGameObjectCreate(GameObject* go)
{
- bool isWorkshop = false;
uint8 workshopId = 0;
switch (go->GetEntry())
{
case GO_WINTERGRASP_FACTORY_BANNER_NE:
- isWorkshop = true;
workshopId = BATTLEFIELD_WG_WORKSHOP_NE;
break;
case GO_WINTERGRASP_FACTORY_BANNER_NW:
- isWorkshop = true;
workshopId = BATTLEFIELD_WG_WORKSHOP_NW;
break;
case GO_WINTERGRASP_FACTORY_BANNER_SE:
- isWorkshop = true;
workshopId = BATTLEFIELD_WG_WORKSHOP_SE;
break;
case GO_WINTERGRASP_FACTORY_BANNER_SW:
- isWorkshop = true;
workshopId = BATTLEFIELD_WG_WORKSHOP_SW;
break;
-
+ default:
+ return;
}
- if (!isWorkshop)
- return;
-
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
{
if (WGWorkshop* workshop = (*itr))
@@ -851,20 +844,13 @@ uint32 BattlefieldWG::GetData(uint32 data)
return Battlefield::GetData(data);
}
-// Method sending worldsate to player
-WorldPacket BattlefieldWG::BuildInitWorldStates()
-{
- 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(4 + 2 + 4 + BuildingsInZone.size() + WorkshopsList.size());
+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);
+ 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));
@@ -880,23 +866,28 @@ WorldPacket BattlefieldWG::BuildInitWorldStates()
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
if (*itr)
data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state;
-
- return data;
}
void BattlefieldWG::SendInitWorldStatesTo(Player* player)
{
- WorldPacket data = BuildInitWorldStates();
+ 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()
{
- WorldPacket data = BuildInitWorldStates();
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))
- player->GetSession()->SendPacket(&data);
+ SendInitWorldStatesTo(player);
}
void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index 11510e1ea98..323f7f2b13d 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -26,12 +26,6 @@
#include "GroupMgr.h"
#include "Battlefield.h"
-uint32 const VehNumWorldState[2] = { 3680, 3490 };
-uint32 const MaxVehNumWorldState[2] = { 3681, 3491 };
-uint32 const ClockWorldState[2] = { 3781, 4354 };
-uint32 const WintergraspFaction[3] = { 1732, 1735, 35 };
-float const WintergraspStalkerPos[4] = { 0, 0, 0, 0 };
-
class BattlefieldWG;
class WintergraspCapturePoint;
@@ -404,9 +398,9 @@ class BattlefieldWG : public Battlefield
void UpdateVehicleCountWG();
void UpdateCounterVehicle(bool init);
- WorldPacket BuildInitWorldStates();
void SendInitWorldStatesTo(Player* player);
void SendInitWorldStatesToAll();
+ void FillInitialWorldStates(WorldPacket& data);
void HandleKill(Player* killer, Unit* victim);
void OnUnitDeath(Unit* unit);
@@ -421,6 +415,7 @@ class BattlefieldWG : public Battlefield
uint8 GetSpiritGraveyardId(uint32 areaId);
uint32 GetData(uint32 data);
+
protected:
bool m_isRelicInteractible;
@@ -441,6 +436,12 @@ class BattlefieldWG : public Battlefield
GameObject* m_titansRelic;
};
+uint32 const VehNumWorldState[] = { 3680, 3490 };
+uint32 const MaxVehNumWorldState[] = { 3681, 3491 };
+uint32 const ClockWorldState[] = { 3781, 4354 };
+uint32 const WintergraspFaction[] = { 1732, 1735, 35 };
+float const WintergraspStalkerPos[] = { 0, 0, 0, 0 };
+
uint8 const WG_MAX_OBJ = 32;
uint8 const WG_KEEPGAMEOBJECT_MAX = 44;
uint8 const WG_MAX_TURRET = 15;
@@ -448,6 +449,7 @@ 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
{
@@ -1112,8 +1114,6 @@ const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] =
// *****************WorkShop Data & Element*****************
// *********************************************************
-uint8 const WG_MAX_WORKSHOP = 6;
-
struct WGWorkshopData
{
uint8 id;
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index d395bccf3a2..b33140a3419 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -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_TeamStartLocX[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocX[TEAM_HORDE] = 0;
- m_TeamStartLocY[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocY[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocY[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocY[TEAM_HORDE] = 0;
- m_TeamStartLocZ[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocZ[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocZ[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocZ[TEAM_HORDE] = 0;
- m_TeamStartLocO[BG_TEAM_ALLIANCE] = 0;
- m_TeamStartLocO[BG_TEAM_HORDE] = 0;
+ m_TeamStartLocO[TEAM_ALLIANCE] = 0;
+ m_TeamStartLocO[TEAM_HORDE] = 0;
- m_ArenaTeamIds[BG_TEAM_ALLIANCE] = 0;
- m_ArenaTeamIds[BG_TEAM_HORDE] = 0;
+ m_ArenaTeamIds[TEAM_ALLIANCE] = 0;
+ m_ArenaTeamIds[TEAM_HORDE] = 0;
- m_StartMaxDist = 0.0f;
+ m_ArenaTeamRatingChanges[TEAM_ALLIANCE] = 0;
+ m_ArenaTeamRatingChanges[TEAM_HORDE] = 0;
- m_ArenaTeamRatingChanges[BG_TEAM_ALLIANCE] = 0;
- m_ArenaTeamRatingChanges[BG_TEAM_HORDE] = 0;
+ m_BgRaids[TEAM_ALLIANCE] = NULL;
+ m_BgRaids[TEAM_HORDE] = NULL;
- m_BgRaids[BG_TEAM_ALLIANCE] = NULL;
- m_BgRaids[BG_TEAM_HORDE] = NULL;
+ m_PlayersCount[TEAM_ALLIANCE] = 0;
+ m_PlayersCount[TEAM_HORDE] = 0;
- m_PlayersCount[BG_TEAM_ALLIANCE] = 0;
- m_PlayersCount[BG_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(), 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)
@@ -530,33 +557,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(LOG_FILTER_BATTLEGROUND, "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,7 +581,7 @@ 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)
@@ -594,17 +594,17 @@ inline Player* Battleground::_GetPlayer(uint64 guid, bool offlineRemove, const c
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 +620,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;
@@ -674,7 +674,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 +718,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,25 +760,26 @@ 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->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, 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->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[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))
@@ -788,8 +790,8 @@ void Battleground::EndBattleground(uint32 winner)
{
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 +801,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 +814,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,23 +848,20 @@ 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());
+ uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
- 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->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, ACHIEVEMENT_CRITERIA_CONDITION_NO_LOSE);
@@ -893,27 +897,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->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 +923,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 +994,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)
@@ -1101,9 +1101,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->outDebug(LOG_FILTER_ARENAS, "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,6 +1167,7 @@ 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());
@@ -1269,27 +1271,20 @@ void Battleground::EventPlayerLoggedOut(Player* player)
// 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;
}
}
@@ -1682,7 +1677,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 +1719,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);
@@ -1899,7 +1894,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,13 +1907,6 @@ 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)
@@ -1937,3 +1925,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 e658ac4ecbd..6d188d1367a 100755
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -104,6 +104,7 @@ enum BattlegroundSpells
enum BattlegroundTimeIntervals
{
+ CHECK_PLAYER_POSITION_INVERVAL = 1000, // ms
RESURRECTION_INTERVAL = 30000, // ms
//REMIND_INTERVAL = 10000, // ms
INVITATION_REMIND_TIME = 20000, // ms
@@ -232,11 +233,6 @@ enum BattlegroundWinner
WINNER_NONE = 2
};
-enum BattlegroundTeamId
-{
- BG_TEAM_ALLIANCE = 0,
- BG_TEAM_HORDE = 1
-};
#define BG_TEAMS_COUNT 2
enum BattlegroundStartingEvents
@@ -278,20 +274,20 @@ enum GroupJoinBattlegroundResult
ERR_IN_NON_RANDOM_BG = -15 // Can't queue for Random Battleground while in another Battleground queue.
};
-class BattlegroundScore
+struct 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 +320,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 +430,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 +469,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 +501,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 +560,12 @@ 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;
protected:
// this method is called, when BG cannot spawn its own spirit guide, or something is wrong, It correctly ends Battleground
@@ -589,6 +582,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 +604,8 @@ class Battleground
bool m_IsRandom;
BGHonorMode m_HonorMode;
+ int32 m_TeamScores[BG_TEAMS_COUNT];
+
private:
// Battleground
BattlegroundTypeId m_TypeID;
@@ -649,7 +645,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 +658,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 +701,3 @@ class Battleground
uint32 ScriptId;
};
#endif
-
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 0b107983379..a787f4b6810 100755
--- 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"
@@ -51,13 +49,10 @@
/*** 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 +61,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 +111,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++)
{
@@ -161,6 +143,7 @@ void BattlegroundMgr::Update(uint32 diff)
else
m_NextRatedArenaUpdate -= diff;
}
+
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
if (m_AutoDistributionTimeChecker < diff)
@@ -234,13 +217,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);
@@ -303,7 +286,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 +341,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 +353,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:
@@ -443,38 +426,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,72 +492,45 @@ 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)
{
+ BattlegroundTypeId bgTypeId = originalBgTypeId;
+ bool isRandom = false;
+
+ switch (originalBgTypeId)
+ {
+ case BATTLEGROUND_RB:
+ isRandom = true;
+ case BATTLEGROUND_AA:
+ bgTypeId = GetRandomBG(originalBgTypeId);
+ break;
+ default:
+ break;
+ }
+
// get the template BG
Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
- BattlegroundSelectionWeightMap* selectionWeights = NULL;
if (!bg_template)
{
sLog->outError(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
return NULL;
}
- bool isRandom = false;
-
- if (bg_template->isArena())
- selectionWeights = &m_ArenaSelectionWeights;
- else if (bgTypeId == BATTLEGROUND_RB)
- {
- selectionWeights = &m_BGSelectionWeights;
- isRandom = true;
- }
-
- 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);
-
- // 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(LOG_FILTER_BATTLEGROUND, "Battleground: CreateNewBattleground - bg template not found for %u", bgTypeId);
- return NULL;
- }
- }
Battleground* bg = NULL;
// create a copy of the BG template
@@ -574,9 +551,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 +570,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,20 +657,14 @@ 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");
@@ -687,33 +674,38 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
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(LOG_FILTER_BATTLEGROUND, "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();
+ uint8 spawn = fields[9].GetUInt8();
+ data.StartMaxDist = float(spawn * spawn);
+
+ 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->outError(LOG_FILTER_SQL, "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
@@ -728,37 +720,12 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
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->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;
- }
-
- 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;
@@ -766,16 +733,34 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
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;
- }
-
- data.StartMaxDist = fields[9].GetFloat();
+ 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;
+ }
- 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;
@@ -783,10 +768,11 @@ 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());
@@ -832,10 +818,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;
@@ -843,29 +829,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;
@@ -878,23 +864,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->outInfo(LOG_FILTER_BATTLEGROUND, "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(), mapid, x, y, z, O, bgTypeId);
player->TeleportTo(mapid, x, y, z, O);
}
else
- {
- sLog->outError(LOG_FILTER_BATTLEGROUND, "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());
}
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
@@ -909,12 +892,12 @@ 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)
@@ -1002,19 +985,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)
@@ -1032,18 +1009,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
@@ -1134,3 +1102,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..67bed737588 100755
--- 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>;
@@ -78,16 +86,15 @@ class BattlegroundMgr
/* 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 f36b4d49a35..aa4177eaf51 100755
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -167,31 +167,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())
{
- 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
- {
- 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
@@ -236,16 +236,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 +263,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])
@@ -299,11 +299,11 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
}
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)
{
@@ -311,12 +311,13 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
//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_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;
@@ -345,7 +346,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 +376,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 +420,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 +475,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, I can't help it if they don't press the enter battle button.",
+ player->GetName(), 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 +504,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 +526,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 +588,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 +646,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 +661,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 +749,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();
- }
}
}
@@ -794,62 +797,38 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
// 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(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();
}
}
@@ -870,7 +849,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 /*diff*/, BattlegroundTyp
// 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,8 +936,8 @@ 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)
{
@@ -977,12 +956,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 +996,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 +1037,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
--- 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 365ffb853d2..5a887c647b1 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -16,12 +16,11 @@
* 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"
@@ -119,17 +118,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 +138,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 +151,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 +209,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 +235,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(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;
}
}
@@ -322,8 +321,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
@@ -364,6 +363,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)
@@ -440,7 +440,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))
@@ -486,7 +486,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));
@@ -503,15 +503,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
@@ -528,19 +528,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));
@@ -552,14 +552,14 @@ 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->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn some object Battleground not created!");
@@ -576,9 +576,9 @@ bool BattlegroundAB::SetupBattleground()
//buffs
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
- || !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->outError(LOG_FILTER_SQL, "BatteGroundAB: Failed to spawn buff object!");
}
@@ -591,20 +591,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)
{
@@ -621,12 +621,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);
@@ -635,7 +635,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;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h
index 870b3965522..63c89717c8f 100755
--- 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
{
@@ -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,28 @@ 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)]; }
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 +306,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 37072866238..c57eeff9911 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -16,11 +16,11 @@
* 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 "GameObject.h"
#include "Miscellaneous/Language.h"
@@ -242,17 +242,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 +269,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 +345,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 +455,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 +480,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 +488,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
@@ -489,27 +510,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 +539,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;
@@ -571,7 +585,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);
@@ -593,8 +606,8 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
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 +644,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 +710,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);
@@ -754,7 +766,6 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes 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(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 +774,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)
@@ -943,7 +962,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 +1077,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);
@@ -1199,9 +1220,13 @@ 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->outError(LOG_FILTER_SQL, "BatteGroundAV: Failed to spawn some object Battleground not created!1");
return false;
@@ -1212,14 +1237,28 @@ 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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!2");
return false;
@@ -1229,12 +1268,24 @@ 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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!3");
return false;
@@ -1242,12 +1293,24 @@ bool BattlegroundAV::SetupBattleground()
}
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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!4");
return false;
@@ -1255,7 +1318,17 @@ bool BattlegroundAV::SetupBattleground()
}
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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
return false;
@@ -1269,7 +1342,17 @@ 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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
return false;
@@ -1277,7 +1360,17 @@ bool BattlegroundAV::SetupBattleground()
}
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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
return false;
@@ -1287,7 +1380,17 @@ 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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
return false;
@@ -1295,24 +1398,52 @@ bool BattlegroundAV::SetupBattleground()
}
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(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(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(LOG_FILTER_BATTLEGROUND, "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
return false;
@@ -1361,10 +1492,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 +1513,7 @@ bool BattlegroundAV::SetupBattleground()
return true;
}
-const char* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
+char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
{
switch (node)
{
@@ -1414,22 +1545,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, uint16 team)
if (m_Nodes[node].TotalOwner == team)
{
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is TotalOwner of node");
- ASSERT (false);
+ ASSERT(false);
}
if (m_Nodes[node].Owner == team)
{
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assaulting team is owner of node");
- ASSERT (false);
+ ASSERT(false);
}
if (m_Nodes[node].State == POINT_DESTROYED)
{
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Destroyed node is being assaulted");
- ASSERT (false);
+ ASSERT(false);
}
if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwner) //only assault an assaulted node if no totalowner exists
{
sLog->outFatal(LOG_FILTER_BATTLEGROUND, "Assault on an not assaulted node with total owner");
- ASSERT (false);
+ 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 +1608,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 +1620,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
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h
index b71b3476fcc..28d524977fc 100755
--- 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!"
@@ -96,7 +96,6 @@ horde:
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
-
};
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] =
@@ -1439,7 +1434,6 @@ enum BG_AV_WorldStates
AV_FROSTWOLFE_UNUSED = 1393,
AV_FROSTWOLFW_UNUSED = 1392
*/
-
};
//alliance_control neutral_control horde_control
@@ -1531,18 +1525,17 @@ struct BG_AV_NodeInfo
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);
/*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,14 @@ 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;
private:
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
/* Nodes occupying */
void EventPlayerAssaultsPoint(Player* player, uint32 object);
@@ -1598,7 +1591,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 +1622,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 78cf6b9863f..d4086b2e48e 100755
--- 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();
}
@@ -105,30 +100,20 @@ bool BattlegroundBE::HandlePlayerUnderMap(Player* player)
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(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 (buff_guid)
- // HandleTriggerBuff(buff_guid, Source);
}
void BattlegroundBE::FillInitialWorldStates(WorldPacket &data)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h
index 8c0df2bc329..27a88fcfc33 100755
--- 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 20eba2a7f67..d8f1883cbda 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -16,13 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundDS.h"
+#include "ObjectAccessor.h"
#include "Language.h"
#include "Player.h"
-#include "Object.h"
-#include "ObjectMgr.h"
#include "WorldPacket.h"
+#include "GameObject.h"
BattlegroundDS::BattlegroundDS()
{
@@ -147,11 +146,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();
}
@@ -181,18 +176,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,8 +195,7 @@ void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger)
setPipeKnockBackCount(0);
break;
default:
- sLog->outError(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;
}
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index d9e60079bf6..ff4b279a2cf 100755
--- 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
{
@@ -79,14 +79,6 @@ enum BattlegroundDSData
BG_DS_WATERFALL_STATUS_OFF = 3
};
-class BattlegroundDSScore : public BattlegroundScore
-{
- public:
- BattlegroundDSScore() {};
- virtual ~BattlegroundDSScore() {};
- //TODO fix me
-};
-
class BattlegroundDS : public Battleground
{
public:
@@ -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 35ea94ba607..ee25f72b382 100755
--- 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()
@@ -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(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;
}
}
@@ -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;
@@ -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);
@@ -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);
}
@@ -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);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
index c7ee4c62504..61ee5b16c1c 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h
@@ -20,8 +20,7 @@
#define __BATTLEGROUNDEY_H
#include "Language.h"
-
-class Battleground;
+#include "Battleground.h"
enum BG_EY_Misc
{
@@ -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,24 @@ 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;
private:
- virtual void PostUpdateImpl(uint32 diff);
+ void PostUpdateImpl(uint32 diff);
void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType);
void EventTeamCapturedPoint(Player* Source, uint32 Point);
@@ -386,7 +384,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 90571dfb758..1c5041da017 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -36,17 +36,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;
@@ -91,13 +91,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);
@@ -106,7 +105,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)
@@ -129,7 +136,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)
{
@@ -139,7 +146,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))
{
@@ -149,7 +156,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))
{
@@ -187,7 +194,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))
{
@@ -236,7 +243,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)
@@ -270,13 +277,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))
+ 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);
+ }
}
}
@@ -287,7 +296,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;
@@ -296,10 +305,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);
@@ -354,19 +360,19 @@ 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,
@@ -378,7 +384,7 @@ bool BattlegroundIC::SetupBattleground()
}
}
- 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,
@@ -416,13 +422,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;
@@ -502,7 +508,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())
{
@@ -589,7 +595,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);
@@ -627,7 +633,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);
}
}
@@ -650,7 +656,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),
@@ -682,7 +688,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))
{
@@ -694,7 +700,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))
{
@@ -707,7 +713,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;
@@ -722,7 +728,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;
@@ -744,7 +750,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))
{
@@ -757,7 +763,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;
@@ -800,7 +806,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(),
@@ -837,6 +843,12 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
switch (go->GetEntry())
{
case GO_HORDE_GATE_1:
+ if (!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);
+ }
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
break;
case GO_HORDE_GATE_2:
@@ -848,6 +860,12 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
break;
case GO_ALLIANCE_GATE_3:
+ if (!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);
+ }
lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED;
break;
default:
@@ -864,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;
@@ -941,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 20f44acc14f..1386af13186 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -19,7 +19,7 @@
#ifndef __BATTLEGROUNDIC_H
#define __BATTLEGROUNDIC_H
-class Battleground;
+#include "Battleground.h"
const uint32 BG_IC_Factions[2] =
{
@@ -185,12 +185,12 @@ enum gameobjectsIC
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
@@ -654,18 +654,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
@@ -847,13 +844,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 +859,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 +876,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 +885,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 +955,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 f39b1ba5540..deb2e565b07 100755
--- 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();
}
@@ -102,26 +97,20 @@ bool BattlegroundNA::HandlePlayerUnderMap(Player* player)
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(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 (buff_guid)
- // HandleTriggerBuff(buff_guid, Source);
}
void BattlegroundNA::FillInitialWorldStates(WorldPacket &data)
@@ -153,13 +142,3 @@ bool BattlegroundNA::SetupBattleground()
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
--- 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 7fa9980a77c..14c1052ed64 100755
--- 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();
}
@@ -102,27 +97,20 @@ bool BattlegroundRL::HandlePlayerUnderMap(Player* player)
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(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 (buff_guid)
- // HandleTriggerBuff(buff_guid, Source);
}
void BattlegroundRL::FillInitialWorldStates(WorldPacket &data)
@@ -152,13 +140,3 @@ bool BattlegroundRL::SetupBattleground()
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
--- 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 769df5445c7..80018bce0a2 100755
--- 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));
@@ -148,12 +141,12 @@ bool BattlegroundRV::HandlePlayerUnderMap(Player* player)
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(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;
}
}
@@ -247,4 +239,4 @@ void BattlegroundRV::TogglePillarCollision()
}
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 d8ac082ec19..115fd95d1b0 100755
--- 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
{
@@ -91,13 +91,6 @@ enum BattlegroundRVData
BG_RV_WORLD_STATE = 0xe1a
};
-class BattlegroundRVScore : public BattlegroundScore
-{
- public:
- BattlegroundRVScore() {};
- virtual ~BattlegroundRVScore() {};
-};
-
class BattlegroundRV : public Battleground
{
public:
@@ -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 58f7cabc72d..eae1c1e3545 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -16,7 +16,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundSA.h"
#include "Language.h"
#include "Player.h"
@@ -56,8 +55,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;
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h
index 78653a993a0..748db56dc77 100755
--- 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;
};
@@ -444,25 +443,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 dd94606b4cd..5fd6e43c029 100755
--- 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"
@@ -65,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;
@@ -159,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;
}
@@ -212,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)
@@ -255,7 +270,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
else
sLog->outError(LOG_FILTER_BATTLEGROUND, "unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));
- SetDroppedFlagGUID(0, team);
+ SetDroppedFlagGUID(0, GetTeamIndexByTeamId(team));
_bothFlagsKept = false;
}
@@ -269,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);
@@ -315,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)
@@ -353,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);
@@ -363,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);
@@ -380,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);
@@ -388,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;
}
@@ -397,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);
@@ -405,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;
}
@@ -448,7 +463,7 @@ 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);
@@ -467,7 +482,7 @@ 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);
@@ -478,7 +493,8 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
}
//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)
{
@@ -499,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);
@@ -512,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)
{
@@ -533,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);
@@ -555,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(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
- this->SetAllianceFlagPicker(0);
- this->RespawnFlag(ALLIANCE, false);
+ 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(LOG_FILTER_BATTLEGROUND, "BattlegroundWS: Removing offline player who has the FLAG!!");
- this->SetHordeFlagPicker(0);
- this->RespawnFlag(HORDE, false);
+ SetHordeFlagPicker(0);
+ RespawnFlag(HORDE, false);
}
else
- this->EventPlayerDroppedFlag(player);
+ EventPlayerDroppedFlag(player);
}
}
@@ -589,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];
@@ -624,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
@@ -639,8 +655,7 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger)
case 4629: // unk4
break;
default:
- sLog->outError(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;
}
@@ -702,17 +717,14 @@ 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;
+ 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()))
{
@@ -726,25 +738,25 @@ void BattlegroundWS::Reset()
m_HonorWinKills = 1;
m_HonorEndKills = 2;
}
- _minutesElapsed = 0;
- _lastFlagCaptureTeam = 0;
- _bothFlagsKept = false;
- _flagDebuffState = 0;
- _flagSpellForceTimer = 0;
- _flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
- _flagsDropTimer[BG_TEAM_HORDE] = 0;
- _flagsTimer[BG_TEAM_ALLIANCE] = 0;
- _flagsTimer[BG_TEAM_HORDE] = 0;
+ _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);
@@ -763,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;
@@ -809,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);
@@ -836,15 +847,14 @@ 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);
}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h
index a014840f273..ec9f4ab1506 100755
--- 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,48 +162,52 @@ 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; }
@@ -224,7 +227,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/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index c3845f16826..579f322594a 100755
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -69,8 +69,8 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team)
if (db_BannedList)
{
- Tokens tokens(db_BannedList, ' ');
- Tokens::iterator iter;
+ Tokenizer tokens(db_BannedList, ' ');
+ Tokenizer::const_iterator iter;
for (iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint64 banned_guid = atol(*iter);
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 87853a53b6c..cd6b9a7da60 100755
--- 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);
}
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 546c4f303b2..7dc4b57d188 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -223,6 +223,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;
}
}
}
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index bd72015d76f..57af0562dcd 100755
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -144,6 +144,7 @@ enum RelationType
RELATION_IN_RAID_OR_PARTY,
RELATION_OWNED_BY,
RELATION_PASSENGER_OF,
+ RELATION_CREATED_BY,
RELATION_MAX
};
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 27695f3eafa..9b065729b88 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -100,14 +100,14 @@ void LoadDisables()
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++]));
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 618032e5f97..3a75066fa2d 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -18,7 +18,7 @@
#include "Common.h"
#include "SharedDefines.h"
#include "DBCStores.h"
-
+#include "Containers.h"
#include "DisableMgr.h"
#include "ObjectMgr.h"
#include "SocialMgr.h"
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index b92c3048b45..305168881a5 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -630,7 +630,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);
@@ -667,7 +667,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);
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 8823a788555..c9d1944af09 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -225,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/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 46abf95128e..bd5b544c33c 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1154,8 +1154,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)
{
@@ -1702,8 +1702,8 @@ 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();
@@ -1752,17 +1752,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;
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index eb2fa8f1a0e..8fb81a0e021 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -802,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:
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 58cc1d027a3..f1a7d646fe4 100755
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -424,7 +424,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]));
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index cbdae9de0bf..8647e6ddb4f 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -772,7 +772,7 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou
if (!data)
return;
- Tokens tokens(data, ' ', count);
+ Tokenizer tokens(data, ' ', count);
if (tokens.size() != count)
return;
@@ -1511,8 +1511,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();
}
@@ -1522,8 +1522,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();
}
@@ -1555,8 +1555,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
{
@@ -1605,7 +1605,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
@@ -1630,8 +1630,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);
@@ -2649,8 +2649,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);
@@ -2785,8 +2785,8 @@ 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))
@@ -2806,8 +2806,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;
@@ -2831,8 +2831,8 @@ 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))
@@ -2851,8 +2851,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));
}
@@ -2862,8 +2862,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));
}
@@ -2874,8 +2874,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/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index ead018ac620..283f2032ab0 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -663,7 +663,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);
@@ -1979,7 +1979,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
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index c498350c78c..c41436e1947 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -76,6 +76,7 @@
#include "AccountMgr.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
+#include "BattlefieldWG.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -191,10 +192,10 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
void PlayerTaxi::LoadTaxiMask(const char* data)
{
- Tokens tokens(data, ' ');
+ Tokenizer tokens(data, ' ');
uint8 index;
- Tokens::iterator iter;
+ Tokenizer::const_iterator iter;
for (iter = tokens.begin(), index = 0;
(index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index)
{
@@ -221,9 +222,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, uint3
{
ClearTaxiDestinations();
- Tokens tokens(values, ' ');
+ Tokenizer tokens(values, ' ');
- for (Tokens::iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
+ for (Tokenizer::const_iterator iter = tokens.begin(); iter != tokens.end(); ++iter)
{
uint32 node = uint32(atol(*iter));
AddTaxiDestination(node);
@@ -519,7 +520,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);
@@ -1324,7 +1325,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:
@@ -1974,7 +1975,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;
@@ -2113,6 +2114,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
else
sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName(), mapid);
+ if (m_vehicle)
+ ExitVehicle();
+
// reset movement flags at teleport, because player will continue move with these flags after teleport
SetUnitMovementFlags(0);
DisableSpline();
@@ -2536,7 +2540,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())
@@ -2616,12 +2620,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;
@@ -5499,15 +5503,10 @@ void Player::RepopAtGraveyard()
ClosestGrave = bg->GetClosestGraveYard(this);
else
{
- if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
- ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = bf->GetClosestGraveYard(this);
else
- {
- if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
- ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
- else
- ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
- }
+ ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
}
// stop countdown until repop
@@ -5948,7 +5947,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));
@@ -7188,7 +7187,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt
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);
@@ -9043,6 +9042,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
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);
@@ -9078,7 +9078,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
NumberOfFields = 83;
break;
case 3277:
- NumberOfFields = 16;
+ NumberOfFields = 18;
break;
case 3358:
case 3820:
@@ -9116,6 +9116,10 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
case 4273: // Ulduar
NumberOfFields = 10;
break;
+ case 4197: // Wintergrasp
+ /// Use the max here, and fill with zeros if missing.
+ NumberOfFields = 10 + WG_MAX_OBJ + WG_MAX_WORKSHOP;
+ break;
default:
NumberOfFields = 12;
break;
@@ -9125,6 +9129,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(mapid); // mapid
data << uint32(zoneid); // zone id
data << uint32(areaid); // area id, new 2.1.0
+ size_t countPos = data.wpos();
data << uint16(NumberOfFields); // count of uint64 blocks
data << uint32(0x8d8) << uint32(0x0); // 1
data << uint32(0x8d7) << uint32(0x0); // 2
@@ -9670,6 +9675,16 @@ 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;
+ }
+ else
+ data.put<uint16>(countPos, 12);
+ // No break here, intended.
default:
data << uint32(0x914) << uint32(0x0); // 7
data << uint32(0x913) << uint32(0x0); // 8
@@ -9679,6 +9694,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
}
GetSession()->SendPacket(&data);
SendBGWeekendWorldStates();
+ SendBattlefieldWorldStates();
}
void Player::SendBGWeekendWorldStates()
@@ -9696,6 +9712,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
@@ -15112,7 +15146,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))
@@ -16657,7 +16691,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;
@@ -16665,7 +16699,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);
@@ -17708,9 +17742,9 @@ 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);
@@ -19570,7 +19604,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);
@@ -21757,6 +21791,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());
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 0decacd6258..5670ca05a85 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -36,8 +36,6 @@
#include "Unit.h"
#include "Util.h" // for Tokens typedef
#include "WorldSession.h"
-
-// for template
#include "SpellMgr.h"
#include<string>
@@ -1518,8 +1516,8 @@ class Player : public Unit, public GridObject<Player>
bool isBeingLoaded() const { return GetSession()->PlayerLoading();}
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);
@@ -1534,8 +1532,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);
@@ -2125,6 +2123,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);
@@ -2917,7 +2916,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/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 558fdd72a95..e7084353491 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -646,8 +646,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());
@@ -680,8 +680,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,8 +708,8 @@ void Transport::CalculatePassengerPosition(float& x, float& y, float& z, float&
{
float inx = x, iny = y, inz = z, ino = o;
o = GetOrientation() + ino;
- x = GetPositionX() + inx * cos(GetOrientation()) - iny * sin(GetOrientation());
- 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;
}
@@ -717,9 +717,9 @@ 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()) * tan(GetOrientation()));
- x = (inx + iny * tan(GetOrientation())) / (cos(GetOrientation()) + sin(GetOrientation()) * tan(GetOrientation()));
+ 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/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 5cec0cf4375..8c0bfb8af23 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -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 6e9ebb38e48..54559507cf4 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -173,6 +173,7 @@ Unit::Unit(bool isWorldObject): WorldObject(isWorldObject)
, m_vehicleKit(NULL)
, m_unitTypeMask(UNIT_MASK_NONE)
, m_HostileRefManager(this)
+ , _lastDamagedTime(0)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
@@ -590,7 +591,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);
@@ -999,7 +1000,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
@@ -1188,7 +1189,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:
@@ -1456,14 +1457,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.
@@ -1496,7 +1497,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);
}
@@ -1580,12 +1581,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));
}
@@ -1646,7 +1647,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()));
@@ -1696,7 +1697,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()));
@@ -1769,8 +1770,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;
@@ -1780,13 +1783,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);
@@ -2155,7 +2159,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)
@@ -4333,7 +4337,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;
}
@@ -4395,12 +4399,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;
}
@@ -4462,11 +4466,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;
}
@@ -4528,11 +4532,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;
}
@@ -5080,7 +5084,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;
}
@@ -5532,7 +5536,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;
}
@@ -5592,7 +5596,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;
}
@@ -5611,7 +5615,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;
}
@@ -5627,7 +5631,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;
@@ -5639,8 +5643,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;
@@ -5694,8 +5698,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;
@@ -5778,7 +5782,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
@@ -5876,7 +5880,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
@@ -5955,7 +5959,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;
}
@@ -5971,7 +5975,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
@@ -6025,7 +6029,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
}
}
// health
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ basepoints0 = CalculatePct(int32(damage), triggerAmount);
target = this;
triggered_spell_id = 30294;
break;
@@ -6044,7 +6048,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;
}
@@ -6097,7 +6101,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;
@@ -6123,7 +6127,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);
@@ -6166,7 +6170,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
@@ -6196,7 +6200,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;
@@ -6208,7 +6212,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;
@@ -6228,7 +6232,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;
}
@@ -6245,7 +6249,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;
@@ -6322,7 +6326,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;
@@ -6332,7 +6336,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;
}
@@ -6400,7 +6404,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);
}
@@ -6445,7 +6449,7 @@ 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;
}
break;
@@ -6488,7 +6492,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;
@@ -6629,31 +6633,47 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Light's Beacon - Beacon of Light
if (dummySpell->Id == 53651)
{
- if (this->GetTypeId() != TYPEID_PLAYER)
+ if (!victim)
return false;
- // Check Party/Raid Group
- if (Group *group = this->ToPlayer()->GetGroup())
+ triggered_spell_id = 0;
+ Unit* beaconTarget = NULL;
+ if (this->GetTypeId() != TYPEID_PLAYER)
{
- for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ beaconTarget = triggeredByAura->GetBase()->GetCaster();
+ if (beaconTarget == this || !(beaconTarget->GetAura(53563, victim->GetGUID())))
+ return false;
+ basepoints0 = int32(damage);
+ triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654;
+ }
+ else
+ { // Check Party/Raid Group
+ if (Group *group = this->ToPlayer()->GetGroup())
{
- Player* Member = itr->getSource();
-
- // check if it was heal by paladin which casted this beacon of light
- if (Aura const * aura = Member->GetAura(53563, victim->GetGUID()))
+ for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
- Unit* beaconTarget = Member;
+ Player* Member = itr->getSource();
- // do not proc when target of beacon of light is healed
- if (beaconTarget == this)
- return false;
+ // 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;
- basepoints0 = int32(damage);
- triggered_spell_id = 53652;
- victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura);
- return true;
+ 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;
+ }
else
return false;
}
@@ -6739,7 +6759,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;
@@ -6798,7 +6818,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;
@@ -6830,7 +6850,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;
@@ -6862,7 +6882,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)
@@ -6901,7 +6921,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
@@ -7148,7 +7168,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;
@@ -7160,7 +7180,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);
@@ -7169,7 +7189,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;
}
@@ -7183,7 +7203,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;
}
@@ -7197,7 +7217,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);
}
@@ -7259,8 +7279,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;
}
@@ -7287,7 +7307,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;
}
@@ -7301,7 +7321,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;
}
@@ -7317,13 +7337,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)
@@ -7477,7 +7497,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
@@ -7523,10 +7543,10 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Unholy Blight
if (dummySpell->Id == 49194)
{
- basepoints0 = CalculatePctN(int32(damage), triggerAmount);
+ 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 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
@@ -7543,7 +7563,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;
}
@@ -7621,7 +7641,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;
}
@@ -7703,7 +7723,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;
}
@@ -7771,7 +7791,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;
@@ -7909,7 +7929,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;
@@ -7928,10 +7948,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;
}
@@ -8000,7 +8020,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;
}
@@ -8095,7 +8115,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;
}
@@ -8259,7 +8279,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;
@@ -8307,7 +8327,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
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);
@@ -8371,7 +8391,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
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;
}
@@ -8488,8 +8508,8 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
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;
}
@@ -8519,7 +8539,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;
@@ -8594,7 +8614,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)
@@ -8681,7 +8701,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;
@@ -8873,7 +8893,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)
@@ -8985,7 +9005,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
@@ -10082,8 +10102,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);
@@ -10333,11 +10352,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());
}
}
}
@@ -10348,13 +10367,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;
@@ -10373,7 +10392,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
@@ -10400,19 +10419,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
@@ -10435,14 +10454,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;
@@ -10451,14 +10470,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
@@ -10469,7 +10488,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
@@ -10482,7 +10501,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;
}
@@ -10514,7 +10533,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;
}
}
@@ -10527,13 +10546,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)
@@ -10541,7 +10560,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)
@@ -10549,7 +10568,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:
@@ -10567,7 +10586,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:
@@ -10576,7 +10595,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:
@@ -10588,7 +10607,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;
}
}
@@ -10599,31 +10618,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)
@@ -10642,7 +10661,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;
}
@@ -10745,7 +10764,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;
}
@@ -10755,7 +10774,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())
@@ -10763,7 +10782,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());
@@ -10798,12 +10817,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;
@@ -10837,14 +10856,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;
@@ -11082,7 +11101,7 @@ 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;
@@ -11145,7 +11164,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;
@@ -11165,12 +11184,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
@@ -11189,13 +11208,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:
@@ -11286,15 +11305,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;
@@ -11316,11 +11335,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
@@ -11363,7 +11382,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)
{
@@ -11405,14 +11424,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;
}
@@ -11559,7 +11578,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)
@@ -11641,11 +11662,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());
}
}
}
@@ -11653,13 +11674,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;
@@ -11679,14 +11700,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;
}
@@ -11694,7 +11715,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
@@ -11705,7 +11726,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
@@ -11716,7 +11737,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;
}
@@ -11732,7 +11753,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;
}
@@ -11788,7 +11809,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();
@@ -11802,7 +11823,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());
}
}
@@ -11819,7 +11840,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;
}
@@ -11838,13 +11859,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;
@@ -11854,12 +11875,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;
@@ -12416,6 +12437,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;
@@ -12622,7 +12647,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
// 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)
{
@@ -12660,7 +12685,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;
@@ -13042,6 +13067,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
@@ -13171,7 +13204,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);
@@ -13184,7 +13217,7 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in
durationMod += durationMod_always;
if (durationMod != 0)
- AddPctN(duration, durationMod);
+ AddPct(duration, durationMod);
}
else
{
@@ -14098,14 +14131,14 @@ 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));
@@ -14607,7 +14640,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);
@@ -16180,12 +16213,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)
@@ -16657,7 +16694,7 @@ 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)
@@ -16947,8 +16984,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());
@@ -17403,7 +17440,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
{
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 8eb822831aa..7f279a8b97e 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -262,6 +262,8 @@ enum UnitRename
#define MAX_SPELL_POSSESS 8
#define MAX_SPELL_CONTROL_BAR 10
+#define MAX_AGGRO_RESET_TIME 10 // in seconds
+
enum Swing
{
NOSWING = 0,
@@ -1332,8 +1334,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);
@@ -2218,6 +2220,10 @@ class Unit : public WorldObject
// 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);
@@ -2339,6 +2345,8 @@ class Unit : public WorldObject
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 ef4ed1a7f81..a9cd1bc3824 100755
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -517,8 +517,8 @@ 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 * cos(GetBase()->GetOrientation()) - iny * sin(GetBase()->GetOrientation());
- y = GetBase()->GetPositionY() + iny * cos(GetBase()->GetOrientation()) + inx * sin(GetBase()->GetOrientation());
+ 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;
}
@@ -526,9 +526,9 @@ void Vehicle::CalculatePassengerOffset(float& x, float& y, float& z, float& o)
{
o -= GetBase()->GetOrientation();
z -= GetBase()->GetPositionZ();
- y -= GetBase()->GetPositionY(); // y = searchedY * cos(o) + searchedX * sin(o)
- x -= GetBase()->GetPositionX(); // x = searchedX * cos(o) + searchedY * sin(o + pi)
+ 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()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
- x = (inx + iny * tan(GetBase()->GetOrientation())) / (cos(GetBase()->GetOrientation()) + sin(GetBase()->GetOrientation()) * tan(GetBase()->GetOrientation()));
+ 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/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 7d94e0ad209..fd2a2fe143a 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -525,10 +525,10 @@ 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)
@@ -907,10 +907,10 @@ 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)
@@ -8605,6 +8605,41 @@ void ObjectMgr::LoadFactionChangeReputations()
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)
{
GameObjectTemplateContainer::const_iterator itr = _gameObjectTemplateStore.find(entry);
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index a6d1dc6c386..bbd95e22685 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -1139,11 +1139,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
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 3bae430ad2c..25c8cd3cc2a 100755
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -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());
}
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;
@@ -256,14 +257,14 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recv_d
Player* allianceFlagCarrier = NULL;
Player* hordeFlagCarrier = NULL;
- if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_ALLIANCE))
+ if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
{
allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
if (allianceFlagCarrier)
++flagCarrierCount;
}
- if (uint64 guid = bg->GetFlagPickerGUID(BG_TEAM_HORDE))
+ if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
{
hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
if (hordeFlagCarrier)
@@ -324,8 +325,8 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recv_data)
uint8 fromWhere;
recv_data >> fromWhere; // 0 - battlemaster (lua: ShowBattlefieldList), 1 - UI (lua: RequestBattlegroundInstanceInfo)
- uint8 unk1;
- recv_data >> unk1; // Unknown 3.2.2
+ uint8 canGainXP;
+ recv_data >> canGainXP; // players with locked xp have their own bg queue on retail
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (!bl)
@@ -366,7 +367,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data)
//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))
@@ -540,7 +541,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;
@@ -680,7 +681,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;
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 39cf0d6b3cf..5c603e46086 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -1644,6 +1644,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
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);
+ char const* knownTitlesStr = fields[3].GetCString();
if (!sObjectMgr->GetPlayerInfo(race, playerClass))
{
@@ -1729,7 +1730,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
sWorld->UpdateCharacterNameData(GUID_LOPART(guid), newname, gender, race);
- BattlegroundTeamId team = BG_TEAM_ALLIANCE;
+ TeamId team = TEAM_ALLIANCE;
// Search each faction is targeted
switch (race)
@@ -1739,7 +1740,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
case RACE_UNDEAD_PLAYER:
case RACE_TROLL:
case RACE_BLOODELF:
- team = BG_TEAM_HORDE;
+ team = TEAM_HORDE;
break;
default:
break;
@@ -1756,7 +1757,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
stmt->setUInt32(0, lowGuid);
// Faction specific languages
- if (team == BG_TEAM_HORDE)
+ if (team == TEAM_HORDE)
stmt->setUInt16(1, 109);
else
stmt->setUInt16(1, 98);
@@ -1815,7 +1816,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
uint32 numFullTaximasks = level / 7;
if (numFullTaximasks > 11)
numFullTaximasks = 11;
- if (team == BG_TEAM_ALLIANCE)
+ if (team == TEAM_ALLIANCE)
{
if (playerClass != CLASS_DEATH_KNIGHT)
{
@@ -1867,7 +1868,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
{
Quest *qinfo = iter->second;
uint32 requiredRaces = qinfo->GetRequiredRaces();
- if (team == BG_TEAM_ALLIANCE)
+ if (team == TEAM_ALLIANCE)
{
if (requiredRaces & RACEMASK_ALLIANCE)
{
@@ -1875,7 +1876,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
quests << ',';
}
}
- else // if (team == BG_TEAM_HORDE)
+ else // if (team == TEAM_HORDE)
{
if (requiredRaces & RACEMASK_HORDE)
{
@@ -1928,7 +1929,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND);
stmt->setUInt32(0, lowGuid);
- if (team == BG_TEAM_ALLIANCE)
+ if (team == TEAM_ALLIANCE)
{
stmt->setUInt16(1, 0);
stmt->setUInt16(2, 1519);
@@ -1955,13 +1956,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
uint32 achiev_horde = it->second;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT);
- stmt->setUInt16(0, uint16(team == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
+ 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 == BG_TEAM_ALLIANCE ? achiev_alliance : achiev_horde));
- stmt->setUInt16(1, uint16(team == BG_TEAM_ALLIANCE ? achiev_horde : achiev_alliance));
+ 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);
}
@@ -1973,8 +1974,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
uint32 item_horde = it->second;
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(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);
}
@@ -1986,13 +1987,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
uint32 spell_horde = it->second;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
- stmt->setUInt32(0, (team == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde));
+ 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 == BG_TEAM_ALLIANCE ? spell_alliance : spell_horde));
- stmt->setUInt32(1, (team == BG_TEAM_ALLIANCE ? spell_horde : spell_alliance));
+ 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);
}
@@ -2004,16 +2005,80 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
uint32 reputation_horde = it->second;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REP_BY_FACTION);
- stmt->setUInt32(0, uint16(team == BG_TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
+ stmt->setUInt32(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
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->setUInt16(0, uint16(team == TEAM_ALLIANCE ? reputation_alliance : reputation_horde));
+ stmt->setUInt16(1, uint16(team == TEAM_ALLIANCE ? reputation_horde : reputation_alliance));
stmt->setUInt32(2, lowGuid);
trans->Append(stmt);
}
+
+ // Title conversion
+ if (knownTitlesStr)
+ {
+ const uint32 ktcount = KNOWN_TITLES_SIZE * 2;
+ uint32 knownTitles[ktcount];
+ Tokenizer tokens(knownTitlesStr, ' ', ktcount);
+
+ if (tokens.size() != ktcount)
+ return;
+
+ for (uint32 index = 0; index < ktcount; ++index)
+ knownTitles[index] = atol(tokens[index]);
+
+ 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;
+
+ 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;
+ }
+ }
+
+ std::ostringstream ss;
+ for (uint32 index = 0; index < ktcount; ++index)
+ ss << knownTitles[index] << ' ';
+
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TITLES_FACTION_CHANGE);
+ stmt->setString(0, ss.str().c_str());
+ stmt->setUInt32(1, 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);
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 1da44882ea9..e6e32e81e51 100755
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -862,8 +862,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;
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index 56818e95a2b..6e0c62107ff 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -146,8 +146,8 @@ bool FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float
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))
@@ -172,8 +172,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;
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index 84cd9e88295..72725570826 100755
--- 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;
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 9919a47642e..6985cb92804 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -135,7 +135,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;
}
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 79e8d47aa94..0d3d97d3996 100755
--- 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"
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6a2c7e64446..a3a850ff1c1 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -423,10 +423,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)
@@ -438,6 +434,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();
@@ -482,7 +483,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);
}
}
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 29dcde9d616..297b4df97c4 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -474,7 +474,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;
}
}
@@ -527,7 +527,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 :)
@@ -539,7 +539,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
@@ -569,7 +569,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;
}
@@ -635,7 +635,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)
@@ -653,7 +653,7 @@ 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
@@ -674,10 +674,10 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
amount = GetBase()->GetUnitOwner()->GetMaxPower(POWER_MANA) * 0.0025f;
break;
case 29166: // Innervate
- ApplyPctF(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
+ ApplyPct(amount, float(GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA)) / GetTotalTicks());
break;
case 48391: // Owlkin Frenzy
- ApplyPctU(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
+ ApplyPct(amount, GetBase()->GetUnitOwner()->GetCreatePowers(POWER_MANA));
break;
default:
break;
@@ -692,7 +692,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:
@@ -2280,6 +2280,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;
}
@@ -4741,7 +4745,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);
@@ -6395,25 +6399,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);
@@ -6506,8 +6510,8 @@ 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;
}
@@ -6544,7 +6548,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);
}
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 3de11b98e30..9c08ebae5ac 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -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));
@@ -1433,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
@@ -1447,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;
}
@@ -1637,6 +1637,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_AURA)
{
+ if (!caster)
+ break;
+
// Improved devotion aura
if (caster->HasAura(20140) || caster->HasAura(20138) || caster->HasAura(20139))
{
@@ -2324,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)
{
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 2f50d47a79b..85c8992c597 100755
--- 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 6b51f240b28..51fbd24a3e0 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1651,7 +1651,7 @@ 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(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);)
@@ -1719,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())
@@ -6365,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)
{
@@ -6393,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)
{
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index d2bdf4b8970..5de81b6bd88 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -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;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1f3014159cb..cc032a5895b 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -377,13 +377,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;
@@ -434,10 +434,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
@@ -495,7 +495,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)
@@ -503,7 +503,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;
}
@@ -636,7 +636,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;
@@ -1436,8 +1436,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);
}
@@ -1493,7 +1493,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))
@@ -1552,7 +1552,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());
}
}
}
@@ -1876,20 +1876,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;
@@ -1972,7 +1972,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);
}
@@ -3364,7 +3364,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;
}
@@ -3382,7 +3382,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
@@ -3391,13 +3391,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
@@ -3406,7 +3406,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)
@@ -3422,14 +3422,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
@@ -3438,9 +3438,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;
@@ -3462,7 +3462,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
@@ -3633,36 +3633,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())
{
@@ -4938,7 +4912,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);
@@ -5088,7 +5062,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();
@@ -5405,12 +5379,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);
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 0531549cbd3..37f6a4b8640 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -2026,16 +2026,16 @@ 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:
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 81807e63fb1..c89442855e1 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -74,6 +74,9 @@ 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;
@@ -2772,6 +2775,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:
@@ -2982,6 +2989,16 @@ void SpellMgr::LoadDbcDataCorrections()
switch (spellInfo->Id)
{
+ 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
@@ -3582,6 +3599,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;
}
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 1399934efeb..f7ab6e22f2e 100755
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -675,6 +675,10 @@ bool AuraScript::_Validate(SpellInfo const* entry)
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 `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);
}
@@ -803,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;
@@ -837,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");
@@ -852,6 +868,7 @@ 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:
@@ -1033,6 +1050,7 @@ 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(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);
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 460a4e20d7f..a5d77806739 100755
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -423,6 +423,7 @@ 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
@@ -449,6 +450,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 +542,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 +562,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)
@@ -676,6 +687,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/World/World.cpp b/src/server/game/World/World.cpp
index 1d1fb45b74e..6ef3932252a 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1617,6 +1617,9 @@ void World::SetInitialWorldSettings()
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs...");
sObjectMgr->LoadFactionChangeReputations();
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change title pairs...");
+ sObjectMgr->LoadFactionChangeTitles();
+
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets...");
sTicketMgr->LoadTickets();
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 167c56c20a2..6803354d29b 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -201,8 +201,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_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp
index 7e489a5781e..c2ec563b3c7 100644
--- a/src/server/scripts/Commands/cs_quest.cpp
+++ b/src/server/scripts/Commands/cs_quest.cpp
@@ -39,12 +39,12 @@ public:
{ "complete", SEC_ADMINISTRATOR, false, &HandleQuestComplete, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, &HandleQuestRemove, "", NULL },
{ "reward", SEC_ADMINISTRATOR, false, &HandleQuestReward, "", NULL },
- { NULL, 0, false, NULL, "", 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;
}
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 7d2a4304054..25f4c176bfc 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -408,9 +408,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));
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
index 08aad90f588..ea9cfe5c3c1 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp
@@ -210,16 +210,16 @@ public:
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);
diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
index 167f040bbc4..e368124abaf 100644
--- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
+++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp
@@ -774,8 +774,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
@@ -1207,13 +1207,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;
diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp
index 9b742b495bb..417c8b338c7 100644
--- a/src/server/scripts/Kalimdor/tanaris.cpp
+++ b/src/server/scripts/Kalimdor/tanaris.cpp
@@ -150,20 +150,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 +187,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);
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index 89064a5d18c..ebab2cb99a9 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -15,10 +15,6 @@
* 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 "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ahnkahet.h"
@@ -34,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
@@ -47,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);
+ 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();
}
};
@@ -170,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);
+
+ me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
+ DoCast(SPELL_PUTRID_MUSHROOM);
if (me->GetEntry() == NPC_POISONOUS_MUSHROOM)
- DoCast(me, SPELL_POISONOUS_MUSHROOM_VISUAL_AURA, true);
-
- uiAuraTimer = 0;
- uiDeathTimer = 30*IN_MILLISECONDS;
+ 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*/) {}
@@ -201,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;
}
};
@@ -224,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 7f4da5666ff..9274a016e2f 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_elder_nadox.cpp
@@ -19,16 +19,13 @@
#include "ScriptedCreature.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
@@ -50,8 +47,6 @@ enum Creatures
#define ACTION_AHNKAHAR_GUARDIAN_DEAD 1
#define DATA_RESPECT_YOUR_ELDERS 2
-#define EMOTE_HATCHES "An Ahn'kahar Guardian hatches!"
-
class boss_elder_nadox : public CreatureScript
{
public:
@@ -61,7 +56,7 @@ class boss_elder_nadox : public CreatureScript
{
boss_elder_nadoxAI(Creature* creature) : ScriptedAI(creature)
{
- instance = me->GetInstanceScript();
+ instance = creature->GetInstanceScript();
}
uint32 uiPlagueTimer;
@@ -78,16 +73,13 @@ class boss_elder_nadox : public CreatureScript
void Reset()
{
- uiPlagueTimer = 13000;
- uiRagueTimer = 20000;
-
+ uiPlagueTimer = 13000;
+ uiRagueTimer = 20000;
uiSwarmerSpawnTimer = 10000;
- uiGuardSpawnTimer = 25000;
-
- uiEnrageTimer = 5000;
-
- bGuardSpawned = false;
- respectYourElders = true;
+ uiGuardSpawnTimer = 25000;
+ uiEnrageTimer = 5000;
+ bGuardSpawned = false;
+ respectYourElders = true;
if (instance)
instance->SetData(DATA_ELDER_NADOX_EVENT, NOT_STARTED);
@@ -95,7 +87,7 @@ 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);
@@ -103,12 +95,12 @@ class boss_elder_nadox : public CreatureScript
void KilledUnit(Unit* /*who*/)
{
- DoScriptText(RAND(SAY_SLAY_1, SAY_SLAY_2, SAY_SLAY_3), me);
+ Talk(SAY_SLAY);
}
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_SLAY_3, me); //SAY_SLAY_3 on death?
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_ELDER_NADOX_EVENT, DONE);
@@ -135,7 +127,7 @@ class boss_elder_nadox : public CreatureScript
if (uiPlagueTimer <= diff)
{
- DoCast(me->getVictim(), SPELL_BROOD_PLAGUE);
+ DoCastVictim(SPELL_BROOD_PLAGUE);
uiPlagueTimer = 15000;
}
else
@@ -160,7 +152,7 @@ class boss_elder_nadox : public CreatureScript
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);
+ Talk(SAY_EGG_SAC);
uiSwarmerSpawnTimer = 10000;
}
@@ -169,7 +161,7 @@ class boss_elder_nadox : public CreatureScript
if (!bGuardSpawned && uiGuardSpawnTimer <= diff)
{
- me->MonsterTextEmote(EMOTE_HATCHES, me->GetGUID(), true);
+ Talk(EMOTE_HATCHES, me->GetGUID());
DoCast(me, SPELL_SUMMON_SWARM_GUARD);
bGuardSpawned = true;
}
@@ -217,7 +209,7 @@ class mob_ahnkahar_nerubian : public CreatureScript
{
mob_ahnkahar_nerubianAI(Creature* creature) : ScriptedAI(creature)
{
- instance = me->GetInstanceScript();
+ instance = creature->GetInstanceScript();
}
InstanceScript* instance;
@@ -237,9 +229,7 @@ class mob_ahnkahar_nerubian : public CreatureScript
Nadox->AI()->DoAction(ACTION_AHNKAHAR_GUARDIAN_DEAD);
}
- void EnterCombat(Unit* /*who*/)
- {
- }
+ void EnterCombat(Unit* /*who*/) {}
void UpdateAI(uint32 const diff)
{
@@ -300,9 +290,7 @@ public:
class achievement_respect_your_elders : public AchievementCriteriaScript
{
public:
- achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders")
- {
- }
+ achievement_respect_your_elders() : AchievementCriteriaScript("achievement_respect_your_elders") {}
bool OnCheck(Player* /*player*/, Unit* target)
{
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 e81d58b4ef3..3a937942118 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp
@@ -44,16 +44,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
@@ -177,7 +174,7 @@ public:
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(SAY_AGGRO, me);
+ Talk(SAY_AGGRO);
if (instance)
{
@@ -300,7 +297,7 @@ public:
void JustDied(Unit* /*killer*/)
{
- DoScriptText(SAY_DEATH_1, me);
+ Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_HERALD_VOLAZJ, DONE);
@@ -311,7 +308,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 7c167fb9c27..02dcc04abd6 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -23,22 +23,15 @@
#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
@@ -129,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);
}
@@ -147,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);
}
@@ -178,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;
}
@@ -270,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;
@@ -278,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);
@@ -534,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 f8e2fc0f99f..4729f68680e 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp
@@ -140,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())
@@ -154,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/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
index dcf1338bc74..3bc91855d36 100644
--- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp
@@ -25,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,
@@ -211,7 +209,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;
@@ -328,7 +326,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;
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 c4008564029..61d693104fa 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp
@@ -42,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,
@@ -51,6 +53,8 @@ enum MovementPoints
{
POINT_FLIGHT = 1,
POINT_LAND = 2,
+ POINT_TAKEOFF = 3,
+ POINT_LAND_GROUND = 4
};
enum Misc
@@ -58,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
{
@@ -96,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)
@@ -106,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;
}
@@ -149,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;
@@ -167,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;
}
@@ -243,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/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index 6e7e3c49ef8..1b12f17ce64 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -1585,7 +1585,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_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index 489616332c8..64f49c6e0e7 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -722,7 +722,7 @@ class npc_putricide_oozeAI : public ScriptedAI
{
public:
npc_putricide_oozeAI(Creature* creature, uint32 hitTargetSpellId) : ScriptedAI(creature),
- _newTargetSelectTimer(0), _hitTargetSpellId(hitTargetSpellId)
+ _hitTargetSpellId(hitTargetSpellId), _newTargetSelectTimer(0)
{
}
@@ -1122,17 +1122,18 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
return true;
}
- SpellCastResult CheckCast()
+ void FilterTargets(std::list<WorldObject*>& targets)
{
if (AuraEffect const* eff = GetCaster()->GetAuraEffect(SPELL_UNBOUND_PLAGUE_SEARCHER, EFFECT_0))
+ {
if (eff->GetTickNumber() < 2)
- return SPELL_FAILED_DONT_REPORT;
+ {
+ targets.clear();
+ return;
+ }
+ }
- return SPELL_CAST_OK;
- }
- void FilterTargets(std::list<WorldObject*>& targets)
- {
targets.remove_if(Trinity::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster())));
Trinity::Containers::RandomResizeList(targets, 1);
}
@@ -1171,7 +1172,6 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
void Register()
{
- OnCheckCast += SpellCheckCastFn(spell_putricide_unbound_plague_SpellScript::CheckCast);
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/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
index 5e6dcbcd66e..af0ca6b3a3f 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp
@@ -207,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_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
index 9f9223f0161..eb0b3692f01 100644
--- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
+++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp
@@ -129,14 +129,14 @@ public:
{
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)));
+ fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO));
+ fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO));
+ fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO));
+ fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO));
+ fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2)));
+ fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount* std::sin(fBaseO-(M_PI/2)));
+ fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::cos(fBaseO-(M_PI/2)));
+ fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount* std::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)
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
index e68e28be99b..c691db4230c 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp
@@ -68,51 +68,6 @@ 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
-{
- 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.
-};
-
enum EregosData
{
DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044
@@ -133,7 +88,7 @@ public:
struct boss_eregosAI : public BossAI
{
boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS_EVENT) { }
-
+
void Reset()
{
_Reset();
@@ -160,7 +115,7 @@ public:
_emeraldVoid = false;
if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true))
_amberVoid = false;
- }
+ }
uint32 GetData(uint32 type)
{
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index 791bc0180e5..8e7863259ad 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -38,7 +38,8 @@ 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
@@ -103,10 +104,9 @@ public:
void Reset()
{
- if (instance->GetBossState(DATA_VAROS_EVENT) != DONE)
- DoCast(SPELL_ARCANE_SHIELD);
-
- _Reset();
+ me->CastSpell(me, SPELL_EVOCATE);
+
+ _Reset();
if (instance->GetData(DATA_UROM_PLATAFORM) == 0)
{
@@ -307,14 +307,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/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
index ca4ae883747..1f4a3d1b229 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp
@@ -56,9 +56,13 @@ public:
eregosCacheGUID = 0;
- azureDragonsList.clear();
+ gwhelpList.clear();
gameObjectList.clear();
- }
+
+ belgaristraszGUID = 0;
+ eternosGUID = 0;
+ verdisaGUID = 0;
+}
void OnUnitDeath(Unit* unit)
{
@@ -112,17 +116,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;
}
}
@@ -159,11 +195,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)
@@ -221,6 +268,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;
@@ -269,6 +341,10 @@ public:
uint64 uromGUID;
uint64 eregosGUID;
+ uint64 belgaristraszGUID;
+ uint64 eternosGUID;
+ uint64 verdisaGUID;
+
uint8 platformUrom;
uint8 centrifugueConstructCounter;
@@ -277,9 +353,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 1d8b5b986f6..f2fa3158603 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp
@@ -20,6 +20,8 @@
#include "ScriptedGossip.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "Vehicle.h"
+#include "CombatAI.h"
#include "oculus.h"
#define GOSSIP_ITEM_DRAKES "So where do we go from here?"
@@ -32,7 +34,7 @@
#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE, 1) || (a)->HasItemCount(ITEM_AMBER_ESSENCE, 1) || (a)->HasItemCount(ITEM_RUBY_ESSENCE, 1))
-enum Drakes
+enum GossipNPCs
{
GOSSIP_TEXTID_DRAKES = 13267,
GOSSIP_TEXTID_BELGARISTRASZ1 = 12916,
@@ -49,25 +51,67 @@ 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") { }
-
- bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
+ npc_verdisa_beglaristrasz_eternos() : CreatureScript("npc_verdisa_beglaristrasz_eternos") { }
+
+ InstanceScript* instance;
+
+ bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (creature->GetEntry())
@@ -184,6 +228,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
@@ -193,7 +259,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)
{
@@ -216,6 +282,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:
@@ -247,9 +483,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/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp
index dcd3a3a91f5..67122b2e859 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
@@ -521,7 +521,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;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
index 98b3a6b658b..6a4a5255293 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp
@@ -21,97 +21,93 @@
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,
+ SAY_YS_HELP = 15
};
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..6038b7ed9d6 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp
@@ -369,7 +369,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);
@@ -407,7 +407,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 +423,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);
@@ -525,7 +525,7 @@ class boss_razorscale : public CreatureScript
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);
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 48667053373..aaa95631792 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
@@ -56,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
@@ -83,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
@@ -107,9 +110,6 @@ public:
InstanceScript* instance;
bool bIsUndead;
- bool bEventInProgress;
-
- uint32 uiSpawnResTimer;
void Reset()
{
@@ -117,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);
@@ -130,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);
}
@@ -156,37 +148,34 @@ 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);
}
- 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);
}
void EnterCombat(Unit* /*who*/)
{
- DoScriptText(YELL_AGGRO_1, me);
+ if (!bIsUndead)
+ DoScriptText(YELL_AGGRO_1, me);
if (instance)
instance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS);
+
+ me->SetInCombatWithZone();
}
void JustDied(Unit* /*killer*/)
@@ -201,6 +190,15 @@ 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)
@@ -211,24 +209,9 @@ public:
void UpdateAI(const uint32 diff)
{
- if (!UpdateVictim())
+ if (!UpdateVictim() && !(events.GetPhaseMask() & (1 << PHASE_EVENT)))
return;
- if (bEventInProgress)
- {
- if (uiSpawnResTimer)
- {
- if (uiSpawnResTimer <= diff)
- {
- DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position
- // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ?
- uiSpawnResTimer = 0;
- } else uiSpawnResTimer -= diff;
- }
-
- return;
- }
-
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
@@ -245,24 +228,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);
@@ -271,8 +263,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;
@@ -411,7 +402,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
@@ -430,32 +422,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 b987b00fa5b..e718942d091 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp
@@ -43,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,
@@ -118,10 +121,7 @@ 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()
{
@@ -138,12 +138,37 @@ public:
onTheRocks = true;
}
- void EnterCombat(Unit* /*who*/)
+ void EnterCombat(Unit* who)
{
me->SetInCombatWithZone();
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*/)
@@ -168,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();
@@ -192,7 +227,10 @@ public:
}
events.ScheduleEvent(EVENT_FROST_TOMB, urand(14,19)*IN_MILLISECONDS);
break;
+ }
}
+
+ DoMeleeAttackIfReady();
}
void SummonSkeletons()
@@ -225,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)
@@ -278,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 be8d60fbeb9..7c977250e79 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp
@@ -47,6 +47,7 @@ enum eEnums
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,
@@ -58,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:
@@ -83,6 +98,7 @@ public:
uint32 Response_Timer;
uint32 Check_Timer;
bool Dalronn_isDead;
+ bool Enraged;
void Reset()
{
@@ -90,6 +106,7 @@ public:
StoneStrike_Timer = 10000;
Dalronn_isDead = false;
Check_Timer = 5000;
+ Enraged = false;
ghost = (me->GetEntry() == MOB_SKARVALD_GHOST);
if (!ghost && instance)
@@ -116,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)
@@ -194,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;
@@ -204,7 +230,8 @@ public:
StoneStrike_Timer = 5000+rand()%5000;
} else StoneStrike_Timer -= diff;
- DoMeleeAttackIfReady();
+ if (!me->HasUnitState(UNIT_STATE_CASTING))
+ DoMeleeAttackIfReady();
}
};
diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
index 2d53e7062eb..c694aa88338 100644
--- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
+++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp
@@ -18,6 +18,8 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "utgarde_keep.h"
+#include "SpellScript.h"
+#include "SpellAuraEffects.h"
uint32 entry_search[3] =
{
@@ -164,7 +166,82 @@ public:
};
};
+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*/)
+ {
+ 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") { }
+
+ class spell_fixate_SpellScript : public SpellScript
+ {
+ 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();
+ }
+};
void AddSC_utgarde_keep()
{
new npc_dragonflayer_forge_master();
+ new spell_ticking_time_bomb();
+ new spell_fixate();
}
diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp
index 9b207c257fc..224d06e9d3c 100644
--- a/src/server/scripts/Northrend/borean_tundra.cpp
+++ b/src/server/scripts/Northrend/borean_tundra.cpp
@@ -1667,7 +1667,6 @@ public:
/*######
## npc_imprisoned_beryl_sorcerer
######*/
-
enum eImprisionedBerylSorcerer
{
SPELL_NEURAL_NEEDLE = 45634,
@@ -1692,103 +1691,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)
- {
+ uint32 step = caster->GetAuraCount(SPELL_NEURAL_NEEDLE) + 1;
+ switch (step)
+ {
+ case 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)
- {
+ break;
+ case 2:
+ DoScriptText(SAY_IMPRISIONED_BERYL_2, me, caster);
+ break;
+ case 3:
DoScriptText(SAY_IMPRISIONED_BERYL_3, me);
- uiStep = 4;
- }
- break;
-
- case 4:
- if (uiStep == 4)
- {
+ break;
+ case 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)
- {
+ break;
+ case 5:
+ DoScriptText(SAY_IMPRISIONED_BERYL_5, me);
+ break;
+ case 6:
+ DoScriptText(SAY_IMPRISIONED_BERYL_6, me, caster);
+ break;
+ case 7:
DoScriptText(SAY_IMPRISIONED_BERYL_7, me);
- uiStep = 1;
- uiPhase = 0;
- }
- break;
+ caster->KilledMonsterCredit(NPC_IMPRISONED_BERYL_SORCERER, 0);
+ break;
+ }
}
}
};
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 e3b1a7e94e1..2937a5b9987 100644
--- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
+++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp
@@ -181,8 +181,8 @@ 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))
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/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp
index 078f8f5a4f0..c84df2ee3d4 100644
--- a/src/server/scripts/Outland/shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/shadowmoon_valley.cpp
@@ -1899,6 +1899,96 @@ class spell_unlocking_zuluheds_chains : public SpellScriptLoader
}
};
+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()
{
new mob_mature_netherwing_drake();
@@ -1917,4 +2007,5 @@ void AddSC_shadowmoon_valley()
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/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index a1c48878507..b46d2083ecd 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -70,7 +70,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 +118,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 +179,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 +413,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 +425,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 +472,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 +582,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 +722,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 32a92da5e3a..6119c9050fa 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -24,6 +24,7 @@
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
+#include "Containers.h"
enum DruidSpells
{
@@ -181,7 +182,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
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;
+ int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * stack / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, aurEff, GetCasterGUID());
return;
}
@@ -204,7 +205,7 @@ class spell_dru_lifebloom : public SpellScriptLoader
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;
+ int32 returnMana = CalculatePct(caster->GetCreateMana(), GetSpellInfo()->ManaCostPercentage) * dispelInfo->GetRemovedCharges() / 2;
caster->CastCustomSpell(caster, DRUID_LIFEBLOOM_ENERGIZE, &returnMana, NULL, NULL, true, NULL, NULL, GetCasterGUID());
return;
}
@@ -255,7 +256,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()
@@ -327,7 +328,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()
@@ -369,7 +370,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);
}
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 3085472749c..5cc31ad54e8 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -1236,7 +1236,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()
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index a2ee6c1c3a3..31aafe8dd38 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -138,7 +138,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 +148,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)
@@ -574,7 +574,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);
}
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 0edfbaee437..f4bbccc8587 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -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 0bf2e5664a0..41bda3c163d 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -24,6 +24,7 @@
#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);
}
}
@@ -566,6 +570,104 @@ class spell_pal_exorcism_and_holy_wrath_damage : public SpellScriptLoader
}
};
+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();
@@ -579,4 +681,6 @@ void AddSC_paladin_spell_scripts()
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..df6c311ca67 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;
}
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index 3d8ca3e729b..aee3889e93b 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -278,7 +278,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);
}
}
@@ -316,7 +316,7 @@ public:
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);
}
}
@@ -432,7 +432,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader
// Pain and Suffering reduces damage
if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1))
- AddPctN(damage, aurEff->GetAmount());
+ AddPct(damage, aurEff->GetAmount());
GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true);
}
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index ad437c5e431..ab6d0e95c1d 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -124,7 +124,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()
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index c863c2363af..e107ea954e4 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -78,7 +78,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 +184,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 +501,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 +592,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 0def62b7d3a..aa56f8300bc 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -410,7 +410,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);
@@ -421,7 +421,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);
}
}
@@ -544,7 +544,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()
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index c64101e11ea..cc8dbe35703 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -183,7 +183,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 +368,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 +400,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/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 5640a84317c..9ade37a1096 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -1954,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);
diff --git a/src/server/shared/Common.h b/src/server/shared/Common.h
index 259c60ade20..ad0e6dd6437 100755
--- 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
--- 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/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index c7a283c94d7..add782cf517 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -420,7 +420,7 @@ 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_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);
@@ -499,6 +499,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE, "UPDATE character_spell SET spell = ? where spell = ? AND guid = ?", CONNECTION_ASYNC);
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_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);
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index 823ad874de9..fedf0022fcc 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -462,6 +462,8 @@ enum CharacterDatabaseStatements
CHAR_UPD_CHAR_SPELL_FACTION_CHANGE,
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,
diff --git a/src/server/shared/Database/MySQLConnection.h b/src/server/shared/Database/MySQLConnection.h
index c597476967d..b0b79ac0a33 100755
--- a/src/server/shared/Database/MySQLConnection.h
+++ b/src/server/shared/Database/MySQLConnection.h
@@ -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/Define.h b/src/server/shared/Define.h
index bb3bab75e87..0f7c2163b7e 100755
--- 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/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
--- 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/Reference.h b/src/server/shared/Dynamic/LinkedReference/Reference.h
index d4c607470cc..6c9710381b9 100755
--- a/src/server/shared/Dynamic/LinkedReference/Reference.h
+++ b/src/server/shared/Dynamic/LinkedReference/Reference.h
@@ -57,13 +57,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 +97,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
--- 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/UnorderedMap.h b/src/server/shared/Dynamic/UnorderedMap.h
index 5e7b48f9b7b..5d485efa89b 100755
--- 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/Log.cpp b/src/server/shared/Logging/Log.cpp
index ed65104d6ac..4538fc75c1e 100755
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -88,8 +88,8 @@ void Log::CreateAppenderFromConfig(const char* name)
std::string options = "Appender.";
options.append(name);
options = ConfigMgr::GetStringDefault(options.c_str(), "");
- Tokens tokens(options, ',');
- Tokens::iterator iter = tokens.begin();
+ Tokenizer tokens(options, ',');
+ Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() < 2)
{
@@ -181,8 +181,8 @@ void Log::CreateLoggerFromConfig(const char* name)
return;
}
- Tokens tokens(options, ',');
- Tokens::iterator iter = tokens.begin();
+ Tokenizer tokens(options, ',');
+ Tokenizer::const_iterator iter = tokens.begin();
if (tokens.size() != 3)
{
@@ -281,9 +281,12 @@ void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list ar
void Log::write(LogMessage* msg)
{
- msg->text.append("\n");
- Logger* logger = GetLoggerByType(msg->type);
- worker->enqueue(new LogOperation(logger, msg));
+ if (worker)
+ {
+ msg->text.append("\n");
+ Logger* logger = GetLoggerByType(msg->type);
+ worker->enqueue(new LogOperation(logger, msg));
+ }
}
std::string Log::GetTimestampStr()
@@ -481,6 +484,7 @@ void Log::Close()
void Log::LoadFromConfig()
{
Close();
+ worker = new LogWorker();
AppenderId = 0;
m_logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
if (!m_logsDir.empty())
@@ -488,5 +492,4 @@ void Log::LoadFromConfig()
m_logsDir.push_back('/');
ReadAppendersFromConfig();
ReadLoggersFromConfig();
- worker = new LogWorker();
}
diff --git a/src/server/shared/Utilities/ByteConverter.h b/src/server/shared/Utilities/ByteConverter.h
index d0790acadd3..05e8b8cc959 100755
--- 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.h b/src/server/shared/Utilities/EventProcessor.h
index 149ca9a4098..0f1a7c15216 100755
--- 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/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 89942b978df..9778e86d444 100755
--- 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>
@@ -56,13 +56,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 +71,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;
}
@@ -471,32 +471,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 37782c31d8b..21aaa36498d 100755
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -19,27 +19,49 @@
#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
{
T val_;
T S::* idMember_;
-
+
Finder(T val, T S::* idMember) : val_(val), idMember_(idMember) {}
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);
@@ -49,27 +71,29 @@ uint32 TimeStringToSecs(const std::string& timestring);
std::string TimeToTimestampStr(time_t t);
/* 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)
@@ -91,58 +115,22 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
}
// Percentage calculation
-template <class T>
-inline T CalculatePctF(T base, float pct)
-{
- return T(base * pct / 100.0f);
-}
-
-template <class T>
-inline T CalculatePctN(T base, int32 pct)
-{
- return T(base * float(pct) / 100.0f);
-}
-
-template <class T>
-inline T CalculatePctU(T base, uint32 pct)
+template <class T, class U>
+inline T CalculatePct(T base, U pct)
{
- return T(base * float(pct) / 100.0f);
+ return T(base * static_cast<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)
+template <class T, class U>
+inline T AddPct(T &base, U pct)
{
- return base = CalculatePctN(base, pct);
+ return base += CalculatePct(base, pct);
}
-template <class T>
-inline T ApplyPctU(T& base, uint32 pct)
+template <class T, class U>
+inline T ApplyPct(T &base, U pct)
{
- return base = CalculatePctU(base, pct);
+ return base = CalculatePct(base, pct);
}
template <class T>
@@ -355,8 +343,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
@@ -404,232 +391,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
+ 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
- {
- 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
+ inline bool operator ==(const flag96 &right) const
{
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return true;
- return false;
+ return
+ (
+ part[0] == right.part[0] &&
+ part[1] == right.part[1] &&
+ part[2] == right.part[2]
+ );
}
- template<class type>
- inline bool operator == (type & right)
+ inline bool operator !=(const flag96 &right) const
{
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return false;
- return true;
+ return !this->operator ==(right);
}
- template<class type>
- inline bool operator == (type & right) const
+ inline flag96 & operator =(const flag96 &right)
{
- if (part[0]!=right.part[0]
- || part[1]!=right.part[1]
- || part[2]!=right.part[2])
- return false;
- return true;
+ 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
{
- part[0]=right.part[0];
- part[1]=right.part[1];
- part[2]=right.part[2];
+ 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)
+ 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 flag96 operator & (type & right) const
+ 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 void operator &= (type & right)
+ inline flag96 & operator |=(const flag96 &right)
{
- *this=*this & right;
+ 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 ret(part[0] | right.part[0], part[1] | right.part[1], part[2] | right.part[2]);
- return
- ret;
+ return flag96(~part[0], ~part[1], ~part[2]);
}
- template<class type>
- inline flag96 operator | (type & right) const
+ 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 void operator |= (type & right)
+ inline flag96 & operator ^=(const flag96 &right)
{
- *this=*this | right;
+ part[0] ^= right.part[0];
+ part[1] ^= right.part[1];
+ part[2] ^= right.part[2];
+ return *this;
}
- inline void operator ~ ()
- {
- part[2]=~part[2];
- part[1]=~part[1];
- part[0]=~part[0];
- };
-
- template<class type>
- inline flag96 operator ^ (type & right)
+ inline operator bool() const
{
- flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
- return
- ret;
+ return (part[0] != 0 || part[1] != 0 || part[2] != 0);
}
- template<class type>
- inline flag96 operator ^ (type & right) const
+ inline bool operator !() const
{
- flag96 ret(part[0] ^ right.part[0], part[1] ^ right.part[1], part[2] ^ right.part[2]);
- return
- ret;
+ return !this->operator bool();
}
- template<class type>
- inline void operator ^= (type & right)
+ inline uint32 & operator [](uint8 el)
{
- *this=*this^right;
+ return part[el];
}
- inline operator bool() const
- {
- return(
- part[0] != 0 ||
- part[1] != 0 ||
- part[2] != 0);
- };
-
- inline operator bool()
+ inline const uint32 & operator [](uint8 el) const
{
- return(
- part[0] != 0 ||
- part[1] != 0 ||
- part[2] != 0);
- };
-
- inline bool operator ! () const
- {
- return(
- part[0] == 0 &&
- part[1] == 0 &&
- part[2] == 0);
- };
-
- inline bool operator ! ()
- {
- return(
- part[0] == 0 &&
- part[1] == 0 &&
- part[2] == 0);
- };
-
- inline uint32 & operator[](uint8 el)
- {
- return (part[el]);
- };
-
- inline uint32 operator[](uint8 el) const
- {
- return (part[el]);
- };
+ return part[el];
+ }
};
#endif