diff options
62 files changed, 1113 insertions, 620 deletions
diff --git a/sql/updates/world/2012_02_11_00_world_creature.sql b/sql/updates/world/2012_02_11_00_world_creature.sql new file mode 100644 index 00000000000..c7d4971cc29 --- /dev/null +++ b/sql/updates/world/2012_02_11_00_world_creature.sql @@ -0,0 +1 @@ +UPDATE `creature` SET `id`=38041 WHERE `guid`=40484; diff --git a/sql/updates/world/2012_02_11_01_world_creature.sql b/sql/updates/world/2012_02_11_01_world_creature.sql new file mode 100644 index 00000000000..898e746d306 --- /dev/null +++ b/sql/updates/world/2012_02_11_01_world_creature.sql @@ -0,0 +1,14 @@ +-- Spawn Elder Ohanzee in Normal and Heroic modes of Gundrak and relocate near Drakkari Colossus (45.7,62) boss (v3.3.2 change). Coordinates are guessed based on https://www.youtube.com/watch?v=FRXgZthksN8 ( ~12min ) +UPDATE `creature` SET `spawnMask`=3,`position_x`=1697.94,`position_y`=752.121,`position_z`=142.765,`orientation`=3.78933 WHERE `guid`=200841; +-- Spawn Elder Kilias in Normal and Heroic modes of Drak'Tharon Keep +UPDATE `creature` SET `spawnMask`=3 WHERE `guid`=200842; +-- Spawn Elder Nurgen in Normal and Heroic modes of Azjol-Nerub +UPDATE `creature` SET `spawnMask`=3 WHERE `guid`=200843; +-- Spawn Elder Yurauk in Normal and Heroic modes of Halls of Stone +UPDATE `creature` SET `spawnMask`=3 WHERE `guid`=200844; +-- Spawn Elder Jarten in Normal and Heroic modes of Utgarde Keep +UPDATE `creature` SET `spawnMask`=3 WHERE `guid`=200845; +-- Spawn Elder Chogan'gada in Normal and Heroic modes of Utgarde Pinnacle +UPDATE `creature` SET `spawnMask`=3 WHERE `guid`=200846; +-- Spawn Elder Igasho in Normal and Heroic modes of The Nexus +UPDATE `creature` SET `spawnMask`=3 WHERE `guid`=200847; diff --git a/sql/updates/world/2012_02_11_02_world_pool.sql b/sql/updates/world/2012_02_11_02_world_pool.sql new file mode 100644 index 00000000000..dd2cf949639 --- /dev/null +++ b/sql/updates/world/2012_02_11_02_world_pool.sql @@ -0,0 +1,19 @@ +SET @pool_id := 352; + +DELETE FROM `pool_template` WHERE `entry` IN (@pool_id, @pool_id+1); +INSERT INTO `pool_template` (`entry`, `max_limit`, `description`) VALUES +(@pool_id,1, 'The Rokk <Master of Cooking> - Daily Quests'), +(@pool_id+1,1, 'Old Man Barlowned - Daily Quests'); + +DELETE FROM `pool_quest` WHERE `entry` IN (11377,11379,11380,11381) AND `pool_entry` = @pool_id; +DELETE FROM `pool_quest` WHERE `entry` IN (11665,11666,11667,11668,11669) AND `pool_entry` = @pool_id+1; +INSERT INTO `pool_quest` (`entry`,`pool_entry`,`description`) VALUES +(11377,@pool_id, 'Revenge is Tasty'), +(11379,@pool_id, 'Super Hot Stew'), +(11380,@pool_id, 'Manalicious'), +(11381,@pool_id, 'Soup for the Soul'), +(11665,@pool_id+1, 'Crocolisks in the City'), +(11666,@pool_id+1, 'Bait Bandits'), +(11667,@pool_id+1, 'The One That Got Away'), +(11668,@pool_id+1, 'Shrimpin Aint Easy'), +(11669,@pool_id+1, 'Felblood Fillet'); diff --git a/sql/updates/world/2012_02_11_03_world_areatrigger.sql b/sql/updates/world/2012_02_11_03_world_areatrigger.sql new file mode 100644 index 00000000000..80e86d52530 --- /dev/null +++ b/sql/updates/world/2012_02_11_03_world_areatrigger.sql @@ -0,0 +1,13 @@ +-- The Botanica and The Mecanar exit areatriggers +DELETE FROM `areatrigger_teleport` WHERE `id` IN (4612,4614); +INSERT INTO `areatrigger_teleport` (`id`,`name`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(4612,'The Botanica',530,3407.110107,1488.479980,182.837753,2.501119), +(4614,'The Mechanar',530,2869.885742,1552.755249,252.158997,0.733993); + +-- Spawn portals +DELETE FROM `gameobject` WHERE `id` IN (184221,184222) AND `guid` IN (233,236,237,242); +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(233,184222,553,1,1,158.952,391.653,-35.5291,0.0494656,0,0,0.0247303,0.999694,300,0,1), +(236,184222,554,1,1,71.1997,149.657,25.5811,3.17222,0,0,0.999883,-0.0153126,300,0,1), +(237,184221,553,1,1,158.952,391.653,-35.5291,0.0494656,0,0,0.0247303,0.999694,300,0,1), +(242,184221,554,1,1,71.1997,149.657,25.5811,3.17222,0,0,0.999883,-0.0153126,300,0,1); diff --git a/sql/updates/world/2012_02_11_04_world_sai.sql b/sql/updates/world/2012_02_11_04_world_sai.sql new file mode 100644 index 00000000000..ba2d106f472 --- /dev/null +++ b/sql/updates/world/2012_02_11_04_world_sai.sql @@ -0,0 +1,49 @@ +SET @NPC_DATURA_BLOODROSE := 28532; +SET @NPC_CAPTURED_DRAKKARI_SCOUT := 28541; +SET @SPELL_IMMOLATION := 40148; + +-- Insert creature_text from sniff +DELETE FROM `creature_text` WHERE `entry` IN (@NPC_DATURA_BLOODROSE,@NPC_CAPTURED_DRAKKARI_SCOUT); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_DATURA_BLOODROSE,0,0,'Indeed. Watch this, $r.',12,0,100,1,0,0,'Bloodrose Datura'), +(@NPC_DATURA_BLOODROSE,1,0,'Here, troll... a gift!',12,0,100,0,0,0,'Bloodrose Datura'), +(@NPC_DATURA_BLOODROSE,2,0,'Ugh... disgusting!',12,0,100,0,0,0,'Bloodrose Datura'), +(@NPC_CAPTURED_DRAKKARI_SCOUT,0,0,'For me? Really, mon?',12,0,100,6,0,0,'Captured Drakkari Scout'), +(@NPC_CAPTURED_DRAKKARI_SCOUT,1,0,'It....it be beautiful!',12,0,100,5,0,0,'Captured Drakkari Scout'); + +-- SmartAIs +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@NPC_DATURA_BLOODROSE,@NPC_CAPTURED_DRAKKARI_SCOUT); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC_DATURA_BLOODROSE,@NPC_CAPTURED_DRAKKARI_SCOUT) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC_DATURA_BLOODROSE*100,@NPC_CAPTURED_DRAKKARI_SCOUT*100) AND `source_type`=9; +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_DATURA_BLOODROSE,0,0,1,62,0,100,0,9714,0,0,0,11,51949,0,0,0,0,0,7,0,0,0,0,0,0,0,'Bloodrose Datura - On gossip select - Spellcast Margarita Kill Credit'), +(@NPC_DATURA_BLOODROSE,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,'Bloodrose Datura - On gossip select - Close gossip'), +(@NPC_DATURA_BLOODROSE,0,2,0,61,0,100,0,0,0,0,0,80,@NPC_DATURA_BLOODROSE*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodrose Datura - On gossip select - Run script'), +(@NPC_DATURA_BLOODROSE*100,9,0,0,0,0,100,0,0,0,0,0,83,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodrose Datura script - Remove npcflag gossip'), +(@NPC_DATURA_BLOODROSE*100,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Bloodrose Datura script - Say line'), +(@NPC_DATURA_BLOODROSE*100,9,2,0,0,0,100,0,0,0,0,0,59,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodrose Datura script - Set walk'), +(@NPC_DATURA_BLOODROSE*100,9,3,0,0,0,100,0,0,0,0,0,69,0,0,0,0,0,0,8,0,0,0,5202.604,-1317.188,242.642,0,'Bloodrose Datura script - Move to position'), +(@NPC_DATURA_BLOODROSE*100,9,4,0,0,0,100,0,2400,2400,0,0,11,51925,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodrose Datura script - Spellcast Throw'), +(@NPC_DATURA_BLOODROSE*100,9,5,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,'Bloodrose Datura script - Say line'), +(@NPC_DATURA_BLOODROSE*100,9,6,0,0,0,100,0,0,0,0,0,45,0,1,0,0,0,0,11,@NPC_CAPTURED_DRAKKARI_SCOUT,10,0,0,0,0,0,'Bloodrose Datura script - Set data'), +(@NPC_DATURA_BLOODROSE*100,9,7,0,0,0,100,0,19000,19000,0,0,11,51927,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodrose Datura script - Spellcast Death_Decay Visual'), +(@NPC_DATURA_BLOODROSE*100,9,8,0,0,0,100,0,0,0,0,0,1,2,0,0,0,0,0,7,0,0,0,0,0,0,0,'Bloodrose Datura script - Say line'), +(@NPC_DATURA_BLOODROSE*100,9,9,0,0,0,100,0,1000,1000,0,0,69,0,0,0,0,0,0,8,0,0,0,5203.73,-1313.077,242.767,0,'Bloodrose Datura script - Move to position'), +(@NPC_DATURA_BLOODROSE*100,9,10,0,0,0,100,0,2500,2500,0,0,66,0,0,0,0,0,0,8,0,0,0,0,0,0,0.419,'Bloodrose Datura script - Set orientation'), +(@NPC_DATURA_BLOODROSE*100,9,11,0,0,0,100,0,500,500,0,0,82,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Bloodrose Datura script - Add npcflag gossip'), + +(@NPC_CAPTURED_DRAKKARI_SCOUT,0,0,0,6,0,100,0,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout - On death - Despawn'), +(@NPC_CAPTURED_DRAKKARI_SCOUT,0,1,2,11,0,100,0,0,0,0,0,91,7,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout - On reset - Remove unit field bytes'), +(@NPC_CAPTURED_DRAKKARI_SCOUT,0,2,3,61,0,100,0,0,0,0,0,96,32,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout - On reset - Remove dynamicflags'), +(@NPC_CAPTURED_DRAKKARI_SCOUT,0,3,0,61,0,100,0,0,0,0,0,28,@SPELL_IMMOLATION,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout - On reset - Remove aura'), +(@NPC_CAPTURED_DRAKKARI_SCOUT,0,4,0,38,0,100,0,0,1,0,0,80,@NPC_CAPTURED_DRAKKARI_SCOUT*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout - On data set - Run script'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,0,0,0,0,100,0,0,0,0,0,66,0,0,0,0,0,0,8,0,0,0,0,0,0,1.653,'Captured Drakkari Scout script - Set orientation'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,1,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Say line'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,2,0,0,0,100,0,3600,3600,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Say line'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,3,0,0,0,100,0,3500,3500,0,0,11,43327,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Spellcast Vomit'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,4,0,0,0,100,0,2500,2500,0,0,11,51929,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Spellcast Bloody Explosion (Green)'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,5,0,0,0,100,0,0,0,0,0,11,51930,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Spellcast Scourge Troll Transform'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,6,0,0,0,100,0,10000,10000,0,0,11,@SPELL_IMMOLATION,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Spellcast'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,7,0,0,0,100,0,500,500,0,0,90,7,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Set unit field bytes'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,8,0,0,0,100,0,1500,1500,0,0,95,32,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Set dynamicflags'), +(@NPC_CAPTURED_DRAKKARI_SCOUT*100,9,9,0,0,0,100,0,8000,8000,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captured Drakkari Scout script - Die'); diff --git a/sql/updates/world/2012_02_11_05_world_sai.sql b/sql/updates/world/2012_02_11_05_world_sai.sql new file mode 100644 index 00000000000..2d773911118 --- /dev/null +++ b/sql/updates/world/2012_02_11_05_world_sai.sql @@ -0,0 +1,65 @@ +SET @NPC_STEFAN := 28518; +SET @NPC_WITHERED_TROLL := 28519; +SET @NPC_NASS := 28521; +SET @NPC_NASS_TARGET_KC_BUNNY := 28523; +SET @SPELL_PLAYER_SUMMON_NASS := 51864; +SET @SPELL_SUMMON_NASS := 51865; +SET @SPELL_KICK_NASS := 51866; +SET @SPELL_COLLECT_HAIR_SAMPLE := 51870; +SET @SPELL_HAIR_SAMPLE_COLLECTED := 51872; +SET @SPELL_QUEST_ACCEPT_SUMMON_NASS := 51889; +SET @SPELL_KICKIN_NASS_QUEST_COMPLETION := 51910; + +-- Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (@SPELL_KICK_NASS,@SPELL_COLLECT_HAIR_SAMPLE,@SPELL_KICKIN_NASS_QUEST_COMPLETION); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,@SPELL_KICK_NASS,0,18,3,@NPC_NASS,0,0,'','Spell Kick Nass only targets Nass'), +(13,0,@SPELL_COLLECT_HAIR_SAMPLE,0,18,1,@NPC_NASS_TARGET_KC_BUNNY,0,0,'','Spell Collect Hair Sample only targets Nass Target KC Bunny'), +(13,0,@SPELL_KICKIN_NASS_QUEST_COMPLETION,0,18,3,@NPC_NASS,0,0,'','Spell Kickin'' Nass: Quest Completion only targets Nass'); + +-- Insert creature_text from sniff +DELETE FROM `creature_text` WHERE `entry` IN (@NPC_STEFAN,@NPC_NASS); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_STEFAN,0,0,'Not sure how ol'' Nass always finds his way back here. Must be by smell....',12,0,100,0,0,0,'Stefan Vadu'), +(@NPC_NASS,0,0,'Let''s go to Zul''Drak he says. We can get to the bottom of this mess, he says...',12,0,33,0,0,0,'Nass'), +(@NPC_NASS,0,1,'One more flock of scourge hair gained, one more shred of dignity lost...',12,0,33,0,0,0,'Nass'), +(@NPC_NASS,0,2,'Are we finished yet?',12,0,33,0,0,0,'Nass'); + +-- Spellscripts +DELETE FROM `spell_scripts` WHERE `id` IN (@SPELL_PLAYER_SUMMON_NASS,@SPELL_QUEST_ACCEPT_SUMMON_NASS,@SPELL_KICKIN_NASS_QUEST_COMPLETION); +INSERT INTO `spell_scripts` (`id`,`effIndex`,`delay`,`command`,`datalong`,`datalong2`,`dataint`,`x`,`y`,`z`,`o`) VALUES +(@SPELL_PLAYER_SUMMON_NASS,0,0,15,@SPELL_SUMMON_NASS,2,0,0,0,0,0), -- On Player Summon Nass cast - Cast Summon Nass +(@SPELL_QUEST_ACCEPT_SUMMON_NASS,0,0,15,@SPELL_SUMMON_NASS,2,0,0,0,0,0), -- On Quest Accept Summon Nass cast - Cast Summon Nass +(@SPELL_KICKIN_NASS_QUEST_COMPLETION,0,0,18,0,0,0,0,0,0,0); -- On Kickin' Nass: Quest Completion - Despawn Nass + +-- SmartAIs +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|32768|256|8, `AIName`='SmartAI' WHERE `entry`=@NPC_NASS; +UPDATE `creature_template` SET `AIName`='SmartAI', `flags_extra`=`flags_extra`|128 WHERE `entry`=@NPC_NASS_TARGET_KC_BUNNY; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry` IN (@NPC_STEFAN,@NPC_WITHERED_TROLL); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC_STEFAN,@NPC_WITHERED_TROLL,@NPC_NASS,@NPC_NASS_TARGET_KC_BUNNY) AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC_NASS*100 AND `source_type`=9; +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_STEFAN,0,0,1,62,0,100,0,9709,0,0,0,11,@SPELL_PLAYER_SUMMON_NASS,0,0,0,0,0,7,0,0,0,0,0,0,0,'Stefan Vadu - On gossip select - Spellcast'), +(@NPC_STEFAN,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,'Stefan Vadu - On gossip select - Close gossip'), +(@NPC_STEFAN,0,2,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Stefan Vadu - On gossip select - Say line'), +(@NPC_STEFAN,0,3,0,19,0,100,0,12630,0,0,0,11,@SPELL_QUEST_ACCEPT_SUMMON_NASS,0,0,0,0,0,7,0,0,0,0,0,0,0,'Stefan Vadu - On quest accept - Spellcast'), + +(@NPC_WITHERED_TROLL,0,0,0,9,0,100,0,0,5,7000,11000,11,54345,0,0,0,0,0,2,0,0,0,0,0,0,0,'Withered Troll - On range - Spellcast Withering Strike'), +(@NPC_WITHERED_TROLL,0,1,0,6,0,100,0,0,0,0,0,11,51869,3,0,0,0,0,1,0,0,0,0,0,0,0,'Withered Troll - On death - Spellcast Summon Nass Target Bunny'), + +(@NPC_NASS,0,0,1,54,0,100,0,0,0,0,0,11,51868,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On summon - Spellcast Nass Periodic Say'), +(@NPC_NASS,0,1,2,61,0,100,0,0,0,0,0,11,61438,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On summon - Spellcast Nass Heartbeat'), +(@NPC_NASS,0,2,3,61,0,100,0,0,0,0,0,8,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On summon - React defensive'), +(@NPC_NASS,0,3,0,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Nass - On summon - Follow'), +(@NPC_NASS,0,4,5,8,0,100,0,@SPELL_KICK_NASS,0,0,0,5,34,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On spellhit - Play emote'), +(@NPC_NASS,0,5,6,61,0,100,0,0,0,0,0,69,0,0,0,0,0,0,19,@NPC_NASS_TARGET_KC_BUNNY,20,0,0,0,0,0,'Nass - On spellhit - Move to closest Nass Target KC Bunny'), +(@NPC_NASS,0,6,0,61,0,100,0,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On spellhit - Set event phase'), +(@NPC_NASS,0,7,0,34,1,100,0,0,0,0,0,11,@SPELL_COLLECT_HAIR_SAMPLE,0,0,0,0,0,19,@NPC_NASS_TARGET_KC_BUNNY,5,0,0,0,0,0,'Nass - On movementinform (phase 1) - Spellcast'), +(@NPC_NASS,0,8,9,8,1,100,0,@SPELL_HAIR_SAMPLE_COLLECTED,0,0,0,11,51871,0,0,0,0,0,23,0,0,0,0,0,0,0,'Nass - On spellhit (phase 1) - Spellcast Nass Kill Credit'), +(@NPC_NASS,0,9,0,61,1,100,0,0,0,0,0,80,@NPC_NASS*100,2,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On spellhit (phase 1) - Run script'), +(@NPC_NASS,0,10,0,8,0,100,0,51867,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass - On spellhit Nass Say - Say line'), +(@NPC_NASS*100,9,0,0,0,1,100,0,1000,1000,0,0,29,0,0,0,0,0,0,23,0,0,0,0,0,0,0,'Nass'' script - Follow'), +(@NPC_NASS*100,9,1,0,0,1,100,0,0,0,0,0,22,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass'' script - Set event phase'), + +(@NPC_NASS_TARGET_KC_BUNNY,0,0,1,8,0,100,0,@SPELL_COLLECT_HAIR_SAMPLE,0,0,0,11,@SPELL_HAIR_SAMPLE_COLLECTED,0,0,0,0,0,7,0,0,0,0,0,0,0,'Nass Target KC Bunny - On spellhit - Spellcast'), +(@NPC_NASS_TARGET_KC_BUNNY,0,1,0,61,0,100,0,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Nass Target KC Bunny - On spellhit - Despawn'); diff --git a/sql/updates/world/2012_02_11_06_world_sai.sql b/sql/updates/world/2012_02_11_06_world_sai.sql new file mode 100644 index 00000000000..5a021bdfb3d --- /dev/null +++ b/sql/updates/world/2012_02_11_06_world_sai.sql @@ -0,0 +1,16 @@ +SET @NPC = 3301; +-- reduce spawn time to ten sec +UPDATE `quest_end_scripts` SET `datalong2`=10000 WHERE `id`=231; +-- Add text for Morgan Ladimore +DELETE FROM `creature_text` WHERE `entry`=@NPC; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(@NPC, 1, 0, 'My sword Archeus served me well in life, but as at last my spirit may pass from the unhappy existence, I need it no longer.', 12, 0, 100, 0, 0, 0, 'Morgan Ladimore - A Daughter''s Love'), +(@NPC, 2, 0, 'I shall cling to the love of my daugter and hope that I will find forgiveness under the Light for my sins.', 12, 0, 100, 0, 0, 0, 'Morgan Ladimore - A Daughter''s Love'); +-- Add SAI to Morgan Ladimore for on spawn +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@NPC; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC 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 +(@NPC,0,0,0,1,0,100,1,0,0,0,0,18,514,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,'Morgan Ladimore - On summon - make passive non-attackable'), +(@NPC,0,1,0,1,0,100,1,4000,4000,0,0,84,1,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,'Morgan Ladimore - 4 sec - say first'), +(@NPC,0,2,0,1,0,100,1,7000,7000,0,0,84,2,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,'Morgan Ladimore - 7 sec - say second'), +(@NPC,0,3,4,1,0,100,1,9000,9000,0,0,90,8,0,0,0,0,0,1,0,0,0,0.0,0.0,0.0,0.0,'Morgan Ladimore - 9 sec - Set bytes1 kneel'); diff --git a/sql/updates/world/2012_02_11_07_world_sai.sql b/sql/updates/world/2012_02_11_07_world_sai.sql new file mode 100644 index 00000000000..935422fed67 --- /dev/null +++ b/sql/updates/world/2012_02_11_07_world_sai.sql @@ -0,0 +1,7 @@ +-- Quest 11529 "Sorlof's Booty" +-- Sorlof SAI +SET @ENTRY := 24914; -- NPC entry +UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +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 +(@ENTRY,0,0,0,6,0,100,0,0,0,0,0,11,45070,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Sorlof - On Death - Cast Sorlof''s Booty on self'); diff --git a/sql/updates/world/2012_02_11_08_world_sai.sql b/sql/updates/world/2012_02_11_08_world_sai.sql new file mode 100644 index 00000000000..81a0307f9ad --- /dev/null +++ b/sql/updates/world/2012_02_11_08_world_sai.sql @@ -0,0 +1 @@ +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=3301 AND `source_type`=0 AND `id`=3 AND `link`=4; diff --git a/sql/updates/world/2012_02_11_09_world_sai_gossip.sql b/sql/updates/world/2012_02_11_09_world_sai_gossip.sql new file mode 100644 index 00000000000..3c49b752ee2 --- /dev/null +++ b/sql/updates/world/2012_02_11_09_world_sai_gossip.sql @@ -0,0 +1,88 @@ +-- Creature Gossip_menu_option Update from sniff +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9511,9590,9592,9780,10220) AND `id`=0; +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9821,9784,9785) AND `id`=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 +(9511,0,0, 'I am ready to be teleported to Dalaran.',1,1,0,0,0,0, ''), +(9590,0,0, 'Why would I want to ride a shredder?',1,1,9592,0,0,0, ''), +(9592,0,0, 'Where can I get a Refurbished Shredder Key?',1,1,9591,0,0,0, ''), +(9780,0,0, 'I am ready to be teleported to Dalaran.',1,1,0,0,0,0, ''), +(9821,1,1, 'I''m looking for a lost companion.',3,128,0,0,0,0, ''), +(9784,1,0, 'I wish to travel to Light''s Breach.',1,1,0,0,0,0, ''), +(9785,1,0, 'I wish to travel to Light''s Breach.',1,1,0,0,0,0, ''), +(10220,0,0, 'I am ready to return to the realm of the living.',1,1,0,0,0,0, ''); + +-- Gossip Menu insert from sniff +DELETE FROM `gossip_menu` WHERE `entry`=9431 AND `text_id`=12694; +DELETE FROM `gossip_menu` WHERE `entry`=9590 AND `text_id`=12943; +DELETE FROM `gossip_menu` WHERE `entry`=9591 AND `text_id`=12945; +DELETE FROM `gossip_menu` WHERE `entry`=9592 AND `text_id`=12944; +DELETE FROM `gossip_menu` WHERE `entry`=10220 AND `text_id`=14208; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(9431,12694), +(9590,12943), +(9591,12945), +(9592,12944), +(10220,14208); + +-- Creature Gossip_menu_id Update from sniff +UPDATE `creature_template` SET `gossip_menu_id`=9431 WHERE `entry`=26814; -- Harrison Jones +UPDATE `creature_template` SET `gossip_menu_id`=10220, `AIName`='SmartAI' WHERE `entry`=26924; -- Gan'jo +UPDATE `creature_template` SET `gossip_menu_id`=9590 WHERE `entry`=27565; -- Gurtor +UPDATE `creature_template` SET `gossip_menu_id`=9780 WHERE `entry` IN (29155,29159,29160,29162); -- Magistrix Kaelana, Magister Varenthas, Magistrix Phaelista, Magister Tyr'ganal +UPDATE `creature_template` SET `gossip_menu_id`=9821 WHERE `entry`=29250; -- Tim Street + +-- Conditions +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (9511,9513,9780,10220) AND `SourceEntry`=0; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (9785,9784) AND `SourceEntry`=1; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,10220,0,0,9,12137,0,0,0,'','Gan''jo - Show gossip option only if player has taken quest 12137'), +(15,9513,0,0,28,12791,0,0,0,'','Show gossip option only if player has complete quest 12791'), +(15,9511,0,0,28,12794,0,0,0,'','Show gossip option only if player has complete quest 12794'), +(15,9780,0,0,28,12791,0,0,0,'','Show gossip option only if player has complete quest 12791'), +(15,9780,0,1,28,12794,0,0,0,'','Show gossip option only if player has complete quest 12794'), +(15,9780,0,2,28,12796,0,0,0,'','Show gossip option only if player has complete quest 12796'), +(15,9784,1,0,28,12770,0,0,0,'','Samuel Clearbook - Show gossip option only if player has complete quest 12770'), +(15,9785,1,0,28,12763,0,0,0,'','Makki Wintergale - Show gossip option only if player has complete quest 12763'); + +-- SmartAIs +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry` IN (23729,26471,26673,27158,29155,29158,29159,29160,29161,29162,29169); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (26853,26876) AND `source_type`=0 AND `id` IN (3,4); -- these npcs already had a SmartAI assigned so deleting the new ids only +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (23729,26471,26673,26924,27158,29155,29158,29159,29160,29161,29162,29169) 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 +(23729,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Baron Ulrik von Stromhearth - On gossip select - Spellcast'), +(23729,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,'Baron Ulrik von Stromhearth - On gossip select - Close gossip'), +(26471,0,0,1,62,0,100,0,9513,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Image of Archmage Aethas Sunreaver - On gossip select - Spellcast'), +(26471,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,'Image of Archmage Aethas Sunreaver - On gossip select - Close gossip'), +(26673,0,0,1,62,0,100,0,9511,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Image of Archmage Modera - On gossip select - Spellcast'), +(26673,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,'Image of Archmage Modera - On gossip select - Close gossip'), +(26853,0,3,4,62,0,100,0,9785,1,0,0,11,53288,0,0,0,0,0,7,0,0,0,0,0,0,0,'Makki Wintergale - On gossip select - Close gossip'), +(26853,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Makki Wintergale - On gossip select - Close gossip'), +(26876,0,3,4,62,0,100,0,9784,1,0,0,11,53311,0,0,0,0,0,7,0,0,0,0,0,0,0,'Samuel Clearbook - On gossip select - Close gossip'), +(26876,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Samuel Clearbook - On gossip select - Close gossip'), +(26924,0,0,1,62,0,100,0,10220,0,0,0,11,61613,0,0,0,0,0,7,0,0,0,0,0,0,0,'Gan''jo - On gossip select - Close gossip'), +(26924,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,'Gan''jo - On gossip select - Close gossip'), +(27158,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Vas the Unstable - On gossip select - Spellcast'), +(27158,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,'Vas the Unstable - On gossip select - Close gossip'), +(29155,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magistrix Kaelana - On gossip select - Spellcast'), +(29155,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,'Magistrix Kaelana - On gossip select - Close gossip'), +(29158,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magister Dath''omere - On gossip select - Spellcast'), +(29158,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,'Magister Dath''omere - On gossip select - Close gossip'), +(29159,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magister Varenthas - On gossip select - Spellcast'), +(29159,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,'Magister Varenthas - On gossip select - Close gossip'), +(29160,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magistrix Phaelista - On gossip select - Spellcast'), +(29160,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,'Magistrix Phaelista - On gossip select - Close gossip'), +(29161,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magistrix Haelenai - On gossip select - Spellcast'), +(29161,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,'Magistrix Haelenai - On gossip select - Close gossip'), +(29162,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magister Tyr''ganal - On gossip select - Spellcast'), +(29162,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,'Magister Tyr''ganal - On gossip select - Close gossip'), +(29169,0,0,1,62,0,100,0,9780,0,0,0,11,30719,0,0,0,0,0,7,0,0,0,0,0,0,0,'Magister Teronus III - On gossip select - Spellcast'), +(29169,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,'Magister Teronus III - On gossip select - Close gossip'); + +DELETE FROM `spell_target_position` WHERE `id`=30719; +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(30719,571,5807.83,587.96,660.939,1.663); -- Teleport to Dalaran + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (53288,53311); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(53288,53289,1,'Flight - Onequah to Light''s Breach trigger Flight - Onequah to Light''s Breach'), +(53311,53310,1,'Flight - Westfall to Light''s Breach trigger Flight - Westfall to Light''s Breach'); diff --git a/sql/updates/world/2012_02_11_10_world_sai.sql b/sql/updates/world/2012_02_11_10_world_sai.sql new file mode 100644 index 00000000000..f2095e320fd --- /dev/null +++ b/sql/updates/world/2012_02_11_10_world_sai.sql @@ -0,0 +1,4 @@ +-- Set the State in the SmartAI upon Death of Ward Keeper in the Instance +DELETE FROM `smart_scripts` WHERE `entryorguid` = 4625 AND `source_type` = 0 AND `id` = 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 +(4625,0,1,0,6,0,100,2,0,0,0,0,34,1,1,0,0,0,0,0,0,0,0,0,0,0,0,'Ward Keepers - Send Event on Die'); diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp index 1d6877d1209..89e76d426fe 100644 --- a/src/server/collision/DynamicTree.cpp +++ b/src/server/collision/DynamicTree.cpp @@ -176,6 +176,54 @@ struct DynamicTreeIntersectionCallback_WithLogger bool didHit() const { return did_hit;} }; +bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray, const Vector3& endPos, float& maxDist) const +{ + float distance = maxDist; + DynamicTreeIntersectionCallback callback(phasemask); + impl.intersectRay(ray, callback, distance, endPos); + if (callback.didHit()) + maxDist = distance; + return callback.didHit(); +} + +bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const Vector3& startPos, const Vector3& endPos, Vector3& resultHit, float modifyDist) const +{ + bool result = false; + float maxDist = (endPos - startPos).magnitude(); + // valid map coords should *never ever* produce float overflow, but this would produce NaNs too + ASSERT(maxDist < std::numeric_limits<float>::max()); + // prevent NaN values which can cause BIH intersection to enter infinite loop + if (maxDist < 1e-10f) + { + resultHit = endPos; + return false; + } + Vector3 dir = (endPos - startPos)/maxDist; // direction with length of 1 + G3D::Ray ray(startPos, dir); + float dist = maxDist; + if (getIntersectionTime(phasemask, ray, endPos, dist)) + { + resultHit = startPos + dir * dist; + if (modifyDist < 0) + { + if ((resultHit - startPos).magnitude() > -modifyDist) + resultHit = resultHit + dir*modifyDist; + else + resultHit = startPos; + } + else + resultHit = resultHit + dir*modifyDist; + + result = true; + } + else + { + resultHit = endPos; + result = false; + } + return result; +} + bool DynamicMapTree::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const { Vector3 v1(x1,y1,z1), v2(x2,y2,z2); diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h index ab28641b6ad..0b4f5908c04 100644 --- a/src/server/collision/DynamicTree.h +++ b/src/server/collision/DynamicTree.h @@ -46,6 +46,8 @@ public: ~DynamicMapTree(); bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; + bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray, const Vector3& endPos, float& maxDist) const; + bool getObjectHitPos(uint32 phasemask, const Vector3& pPos1, const Vector3& pPos2, Vector3& pResultHitPos, float pModifyDist) const; float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const; void insert(const GameObjectModel&); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 4b15805c2c9..1cf78c4a59c 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -85,14 +85,9 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3 if (eventType == e/* && (!(*i).event.event_phase_mask || IsInPhase((*i).event.event_phase_mask)) && !((*i).event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE && (*i).runOnce)*/) { bool meets = true; - if (unit) - { - if (Player* player = unit->ToPlayer()) - { - ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); - meets = sConditionMgr->IsObjectMeetToConditions(player, conds); - } - } + ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); + ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject()); + meets = sConditionMgr->IsObjectMeetToConditions(info, conds); if (meets) ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 08ca406e373..10c0e75ed88 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -194,26 +194,26 @@ Battleground::Battleground() m_HonorMode = BG_NORMAL; - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_2M; + StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; + StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; + StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; //we must set to some default existing values - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + 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; } Battleground::~Battleground() { // remove objects and creatures // (this is done automatically in mapmanager update, when the instance is reset after the reset time) - uint32 size = uint32(m_BgCreatures.size()); + uint32 size = uint32(BgCreatures.size()); for (uint32 i = 0; i < size; ++i) DelCreature(i); - size = uint32(m_BgObjects.size()); + size = uint32(BgObjects.size()); for (uint32 i = 0; i < size; ++i) DelObject(i); @@ -229,7 +229,7 @@ Battleground::~Battleground() // remove from bg free slot queue RemoveFromBGFreeSlotQueue(); - for (BattlegroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) + for (BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr) delete itr->second; } @@ -452,21 +452,21 @@ inline void Battleground::_ProcessJoin(uint32 diff) } StartingEventCloseDoors(); - SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FIRST]); + SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FIRST]); // First start warning - 2 or 1 minute - SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 1 minute or 30 seconds, warning is signalled - else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) + else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) { m_Events |= BG_STARTING_EVENT_2; - SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 30 or 15 seconds, warning is signalled - else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) + else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) { m_Events |= BG_STARTING_EVENT_3; - SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // Delay expired (atfer 2 or 1 minute) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) @@ -475,9 +475,9 @@ inline void Battleground::_ProcessJoin(uint32 diff) StartingEventOpenDoors(); - SendWarningToAll(m_StartMessageIds[BG_STARTING_EVENT_FOURTH]); + SendWarningToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH]); SetStatus(STATUS_IN_PROGRESS); - SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]); + SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]); // Remove preparation if (isArena()) @@ -919,11 +919,11 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac participant = true; } - BattlegroundScoreMap::iterator itr2 = m_PlayerScores.find(guid); - if (itr2 != m_PlayerScores.end()) + BattlegroundScoreMap::iterator itr2 = PlayerScores.find(guid); + if (itr2 != PlayerScores.end()) { delete itr2->second; // delete player's score - m_PlayerScores.erase(itr2); + PlayerScores.erase(itr2); } RemovePlayerFromResurrectQueue(guid); @@ -1057,9 +1057,9 @@ void Battleground::Reset() m_Players.clear(); - for (BattlegroundScoreMap::const_iterator itr = m_PlayerScores.begin(); itr != m_PlayerScores.end(); ++itr) + for (BattlegroundScoreMap::const_iterator itr = PlayerScores.begin(); itr != PlayerScores.end(); ++itr) delete itr->second; - m_PlayerScores.clear(); + PlayerScores.clear(); ResetBGSubclass(); } @@ -1331,8 +1331,8 @@ bool Battleground::HasFreeSlots() const void Battleground::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { //this procedure is called from virtual function implemented in bg subclass - BattlegroundScoreMap::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + BattlegroundScoreMap::const_iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found... return; switch (type) @@ -1401,8 +1401,8 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid) bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/) { - // If the assert is called, means that m_BgObjects must be resized! - ASSERT(type < m_BgObjects.size()); + // If the assert is called, means that BgObjects must be resized! + ASSERT(type < BgObjects.size()); Map* map = FindBgMap(); if (!map) @@ -1449,7 +1449,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float delete go; return false; } - m_BgObjects[type] = go->GetGUID(); + BgObjects[type] = go->GetGUID(); return true; } @@ -1457,7 +1457,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float // It would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code void Battleground::DoorClose(uint32 type) { - if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type])) { // If doors are open, close it if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) @@ -1469,12 +1469,12 @@ void Battleground::DoorClose(uint32 type) } else sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); + type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } void Battleground::DoorOpen(uint32 type) { - if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type])) { // Change state to be sure they will be opened obj->SetLootState(GO_READY); @@ -1482,31 +1482,31 @@ void Battleground::DoorOpen(uint32 type) } else sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); + type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } GameObject* Battleground::GetBGObject(uint32 type) { - GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type]); + GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]); if (!obj) sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); + type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); return obj; } Creature* Battleground::GetBGCreature(uint32 type) { - Creature* creature = GetBgMap()->GetCreature(m_BgCreatures[type]); + Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]); if (!creature) sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(m_BgCreatures[type]), m_MapId, m_InstanceID); + type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); return creature; } void Battleground::SpawnBGObject(uint32 type, uint32 respawntime) { if (Map* map = FindBgMap()) - if (GameObject* obj = map->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = map->GetGameObject(BgObjects[type])) { if (respawntime) obj->SetLootState(GO_JUST_DEACTIVATED); @@ -1521,8 +1521,8 @@ void Battleground::SpawnBGObject(uint32 type, uint32 respawntime) Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime) { - // If the assert is called, means that m_BgCreatures must be resized! - ASSERT(type < m_BgCreatures.size()); + // If the assert is called, means that BgCreatures must be resized! + ASSERT(type < BgCreatures.size()); Map* map = FindBgMap(); if (!map) @@ -1557,7 +1557,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f return NULL; } - m_BgCreatures[type] = creature->GetGUID(); + BgCreatures[type] = creature->GetGUID(); if (respawntime) creature->SetRespawnDelay(respawntime); @@ -1567,37 +1567,37 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f bool Battleground::DelCreature(uint32 type) { - if (!m_BgCreatures[type]) + if (!BgCreatures[type]) return true; - if (Creature* creature = GetBgMap()->GetCreature(m_BgCreatures[type])) + if (Creature* creature = GetBgMap()->GetCreature(BgCreatures[type])) { creature->AddObjectToRemoveList(); - m_BgCreatures[type] = 0; + BgCreatures[type] = 0; return true; } sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(m_BgCreatures[type]), m_MapId, m_InstanceID); - m_BgCreatures[type] = 0; + type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); + BgCreatures[type] = 0; return false; } bool Battleground::DelObject(uint32 type) { - if (!m_BgObjects[type]) + if (!BgObjects[type]) return true; - if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type])) { obj->SetRespawnTime(0); // not save respawn time obj->Delete(); - m_BgObjects[type] = 0; + BgObjects[type] = 0; return true; } sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); - m_BgObjects[type] = 0; + type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + BgObjects[type] = 0; return false; } @@ -1715,8 +1715,8 @@ void Battleground::HandleTriggerBuff(uint64 go_guid) return; // Change buff type, when buff is used: - int32 index = m_BgObjects.size() - 1; - while (index >= 0 && m_BgObjects[index] != go_guid) + int32 index = BgObjects.size() - 1; + while (index >= 0 && BgObjects[index] != go_guid) index--; if (index < 0) { @@ -1837,8 +1837,8 @@ void Battleground::SetHoliday(bool is_holiday) int32 Battleground::GetObjectType(uint64 guid) { - for (uint32 i = 0; i < m_BgObjects.size(); ++i) - if (m_BgObjects[i] == guid) + for (uint32 i = 0; i < BgObjects.size(); ++i) + if (BgObjects[i] == guid) return i; sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?", GUID_LOPART(guid), m_MapId, m_InstanceID); diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 6eb64a2caba..32f6ebc92de 100755 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -411,9 +411,9 @@ class Battleground uint32 GetPlayersSize() const { return m_Players.size(); } typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap; - BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return m_PlayerScores.begin(); } - BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return m_PlayerScores.end(); } - uint32 GetPlayerScoresSize() const { return m_PlayerScores.size(); } + BattlegroundScoreMap::const_iterator GetPlayerScoresBegin() const { return PlayerScores.begin(); } + BattlegroundScoreMap::const_iterator GetPlayerScoresEnd() const { return PlayerScores.end(); } + uint32 GetPlayerScoresSize() const { return PlayerScores.size(); } uint32 GetReviveQueueSize() const { return m_ReviveQueue.size(); } @@ -539,8 +539,8 @@ class Battleground // TODO: make this protected: typedef std::vector<uint64> BGObjects; typedef std::vector<uint64> BGCreatures; - BGObjects m_BgObjects; - BGCreatures m_BgCreatures; + BGObjects BgObjects; + BGCreatures BgCreatures; void SpawnBGObject(uint32 type, uint32 respawntime); bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime = 0); Creature* AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime = 0); @@ -589,7 +589,7 @@ class Battleground void _ProcessJoin(uint32 diff); // Scorekeeping - BattlegroundScoreMap m_PlayerScores; // Player scores + BattlegroundScoreMap PlayerScores; // Player scores // must be implemented in BG subclass virtual void RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) {} @@ -600,9 +600,9 @@ class Battleground // these are important variables used for starting messages uint8 m_Events; - BattlegroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT]; + BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT]; // this must be filled in constructors! - uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT]; + uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]; bool m_BuffChange; bool m_IsRandom; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp index 61180ae88ea..e4c1b484d4d 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp @@ -23,15 +23,15 @@ BattlegroundAA::BattlegroundAA() { - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + 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 - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + 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() @@ -53,7 +53,7 @@ void BattlegroundAA::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundAAScore* sc = new BattlegroundAAScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; } void BattlegroundAA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 1e128429533..71f0ce29aec 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -31,13 +31,13 @@ BattlegroundAB::BattlegroundAB() { m_BuffChange = true; - m_BgObjects.resize(BG_AB_OBJECT_MAX); - m_BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers + BgObjects.resize(BG_AB_OBJECT_MAX); + BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; } BattlegroundAB::~BattlegroundAB() @@ -202,7 +202,7 @@ void BattlegroundAB::AddPlayer(Player* player) //create score and add it to map, default values are set in the constructor BattlegroundABScore* sc = new BattlegroundABScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; } void BattlegroundAB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) @@ -395,7 +395,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node) DelCreature(node+7);//NULL checks are in DelCreature! 0-6 spirit guides // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard - std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; + std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]]; if (!ghost_list.empty()) { WorldSafeLocsEntry const* ClosestGrave = NULL; @@ -413,7 +413,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node) } } - if (m_BgCreatures[node]) + if (BgCreatures[node]) DelCreature(node); // buff object isn't despawned @@ -426,11 +426,11 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ return; uint8 node = BG_AB_NODE_STABLES; - GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[node*8+7]); + GameObject* obj = GetBgMap()->GetGameObject(BgObjects[node*8+7]); while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj, 10)))) { ++node; - obj = GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); + obj = GetBgMap()->GetGameObject(BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); } if (node == BG_AB_DYNAMIC_NODES_COUNT) @@ -614,7 +614,7 @@ void BattlegroundAB::Reset() } for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT + 5; ++i)//+5 for aura triggers - if (m_BgCreatures[i]) + if (BgCreatures[i]) DelCreature(i); } @@ -673,8 +673,8 @@ WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveYard(Player* player) void BattlegroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found... return; switch (type) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index f2e8c2bf0af..801b522feab 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -29,13 +29,13 @@ BattlegroundAV::BattlegroundAV() { - m_BgObjects.resize(BG_AV_OBJECT_MAX); - m_BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); + BgObjects.resize(BG_AV_OBJECT_MAX); + BgCreatures.resize(AV_CPLACE_MAX+AV_STATICCPLACE_MAX); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; } BattlegroundAV::~BattlegroundAV() @@ -430,7 +430,7 @@ void BattlegroundAV::AddPlayer(Player* player) Battleground::AddPlayer(player); //create score and add it to map, default values are set in constructor BattlegroundAVScore* sc = new BattlegroundAVScore; - m_PlayerScores[player->GetGUID()] = sc; + 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.. @@ -532,8 +532,8 @@ void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger) void BattlegroundAV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found... return; switch (type) @@ -585,7 +585,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { uint8 tmp = node-BG_AV_NODES_DUNBALDAR_SOUTH; //despawn marshal - if (m_BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp]) + if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp]) DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp); else sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp); @@ -649,10 +649,10 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av depopulating mine %i (0=north, 1=south)", mine); if (mine == AV_SOUTH_MINE) for (uint16 i=AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++) - if (m_BgCreatures[i]) + if (BgCreatures[i]) DelCreature(i); //TODO just set the respawntime to 999999 for (uint16 i=((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_1_MIN:AV_CPLACE_MINE_S_1_MIN); i <= ((mine == AV_NORTH_MINE)?AV_CPLACE_MINE_N_3:AV_CPLACE_MINE_S_3); i++) - if (m_BgCreatures[i]) + if (BgCreatures[i]) DelCreature(i); //TODO here also } SendMineWorldStates(mine); @@ -750,7 +750,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) else creatureid = (owner == ALLIANCE)? AV_NPC_A_GRAVEDEFENSE3 : AV_NPC_H_GRAVEDEFENSE3; //spiritguide - if (m_BgCreatures[node]) + if (BgCreatures[node]) DelCreature(node); if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], owner)) sLog->outError("AV: couldn't spawn spiritguide at node %i", node); @@ -783,10 +783,10 @@ void BattlegroundAV::DePopulateNode(BG_AV_Nodes node) { uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node); for (uint8 i=0; i<4; i++) - if (m_BgCreatures[c_place+i]) + if (BgCreatures[c_place+i]) DelCreature(c_place+i); //spiritguide - if (!IsTower(node) && m_BgCreatures[node]) + if (!IsTower(node) && BgCreatures[node]) DelCreature(node); //remove bonus honor aura trigger creature when node is lost @@ -1029,7 +1029,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION+3*node, RESPAWN_IMMEDIATELY); //neutral aura spawn SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+GetTeamIndexByTeamId(owner)+3*node, RESPAWN_ONE_DAY); //teeamaura despawn // Those who are waiting to resurrect at this object are taken to the closest own object's graveyard - std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; + std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]]; if (!ghost_list.empty()) { Player* player; @@ -1044,7 +1044,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) else player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); } - m_ReviveQueue[m_BgCreatures[node]].clear(); + m_ReviveQueue[BgCreatures[node]].clear(); } } DePopulateNode(node); @@ -1490,7 +1490,7 @@ void BattlegroundAV::ResetBGSubclass() m_Mine_Timer=AV_MINE_TICK_TIMER; for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++) - if (m_BgCreatures[i]) + if (BgCreatures[i]) DelCreature(i); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 0e79296b6f4..c7eddbb67a9 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -26,17 +26,17 @@ BattlegroundBE::BattlegroundBE() { - m_BgObjects.resize(BG_BE_OBJECT_MAX); + BgObjects.resize(BG_BE_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + 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 - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + 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; } BattlegroundBE::~BattlegroundBE() @@ -68,7 +68,7 @@ void BattlegroundBE::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundBEScore* sc = new BattlegroundBEScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; UpdateArenaWorldState(); } @@ -116,10 +116,10 @@ void BattlegroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger) switch (Trigger) { case 4538: // buff trigger? - //buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1]; + //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_1]; break; case 4539: // buff trigger? - //buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_2]; + //buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2]; break; default: sLog->outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger); @@ -164,8 +164,8 @@ bool BattlegroundBE::SetupBattleground() void BattlegroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found... return; //there is nothing special in this score diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 0a168491996..d24058cdd8a 100755..100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -26,17 +26,17 @@ BattlegroundDS::BattlegroundDS() { - m_BgObjects.resize(BG_DS_OBJECT_MAX); + BgObjects.resize(BG_DS_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + 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 - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + 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; } BattlegroundDS::~BattlegroundDS() @@ -46,25 +46,34 @@ BattlegroundDS::~BattlegroundDS() void BattlegroundDS::PostUpdateImpl(uint32 diff) { + if (GetStatus() != STATUS_IN_PROGRESS) + return; + if (getWaterFallTimer() < diff) { - if (isWaterFallActive()) + if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_OFF) // Add the water { - setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); - SpawnBGObject(BG_DS_OBJECT_WATER_2, getWaterFallTimer()); - // turn off collision - if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) - gob->EnableCollision(false); - setWaterFallActive(false); + DoorClose(BG_DS_OBJECT_WATER_2); + setWaterFallTimer(BG_DS_WATERFALL_WARNING_DURATION); + setWaterFallStatus(BG_DS_WATERFALL_STATUS_WARNING); } - else + else if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_WARNING) // Active collision { + if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) + gob->SetGoState(GO_STATE_READY); + setWaterFallTimer(BG_DS_WATERFALL_DURATION); - SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY); - // Turn on collision - if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) - gob->EnableCollision(true); - setWaterFallActive(true); + setWaterFallStatus(BG_DS_WATERFALL_STATUS_ON); + } + else //if (getWaterFallStatus() == BG_DS_WATERFALL_STATUS_ON) // Remove collision and water + { + // turn off collision + if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) + gob->SetGoState(GO_STATE_ACTIVE); + + DoorOpen(BG_DS_OBJECT_WATER_2); + setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); + setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF); } } else @@ -86,19 +95,23 @@ void BattlegroundDS::StartingEventOpenDoors() SpawnBGObject(i, 60); setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); - setWaterFallActive(false); + setWaterFallStatus(BG_DS_WATERFALL_STATUS_OFF); + + SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY); + DoorOpen(BG_DS_OBJECT_WATER_2); - for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) - SpawnBGObject(i, getWaterFallTimer()); + // Turn off collision + if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[BG_DS_OBJECT_WATER_1])) + gob->SetGoState(GO_STATE_ACTIVE); } void BattlegroundDS::AddPlayer(Player* player) { Battleground::AddPlayer(player); //create score and add it to map, default values are set in constructor - BattlegroundDSScore* sc = new BattlegroundDSScore; + BattlegroundDSScore* score = new BattlegroundDSScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = score; UpdateArenaWorldState(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 1ec465864d5..7efc6e1caa7 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -46,7 +46,12 @@ enum BattlegroundDSData { // These values are NOT blizzlike... need the correct data! BG_DS_WATERFALL_TIMER_MIN = 30000, BG_DS_WATERFALL_TIMER_MAX = 60000, + BG_DS_WATERFALL_WARNING_DURATION = 7000, BG_DS_WATERFALL_DURATION = 10000, + + BG_DS_WATERFALL_STATUS_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking + BG_DS_WATERFALL_STATUS_ON = 2, // LoS and Movement blocking active + BG_DS_WATERFALL_STATUS_OFF = 3, }; class BattlegroundDSScore : public BattlegroundScore @@ -76,14 +81,14 @@ class BattlegroundDS : public Battleground void HandleKillPlayer(Player* player, Player* killer); bool HandlePlayerUnderMap(Player* player); private: - uint32 m_waterTimer; - bool m_waterfallActive; + uint32 _waterfallTimer; + uint8 _waterfallStatus; virtual void PostUpdateImpl(uint32 diff); protected: - bool isWaterFallActive() { return m_waterfallActive; }; - void setWaterFallActive(bool active) { m_waterfallActive = active; }; - void setWaterFallTimer(uint32 timer) { m_waterTimer = timer; }; - uint32 getWaterFallTimer() { return m_waterTimer; }; + uint32 getWaterFallStatus() { return _waterfallStatus; }; + void setWaterFallStatus(uint32 status) { _waterfallStatus = status; }; + void setWaterFallTimer(uint32 timer) { _waterfallTimer = timer; }; + uint32 getWaterFallTimer() { return _waterfallTimer; }; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index b7994d0052c..344dc79fe79 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -37,17 +37,17 @@ uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = { BattlegroundEY::BattlegroundEY() { m_BuffChange = true; - m_BgObjects.resize(BG_EY_OBJECT_MAX); - m_BgCreatures.resize(BG_EY_CREATURES_MAX); + BgObjects.resize(BG_EY_OBJECT_MAX); + BgCreatures.resize(BG_EY_CREATURES_MAX); m_Points_Trigger[FEL_REAVER] = TR_FEL_REAVER_BUFF; m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF; m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; } BattlegroundEY::~BattlegroundEY() @@ -143,7 +143,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint() GameObject* obj = NULL; for (uint8 i = 0; i < EY_POINTS_MAX; ++i) { - obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); + obj = HashMapHolder<GameObject>::Find(BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); if (obj) { uint8 j = 0; @@ -183,7 +183,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() GameObject* obj = NULL; for (uint8 i = 0; i < EY_POINTS_MAX; ++i) { - obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); + obj = HashMapHolder<GameObject>::Find(BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); if (obj) { uint8 j = 0; @@ -340,7 +340,7 @@ void BattlegroundEY::AddPlayer(Player* player) m_PlayersNearPoint[EY_POINTS_MAX].push_back(player->GetGUID()); - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; } void BattlegroundEY::RemovePlayer(Player* player, uint64 guid, uint32 /*team*/) @@ -735,7 +735,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point) else SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, Source); - if (m_BgCreatures[Point]) + if (BgCreatures[Point]) DelCreature(Point); WorldSafeLocsEntry const* sg = NULL; @@ -807,8 +807,8 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found + BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found return; switch (type) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 40f31cef394..e5ec15bf60d 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -28,13 +28,13 @@ BattlegroundIC::BattlegroundIC() { - m_BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS); - m_BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS); + BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS); + BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE; + 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++) factionReinforcements[i] = MAX_REINFORCEMENTS; @@ -298,7 +298,7 @@ void BattlegroundIC::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundICScore* sc = new BattlegroundICScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; if (nodePoint[NODE_TYPE_QUARRY].nodeState == (player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H)) player->CastSpell(player, SPELL_QUARRY, true); @@ -327,9 +327,9 @@ void BattlegroundIC::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) void BattlegroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - std::map<uint64, BattlegroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID()); + std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + if (itr == PlayerScores.end()) // player not found... return; switch (type) @@ -476,7 +476,7 @@ void BattlegroundIC::EndBattleground(uint32 winner) void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType) { // Those who are waiting to resurrect at this node are taken to the closest own node's graveyard - std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]]; + std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]]; if (!ghost_list.empty()) { WorldSafeLocsEntry const* ClosestGrave = NULL; @@ -528,7 +528,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target // if we are here means that the point has been lost, or it is the first capture if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY) - if (m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2]) + if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2]) DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2); UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index cee8cb2b4da..0974c96a991 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -26,17 +26,17 @@ BattlegroundNA::BattlegroundNA() { - m_BgObjects.resize(BG_NA_OBJECT_MAX); + BgObjects.resize(BG_NA_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + 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 - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + 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; } BattlegroundNA::~BattlegroundNA() @@ -65,7 +65,7 @@ void BattlegroundNA::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundNAScore* sc = new BattlegroundNAScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; UpdateArenaWorldState(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp index c304c194a71..98985b41b5a 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp @@ -24,10 +24,10 @@ BattlegroundRB::BattlegroundRB() { //TODO FIX ME! - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + 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() @@ -49,7 +49,7 @@ void BattlegroundRB::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundRBScore* sc = new BattlegroundRBScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; } void BattlegroundRB::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) @@ -65,9 +65,9 @@ void BattlegroundRB::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) void BattlegroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - std::map<uint64, BattlegroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID()); + std::map<uint64, BattlegroundScore*>::iterator itr = PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + if (itr == PlayerScores.end()) // player not found... return; Battleground::UpdatePlayerScore(Source, type, value, doAddHonor); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index f1602507cc1..6a626217a4e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -26,17 +26,17 @@ BattlegroundRL::BattlegroundRL() { - m_BgObjects.resize(BG_RL_OBJECT_MAX); + BgObjects.resize(BG_RL_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + 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 - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + 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; } BattlegroundRL::~BattlegroundRL() @@ -65,7 +65,7 @@ void BattlegroundRL::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundRLScore* sc = new BattlegroundRLScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; UpdateArenaWorldState(); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index ac3ee2642f4..64167690633 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -26,17 +26,17 @@ BattlegroundRV::BattlegroundRV() { - m_BgObjects.resize(BG_RV_OBJECT_MAX); + BgObjects.resize(BG_RV_OBJECT_MAX); - m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; - m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; - m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; - m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; + 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 - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + 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() @@ -110,7 +110,7 @@ void BattlegroundRV::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundRVScore* sc = new BattlegroundRVScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE)); UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE)); @@ -229,13 +229,18 @@ void BattlegroundRV::TogglePillarCollision(bool apply) { for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i) { - if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[i])) + if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[i])) { - bool startOpen = (gob->GetGoType() == GAMEOBJECT_TYPE_DOOR || gob->GetGoType() == GAMEOBJECT_TYPE_BUTTON ? gob->GetGOInfo()->door.startOpen : false); - if (startOpen) - gob->EnableCollision(!apply); - else - gob->EnableCollision(apply); + if (i >= BG_RV_OBJECT_PILAR_COLLISION_1) + { + uint32 _state = GO_STATE_READY; + if (gob->GetGOInfo()->door.startOpen) + _state = GO_STATE_ACTIVE; + gob->SetGoState(apply ? (GOState)_state : (GOState)(!_state)); + + if (gob->GetGOInfo()->door.startOpen) + gob->EnableCollision(!apply); // Forced collision toggle + } for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 5ee1a7bcc58..b236bd41210 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -26,12 +26,12 @@ BattlegroundSA::BattlegroundSA() { - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN; - m_BgObjects.resize(BG_SA_MAXOBJ); - m_BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY); + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN; + BgObjects.resize(BG_SA_MAXOBJ); + BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY); TimerEnabled = false; UpdateWaitTimer = 0; SignaledRoundTwo = false; @@ -460,7 +460,7 @@ void BattlegroundSA::AddPlayer(Player* player) player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0); } SendTransportInit(player); - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; } void BattlegroundSA::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) @@ -476,8 +476,8 @@ void BattlegroundSA::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) void BattlegroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found... + BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found... return; if (type == SCORE_DESTROYED_DEMOLISHER) @@ -563,7 +563,7 @@ void BattlegroundSA::HandleKillUnit(Creature* unit, Player* killer) */ void BattlegroundSA::OverrideGunFaction() { - if (!m_BgCreatures[0]) + if (!BgCreatures[0]) return; for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++) @@ -581,7 +581,7 @@ void BattlegroundSA::OverrideGunFaction() void BattlegroundSA::DemolisherStartState(bool start) { - if (!m_BgCreatures[0]) + if (!BgCreatures[0]) return; for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) @@ -863,7 +863,7 @@ void BattlegroundSA::UpdateDemolisherSpawns() { for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++) { - if (m_BgCreatures[i]) + if (BgCreatures[i]) { if (Creature* Demolisher = GetBGCreature(i)) { @@ -898,12 +898,12 @@ void BattlegroundSA::UpdateDemolisherSpawns() void BattlegroundSA::SendTransportInit(Player* player) { - if (m_BgObjects[BG_SA_BOAT_ONE] || m_BgObjects[BG_SA_BOAT_TWO]) + if (BgObjects[BG_SA_BOAT_ONE] || BgObjects[BG_SA_BOAT_TWO]) { UpdateData transData; - if (m_BgObjects[BG_SA_BOAT_ONE]) + if (BgObjects[BG_SA_BOAT_ONE]) GetBGObject(BG_SA_BOAT_ONE)->BuildCreateUpdateBlockForPlayer(&transData, player); - if (m_BgObjects[BG_SA_BOAT_TWO]) + if (BgObjects[BG_SA_BOAT_TWO]) GetBGObject(BG_SA_BOAT_TWO)->BuildCreateUpdateBlockForPlayer(&transData, player); WorldPacket packet; transData.BuildPacket(&packet); @@ -913,12 +913,12 @@ void BattlegroundSA::SendTransportInit(Player* player) void BattlegroundSA::SendTransportsRemove(Player* player) { - if (m_BgObjects[BG_SA_BOAT_ONE] || m_BgObjects[BG_SA_BOAT_TWO]) + if (BgObjects[BG_SA_BOAT_ONE] || BgObjects[BG_SA_BOAT_TWO]) { UpdateData transData; - if (m_BgObjects[BG_SA_BOAT_ONE]) + if (BgObjects[BG_SA_BOAT_ONE]) GetBGObject(BG_SA_BOAT_ONE)->BuildOutOfRangeUpdateBlock(&transData); - if (m_BgObjects[BG_SA_BOAT_TWO]) + if (BgObjects[BG_SA_BOAT_TWO]) GetBGObject(BG_SA_BOAT_TWO)->BuildOutOfRangeUpdateBlock(&transData); WorldPacket packet; transData.BuildPacket(&packet); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 226bf172a09..9650cf11a8c 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -42,20 +42,15 @@ uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { {60, 40, 80} // holiday }; -uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = { - {0, 35, 0}, // normal honor - {0, 45, 0} // holiday -}; - BattlegroundWS::BattlegroundWS() { - m_BgObjects.resize(BG_WS_OBJECT_MAX); - m_BgCreatures.resize(BG_CREATURES_MAX_WS); + BgObjects.resize(BG_WS_OBJECT_MAX); + BgCreatures.resize(BG_CREATURES_MAX_WS); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; - m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + 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; } BattlegroundWS::~BattlegroundWS() @@ -75,96 +70,93 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff) else // Horde has more points and thus wins EndBattleground(HORDE); } - else if (GetTeamScore(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 - EndBattleground(m_LastFlagCaptureTeam); - + EndBattleground(_lastFlagCaptureTeam); else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score EndBattleground(HORDE); else EndBattleground(ALLIANCE); } - else if (GetStartTime() > uint32(m_minutesElapsed * MINUTE * IN_MILLISECONDS)) + else if (GetStartTime() > uint32(_minutesElapsed * MINUTE * IN_MILLISECONDS)) { - ++m_minutesElapsed; - UpdateWorldState(BG_WS_STATE_TIMER, 25 - m_minutesElapsed); + ++_minutesElapsed; + UpdateWorldState(BG_WS_STATE_TIMER, 25 - _minutesElapsed); } - if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) + if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { - m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff; + _flagsTimer[BG_TEAM_ALLIANCE] -= diff; - if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0) + if (_flagsTimer[BG_TEAM_ALLIANCE] < 0) { - m_FlagsTimer[BG_TEAM_ALLIANCE] = 0; + _flagsTimer[BG_TEAM_ALLIANCE] = 0; RespawnFlag(ALLIANCE, true); } } - if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) + if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) { - m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff; + _flagsDropTimer[BG_TEAM_ALLIANCE] -= diff; - if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0) + if (_flagsDropTimer[BG_TEAM_ALLIANCE] < 0) { - m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0; + _flagsDropTimer[BG_TEAM_ALLIANCE] = 0; RespawnFlagAfterDrop(ALLIANCE); - m_BothFlagsKept = false; + _bothFlagsKept = false; } } - if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) + if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN) { - m_FlagsTimer[BG_TEAM_HORDE] -= diff; + _flagsTimer[BG_TEAM_HORDE] -= diff; - if (m_FlagsTimer[BG_TEAM_HORDE] < 0) + if (_flagsTimer[BG_TEAM_HORDE] < 0) { - m_FlagsTimer[BG_TEAM_HORDE] = 0; + _flagsTimer[BG_TEAM_HORDE] = 0; RespawnFlag(HORDE, true); } } - if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) + if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) { - m_FlagsDropTimer[BG_TEAM_HORDE] -= diff; + _flagsDropTimer[BG_TEAM_HORDE] -= diff; - if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0) + if (_flagsDropTimer[BG_TEAM_HORDE] < 0) { - m_FlagsDropTimer[BG_TEAM_HORDE] = 0; + _flagsDropTimer[BG_TEAM_HORDE] = 0; RespawnFlagAfterDrop(HORDE); - m_BothFlagsKept = false; + _bothFlagsKept = false; } } - if (m_BothFlagsKept) + if (_bothFlagsKept) { - m_FlagSpellForceTimer += diff; - if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes - { - if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0])) - player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true); - if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1])) - player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true); - m_FlagDebuffState = 1; - } - else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes - { - if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0])) + _flagSpellForceTimer += diff; + if (_flagDebuffState == 0 && _flagSpellForceTimer >= 10*MINUTE*IN_MILLISECONDS) //10 minutes { - player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); - player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); + if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0])) + player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true); + if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1])) + player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true); + _flagDebuffState = 1; } - if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1])) + else if (_flagDebuffState == 1 && _flagSpellForceTimer >= 900000) //15 minutes { - player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); - player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); + if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0])) + { + player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); + } + if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[1])) + { + player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); + player->CastSpell(player, WS_SPELL_BRUTAL_ASSAULT, true); + } + _flagDebuffState = 2; } - m_FlagDebuffState = 2; - } } else { - m_FlagSpellForceTimer = 0; //reset timer. - m_FlagDebuffState = 0; + _flagSpellForceTimer = 0; //reset timer. + _flagDebuffState = 0; } } } @@ -208,7 +200,7 @@ void BattlegroundWS::AddPlayer(Player* player) //create score and add it to map, default values are set in constructor BattlegroundWGScore* sc = new BattlegroundWGScore; - m_PlayerScores[player->GetGUID()] = sc; + PlayerScores[player->GetGUID()] = sc; } void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) @@ -216,12 +208,12 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) if (Team == ALLIANCE) { sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Alliance flag"); - m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; } else { sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Respawn Horde flag"); - m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; } if (captured) @@ -232,7 +224,7 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound... } - m_BothFlagsKept = false; + _bothFlagsKept = false; } void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) @@ -260,7 +252,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0, team); - m_BothFlagsKept = false; + _bothFlagsKept = false; } void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) @@ -277,12 +269,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) 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) - m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); - if (m_FlagDebuffState == 1) + if (_flagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); - if (m_FlagDebuffState == 2) + if (_flagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); @@ -295,12 +287,12 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) 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) - m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); - if (m_FlagDebuffState == 1) + if (_flagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); - if (m_FlagDebuffState == 2) + if (_flagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) AddPoint(HORDE, 1); @@ -345,7 +337,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) } else { - m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; + _flagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; } } @@ -388,11 +380,11 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source) { SetHordeFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); - if (m_FlagDebuffState == 1) + if (_flagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); - if (m_FlagDebuffState == 2) + if (_flagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); - m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); set = true; } @@ -405,11 +397,11 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source) { SetAllianceFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); - if (m_FlagDebuffState == 1) + if (_flagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); - if (m_FlagDebuffState == 2) + if (_flagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); - m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); set = true; } @@ -431,7 +423,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* Source) UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } - m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; + _flagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; } } @@ -445,40 +437,40 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target //alliance flag picked up from base if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE - && this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) + && this->BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { message_id = LANG_BG_WS_PICKEDUP_AF; type = CHAT_MSG_BG_SYSTEM_HORDE; PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SetAllianceFlagPicker(Source->GetGUID()); - m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; //update world state to show correct flag carrier UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true); Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED); - if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER) - m_BothFlagsKept = true; + if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER) + _bothFlagsKept = true; } //horde flag picked up from base if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE - && this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) + && this->BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { message_id = LANG_BG_WS_PICKEDUP_HF; type = CHAT_MSG_BG_SYSTEM_ALLIANCE; PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SetHordeFlagPicker(Source->GetGUID()); - m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; //update world state to show correct flag carrier UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true); Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED); - if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER) - m_BothFlagsKept = true; + if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER) + _bothFlagsKept = true; } //Alliance flag on ground(not in base) (returned or picked up again from ground!) @@ -493,7 +485,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1); - m_BothFlagsKept = false; + _bothFlagsKept = false; } else { @@ -503,11 +495,11 @@ 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); - m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER; UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER); - if (m_FlagDebuffState == 1) + if (_flagDebuffState == 1) Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true); - if (m_FlagDebuffState == 2) + if (_flagDebuffState == 2) Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1); } @@ -527,7 +519,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED); UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1); - m_BothFlagsKept = false; + _bothFlagsKept = false; } else { @@ -537,11 +529,11 @@ 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); - m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER; UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER); - if (m_FlagDebuffState == 1) + if (_flagDebuffState == 1) Source->CastSpell(Source, WS_SPELL_FOCUSED_ASSAULT, true); - if (m_FlagDebuffState == 2) + if (_flagDebuffState == 2) Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1); } @@ -610,30 +602,30 @@ void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 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 = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1]; + //buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_1]; break; case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in Battleground::Update(). - //buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2]; + //buff_guid = BgObjects[BG_WS_OBJECT_SPEEDBUFF_2]; break; case 3706: // Alliance elixir of regeneration spawn - //buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_1]; + //buff_guid = BgObjects[BG_WS_OBJECT_REGENBUFF_1]; break; case 3708: // Horde elixir of regeneration spawn - //buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_2]; + //buff_guid = BgObjects[BG_WS_OBJECT_REGENBUFF_2]; break; case 3707: // Alliance elixir of berserk spawn - //buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_1]; + //buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_1]; break; case 3709: // Horde elixir of berserk spawn - //buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2]; + //buff_guid = BgObjects[BG_WS_OBJECT_BERSERKBUFF_2]; break; case 3646: // Alliance Flag spawn - if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE]) + if (_flagState[BG_TEAM_HORDE] && !_flagState[BG_TEAM_ALLIANCE]) if (GetFlagPickerGUID(BG_TEAM_HORDE) == Source->GetGUID()) EventPlayerCapturedFlag(Source); break; case 3647: // Horde Flag spawn - if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE]) + if (_flagState[BG_TEAM_ALLIANCE] && !_flagState[BG_TEAM_HORDE]) if (GetFlagPickerGUID(BG_TEAM_ALLIANCE) == Source->GetGUID()) EventPlayerCapturedFlag(Source); break; @@ -710,8 +702,8 @@ void BattlegroundWS::Reset() m_FlagKeepers[BG_TEAM_HORDE] = 0; m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; m_DroppedFlagGUID[BG_TEAM_HORDE] = 0; - m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; - m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE; + _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE; m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0; bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID()); @@ -719,13 +711,13 @@ void BattlegroundWS::Reset() m_HonorWinKills = (isBGWeekend) ? 3 : 1; m_HonorEndKills = (isBGWeekend) ? 4 : 2; // For WorldState - m_minutesElapsed = 0; - m_LastFlagCaptureTeam = 0; + _minutesElapsed = 0; + _lastFlagCaptureTeam = 0; /* Spirit nodes is static at this BG and then not required deleting at BG reset. - if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) + if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE]) DelCreature(WS_SPIRIT_MAIN_ALLIANCE); - if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE]) + if (BgCreatures[WS_SPIRIT_MAIN_HORDE]) DelCreature(WS_SPIRIT_MAIN_HORDE); */ } @@ -757,8 +749,8 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer) void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { - BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); - if (itr == m_PlayerScores.end()) // player not found + BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); + if (itr == PlayerScores.end()) // player not found return; switch (type) @@ -805,16 +797,16 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE)); data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE)); - if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) + if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); - else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) + else if (_flagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1); else data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0); - if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) + if (_flagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1); - else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) + else if (_flagState[BG_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); @@ -824,17 +816,17 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) if (GetStatus() == STATUS_IN_PROGRESS) { data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1); - data << uint32(BG_WS_STATE_TIMER) << uint32(25-m_minutesElapsed); + data << uint32(BG_WS_STATE_TIMER) << uint32(25-_minutesElapsed); } else data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0); - if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) + 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 (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) + if (_flagState[BG_TEAM_ALLIANCE] == 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); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 063d04253a5..a014840f273 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -180,7 +180,7 @@ class BattlegroundWS : public Battleground bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; } void RespawnFlag(uint32 Team, bool captured); void RespawnFlagAfterDrop(uint32 Team); - uint8 GetFlagState(uint32 team) { return m_FlagState[GetTeamIndexByTeamId(team)]; } + uint8 GetFlagState(uint32 team) { return _flagState[GetTeamIndexByTeamId(team)]; } /* Battleground Events */ virtual void EventPlayerDroppedFlag(Player* Source); @@ -196,7 +196,7 @@ class BattlegroundWS : public Battleground virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); void UpdateFlagState(uint32 team, uint32 value); - void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; } + 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;} @@ -211,18 +211,18 @@ class BattlegroundWS : public Battleground private: uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde uint64 m_DroppedFlagGUID[2]; - uint8 m_FlagState[2]; // for checking flag state - int32 m_FlagsTimer[2]; - int32 m_FlagsDropTimer[2]; - uint32 m_LastFlagCaptureTeam; // Winner is based on this if score is equal + uint8 _flagState[2]; // for checking flag state + int32 _flagsTimer[2]; + int32 _flagsDropTimer[2]; + uint32 _lastFlagCaptureTeam; // Winner is based on this if score is equal uint32 m_ReputationCapture; uint32 m_HonorWinKills; uint32 m_HonorEndKills; - int32 m_FlagSpellForceTimer; - bool m_BothFlagsKept; - uint8 m_FlagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault - uint8 m_minutesElapsed; + int32 _flagSpellForceTimer; + bool _bothFlagsKept; + uint8 _flagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault + uint8 _minutesElapsed; virtual void PostUpdateImpl(uint32 diff); }; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 8b785ebaa26..6f380bb5d8a 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -36,7 +36,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) // object not present, return false if (!object) { - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found"); + sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found for condition (Entry: %u Type: %u Group: %u)", mSourceEntry, mSourceType, mSourceGroup); return false; } bool condMeets = false; @@ -217,26 +217,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_LEVEL: { if (Unit* unit = object->ToUnit()) - { - switch (mConditionValue2) - { - case LVL_COND_EQ: - condMeets = unit->getLevel() == mConditionValue1; - break; - case LVL_COND_HIGH: - condMeets = unit->getLevel() > mConditionValue1; - break; - case LVL_COND_LOW: - condMeets = unit->getLevel() < mConditionValue1; - break; - case LVL_COND_HIGH_EQ: - condMeets = unit->getLevel() >= mConditionValue1; - break; - case LVL_COND_LOW_EQ: - condMeets = unit->getLevel() <= mConditionValue1; - break; - } - } + condMeets = CompareValues(static_cast<ComparisionType>(mConditionValue2), static_cast<uint32>(unit->getLevel()), mConditionValue1); break; } case CONDITION_DRUNKENSTATE: @@ -255,6 +236,92 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = GetClosestGameObjectWithEntry(object, mConditionValue1, (float)mConditionValue2) ? true : false; break; } + case CONDITION_OBJECT_ENTRY: + { + if (object->GetTypeId() == mConditionValue1) + condMeets = (!mConditionValue2) || (object->GetEntry() == mConditionValue2); + break; + } + case CONDITION_TYPE_MASK: + { + condMeets = object->isType(mConditionValue1); + break; + } + case CONDITION_RELATION_TO: + { + if (WorldObject* toObject = sourceInfo.mConditionTargets[mConditionValue1]) + { + Unit* toUnit = toObject->ToUnit(); + Unit* unit = object->ToUnit(); + if (toUnit && unit) + { + switch (mConditionValue2) + { + case RELATION_SELF: + condMeets = unit == toUnit; + break; + case RELATION_IN_PARTY: + condMeets = unit->IsInPartyWith(toUnit); + break; + case RELATION_IN_RAID_OR_PARTY: + condMeets = unit->IsInRaidWith(toUnit); + break; + case RELATION_OWNED_BY: + condMeets = unit->GetOwnerGUID() == toUnit->GetGUID(); + break; + case RELATION_PASSENGER_OF: + condMeets = unit->IsOnVehicle(toUnit); + break; + } + } + } + break; + } + case CONDITION_REACTION_TO: + { + if (WorldObject* toObject = sourceInfo.mConditionTargets[mConditionValue1]) + { + Unit* toUnit = toObject->ToUnit(); + Unit* unit = object->ToUnit(); + if (toUnit && unit) + condMeets = (1 << unit->GetReactionTo(toUnit)) & mConditionValue2; + } + break; + } + case CONDITION_DISTANCE_TO: + { + if (WorldObject* toObject = sourceInfo.mConditionTargets[mConditionValue1]) + condMeets = CompareValues(static_cast<ComparisionType>(mConditionValue3), object->GetDistance(toObject), static_cast<float>(mConditionValue2)); + break; + } + case CONDITION_ALIVE: + { + if (Unit* unit = object->ToUnit()) + condMeets = unit->isAlive(); + break; + } + case CONDITION_HP_VAL: + { + if (Unit* unit = object->ToUnit()) + condMeets = CompareValues(static_cast<ComparisionType>(mConditionValue2), unit->GetHealth(), static_cast<uint32>(mConditionValue1)); + break; + } + case CONDITION_HP_PCT: + { + if (Unit* unit = object->ToUnit()) + condMeets = CompareValues(static_cast<ComparisionType>(mConditionValue2), unit->GetHealthPct(), static_cast<float>(mConditionValue1)); + break; + } + case CONDITION_WORLD_STATE: + { + condMeets = mConditionValue2 == sWorld->getWorldState(mConditionValue1); + break; + } + case CONDITION_PHASEMASK: + { + condMeets = object->GetPhaseMask() & mConditionValue1; + break; + } default: condMeets = false; break; @@ -270,6 +337,20 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) return condMeets && script; } +uint32 Condition::GetMaxAvailableConditionTargets() +{ + // returns number of targets which are available for given source type + switch(mSourceType) + { + case CONDITION_SOURCE_TYPE_SPELL: + return 2; + case CONDITION_SOURCE_TYPE_SMART_EVENT: + return 2; + default: + return 1; + } +} + ConditionMgr::ConditionMgr() { } @@ -733,12 +814,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE: @@ -756,12 +831,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE: @@ -779,12 +848,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE: @@ -802,12 +865,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE: @@ -825,12 +882,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE: @@ -848,12 +899,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE: @@ -871,12 +916,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE: @@ -894,12 +933,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE: @@ -917,12 +950,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE: @@ -940,12 +967,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE: @@ -963,12 +984,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE: @@ -986,12 +1001,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET: @@ -1061,12 +1070,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceEntry); return false; } - - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_SPELL: @@ -1077,12 +1080,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); return false; } - - if (cond->mConditionTarget > 2) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET: @@ -1127,12 +1124,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ", or the spells are already listed in CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET conditions.", cond->mSourceEntry); break; } - - if (cond->mConditionTarget > 2) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; } case CONDITION_SOURCE_TYPE_QUEST_ACCEPT: @@ -1141,11 +1132,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->mSourceEntry); return false; } - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; case CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK: if (!sObjectMgr->GetQuestTemplate(cond->mSourceEntry)) @@ -1153,11 +1139,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->mSourceEntry); return false; } - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: if (!sObjectMgr->GetCreatureTemplate(cond->mSourceGroup)) @@ -1171,21 +1152,10 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); return false; } - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } break; case CONDITION_SOURCE_TYPE_GOSSIP_MENU: case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: case CONDITION_SOURCE_TYPE_SMART_EVENT: - if (cond->mConditionTarget) - { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); - return false; - } - break; case CONDITION_SOURCE_TYPE_NONE: default: break; @@ -1201,6 +1171,12 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) return false; } + if (cond->mConditionTarget >= cond->GetMaxAvailableConditionTargets()) + { + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); + return false; + } + switch (cond->mConditionType) { case CONDITION_AURA: @@ -1517,7 +1493,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_LEVEL: { - if (cond->mConditionValue2 >= LVL_COND_MAX) + if (cond->mConditionValue2 >= COMP_TYPE_MAX) { sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->mConditionValue2); return false; @@ -1564,9 +1540,168 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } + case CONDITION_OBJECT_ENTRY: + { + switch (cond->mConditionValue1) + { + case TYPEID_UNIT: + if (cond->mConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue2)) + { + sLog->outErrorDb("ObjectEntry condition has non existing creature template entry (%u), skipped", cond->mConditionValue2); + return false; + } + break; + case TYPEID_GAMEOBJECT: + if (cond->mConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->mConditionValue2)) + { + sLog->outErrorDb("ObjectEntry condition has non existing game object template entry (%u), skipped", cond->mConditionValue2); + return false; + } + break; + case TYPEID_PLAYER: + case TYPEID_CORPSE: + if (cond->mConditionValue2) + sLog->outErrorDb("ObjectEntry condition has useless data in value2 (%u)!", cond->mConditionValue2); + break; + default: + sLog->outErrorDb("ObjectEntry condition has wrong typeid set (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue3) + sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_TYPE_MASK: + { + if (!cond->mConditionValue1 || (cond->mConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) + { + sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->mConditionValue2); + return false; + } + if (cond->mConditionValue2) + sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_RELATION_TO: + { + if (cond->mConditionValue1 >= cond->GetMaxAvailableConditionTargets()) + { + sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue1 == cond->mConditionTarget) + { + sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2 >= RELATION_MAX) + { + sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->mConditionValue2); + return false; + } + if (cond->mConditionValue3) + sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_REACTION_TO: + { + if (cond->mConditionValue1 >= cond->GetMaxAvailableConditionTargets()) + { + sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue1 == cond->mConditionTarget) + { + sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->mConditionValue1); + return false; + } + if (!cond->mConditionValue2) + { + sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->mConditionValue2); + return false; + } + break; + } + case CONDITION_DISTANCE_TO: + { + if (cond->mConditionValue1 >= cond->GetMaxAvailableConditionTargets()) + { + sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue1 == cond->mConditionTarget) + { + sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue3 >= COMP_TYPE_MAX) + { + sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->mConditionValue3); + return false; + } + break; + } + case CONDITION_ALIVE: + { + if (cond->mConditionValue1) + sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->mConditionValue1); + if (cond->mConditionValue2) + sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_HP_VAL: + { + if (cond->mConditionValue2 >= COMP_TYPE_MAX) + { + sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->mConditionValue2); + return false; + } + if (cond->mConditionValue3) + sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_HP_PCT: + { + if (cond->mConditionValue1 > 100) + { + sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue2 >= COMP_TYPE_MAX) + { + sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->mConditionValue2); + return false; + } + if (cond->mConditionValue3) + sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } case CONDITION_AREAID: case CONDITION_INSTANCE_DATA: break; + case CONDITION_WORLD_STATE: + { + if (!sWorld->getWorldState(cond->mConditionValue1)) + { + sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->mConditionValue1); + return false; + } + if (cond->mConditionValue3) + sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } + case CONDITION_PHASEMASK: + { + if (cond->mConditionValue2) + sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->mConditionValue3); + break; + } default: break; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index aca666c55de..f3e9c728ac1 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -29,49 +29,47 @@ class LootTemplate; struct Condition; enum ConditionType -{ // value1 value2 value3 - CONDITION_NONE = 0, // 0 0 0 always true - CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex - CONDITION_ITEM = 2, // item_id count bank true if has #count of item_ids (if 'bank' is set it searches in bank slots too) - CONDITION_ITEM_EQUIPPED = 3, // item_id 0 0 true if has item_id equipped - CONDITION_ZONEID = 4, // zone_id 0 0 true if in zone_id - CONDITION_REPUTATION_RANK = 5, // faction_id min_rank 0 true if has min_rank for faction_id - CONDITION_TEAM = 6, // player_team 0, 0 469 - Alliance, 67 - Horde) - CONDITION_SKILL = 7, // skill_id skill_value 0 true if has skill_value for skill_id - CONDITION_QUESTREWARDED = 8, // quest_id 0 0 true if quest_id was rewarded before - CONDITION_QUESTTAKEN = 9, // quest_id 0, 0 true while quest active - CONDITION_DRUNKENSTATE = 10, // DrunkenState 0, 0 true if player is drunk enough - CONDITION_UNUSED_11 = 11, - CONDITION_ACTIVE_EVENT = 12, // event_id 0 0 true if event is active - CONDITION_INSTANCE_DATA = 13, // entry data 0 true if data is set in current instance - CONDITION_QUEST_NONE = 14, // quest_id 0 0 true if doesn't have quest saved - CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class - CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race - CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete +{ // value1 value2 value3 + CONDITION_NONE = 0, // 0 0 0 always true + CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex + CONDITION_ITEM = 2, // item_id count bank true if has #count of item_ids (if 'bank' is set it searches in bank slots too) + CONDITION_ITEM_EQUIPPED = 3, // item_id 0 0 true if has item_id equipped + CONDITION_ZONEID = 4, // zone_id 0 0 true if in zone_id + CONDITION_REPUTATION_RANK = 5, // faction_id rankMask 0 true if has min_rank for faction_id + CONDITION_TEAM = 6, // player_team 0, 0 469 - Alliance, 67 - Horde) + CONDITION_SKILL = 7, // skill_id skill_value 0 true if has skill_value for skill_id + CONDITION_QUESTREWARDED = 8, // quest_id 0 0 true if quest_id was rewarded before + CONDITION_QUESTTAKEN = 9, // quest_id 0, 0 true while quest active + CONDITION_DRUNKENSTATE = 10, // DrunkenState 0, 0 true if player is drunk enough + CONDITION_WORLD_STATE = 11, // index value 0 true if world has the value for the index + CONDITION_ACTIVE_EVENT = 12, // event_id 0 0 true if event is active + CONDITION_INSTANCE_DATA = 13, // entry data 0 true if data is set in current instance + CONDITION_QUEST_NONE = 14, // quest_id 0 0 true if doesn't have quest saved + CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class + CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race + CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0 - CONDITION_CREATURE_TARGET = 19, // creature entry 0 0 true if current target is creature with value1 entry - CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 0 true if target's health is below value1 percent, false if over or no target - CONDITION_TARGET_RANGE = 21, // minDistance maxDist 0 true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit - CONDITION_MAPID = 22, // map_id 0 0 true if in map_id - CONDITION_AREAID = 23, // area_id 0 0 true if in area_id - CONDITION_ITEM_TARGET = 24, // ItemRequiredTargetType, TargetEntry, 0 - CONDITION_SPELL = 25, // spell_id 0 0 true if player has learned spell - CONDITION_UNUSED_26 = 26, - CONDITION_LEVEL = 27, // level opt 0 true if unit's level is equal to param1 (param2 can modify the statement) - CONDITION_QUEST_COMPLETE = 28, // quest_id 0 0 true if player has quest_id with all objectives complete, but not yet rewarded - CONDITION_NEAR_CREATURE = 29, // creature entry distance 0 true if there is a creature of entry in range - CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance 0 true if there is a gameobject of entry in range - CONDITION_MAX = 31 // MAX -}; - -enum LevelConditionType -{ - LVL_COND_EQ, - LVL_COND_HIGH, - LVL_COND_LOW, - LVL_COND_HIGH_EQ, - LVL_COND_LOW_EQ, - LVL_COND_MAX + CONDITION_CREATURE_TARGET = 19, // creature entry 0 0 true if current target is creature with value1 entry + CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 0 true if target's health is below value1 percent, false if over or no target + CONDITION_TARGET_RANGE = 21, // minDistance maxDist 0 true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit + CONDITION_MAPID = 22, // map_id 0 0 true if in map_id + CONDITION_AREAID = 23, // area_id 0 0 true if in area_id + CONDITION_ITEM_TARGET = 24, // ItemRequiredTargetType, TargetEntry, 0 + CONDITION_SPELL = 25, // spell_id 0 0 true if player has learned spell + CONDITION_PHASEMASK = 26, // phasemask 0 0 true if object is in phasemask + CONDITION_LEVEL = 27, // level ComparisonType 0 true if unit's level is equal to param1 (param2 can modify the statement) + CONDITION_QUEST_COMPLETE = 28, // quest_id 0 0 true if player has quest_id with all objectives complete, but not yet rewarded + CONDITION_NEAR_CREATURE = 29, // creature entry distance 0 true if there is a creature of entry in range + CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance 0 true if there is a gameobject of entry in range + CONDITION_OBJECT_ENTRY = 31, // TypeID entry 0 true if object is type TypeID and the entry is 0 or matches entry of the object + CONDITION_TYPE_MASK = 32, // TypeMask 0 0 true if object is type object's TypeMask matches provided TypeMask + CONDITION_RELATION_TO = 33, // ConditionTarget RelationType 0 true if object is in given relation with object specified by ConditionTarget + CONDITION_REACTION_TO = 34, // ConditionTarget rankMask 0 true if object's reaction matches rankMask object specified by ConditionTarget + CONDITION_DISTANCE_TO = 35, // ConditionTarget distance ComparisonType true if object and ConditionTarget are within distance given by parameters + CONDITION_ALIVE = 36, // 0 0 0 true if unit is alive + CONDITION_HP_VAL = 37, // hpVal ComparisonType 0 true if unit's hp matches given value + CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct + CONDITION_MAX = 39 // MAX }; enum ConditionSourceType @@ -102,6 +100,26 @@ enum ConditionSourceType CONDITION_SOURCE_TYPE_MAX = 23 //MAX }; +enum ComparisionType +{ + COMP_TYPE_EQ = 0, + COMP_TYPE_HIGH, + COMP_TYPE_LOW, + COMP_TYPE_HIGH_EQ, + COMP_TYPE_LOW_EQ, + COMP_TYPE_MAX +}; + +enum RelationType +{ + RELATION_SELF = 0, + RELATION_IN_PARTY, + RELATION_IN_RAID_OR_PARTY, + RELATION_OWNED_BY, + RELATION_PASSENGER_OF, + RELATION_MAX +}; + enum { MAX_CONDITION_TARGETS = 3, @@ -109,7 +127,7 @@ enum struct ConditionSourceInfo { - WorldObject* mConditionTargets[MAX_CONDITION_TARGETS]; + WorldObject* mConditionTargets[MAX_CONDITION_TARGETS]; // an array of targets available for conditions Condition* mLastFailedCondition; ConditionSourceInfo(WorldObject* target0, WorldObject* target1 = NULL, WorldObject* target2 = NULL) { @@ -156,6 +174,7 @@ struct Condition bool Meets(ConditionSourceInfo& sourceInfo); bool isLoaded() const { return mConditionType > CONDITION_NONE || mReferenceId; } + uint32 GetMaxAvailableConditionTargets(); }; typedef std::list<Condition*> ConditionList; @@ -221,6 +240,26 @@ class ConditionMgr SmartEventConditionContainer SmartEventConditionStore; }; +template <class T> bool CompareValues(ComparisionType type, T val1, T val2) +{ + switch (type) + { + case COMP_TYPE_EQ: + return val1 == val2; + case COMP_TYPE_HIGH: + return val1 > val2; + case COMP_TYPE_LOW: + return val1 < val2; + case COMP_TYPE_HIGH_EQ: + return val1 >= val2; + case COMP_TYPE_LOW_EQ: + return val1 <= val2; + } + // incorrect parameter + ASSERT(false); + return false; +} + #define sConditionMgr ACE_Singleton<ConditionMgr, ACE_Null_Mutex>::instance() #endif diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 3ab91e9582f..aadf9f44b0b 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2671,7 +2671,7 @@ 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); ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); @@ -2689,6 +2689,17 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); } + // check dynamic collision + col = GetMap()->getObjectHitPos(GetPhaseMask(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.5f, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); + + // Collided with a gameobject + if (col) + { + destx -= CONTACT_DISTANCE * cos(angle); + desty -= CONTACT_DISTANCE * sin(angle); + dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty)); + } + float step = dist/10.0f; for (uint8 j = 0; j < 10; ++j) @@ -2712,7 +2723,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float Trinity::NormalizeMapCoord(pos.m_positionX); Trinity::NormalizeMapCoord(pos.m_positionY); - UpdateGroundPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); + UpdateAllowedPositionZ(pos.m_positionX, pos.m_positionY, pos.m_positionZ); pos.m_orientation = m_orientation; } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 4cc298e4349..c14b7599d5f 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -51,7 +51,7 @@ enum TypeMask TYPEMASK_OBJECT = 0x0001, TYPEMASK_ITEM = 0x0002, TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004 - TYPEMASK_UNIT = 0x0008, //creature or player + TYPEMASK_UNIT = 0x0008, // creature TYPEMASK_PLAYER = 0x0010, TYPEMASK_GAMEOBJECT = 0x0020, TYPEMASK_DYNAMICOBJECT = 0x0040, diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 6e13e70d1cd..b8c35d45e98 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -500,7 +500,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::Obj void Map::Update(const uint32 t_diff) { - m_dyn_tree.update(t_diff); + _dynamicTree.update(t_diff); /// update worldsessions for existing players for (m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter) { @@ -1800,12 +1800,26 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const { return VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2) - && m_dyn_tree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask); + && _dynamicTree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask); +} + +bool Map::getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist) +{ + Vector3 startPos = Vector3(x1, y1, z1); + Vector3 dstPos = Vector3(x2, y2, z2); + + Vector3 resultPos; + bool result = _dynamicTree.getObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist); + + rx = resultPos.x; + ry = resultPos.y; + rz = resultPos.z; + return result; } float Map::GetHeight(uint32 phasemask, float x, float y, float z, bool vmap/*=true*/, float maxSearchDist/*=DEFAULT_HEIGHT_SEARCH*/) const { - return std::max<float>(GetHeight(x, y, z, vmap, maxSearchDist), m_dyn_tree.getHeight(x, y, z, maxSearchDist, phasemask)); + return std::max<float>(GetHeight(x, y, z, vmap, maxSearchDist), _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask)); } bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 7d234d5f75a..148a55d4691 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -429,10 +429,11 @@ class Map : public GridRefManager<NGridType> float GetWaterOrGroundLevel(float x, float y, float z, float* ground = NULL, bool swim = false) const; float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; - void Balance() { m_dyn_tree.balance(); } - void Remove(const GameObjectModel& mdl) { m_dyn_tree.remove(mdl); } - void Insert(const GameObjectModel& mdl) { m_dyn_tree.insert(mdl); } - bool Contains(const GameObjectModel& mdl) const { return m_dyn_tree.contains(mdl);} + void Balance() { _dynamicTree.balance(); } + void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); } + void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); } + bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);} + bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist); private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); @@ -488,7 +489,7 @@ class Map : public GridRefManager<NGridType> uint32 i_InstanceId; uint32 m_unloadTimer; float m_VisibleDistance; - DynamicMapTree m_dyn_tree; + DynamicMapTree _dynamicTree; MapRefManager m_mapRefManager; MapRefManager::iterator m_mapRefIter; diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 18340ea224b..173df8dc809 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -212,12 +212,12 @@ int32 Quest::GetRewOrReqMoney() const bool Quest::IsAutoAccept() const { - return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_ACCEPT) ? false : Flags & QUEST_FLAGS_AUTO_ACCEPT; + return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_ACCEPT) ? false : (Flags & QUEST_FLAGS_AUTO_ACCEPT); } bool Quest::IsAutoComplete() const { - return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) ? false : Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE); + return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) ? false : (Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE)); } bool Quest::IsAllowedInRaid() const diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 6802cbdd90d..ef5f32b5575 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -6076,7 +6076,10 @@ void Spell::EffectLeap(SpellEffIndex /*effIndex*/) if (!m_targets.HasDst()) return; - unitTarget->NearTeleportTo(m_targets.GetDst()->GetPositionX(), m_targets.GetDst()->GetPositionY(), m_targets.GetDst()->GetPositionZ(), m_targets.GetDst()->GetOrientation(), unitTarget == m_caster); + Position pos; + m_targets.GetDst()->GetPosition(&pos); + unitTarget->GetFirstCollisionPosition(pos, unitTarget->GetDistance(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() + 2.0f), 0.0f); + unitTarget->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), unitTarget == m_caster); } void Spell::EffectReputation(SpellEffIndex effIndex) diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 13609a490e5..1e1e34431a2 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -33,7 +33,6 @@ npc_guardian 100% guardianAI used to prevent players from accessin npc_garments_of_quests 80% NPC's related to all Garments of-quests 5621, 5624, 5625, 5648, 565 npc_injured_patient 100% patients for triage-quests (6622 and 6624) npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 and 6624 (Triage) -npc_kingdom_of_dalaran_quests Misc NPC's gossip option related to quests 12791, 12794 and 12796 npc_mount_vendor 100% Regular mount vendors all over the world. Display gossip if player doesn't meet the requirements to buy npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given @@ -1137,50 +1136,6 @@ public: }; /*###### -## npc_kingdom_of_dalaran_quests -######*/ - -enum eKingdomDalaran -{ - SPELL_TELEPORT_DALARAN = 53360, - ITEM_KT_SIGNET = 39740, - QUEST_MAGICAL_KINGDOM_A = 12794, - QUEST_MAGICAL_KINGDOM_H = 12791, - QUEST_MAGICAL_KINGDOM_N = 12796 -}; - -#define GOSSIP_ITEM_TELEPORT_TO "I am ready to be teleported to Dalaran." - -class npc_kingdom_of_dalaran_quests : public CreatureScript -{ -public: - npc_kingdom_of_dalaran_quests() : CreatureScript("npc_kingdom_of_dalaran_quests") { } - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->HasItemCount(ITEM_KT_SIGNET, 1) && (!player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_A) || - !player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N))) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF + 1) - { - player->CLOSE_GOSSIP_MENU(); - player->CastSpell(player, SPELL_TELEPORT_DALARAN, false); - } - return true; - } -}; - -/*###### ## npc_mount_vendor ######*/ @@ -3154,7 +3109,6 @@ void AddSC_npcs_special() new npc_injured_patient; new npc_garments_of_quests; new npc_guardian; - new npc_kingdom_of_dalaran_quests; new npc_mount_vendor; new npc_rogue_trainer; new npc_sayge; @@ -3179,4 +3133,3 @@ void AddSC_npcs_special() new npc_firework; new npc_spring_rabbit(); } - diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 82f71aed030..a956655ffaa 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -9,5 +9,5 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. add_subdirectory(map_extractor) -add_subdirectory(vmap3_assembler) -add_subdirectory(vmap3_extractor) +add_subdirectory(vmap4_assembler) +add_subdirectory(vmap4_extractor) diff --git a/src/tools/vmap3_assembler/CMakeLists.txt b/src/tools/vmap4_assembler/CMakeLists.txt index 42ffc749ba8..e4f57646c49 100644 --- a/src/tools/vmap3_assembler/CMakeLists.txt +++ b/src/tools/vmap4_assembler/CMakeLists.txt @@ -21,21 +21,21 @@ include_directories( ) add_definitions(-DNO_CORE_FUNCS) -add_executable(vmap3assembler VMapAssembler.cpp) -add_dependencies(vmap3assembler mpq) +add_executable(vmap4assembler VMapAssembler.cpp) +add_dependencies(vmap4assembler mpq) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - set_target_properties(vmap3assembler PROPERTIES LINK_FLAGS "-framework Carbon") + set_target_properties(vmap4assembler PROPERTIES LINK_FLAGS "-framework Carbon") endif() -target_link_libraries(vmap3assembler +target_link_libraries(vmap4assembler collision g3dlib ${ZLIB_LIBRARIES} ) if( UNIX ) - install(TARGETS vmap3assembler DESTINATION bin) + install(TARGETS vmap4assembler DESTINATION bin) elseif( WIN32 ) - install(TARGETS vmap3assembler DESTINATION "${CMAKE_INSTALL_PREFIX}") + install(TARGETS vmap4assembler DESTINATION "${CMAKE_INSTALL_PREFIX}") endif() diff --git a/src/tools/vmap3_assembler/VMapAssembler.cpp b/src/tools/vmap4_assembler/VMapAssembler.cpp index bb8e324bc75..bb8e324bc75 100644 --- a/src/tools/vmap3_assembler/VMapAssembler.cpp +++ b/src/tools/vmap4_assembler/VMapAssembler.cpp diff --git a/src/tools/vmap3_extractor/CMakeLists.txt b/src/tools/vmap4_extractor/CMakeLists.txt index 2ff2fd0cf6b..1c44b01bbec 100644 --- a/src/tools/vmap3_extractor/CMakeLists.txt +++ b/src/tools/vmap4_extractor/CMakeLists.txt @@ -31,18 +31,18 @@ elseif( WIN32 ) ) endif() -add_executable(vmap3extractor ${sources}) +add_executable(vmap4extractor ${sources}) -target_link_libraries(vmap3extractor +target_link_libraries(vmap4extractor ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} mpq ) -add_dependencies(vmap3extractor mpq) +add_dependencies(vmap4extractor mpq) if( UNIX ) - install(TARGETS vmap3extractor DESTINATION bin) + install(TARGETS vmap4extractor DESTINATION bin) elseif( WIN32 ) - install(TARGETS vmap3extractor DESTINATION "${CMAKE_INSTALL_PREFIX}") + install(TARGETS vmap4extractor DESTINATION "${CMAKE_INSTALL_PREFIX}") endif() diff --git a/src/tools/vmap3_extractor/adtfile.cpp b/src/tools/vmap4_extractor/adtfile.cpp index a966172a3be..a966172a3be 100644 --- a/src/tools/vmap3_extractor/adtfile.cpp +++ b/src/tools/vmap4_extractor/adtfile.cpp diff --git a/src/tools/vmap3_extractor/adtfile.h b/src/tools/vmap4_extractor/adtfile.h index 08814996f68..08814996f68 100644 --- a/src/tools/vmap3_extractor/adtfile.h +++ b/src/tools/vmap4_extractor/adtfile.h diff --git a/src/tools/vmap3_extractor/dbcfile.cpp b/src/tools/vmap4_extractor/dbcfile.cpp index 2474cea5259..2474cea5259 100644 --- a/src/tools/vmap3_extractor/dbcfile.cpp +++ b/src/tools/vmap4_extractor/dbcfile.cpp diff --git a/src/tools/vmap3_extractor/dbcfile.h b/src/tools/vmap4_extractor/dbcfile.h index 56cce9a521c..56cce9a521c 100644 --- a/src/tools/vmap3_extractor/dbcfile.h +++ b/src/tools/vmap4_extractor/dbcfile.h diff --git a/src/tools/vmap3_extractor/gameobject_extract.cpp b/src/tools/vmap4_extractor/gameobject_extract.cpp index 8a1f67cd2c2..8a1f67cd2c2 100644 --- a/src/tools/vmap3_extractor/gameobject_extract.cpp +++ b/src/tools/vmap4_extractor/gameobject_extract.cpp diff --git a/src/tools/vmap3_extractor/loadlib/loadlib.h b/src/tools/vmap4_extractor/loadlib/loadlib.h index 61865c4b436..61865c4b436 100644 --- a/src/tools/vmap3_extractor/loadlib/loadlib.h +++ b/src/tools/vmap4_extractor/loadlib/loadlib.h diff --git a/src/tools/vmap3_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp index 117c594b41a..117c594b41a 100644 --- a/src/tools/vmap3_extractor/model.cpp +++ b/src/tools/vmap4_extractor/model.cpp diff --git a/src/tools/vmap3_extractor/model.h b/src/tools/vmap4_extractor/model.h index a6f4e27583c..a6f4e27583c 100644 --- a/src/tools/vmap3_extractor/model.h +++ b/src/tools/vmap4_extractor/model.h diff --git a/src/tools/vmap3_extractor/modelheaders.h b/src/tools/vmap4_extractor/modelheaders.h index d859fd3511e..d859fd3511e 100644 --- a/src/tools/vmap3_extractor/modelheaders.h +++ b/src/tools/vmap4_extractor/modelheaders.h diff --git a/src/tools/vmap3_extractor/mpq_libmpq.cpp b/src/tools/vmap4_extractor/mpq_libmpq.cpp index 528b9679a58..528b9679a58 100644 --- a/src/tools/vmap3_extractor/mpq_libmpq.cpp +++ b/src/tools/vmap4_extractor/mpq_libmpq.cpp diff --git a/src/tools/vmap3_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h index 4b0a2465bfd..4b0a2465bfd 100644 --- a/src/tools/vmap3_extractor/mpq_libmpq04.h +++ b/src/tools/vmap4_extractor/mpq_libmpq04.h diff --git a/src/tools/vmap3_extractor/vec3d.h b/src/tools/vmap4_extractor/vec3d.h index 06a5b730f16..06a5b730f16 100644 --- a/src/tools/vmap3_extractor/vec3d.h +++ b/src/tools/vmap4_extractor/vec3d.h diff --git a/src/tools/vmap3_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index bf5fe1c517f..599290a9254 100644 --- a/src/tools/vmap3_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -457,7 +457,7 @@ bool processArgv(int argc, char ** argv, const char *versionString) int main(int argc, char ** argv) { bool success=true; - const char *versionString = "V3.00 2010_07"; + const char *versionString = "V4.00 2012_02"; // Use command line arguments, when some if(!processArgv(argc, argv, versionString)) diff --git a/src/tools/vmap3_extractor/vmapexport.h b/src/tools/vmap4_extractor/vmapexport.h index b407e7a106e..b407e7a106e 100644 --- a/src/tools/vmap3_extractor/vmapexport.h +++ b/src/tools/vmap4_extractor/vmapexport.h diff --git a/src/tools/vmap3_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp index e3ee545db19..e3ee545db19 100644 --- a/src/tools/vmap3_extractor/wdtfile.cpp +++ b/src/tools/vmap4_extractor/wdtfile.cpp diff --git a/src/tools/vmap3_extractor/wdtfile.h b/src/tools/vmap4_extractor/wdtfile.h index f3d71c41791..f3d71c41791 100644 --- a/src/tools/vmap3_extractor/wdtfile.h +++ b/src/tools/vmap4_extractor/wdtfile.h diff --git a/src/tools/vmap3_extractor/wmo.cpp b/src/tools/vmap4_extractor/wmo.cpp index 58957e007c1..58957e007c1 100644 --- a/src/tools/vmap3_extractor/wmo.cpp +++ b/src/tools/vmap4_extractor/wmo.cpp diff --git a/src/tools/vmap3_extractor/wmo.h b/src/tools/vmap4_extractor/wmo.h index d1f7b82f0c6..d1f7b82f0c6 100644 --- a/src/tools/vmap3_extractor/wmo.h +++ b/src/tools/vmap4_extractor/wmo.h |